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

Return RMSEA and TLI of NA from summary when not available #347

Open
mhunter1 opened this issue Jun 24, 2022 · 2 comments
Open

Return RMSEA and TLI of NA from summary when not available #347

mhunter1 opened this issue Jun 24, 2022 · 2 comments
Assignees
Labels
enhancement good first issue Good first issue for newbie developers summary summarizing and reporting model results

Comments

@mhunter1
Copy link
Contributor

Currently, OpenMx returns RMSEA=0 and TLI=1 when we don't have the information to compute these. This behavior is confusing to users.

Note: @tbates some packages like umx might depend on this confusing behavior. Be advised that it will change in the near future.

@mhunter1 mhunter1 added enhancement summary summarizing and reporting model results good first issue Good first issue for newbie developers labels Jun 24, 2022
@mhunter1 mhunter1 self-assigned this Jun 24, 2022
@tbates
Copy link
Member

tbates commented Jun 24, 2022

Hi @mhunter1 is there a test model? then i can check easily? Pretty sure umx will just be passing through the obtained values, and it's fairly bullet proof about getting NAs when a value is expected, so shouldn't break anything

@mhunter1
Copy link
Contributor Author

mhunter1 commented Jun 26, 2022

@tbates Here are more details and an example.

The misleading behavior of summary() appears to be isolated to non-RAM, and non-LISREL models. summary() for any model that has raw data, mxExpectationNormal(), and no saturated model gives 0 and 1 for RMSEA and TLI, respectively. When this issue is closed, summary() will return NA for these fit statistics in this situation. See below for an example of a model that shows the current, misleading behavior.

library(OpenMx)

# Simulate some data

x=rnorm(1000, mean=0, sd=1)
y= 0.5*x + rnorm(1000, mean=0, sd=1)
tmpFrame <- data.frame(x, y)
tmpNames <- names(tmpFrame)

# Define the matrices
M <- mxMatrix(type = "Full", nrow = 1, ncol = 2, values=c(0,0),
              free=c(TRUE,TRUE), labels=c("Mx", "My"), name = "M")
S <- mxMatrix(type = "Full", nrow = 2, ncol = 2, values=c(1,0,0,1),
              free=c(TRUE,FALSE,FALSE,TRUE), labels=c("Vx", NA, NA, "Vy"),
              name = "S")
A <- mxMatrix(type = "Full", nrow = 2, ncol = 2, values=c(0,1,0,0),
              free=c(FALSE,TRUE,FALSE,FALSE), labels=c(NA, "b", NA, NA),
              name = "A")
I <- mxMatrix(type="Iden", nrow=2, ncol=2, name="I")

# Define the expectation
expCov <- mxAlgebra(solve(I-A) %*% S %*% t(solve(I-A)), name="expCov")
expFunction <- mxExpectationNormal(covariance="expCov", means="M",
	dimnames=tmpNames)

# Choose a fit function
fitFunction <- mxFitFunctionML()

# Define the model
tmpModel <- mxModel(model="exampleModel", M, S, A, I,
                    expCov, expFunction, fitFunction,
                    mxData(observed=tmpFrame, type="raw"))

# Fit the model and print a summary
tmpModelOut <- mxRun(tmpModel)
st <- summary(tmpModelOut)
st$RMSEA
# [1] 0
st$TLI
# [1] 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Good first issue for newbie developers summary summarizing and reporting model results
Projects
None yet
Development

No branches or pull requests

2 participants