R crashes

Posted on
No user picture. karobro Joined: 01/16/2013

Hi,
I'm having problems with R crashing with the new beta version. It does not seem to be a problem of excess memory usage, as I've seen in another thread here. What is strange is that after I've downloaded the beta things look fine (see mxVersion below), and it works with a simple twin multivariate saturated script. When I try a more complicated model, this is when R crashes.

> mxVersion()
OpenMx version: 2.0.0.3751
R version: R version 3.1.1 (2014-07-10)
Platform: i386-w64-mingw32
Default optimiser: CSOLNP

Here is information from Windows event Viewer when R crashes:

Faulting application name: Rgui.exe, version: 3.11.579.0, time stamp: 0x53be708a
Faulting module name: OpenMx.dll, version: 0.0.0.0, time stamp: 0x53ee0f11
Exception code: 0xc0000005
Fault offset: 0x0001a2be
Faulting process id: 0x1820
Faulting application start time: 0x01cfc778c91b0525
Faulting application path: C:\Program Files\R\R-3.1.1\bin\i386\Rgui.exe
Faulting module path: C:\Program Files\R\R-3.1.1\library\OpenMx\libs\i386\OpenMx.dll
Report Id: 3be81308-336c-11e4-87e3-005056ad3f12

Does anyone have any idea what could be causing this? I've tried different computers and R Versions.

Replied on Thu, 09/04/2014 - 17:13
Picture of user. RobK Joined: 04/19/2011

Does it crash when NPSOL is the default optimizer? You can switch from CSOLNP to NPSOL with mxOption(NULL,"Default optimizer","NPSOL").

Also, out of curiosity, what do you see when you enter options()$mxOption$"Number of Threads" into R?

Edit:
Two other things. First, on which other systems have you observed this crash? Second, could you attach your script or one similar to it?

Replied on Fri, 09/05/2014 - 08:33
No user picture. karobro Joined: 01/16/2013

In reply to by RobK

Thanks for the reply!

Yes, it also crashes with NPSOL.

This is what comes out when entering
options()$mxOption$"Number of Threads"
[1] 0

It also crashed on R 3.0.1, and I've only tried Windows. I should ask the author of the script for permission to post it, so I will come back to this.

Replied on Mon, 09/08/2014 - 15:37
Picture of user. RobK Joined: 04/19/2011

In reply to by karobro

I think there's a bug with mxFitFunctionMultigroup(). Try redefining your function to

makeModel <- function(name) {
parsZf <- list( pathAf, pathCf, pathEf, pathRaf, pathRcf, pathRef, covAf, covCf, covEf, covPf, estVarsZf )
parsZm <- list( pathAm, pathCm, pathEm, pathRam, pathRcm, pathRem, covAm, covCm, covEm, covPm, estVarsZm )
parsZfm <- list( corRao, corRco, covAmf, covCmf, covAfm, covCfm)
modelMZf <- mxModel( parsZf, mtGf, covMZf, dataMZf, expFunctionMZf, fitfunction, name="MZf" )
modelDZf <- mxModel( parsZf, mtGf, covDZf, dataDZf, expFunctionDZf, fitfunction, name="DZf" )
modelMZm <- mxModel( parsZm, mtGm, covMZm, dataMZm, expFunctionMZm, fitfunction, name="MZm" )
modelDZm <- mxModel( parsZm, mtGm, covDZm, dataDZm, expFunctionDZm, fitfunction, name="DZm" )
modelDZo <- mxModel( parsZf, parsZm, parsZfm, mtGo, covDZo, dataDZo, expFunctionDZo, fitfunction, name="DZo" )

mgalg <- mxAlgebra(MZf.fitfunction + DZf.fitfunction + MZm.fitfunction + DZm.fitfunction, name="mgalg")
mgfitfunction <- mxFitFunctionAlgebra("mgalg")

name <- mxModel( name, parsZf, parsZm, parsZfm, modelMZf, modelDZf, modelMZm, modelDZm, modelDZo, mgalg,
mgfitfunction)
}

and see if that prevents the crash.