ms_montecarlo: Monte Carlo evaluation with Monte Carlo standard errors

View source: R/methods.R

ms_montecarloR Documentation

Monte Carlo evaluation with Monte Carlo standard errors

Description

Repeatedly simulates panel data from a known generator, fits the model, and summarises finite-sample performance. Every summary carries its Monte Carlo standard error, so that differences smaller than the simulation noise are not read as findings, and convergence is taken from the optimiser's code rather than from the absence of an error.

Usage

ms_montecarlo(process, n = c(100, 300, 500), B = 1000, t = 10,
  Q = NULL, truth = NULL, horizon = 5, sim_args = list(),
  seed = NULL, verbose = TRUE)

Arguments

process

Character. One of ms_structures().

n

Integer vector of sample sizes.

B

Integer. Replicates per cell.

t

Numeric. Observation window.

Q

Optional generator; defaults to the reference generator.

truth

Optional vector of true intensities in row-major order of the permitted transitions.

horizon

Numeric. Horizon for the transition probability matrix.

sim_args

List of further arguments passed to sim_mspdata, for example list(schedule = "random", p_miss = 0.2) for an irregular visit schedule, or list(sojourn = "weibull", shape = 1.5) for the semi-Markov misspecification study.

seed

Optional integer seed.

verbose

Logical. Report progress by cell.

Value

A data frame with one row per parameter and sample size holding the truth, the mean estimate, bias, relative bias, empirical standard error, RMSE and coverage, each with its Monte Carlo standard error, together with the non-convergence rate and the number of converged replicates.

See Also

fit_msm

Examples


ms_montecarlo("two_state", n = 100, B = 25, seed = 1)


modMStates documentation built on Sept. 3, 2026, 5:10 p.m.