Learn R Programming

circumplex (version 2.0.1)

cpm_simulate: Simulate data from a fitted circular process model

Description

Draw n standardized observations from the model-implied correlation matrix \(\hat{P}\) of a fitted cpm_fit() object, using the low-rank factor representation \(P = \Lambda\Lambda^\top + (I - D_\zeta^2)\) (Browne, 1992; design sec. 1.3/sec. 5.4). Each observation is generated as \(x = \Lambda z + (I - D_\zeta^2)^{1/2}\varepsilon\) with independent standard-normal common-factor scores \(z\) and unique deviates \(\varepsilon\), so the draws are exactly positive semidefinite by construction (no eigenvalue clamping) and their population correlation matrix is \(\hat{P}\) exactly.

Usage

cpm_simulate(object, n)

Value

A numeric matrix with n rows and one column per fitted scale, columns in the fitted scale order with colnames set to the scale names (rownames are NULL). The population covariance is object$matrices$Phat, so cov() of the returned matrix converges to it as n grows. Under the default unit scaling Phat is a correlation matrix (zero-mean, unit-variance margins), so cor() converges to it too; under scaling = "free" the margins carry the fitted variance ratios \(\hat\sigma^2\).

Arguments

object

A circumplex_cpm object from cpm_fit().

n

The number of observations (rows) to simulate; a positive whole number.

Reproducibility

cpm_simulate() consumes R's global random number stream (the common-factor scores then the unique deviates, drawn in that fixed order), so it follows the package's set.seed()-immediately-before convention: a given seed reproduces the draw exactly. It is one of the package's stochastic entry points (alongside ssm_analyze() and the bootstrap path of cpm_fit()); the fit itself is deterministic.

Details

This is the mean-based simulation path of the SSM CI-trustworthiness diagnostic (ssm_ci_accuracy(); the M4 Brief-B contract): a caller draws standardized data here and rescales it to a group's means and SDs. The correlation-based (augmented scales-plus-measures) path is not produced here -- it reduces to the returned population block object$matrices$Phat, from which the caller assembles and repairs its own joint matrix.

References

Browne, M. W. (1992). Circumplex models for correlation matrices. Psychometrika, 57(4), 469-497.

See Also

cpm_fit()

Other analysis functions: cpm_fit(), ssm_analyze(), ssm_analyze_long(), ssm_ci_accuracy(), ssm_draws(), ssm_parameters(), ssm_parameters_id(), ssm_score(), ssm_sem(), ssm_sem_parameters(), summary.circumplex_ssm_id()

Examples

Run this code
data("jz2017")
scales <- c("PA", "BC", "DE", "FG", "HI", "JK", "LM", "NO")
fit <- cpm_fit(cormat = cor(jz2017[scales]), scales = scales,
               n = nrow(jz2017))
set.seed(1)
x <- cpm_simulate(fit, n = 500)
round(cor(x) - fit$matrices$Phat, 2)

Run the code above in your browser using DataLab