View source: R/ssm_sem_syntax.R
| ssm_sem_syntax | R Documentation |
Emit lavaan model syntax for a structural-equation-model formulation of the Structural Summary Method, with the circumplex scale angles held fixed at their theoretical values. This is the syntax-generation layer of the SEM-based SSM (see the package's design notes); it is a pure function of its arguments and does not require lavaan to be installed (only fitting the emitted model does).
ssm_sem_syntax(
instrument = NULL,
scales = NULL,
angles = NULL,
measures = NULL,
model = c("scaled", "strict"),
n_groups = 1,
invariance = c("configural", "metric", "scalar", "strict_residuals"),
include_defined = NULL
)
instrument |
Optional. A |
scales |
Optional. A character vector of circumplex scale (column)
names, each appearing only once, and |
angles |
Optional. A numeric vector of scale angles in degrees, the same
length as |
measures |
Optional. Either |
model |
Optional. The measurement-model tier: |
n_groups |
Optional. A single positive whole number: the number of
groups for a multi-group model. |
invariance |
Optional. The cross-group invariance rung to emit when
|
include_defined |
Optional. (Single-group models only: for
|
Two model tiers are available. The "scaled" tier frees a general saturation
and a circumplex saturation per scale while fixing each scale's angle; the
circumplex plane is held isotropic and orthogonal, and the general factor is
held orthogonal to the plane (freeing the general-plane covariances
alongside free saturations makes the model locally unidentified exactly at
zero covariance, so they cannot be estimated in this tier). The "strict"
tier fixes every loading to the unit cosine pattern
(1, cos(angle), sin(angle)) and frees the 3x3 factor covariance matrix –
including the general-plane covariances, making it the tier that can model
a general factor leaning into the plane. The angles enter only as evaluated
cosine and sine constants; no angle is ever a free parameter.
The returned string always carries a weights attribute: the
ordinary-least-squares projection matrix that maps a profile vector to the
structural summary coordinates (e, x, y). For equally spaced angles this
equals the conventional closed-form estimator; for unequally spaced angles it
is the least-squares projection and can differ. The emitted syntax never
contains := definitions for amplitude or displacement: those are nonlinear
functions whose confidence intervals must be constructed in-package, not by
lavaan's delta method (which ignores the angular branch cut).
A single character string of lavaan model syntax, with
attributes angles (a circumplex_degree vector), scales, model,
weights (the 3-by-p OLS projection matrix, rows e, x, y),
n_groups, and (when n_groups >= 2) invariance.
ssm_analyze() for the observed-data SSM.
# Octant instrument, default scaled tier
syn <- ssm_sem_syntax(scales = paste0("s", 1:8), angles = octants())
attr(syn, "weights")
cat(syn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.