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

umxSummary: report algebra variables #70

Closed
tbates opened this issue May 14, 2019 · 2 comments
Closed

umxSummary: report algebra variables #70

tbates opened this issue May 14, 2019 · 2 comments
Assignees

Comments

@tbates
Copy link
Owner

tbates commented May 14, 2019

Currently neither OpenMx::summary nor umxSummary show users the values of any algebras in a RAM model.

Very useful to add this as default output, with estimate, SE and P(>|Z|): if they add them, they probably want to see the value :-)

library(mlbench)
data(BostonHousing2)

BostonHousing2$log_crim  = log2(BostonHousing2$crim)
BostonHousing2$nox  = BostonHousing2$nox*100

m1 = umxRAM(data = BostonHousing2,
	"#crime_model
	cmedv ~ log_crim + b1*nox; 
	nox   ~ a1*rad + a2*log_crim
	i_1 := a1*b1
	i_2 := a2*b1"
)

Outputs the parameters and fit, but not the i_1 and i_2 algebras:

Table: Model Parameter loadings

name Estimate SE
b1 -0.144 0.051
a1 -0.302 0.068
log_crim_to_cmedv -0.925 0.188
a2 3.648 0.191
cmedv_with_cmedv 65.499 4.118
nox_with_nox 48.798 3.068
rad_with_rad 75.667 4.757
log_crim_with_rad 23.132 1.584
log_crim_with_log_crim 9.710 0.610
one_to_cmedv 29.470 2.995
one_to_nox 62.457 0.900
one_to_rad 9.549 0.387
one_to_log_crim -1.126 0.139

Model Fit: χ²(1) = 0.08, p = 0.777; CFI = 1.001; TLI = 1.004; RMSEA = 0

@tbates tbates self-assigned this May 14, 2019
@tbates
Copy link
Owner Author

tbates commented May 14, 2019

Probably involves ?mxSE, so

if (length(model@algebras)>0){
    for(thisAlg in names(m3@algebras)){
       # OpenMx algebras needed be values, so just emit what we find, more free-form
       b  = mxEvalByName(thisAlg, model)
       SE = mxSE(thisAlg, model, forceName = TRUE)
       p = 2*pnorm(abs(b/SE), lower.tail = FALSE)
       print(paste0(thisAlg, umxAPA(b, SE), SE, p))
   }

       # And just emit larger matrices more free-form? or break into a list of cells?      
   }
}

@tbates tbates closed this as completed in 0ed16d5 Jan 10, 2021
@tbates
Copy link
Owner Author

tbates commented Jan 10, 2021

umxSummary now reports algebra values

Algebra'i_1' = 0.043CI95[0.008, 0.079]. p-value = 0.017
Algebra'i_2' = -0.525CI95[-0.89, -0.16]. p-value = 0.005

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

No branches or pull requests

1 participant