[R] segfault with correlation structures in nlme

José Rafael Ferrer Paris jr_frrr at yahoo.de
Tue Mar 13 21:06:37 CET 2007


Hi out there,

I am trying to fit a species accumulation curve (increase in number of
species known vs. sampling effort) for multiple regions and several
bootstrap samples. The bootstrap samples represent different
arrangements of the actual sample sequence.

 I fitted a series of nlme-models and everything seems OK, but since the
observations are correlated I tried to include some correlation
structure. Since the ARMA classes were not succesful in reducing this
correlation, I tried spatial correlation functions with sampling effort
(measured in time units) as a distance measure. As a result I got
several segfault errors (which I don't know what they exactly mean =/).

I was wondering if it was an effect of the model or the data I used, but
I was able to reproduce the error messages using the Ovary data set and
the example in the Pinheiro & Bates book:

>library(nlme)
>data(ovary)
>fm10var.lme <-  lme(follicles ~ sin(2 * pi * Time) +
                    cos(2 * pi * Time),data=Ovary,
                    random=pdDiag(~sin(2*pi*Time)))
>fm50var.lme <- update(fm10var.lme,correlation=corARMA(p=1,q=1))
>fm10var.nlme <-  nlme(follicles ~ A + B * sin(2 * pi * w * Time) +
                      C * cos(2 * pi * w * Time),data=Ovary,
                      fixed= A+B+C+w~1,
                      random=pdDiag(A+B+w~1),
                       start = c(fixef(fm50var.lme),1))
>plot(ACF(fm10var.nlme,maxLag=10),alpha=.05)
>fm20var.nlme <- update(fm10var.nlme,corr=corAR1(0.311))
>fm30var.nlme <- update(fm10var.nlme,corr=corARMA(p=0,q=2))

>fm60var.nlme <- update(fm10var.nlme,corr=corGaus(form=~Time))

 *** caught segfault ***
address 0x1075e501, cause 'memory not mapped'

Traceback:
 1: eval(expr, envir, enclos)
 2: eval(modelExpression, env)
 3: assign("modelValue", eval(modelExpression, env), envir = thisEnv)
 4: function (newPars) {    if (!missing(newPars)) {        for (i in
names(ind)) {            assign(i, clearNames(newPars[ind[[i]]]), envir
= env)        }      assign("modelValue", eval(modelExpression, env),
envir = thisEnv)    }    modelValue}(c(-4.11936939372863,
0.157676781855328, -0.071492289279548, -3.89562017836122,
3.06079106423361, -0.0260217128029253, -2.83650117790746,
1.62924792896056, 0.0607736472981399, -0.834700672739711,
0.07926271837803, 0.0403415470454326, -0.698687811226831,
-0.121079563050668, 0.032722843419347, 0.0404804003710554,
0.379937934267249, 0.087562808768161, 3.08430247504295,
2.08510442577037, 0.103812382483994, 1.44441306260898,
-1.70151546937888, -0.0432622314094444, 2.37971674786747,
-1.04307471138899, 0.0217885202778396, 2.60583067635322,
-0.638495324795519, -0.137018044847307, 1.70105176178795,
-3.07372462709182, -0.0445309584408364, 12.3518546784787,
-3.22126648052618, -1.69049623029482, 0.907261039321137))
 5: .C(fit_nlme, thetaPNLS = as.double(c(as.vector(unlist(sran)),
sfix)), pdFactor = as.double(pdFactor(nlmeSt$reStruct)),
as.integer(unlist(rev(grpShrunk))), as.integer(unlist(Dims)),
as.integer(attr(nlmeSt$reStruct, "settings"))[-(1:3)], as.double(cF),
as.double(vW), as.integer(unlist(cD)), settings =
as.double(pnlsSettings),     additional = double(NReal * (pLen + 1)),
as.integer(!is.null(correlation)),     as.integer(!is.null(weights)),
nlModel, NAOK = TRUE)
 6: nlme.formula(model = follicles ~ A + B * sin(2 * pi * w * Time) +
C * cos(2 * pi * w * Time), data = Ovary, fixed = A + B +     C + w ~ 1,
random = pdDiag(A + B + w ~ 1), start = c(fixef(fm50var.lme),     1),
corr = corGaus(form = ~Time))
 7: eval(expr, envir, enclos)
 8: eval(call, parent.frame())
 9: update.nlme(fm10var.nlme, corr = corGaus(form = ~Time))
10: update(fm10var.nlme, corr = corGaus(form = ~Time))

The above was under:

R version 2.4.1 (2006-12-18)
nlme Version:   3.1-79
Linux 2.6.15-27-386 (Ubuntu 6.06)

Then I tried the same on another computer and got:
 *** caught segfault ***
address 0x82e4902a, cause 'memory not mapped'
Violación de segmento

R Version 2.3.1 (2006-06-01)
nlme Version:       3.1-74
Linux 2.6.12-10-386  (Ubuntu 5.10)

I worked out the example of rats body weights, also in the book, and it
gave no error, so the problem seems to be in using the corLin and
corGaus functions with a nlme fit. Apparently is neither my version of R
and nlme, nor the dataset. Can someone try to reproduce this? Or does
someone knows the cause/explanation/fix? 

Thanks very much 

JR Ferrer-Paris

-- 
Dipl.-Biol. JR Ferrer Paris
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laboratorio de Biología de Organismos --- Centro de Ecología
Instituto Venezolano de Investigaciones Científicas (IVIC) 
Apdo. 21827, Caracas 1020-A 
República Bolivariana de Venezuela

Tel: (+58-212) 504-1452
Fax: (+58-212) 504-1088

email: jferrer at ivic.ve
clave-gpg: 2C260A95



More information about the R-help mailing list