by_group: Wrapper function to run multiple instances of 'rblimp' based...

View source: R/by_group.R

by_groupR Documentation

Wrapper function to run multiple instances of rblimp based on grouping variable

Description

rblimp 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.

Usage

by_group(expr, group)

Arguments

expr

a call to rblimp or rblimp_fcs.

group

a character vector or index pointing to grouping variable in data set

Details

Separates by grouping to run blimp command on each individual sub data set.

Value

a list of all blimp runs by group with class of blimp_bygroup

See Also

as.mitml

Examples


# 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


rblimp documentation built on May 18, 2026, 9:07 a.m.