beta_bias: Percent Bias of Estimated Coefficient

Description Usage Arguments Details Value Examples

View source: R/assess_performance.R

Description

This function returns the relative bias of the mean of the estimated coefficients.

Usage

1
beta_bias(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.

Details

This function estimates the percent bias in the estimated log relative risk (b) as:

100 ((β - b) / β)

where b is the mean of the estimated log relative risk values from all simulations and β is the true log relative risk used to simulate the data.

Value

A data frame with a single value: the percent bias of the mean of the estimated coefficients over n_reps simulations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sims <- create_sims(n_reps = 10, n = 600, central = 100,
                    sd = 10, exposure_type = "continuous",
                    exposure_trend = "cos1",
                    exposure_amp = 0.6,
                    average_outcome = 20,
                    outcome_trend = "no trend",
                    rr = 1.01)
fits <- fit_mods(data = sims, custom_model = spline_mod,
                 custom_model_args = list(df_year = 1))
beta_bias(fits, true_rr = 1.02)

eesim documentation built on May 2, 2019, 7:30 a.m.