## Request an automatic residual covariance between dependent variables.
lavaan2RAM("y ~ x\nz ~ x", auto.cov.y=TRUE)
## Choose a marker-loading scale when the latent variance is not fixed.
lavaan2RAM("f =~ y1 + y2 + y3", std.lv=FALSE, auto.fix.first=TRUE)
## Parameter constraints use explicit labels.
lavaan2RAM("y ~ b*x", constraints="b == 0.5")
## Regression model on correlation matrix
model1 <- "## y is modelled by x1, x2, and x3
y ~ b1*x1 + b2*x2 + b3*x3
## Fix the independent variables at 1
x1 ~~ 1*x1
x2 ~~ 1*x2
x3 ~~ 1*x3
## Declare the correlations among the independent variables
x1 ~~ x2
x1 ~~ x3
x2 ~~ x3
## Constraint
b3 == b1 + b2
## Function of parameters
fn1 := b1*b2^b3"
## Compare the arrangements of variables with and without
## specifying the obs.variables arguments.
lavaan2RAM(model1, obs.variables=c("y", "x1", "x2", "x3"))
## Two-factor CFA model
model2 <- "f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
## Declare the correlation between f1 and f2
## and label it with cor_f1f2
f1 ~~ cor_f1f2*f2"
lavaan2RAM(model2)
## Regression model with the mean structure
model3 <- "y ~ x
## Intercept of y
y ~ 1
## Mean of x
x ~ 1"
lavaan2RAM(model3)
## Multiple group regression model
## Different intercepts with a common slope
model4 <- "y ~ c(a1, a2)*1 + c(b, b)*x"
lavaan2RAM(model4, ngroups=2)
## Two-level random-intercept regression model
model5 <- "level: 1
y ~ b1*x
y ~~ residW*y
level: 2
y ~ 1
y ~~ residB*y"
lavaan2RAM(model5)
Run the code above in your browser using DataLab