Open lf-araujo opened 10 months ago
In umxSuperModel
snippet (below) , or should this be a request to enhance OpenMx::mxRename
?
tmpnames = umxModelNames(newModel)
dupes = tmpnames[duplicated(tmpnames)] # "top" "MZ" "DZ"
if(length(dupes) > 0){
suffix = 2
subNames = names(newModel$submodels)[-1]
for(thisSub in subNames){
thisModel = newModel$submodels[[thisSub]]
for(thisDupName in dupes){
thisModel = mxRename(thisModel, paste0(thisDupName, "_", suffix), oldname = thisDupName)
}
newModel = mxModel(newModel, thisModel)
suffix = suffix + 1
}
The issue is in the excerpt above, when the innermost for loop is run, if there is more than 2 models, suffix will not have increased and mxRename will complain. There is an ugly solution:
move up suffix = suffix + 1 to the innermost loop, three lines up. Which will result in:
> umxModelNames(multi)
[1] "a" "b" "c" "top" "topMZ" "topDZ" "top_2" "topMZ_3"
[9] "topDZ_4" "top_8" "topMZ_9" "topDZ_10"
Still thinking in something more elegant.
I'll have a look
Thanks.
I see that sometimes the starting values for the thresholds are not always ascending, not sure that this is what is causing this issue. Luis Araujo T32 | Virginia Institute for Psychiatric and Behavioral Genetics | Richmond | US Department of Psychiatry | The University of Melbourne | AU +1 804 502-4074 (tel:+1%20804%20502-4074) http://go.unimelb.edu.au/y5yr
On Oct 4 2023, at 5:09 am, Tim Bates @.***> wrote:
I'll have a look — Reply to this email directly, view it on GitHub (https://github.com/tbates/umx/issues/221#issuecomment-1746457579), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ACNLSLTGMCWAHBNSDZA6CWTX5URUVAVCNFSM6AAAAAA4PBYEQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWGQ2TONJXHE). You are receiving this because you authored the thread.
Super models with nested submodels are handled up to two, but no more:
The issue lies at the underlying renaming functionality, that is only checking up to two submodels.