glance_fits {simpr} | R Documentation |
Create tibble of model "glances" (summaries)
Description
Turn fitted models of simulated data (from
fit
) into a
tidy tibble of model summaries, each with one line (via
broom::glance
).
Usage
glance_fits(obj, ..., .progress = FALSE, .options = furrr_options())
Arguments
obj |
tibble with repetition number,
metaparameters, simulated data, and fitted
models, from
|
... |
Additional arguments to
|
.progress |
A logical, for whether or not to print a progress bar for multiprocess, multisession, and multicore plans . |
.options |
The |
Details
This the fifth step of the
simulation process: after fitting the model
with fit
, now
tidy the model output for further analysis such
as evaluating power. All model objects should
be supported by
broom::glance
.
The output of this function is quite useful comparing
overall model fits; see
Examples. For looking at specific
features of the model such as tests for
individual parameter estimates, use
tidy_fits
.
Value
a tibble with the output of the
broom::glance
method for the given object.
See Also
tidy_fits
to view model
components (e.g. parameter estimates),
apply_fits
to apply an
arbitrary function to the fits
Examples
simple_linear_data = specify(a = ~ 2 + rnorm(n),
b = ~ 5 + 3 * x1 + rnorm(n, 0, sd = 0.5)) %>%
define(n = 100:101) %>%
generate(2)
## Can show tidy output for multiple competing models,
compare_degree = simple_linear_data %>%
fit(linear = ~lm(a ~ b, data = .),
quadratic = ~lm(a ~ b + I(b^2), data = .)) %>%
glance_fits
compare_degree
## Models can be anything supported by broom::tidy.
cor_vs_lm = simple_linear_data %>%
fit(linear = ~lm(a ~ b, data = .),
cor = ~ cor.test(.$a, .$b)) %>%
glance_fits
cor_vs_lm # has NA for non-matching terms