tbates / umx

Making Structural Equation Modeling (SEM) in R quick & powerful
https://tbates.github.io/
44 stars 17 forks source link

umxSummary support for nested umxSupermodel #222

Open lf-araujo opened 10 months ago

lf-araujo commented 10 months ago

I noticed this a while ago, umxSummary often fails with:

#Error in names(parameterTable) <- c("label", "name", "matrix", "row",  : 
#  'names' attribute [9] must be the same length as the vector [0]

With supermodels. Below full MWE:

     data(docData)

     mzData  = subset(docData, zygosity %in% c("MZFF", "MZMM")) |>
       dplyr::mutate(ethnicity = rep(LETTERS[1:5],140))

     dzData  = subset(docData, zygosity %in% c("DZFF", "DZMM")) |>
       dplyr::mutate(ethnicity = rep(LETTERS[1:5],140))

     # ============================
     # = 2. Make a MRDoC2 model   =
     # ============================

 outa <- umxMRDoC(name = "a", pheno = c("varA1", "varA2"), prss = c("varB1", "varA3") ,
                     mzData = mzData|>dplyr::filter(ethnicity=="A"),
       dzData = dzData|>dplyr::filter(ethnicity=="A")) |>
      umxModify( regex="*", newlabels ="a_\\1" ,  autoRun = F)

 outb <- umxMRDoC(name = "b", pheno = c("varA1", "varA2"), prss = c("varB1", "varA3") ,
                     mzData = mzData|>dplyr::filter(ethnicity=="B"),
       dzData = dzData|>dplyr::filter(ethnicity=="B")) |>
      umxModify( regex="*", newlabels ="b_\\1" ,  autoRun = F)

multi <- umxSuperModel("multigroup", outa, outb)

umxSummary(multi)
#Error in names(parameterTable) <- c("label", "name", "matrix", "row",  : 
#  'names' attribute [9] must be the same length as the vector [0]
lf-araujo commented 9 months ago

This may be related to #226 .