Hi Tim and Mike,
This is the first time I am playing with real data, and since I understand lavaans syntax better than openMx's I decided to start with umx.
I am trying to specify a CP model with two latents, but my measured indicators represents parenting style and personality (big5), 10 variables in total. See fig 1. I think they are better conceptualized as two latents that can correlate, but only loads in part of the variables, the five personality traits and the five parenting styles.
Initially I thought that I could either use umx_make_Twins or remove the unwanted paths with umxModify( update = ). However, it seems that with umxModify I can only remove the paths, but I cant add the correlation between latents. I ended up with fig 2.
- What should be the best approach to allow the two latents in fig 2 to correlate?
Below is a minimal working example to facilitate discussion:
dt <- ZA6701_en_add_scales_wid1_v4.0.0 %>% left_join(ZA6701_en_master_v4.0.0, by = "pid") %>% transmute(zygosity = zyg0102, parcontt1 = as.numeric(parcontt), parcontt2 = as.numeric(parcontt), parincot1 = as.numeric(parincot), parincot2 = as.numeric(parincot), parmonit1 = as.numeric(parmonit), parmonit2 = as.numeric(parmonit), parnegct1 = as.numeric(parnegct), parnegct2 = as.numeric(parnegct), parwarmt1 = as.numeric(parwarmt), parwarmt2 = as.numeric(parwarmt), peragre1 = as.numeric(peragre), peragre2 = as.numeric(peragre), percons1 = as.numeric(percons), percons2 = as.numeric(percons), perneur1 = as.numeric(perneur), perneur2 = as.numeric(perneur), perextr1 = as.numeric(perextr), perextr2 = as.numeric(perextr), peropen1 = as.numeric(peropen), peropen2 = as.numeric(peropen)) selDVs <- c("parcontt","parincot", "parmonit", "parnegct", "parwarmt", "peragre", "percons", "perneur", "perextr","peropen") vupdate <- c("cp_loadings_r6c1", "cp_loadings_r7c1", "cp_loadings_r8c1", "cp_loadings_r9c1", "cp_loadings_r10c1", "cp_loadings_r1c2", "cp_loadings_r2c2", "cp_loadings_r3c2", "cp_loadings_r4c2", "cp_loadings_r5c2") m2 <- umxCP(data = dt, mzData = "1: monozygotic", dzData = "2: dizygotic", selDVs = selDVs, sep = "", nFac = 2) umx m3 <- umxModify(m2, update = vupdate, comparison = F) plot(m3) parameters(m2) <blockcode> Thanks, Luis