# \donttest{
## Proposed model
model1 <- 'W2 ~ w2w*W1 + s2w*S1
S2 ~ w2s*W1 + s2s*S1
W1 ~~ w1WITHs1*S1
W2 ~~ w2WITHs2*S2
W1 ~~ 1*W1
S1 ~~ 1*S1
W2 ~~ Errw2*W2
S2 ~~ Errs2*S2'
## Convert into RAM
RAM1 <- lavaan2RAM(model1, obs.variables=c("W1", "S1", "W2", "S2"))
## No moderator
M0 <- create.vechsR(A0=RAM1$A, S0=RAM1$S, F0=NULL, Ax=NULL, Sx=NULL)
## Lag (definition variable) as a moderator on the paths in the Amatrix
Ax <- matrix(c(0,0,0,0,
0,0,0,0,
"0*data.Lag","0*data.Lag",0,0,
"0*data.Lag","0*data.Lag",0,0),
nrow=4, ncol=4, byrow=TRUE)
M1 <- create.vechsR(A0=RAM1$A, S0=RAM1$S, F0=NULL, Ax=Ax, Sx=NULL)
## Lag (definition variable) as a moderator on the correlation in the Smatrix
Sx <- matrix(c(0,"0*data.Lag",0,0,
"0*data.Lag",0,0,0,
0,0,0,"0*data.Lag",
0,0,"0*data.Lag",0),
nrow=4, ncol=4, byrow=TRUE)
M2 <- create.vechsR(A0=RAM1$A, S0=RAM1$S, F0=NULL, Ax=NULL, Sx=Sx)
# }
Run the code above in your browser using DataLab