randomIntModel: Make a 'Random Intercept Model' for MSEM analysis in lavaan

View source: R/randomIntModel.R

randomIntModelR Documentation

Make a 'Random Intercept Model' for MSEM analysis in lavaan

Description

This provides code that should run a pretty agnostic 'random intercept model' in lavaan, in much the manner detailed by Mehta & Neale (2005, Figure 3).

Usage

randomIntModel(pmRatingData[3:ncol(pmRatingData)]) #if first two variables
are 'p' and 'm' and all the remaining variables are variable ratings

Arguments

varset

the set of variables you want to include in the null model

Details

Unfortunately, there is a good chance that if you have a large number of variables (or perhaps a large number of clusters, or observations within clusters, or... I don't know the parameters), that this will take basically forever to run. Unfortunately I don't have any ideas about what causes this or how to fix it.

Value

the text you need to put into model for lavaan::sem(model, ...). Note that original variables x will be relabeled wx and and bx to indicate within- and between- levels, respectively.


funfield-lab/fancyr documentation built on Nov. 21, 2023, 2:42 p.m.