[R-sig-ME] spatial correlation structures in nlme, segfault

Chris Knight chris.knight at manchester.ac.uk
Tue Jun 30 10:56:04 CEST 2009


Hi,

I'm having a problem where attempting to fit spatial correlation 
structures in nlme crashes R with a segmentation fault- full details and 
example at the end.

I get the same issue with corLin(), corExp(), corGaus(), corSpher() and 
corRatio() on Mac, windows and linux setups  with R2.9.1 and R2.9.0, 32 
or 64 bit (admittedly I've not tried all possible combinations and the 
latter two OSs were virtual machines), but I don't get the problem using 
gnls() on a single level of the data, or using any of the ARMA 
correlation structures.

The actual datasets I'm working with are time series, larger and more 
complex than the example and the segfault takes some time to happen- 
ARMA classes, from my limited attempts, don't seem to do a sufficient 
job on the correlations (the semivariogram for my data modelled with 
corAR1() still looks like a reasonable approximation to a 'linear' 
semivariogram (e.g. as given on p233 of P&B), with no nugget and 
plateauing at a distance of ~20, correlation=corLin(value=20, 
form=~time) gives the segfault)

Any help/suggestions for alternative analyses or work-arounds much 
appreciated. Thanks,

Chris



This seems very similar to an issue identified by JR Ferrer-Paris back 
in 2007: (http://tolstoy.newcastle.edu.au/R/e2/help/07/03/12434.html) to 
which I haven't been able to find an answer. This is therefore his 
example based on the Ovary example from P&B p395ff, even though 
corGaus() doesn't seem a particularly appropriate variance function to 
use on this data(?).

My setup is a 2x2.8GHz Quad-Core Intel Xeon Mac pro with 24Gb RAM
running Mac OS X 10.5.7 (same problem in 10.5.6).

 > library(nlme)
 > sessionInfo()
R version 2.9.1 (2009-06-26)
i386-apple-darwin8.11.1

locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] nlme_3.1-92

loaded via a namespace (and not attached):
[1] grid_2.9.1      lattice_0.17-25
 > 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 0x18d38068, cause 'memory not mapped'

Traceback:
  1: .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)
  2: 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))
  3: eval(expr, envir, enclos)
  4: eval(call, parent.frame())
  5: update.nlme(fm10var.nlme, corr = corGaus(form = ~Time))
  6: update(fm10var.nlme, corr = corGaus(form = ~Time))

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:


  --
------------------------------------------------------------------------
Dr Christopher Knight                             Michael Smith Building
Wellcome Trust RCD Fellow                       Faculty of Life Sciences
Tel:  +44 (0)161 2755378                    The University of Manchester
room B.2012                                                  Oxford Road
www.dbkgroup.org/MCISB/people/knight/                 Manchester M13 9PT
· . ,,><(((°>                                                         UK




More information about the R-sig-mixed-models mailing list