The proposed check seems to require mind-reading. How do we know what the user intended? If it was a simple misspelling then it is appropriate to stop.
It's an unlikely typo to accidentally type the name of a fixed parameter, and it's not false that the CI of the fixed parameter is the estimate.
Emitting a warning would be plenty of "punishment".
The (very common) use case is the user generates all the labels from, say, an algebra, and currently has to filter them for being fixed (which might involve looking up free variables in other matrices in the case of an algebra).
The behavior to catch the typo case (and given the potential loss of days of run-time, I'd only issue a warning here is)
fixedParams = omxGetParameters(model, free = FALSE)
freeParams = omxGetParameters(model, free = TRUE)
if(myParam %in% freeParams{
# run CI
}else{
if(myParam %in% fixedParams){
# put estimate in lower and upper bounds
} else {
warning("You asked for a CI on ", omxQuotes(myParam), "but this is not in the model")
}
}
A warning for CI's of fixed matrix elements is fine IMO - even just marking them with an asterisk like we do for estimates on bounds would be ok by me. Note that no CPU time is needed - just skip estimation altogether.
Here's an example based on the ?mxCI one.
# generate data
covariance <- matrix(c(1.0, 0.5, 0.5, 1.0),
nrow=2,
dimnames=list(c("a", "b"), c("a", "b")))
data <- mxData(covariance, "cov", numObs=100)
The behavior now is just to omit the CI if it is a fixed parameter. From a user perspective I think this is potentially puzzling. "I asked for a CI but didn't get it in the output, how come?" I'd rather see the CI's in the output, but with the estimates as upper & lower bounds and something to denote that the mxMatrix() element is fixed. This is a closer parallel to what happens to a mxAlgebra() element, which may or may not depend on any of the free parameters. Either way, the CI appears in the output.
#1
Log in or register to post comments
#2
Emitting a warning would be plenty of "punishment".
The (very common) use case is the user generates all the labels from, say, an algebra, and currently has to filter them for being fixed (which might involve looking up free variables in other matrices in the case of an algebra).
The behavior to catch the typo case (and given the potential loss of days of run-time, I'd only issue a warning here is)
fixedParams = omxGetParameters(model, free = FALSE)
freeParams = omxGetParameters(model, free = TRUE)
if(myParam %in% freeParams{
# run CI
}else{
if(myParam %in% fixedParams){
# put estimate in lower and upper bounds
} else {
warning("You asked for a CI on ", omxQuotes(myParam), "but this is not in the model")
}
}
Log in or register to post comments
#3
Thanks.
Log in or register to post comments
#4
Here's an example based on the ?mxCI one.
# generate data
covariance <- matrix(c(1.0, 0.5, 0.5, 1.0),
nrow=2,
dimnames=list(c("a", "b"), c("a", "b")))
data <- mxData(covariance, "cov", numObs=100)
# create an expected covariance matrix
expect <- mxMatrix("Symm", 2, 2,
free=c(TRUE,TRUE,FALSE),
values=c(1, .5, 1),
labels=c("var1", "cov12", "var2"),
name="expectedCov")
# request 95 percent confidence intervals
ci <- mxCI(c("var1", "cov12", "var2"))
# specify the model
model <- mxModel(model="Confidence Interval Example",
data, expect, ci,
mxMLObjective("expectedCov", dimnames=c("a", "b")))
# run the model
results <- mxRun(model, intervals=TRUE)
# view confidence intervals
print(summary(results)$CI)
# view all results
summary(results)
Log in or register to post comments
#5
It is easier if we issue a message than to report the CI with lower and upper bounds equal.
Log in or register to post comments
#6
Log in or register to post comments
#7
The behavior now is just to omit the CI if it is a fixed parameter. From a user perspective I think this is potentially puzzling. "I asked for a CI but didn't get it in the output, how come?" I'd rather see the CI's in the output, but with the estimates as upper & lower bounds and something to denote that the mxMatrix() element is fixed. This is a closer parallel to what happens to a mxAlgebra() element, which may or may not depend on any of the free parameters. Either way, the CI appears in the output.
Log in or register to post comments
#8
Log in or register to post comments