SIMULATE: Create a SIMULATE specification for use in rblimp()

View source: R/rblimp_sim.R

SIMULATER Documentation

Create a SIMULATE specification for use in rblimp()

Description

Creates a simulation specification that can be passed to rblimp() as the data argument. Instead of reading existing data, rblimp() will use Blimp's SIMULATE command to generate data and then fit the specified model to it.

Usage

SIMULATE(model, n, define = NULL, variables = NULL)

Arguments

model

Character string or vector specifying data generation equations. Same format as rblimp_sim().

n

Sample size. For single-level: integer. For multilevel: named list.

define

Character vector or string of parameter definitions (optional).

variables

Formula or character string specifying which variables to save (optional).

Value

A blimp_simulate object (subclass of blimp_syntax) that can be passed to rblimp() as the data argument.

See Also

rblimp_sim() for directly generating simulated data without fitting a model

Examples


# Create simulation specification
sim_spec <- SIMULATE(
  model = c(
    "x = normal(0, 1)",
    "y = normal(10 + x*0.5, 1)"
  ),
  n = 1000
)

# View the specification
print(sim_spec)

# Use in rblimp to fit a model to simulated data
mdl <- rblimp(
  model = "y ~ x",
  data = sim_spec,
  seed = 123,
  burn = 5000,
  iter = 5000
)

summary(mdl)


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