Snaebjorn Gunnsteinsson
2007-Mar-16 12:03 UTC
[R] Segmentation fault in estimating structural equation models with the SEM package.
Dear R-users, I am running a large number of simulations and estimating a structural equation model for each one using the SEM package. Each run of my program has around 8000 simulations. Most of the time the program completes all of them correctly but sometimes I get a segmentation fault in the sem routine and my program stops with the following error message:> *** caught segfault *** > address (nil), cause 'unknown' > > Traceback: > 1: nlm(if (analytic.gradient) objective.2 else objective.1, > start, hessian = TRUE, iterlim = maxiter, print.level = if > (debug) 2 else 0, typsize = typsize, . > ..) > 2: sem.default(ram = ram, S = S, N = N, param.names = pars, > var.names = vars, fixed.x = fixed.x, debug = debug, ...) > 3: sem(ram = ram, S = S, N = N, param.names = pars, var.names = > vars, fixed.x = fixed.x, debug = debug, ...) > 4: sem.mod(modelspec, cor.or.cov.mat, N, obs.variables = > comb.set, warn = FALSE) > 5: sem(modelspec, cor.or.cov.mat, N, obs.variables = comb.set, warn > = FALSE) > 6: try(sem(modelspec, cor.or.cov.mat, N, obs.variables = > comb.set, warn = FALSE), silent = TRUE) > 7: eval.with.vis(expr, envir, enclos) > 8: eval.with.vis(ei, envir) > 9: source("analysis.base.R") > aborting ...Does anybody have an idea about how I could prevent this from happening or catch it so that my program could continue running? Could I, in some way, manage the memory myself to prevent this? The model is correctly specified and clearly identified but the covariance matrix changes between simulations (it is a two latent variable measurement model with more than 4 observed variables on each LV). Many thanks, regards, Snaebjorn P.S. Using R 2.4.1 (2006-06-01) on x86_64 GNU/Linux Using version 0.9-6 (2006/11/22) of the SEM package. ----------------------------------------------------------- Snaebjorn Gunnsteinsson JiVitA Science Fellow The JiVitA Project (NIPHP-USAID) Rangpur, Bangladesh www.jivita.org Mobile: +880-171-320-2560