Fits a specified model to each of the simulated datasets and returns a dataframe
summarizing results from fitting the model to each dataset, including the estimated
effect and the estimated standard error for that estimated effect. The model is specified
through a user-created R function, which must take specific input and return
output in a specific format. For more details, see the parameter definitions,
the Details section, and the vignette for the
A list of simulated data sets. Each simulated dataset must include a
The object name of an R function that defines the code that will be used to fit the model. This object name should not be in quotations. See Details for more.
A list of arguments and their values for a custom
model. These arguments are passed through to the function specified with
The function specified by the
custom_model argument should be
a user-created function that inputs a data frame with columns named "x" for
exposure values and "outcome" for outcome values. The function must output a data
frame with columns called
97.5%. Note that these columns are the output
confint for models fit using a
glm call. You may
use the function
format_out from eesim within your function to produce output
with these columns if this model is fit using
glm or something similar.
For more details and examples, see the vignette for
A data frame in which each row gives the results from the model-fitting function run
on one of the simulated datasets input to the function as the
data object. The returned
data frame has one row per simulated dataset and the following columns:
Estimate: The estimated β (log relative risk) as estimated by
the model specified with
Std.Error: The standard error for the estimated β.
t.value: The test statistic for a test of the null hypothesis β = 0.
p.value: The p-value for a test of the null hypothesis β = 0.
lower_ci: The lower value in the 95% confidence interval estimated for
upper_ci: The upper value in the 95% confidence interval estimated for
1 2 3 4 5 6 7 8 9
# Create a set of simulated datasets and then fit the model defined in `spline_mod` to # all datasets, using the argument `df_year = 7` in the call to `spline_mod`. The `spline_mod` # function is included in the `eesim` package and can be investigating by calling the function # name without parentheses (i.e., `spline_mod`). sims <- create_sims(n_reps = 10, n = 5 * 365, central = 100, sd = 10, exposure_type = "continuous", exposure_trend = "cos1", exposure_amp = .6, average_outcome = 22, outcome_trend = "no trend", outcome_amp = .6, rr = 1.01) fit_mods(data = sims, custom_model = spline_mod, custom_model_args = list(df_year = 7))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.