simulate.SLik_j: Simulate method for an 'SLik_j' object.

View source: R/extractors.R

simulate.SLik_jR Documentation

Simulate method for an SLik_j object.

Description

simulate method for SLik_j objects, by default simulating realizations of the vector of projected summary statistics, drawn from their inferred distribution, given the summary-ML estimates which are the default value of the given argument.

For any non-default given argument, the sampling distribution is still deduced from the multivariate Gaussian mixture fit of the reference table, by conditioning it on given values. Any variable included in the mixture model may be included in given, allowing to simulate from other distributions than that of the vector of projected summary statistics.

This usage should not be confused with simulating the sample-generating process, necessarily distinctly available to the user, and which does not rely on the mixture model stored in the fit object. Simulations of the sample-generating process for given parameter values can be obtained by setting non-default option SGP=TRUE.

Usage

## S3 method for class 'SLik_j'
simulate(object, nsim = 1, seed = NULL, given=object$MSL$MSLE, 
                          norm_or_t=.wrap_rmvnorm, SGP=FALSE, ...)

Arguments

object

An object of class SLik_j as produced by the up-to-date workflow.

nsim

number of response vectors of projected summary statistics to simulate.

seed

Seed for the random number generator (RNG). Here this controls the .Random.seed in the global environment, as in simulate.lm. This means that if a non-NULL seed is specified, it controls the RNG during the simulate call, but the RNG is reset to its prior state on exit.

given

The default is the summary-MLE, a full vector of fitted parameters; but Any variable included in the mixture fit of the referencetable may be included (see Description).

norm_or_t

Controls the sampler in in cluster of the mixture. The default value is a trivial wrapper around the rmvnorm sampler (consistently with the fitted model), but this argument makes it possible to specify other samplers (e.g., norm_or_t=Infusion:::.wrap_rmvt to sample from rmvt(., df=1); or used-defined samplers with the same interface).

SGP

Boolean. Whether to sample from the sample-generating process.

...

Additional arguments. Currently ignored, except when SGP=TRUE, in which case e.g. control.Simulate can be passed through the dots to control the sample simulator.

Value

By default (SGP=FALSE), a matrix of size nsim times the number of projected summary statistics; if SGP=TRUE, a data frame with columns for parameters, for raw summary statistics, and optionally for latent variables if relevant.

Examples

## Assuming an object 'slik_j' of class 'SLik_j':
# simulate(slik_j, nsim=3)

Infusion documentation built on Sept. 30, 2024, 9:16 a.m.