Learn R Programming

eesim (version 0.1.0)

check_sims: Assess model performance

Description

Calculates several measures of model performance, based on results of fitting a model to all simulated datasets.

Usage

check_sims(df, true_rr)

Arguments

df

A data frame of replicated simulations which must include a column titled "Estimate" with the effect estimate from the fitted model.

true_rr

The true relative risk used to simulate the data.

Value

A dataframe with one row with model assessment across all simulations. Includes values for:

  • beta_hat: Mean of the estimated log relative risk across all simulations.

  • rr_hat: Mean value of the estimated relative risk across all simulations.

  • var_across_betas: Variance of the estimated log relative risk across all simulations

  • mean_beta_var: The mean of the estimated variances of the estimated log relative risks across all simulations.

  • percent_bias: The relative bias of the estimated log relative risks compared to the true log relative risk.

  • coverage: Percent of simulations for which the estimated 95% confidence interval for log relative risk includes the true log relative risk.

  • power: Percent of simulations for which the null hypothesis that the log relative risk equals zero is rejected based on a p-value of 0.05.

See Also

The following functions are used to calculate these measurements: beta_bias, beta_var, coverage_beta, mean_beta, power_beta

Examples

Run this code
sims <- create_sims(n_reps = 100, n = 1000, central = 100,
                    sd = 10, exposure_type = "continuous",
                    exposure_trend = "cos1",
                    exposure_amp = 0.6,
                    average_outcome = 20,
                    outcome_trend = "no trend",
                    rr = 1.02)
fits <- fit_mods(data = sims, custom_model = spline_mod,
                 custom_model_args = list(df_year = 1))
check_sims(df = fits, true_rr = 1.02)

Run the code above in your browser using DataLab