| by_group | R Documentation |
rblimp based on grouping variablerblimp will generate the input, run the script, and load most the saved data into an R object. rblimp_fcs
is used to specify the FCS command in Blimp. rblimp_syntax will generate the Blimp syntax file only.
by_group(expr, group)
expr |
a call to |
group |
a character vector or index pointing to grouping variable in data set |
Separates by grouping to run blimp command on each individual sub data set.
a list of all blimp runs by group with class of blimp_bygroup
as.mitml
# Generate Data
mydata <- rblimp_sim(
c(
'x ~ normal(0, 1)',
'y ~ normal(0, 1)',
'group = uniform(0, 1) < 0.5'
),
n = 1000,
seed = 10972
)
# Nonsensical model
mdl <- rblimp_fcs(
c('x', 'y'),
mydata,
seed = 3927,
nimps = 2,
) |> by_group('group')
# Analyze each imputation
results <- with(mdl, lm(y ~ x))
# use `mitml` package to pool results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.