I am trying to run a CFA where one latent variable is regressed on four manifest variables. I am trying to constrain the pattern coefficients ($\lambda$) mean to equal one, according to Kline's (2015, p. 200) [6] effects coding method:
$$ \frac{\lambda_1 + \lambda_2 + \lambda_3 + \lambda_4}{4} = 1 $$
Below is a code example. I tried adding an mxConstraint()
function in mxModel()
but the syntax is not correct. How can I apply the constraints properly?
library(OpenMx) data <- mxData(observed = mydata, type="raw") # residual variances res_var <- mxPath( from = paste0("x", 1:4), arrows = 2, free = TRUE, values = 1, labels = paste0("e_x", 1:4) ) # latent variance lat_var <- mxPath( from = "L", arrows = 2, free = TRUE, values = 1, labels = c("var_L") ) # factor loadings fac_loads <- mxPath( from = "L", to = paste0("x", 1:4), free = c(TRUE, TRUE, TRUE, TRUE), values = 1, arrows = 1, label = paste0("L__x", 1:4) ) # means means <- mxPath( from = "one", to = c(L, paste0("x", 1:4), arrows = 1, free = FALSE, values = 0, labels = c(paste0("mean_", student_sci_ach), "mean_stSCI") ) model <- mxModel( "My Model", type = "RAM", manifestVars = paste0("x", 1:4), latentVars = "L", data, var, lat_var, fac_loads, means, # I tried defining a constraint here, but this obviously doesn't work. mxConstraint(mean(paste0("L__x", 1:4)) == 1) ) results <- mxRun(model) summary(results) <\blockcode>