Skip to contents

The general entry point for CFA syntax. It takes an instrument, and derives the constructs from its scales, or an sframe_model_spec() declaring constructs that cut across them, and it accepts correlated residuals and latent covariances.

Usage

sframe_syntax_cfa(
  instrument = NULL,
  model = NULL,
  scales = NULL,
  ordered = FALSE,
  std_lv = TRUE,
  residual_covariances = NULL,
  latent_covariances = TRUE
)

Arguments

instrument

Optional sframe object used to derive constructs from scales when model is not supplied.

model

Optional sframe_model_spec() object.

scales

Optional scale IDs when deriving a model from an instrument.

ordered

Logical. Whether to add an ordered-item note.

std_lv

Logical. Whether to add a std.lv = TRUE note.

residual_covariances

Optional list of sframe_covariance() objects for correlated residuals.

latent_covariances

Logical. Whether to include model-level latent covariances supplied in model.

Value

A lavaan syntax string.

Details

Each generator emits the language its engine reads, so they stay separate: this one and sframe_syntax_sem() write lavaan, sframe_syntax_pls() writes seminr, and sframe_syntax_efa() writes an exploratory plan.

Examples

demo <- sframe_demo("tourism_services")
syntax <- sframe_syntax_cfa(demo$instrument,
                             scales = c("satisfaction", "behavioural_intention"))
cat(syntax)