riclpm_text: riclpm_text

Description Usage Arguments Details Value Examples

View source: R/gen_syntax.R

Description

Given a list of sets of variables sampled repeatedly over equal time intervals, create a Random Intercept Cross Lagged Panel Model (RI-CLPM) specification for lavaan.

Usage

1
2
riclpm_text(var_groups, constrain_over_waves = TRUE,
  constrain_ints = "free")

Arguments

var_groups

A named list of vectors of variable names. See Details.

constrain_over_waves

Constrain regression coefficients, covariances, and residuals to be the same from wave to wave? Will not constrain variances and covariances of wave-1 latent residuals.

constrain_ints

Constrain intercepts of manifest variables? Default is to free them. At the moment, passing other values is nonsense.

Details

The input is a named list of character vectors. The character vectors should include the variable names as they appear in the data set. The lists names will be used to create the variable name of the latent random intercept term. For example, if the data has observed variables x and y at waves 1-3, the var_groups argument should be something like list(x=c("x_t1", "x_t2", "x_t3"), y=c("y_t1", "y_t2", "y_t3")).

Value

Model text to be passed to a lavaan function.

Examples

1
2
3
4
5
var_groups <- list(
    x=c("x_t1",  "x_t2",  "x_t3"),
    y=c("y_t1",  "y_t2",  "y_t3"),
    z=c("z_t1",  "z_t2",  "z_t3"))
model_text <- riclpmr::riclpm_text(var_groups)

jflournoy/riclpmr documentation built on Dec. 15, 2020, 5 a.m.