Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmu_update_covar for that pesky 9999 trick that saves your analyses… #257

Merged
merged 2 commits into from
Mar 6, 2025

Conversation

lf-araujo
Copy link
Contributor

…from doom.

@jelman

@lf-araujo
Copy link
Contributor Author

I added a experimental umxDoC2 it should work with the umxDoC example below. Note that I spent a lot of time trying to get umxSummary to work with this, I tried to keep matrices named as close as the original. But in the end, I just don't understand properly how umxSummary works.

The advantage of this version is that in my tests, it works and fits better than the current implementation.

 ```
 data(docData)
 docData = umx_scale_wide_twin_data(c(var1, var2), docData, sep= "_T")
 mzData  = subset(docData, zygosity %in% c("MZFF", "MZMM"))
 dzData  = subset(docData, zygosity %in% c("DZFF", "DZMM"))
 
 # =======================================
 # = 2. Define manifests for var 1 and 2 =
 # =======================================
 var1 = paste0("varA", 1:3)
 var2 = paste0("varB", 1:3)
 
 # =======================================================
 # = 3. Make the non-causal (Cholesky) and causal models =
 # =======================================================
 Chol = umxDoC2(var1= var1, var2= var2, mzData= mzData, dzData= dzData, causal= FALSE)
 # nb: DoC initially has causal paths fixed @0
 DoC  = umxDoC2(var1= var1, var2= var2, mzData= mzData, dzData= dzData, causal= TRUE)
 a2b   = umxModify(DoC, "a2b", free = TRUE, name = "a2b"); summary(a2b)
 b2a   = umxModify(DoC, "b2a", free = TRUE, name = "b2a"); summary(b2a)
 Recip = umxModify(DoC, c("a2b", "b2a"), free = TRUE, name = "Recip"); summary(Recip)
 
 # Compare fits
 umxCompare(Chol, c(a2b, b2a, Recip))
 
 # ==========================================
 # = Alternative call with data in one file =
 # ==========================================
 data(docData)
 docData = umx_scale_wide_twin_data(varsToScale=c("varA1", "varA2"), data = docData, sep= "_T")
 DoC = umxDoC2(var1= paste0("varA", 1:3), var2= paste0("varB", 1:2),  covar="varA3",             mzData= c("MZFF", "MZMM"), dzData= c("DZFF", "DZMM"), data = docData, verbose = TRUE)

@tbates tbates merged commit 58be83d into tbates:master Mar 6, 2025
0 of 2 checks passed
@tbates
Copy link
Owner

tbates commented Mar 6, 2025

You should make the new model a class, then you can make a custom umxSummary that will just work

#model = as(model, "MxModelDoC")

@lf-araujo
Copy link
Contributor Author

lf-araujo commented Mar 6, 2025 via email

@tbates
Copy link
Owner

tbates commented Mar 6, 2025

So colnames(means) = selDVs[1:nVar] is failing.
It worked for umxDoC but fails for umxDoC2, so you've changed the structure of the means matrix I guess?
Yeah, you now have
$matrices : 'FacLoad', 'unitM', 'Mean', 'as', 'cs', 'es', 'beta', 'I', 'psi_a', 'psi_c', and 'psi_e'
$algebras : 'VC', 'V', 'FacMean', 'ManMean', 'A', 'C', and 'E'

So Mean not means? or something?
Need to edit umxSummary.MxModelDoC for the new names. That will break umxDoC support, but it's pretty broken anyhow?

@tbates
Copy link
Owner

tbates commented Mar 8, 2025

FYI, on CRAN you can't use any non-ascii characters lambda delta etc.
Also it's unsafe to rely on "F" being FALSE.

Had to go through a bunch of finding all these

@lf-araujo
Copy link
Contributor Author

lf-araujo commented Mar 10, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants