You are here

CSOLNP CIs far too small and out of order?

Here's a test .rda file containing a model, along with an accompanying script to add a CI to this model, and estimate it with NPSOL and with CSOLNP

The behaviors are very different: NPSOL code reds on the model, but computes the CIs where they should be.

CSOLNP says everything is fine, but returns miniscule CIs - sometimes it's even out of order.

The direct link to the attached model is

http://openmx.psyc.virginia.edu/sites/default/files/issues/m1.txt

mxVersion()
OpenMx version: 2.0.0.3952
R version: R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0
Default optimiser: CSOLNP
 
# =====================
# = Set opt to NPSOL  =
# =====================
mxOption(NULL, "Default optimizer", "NPSOL")
# Add a CI, and estimate it...
x = mxModel(m1, mxCI("DepressionII_with_heart_disease"))
# NPSOL code reds, but the CI looks fine
x = mxRun(x, intervals = T); summary(x)$CI
#                                  lbound   estimate   ubound note
# DepressionII_with_heart_disease 0.1022891 0.1346589 0.1687101
 
# ====================
# = Switch optimizer =
# ====================
mxOption(NULL, "Default optimizer", "CSOLNP")
 
x = mxModel(m1, mxCI("DepressionII_with_heart_disease"))
x = mxRun(x, intervals = T); summary(x)$CI
# CSOLNP claims to run fine, but the CIs are near (but not quite) identical to each other and miles out.
# DepressionII_with_heart_disease 0.1346571 0.1346638 0.1346748
AttachmentSize
Plain text icon m1.txt17.66 KB
Binary Data CSOLNP_CI_fail.R941 bytes
Reporter: 
Created: 
Sat, 11/01/2014 - 14:03
Updated: 
Fri, 08/05/2016 - 10:47

Comments

Please try with SLSQP

built from git, but model says "engine SLSQP unknown"

x = mxRun(mxModel(m1, mxCI("DepressionII_with_heart_disease")), intervals = T)
Running m1
Error in runHelper(model, frontendStart, intervals, silent, suppressWarnings,  : 
  MxComputeGradientDescent: engine SLSQP unknown
> mxVersion()
OpenMx version: 2.1.0.182 [GIT v2.1.0-38-ga48c723-dirty]
R version: R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0
Default optimiser: SLSQP
> 

Version v2.1.0-38-ga48c723 is about a month old. Try with v2.1.0-182-g9331c69 or newer. I get,

                                     lbound  estimate    ubound note
DepressionII_with_heart_disease 0.007011119 0.1346588 0.2961334     

This is wider than NPSOL. Something isn't right. I will investigate why.

yeah. I get that now. We should mod mxVersion() to note the current Git version. I'd rebuilt, but R still had the old version in memory.

But yes also: those CIs are far too wide.

Can you run this with SLSQP and look at x$output$computes[[2]] ? It should like roughly like this,

                        parameter lower      fit age_to_mean_sdrr age_to_NeuroticismII age_to_heart_disease  ...
1 DepressionII_with_heart_disease     0 1074.195       -0.3723423           -0.2485399            0.3628947
2 DepressionII_with_heart_disease     1 1032.550       -0.3723427           -0.2485343            0.3629006

This will show where the other parameters moved during the profile likelihood optimization. See if anything looks out of bounds. I suspect you need some box constraints to keep things more reasonable.

Fixed now: yay