문제

I want to reduce typing-load in lavaan.

Imagine that you have 50 manisfest variables: var1, var2, var3, ... var50. In Mplus it is possible to assign a multitude of variables to a factor with the minus '-' sign like this:

Factor BY var1-var50;

Basically saying that Factor is defined by all 50 variables.

Is there a similar way to define the factor in lavaan? It seems that I need to state all 50 variable names:

model <- ' factor =~ var1 + var2 + var3 + var4 and so on...
도움이 되었습니까?

해결책

Try this :

lvmodel <- 
paste('factor',paste(paste0('var',1:50),collapse='+'),sep='=~')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top