[R-sig-ME] Is there a way to include both time correlation term and spatial correlation term in a single lme model?
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Tue Sep 16 12:57:42 CEST 2014
Yes. INLA handles that by adding a random effect for location (with spatial autocorrelation in the levels of the random effect).
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: Nirmala Liyanage [mailto:nirmala.liyanage op sydney.edu.au]
Verzonden: dinsdag 16 september 2014 12:51
Aan: ONKELINX, Thierry
CC: r-sig-mixed-models op r-project.org
Onderwerp: RE: [R-sig-ME] Is there a way to include both time correlation term and spatial correlation term in a single lme model?
Dear Thierry,
Thank you very much.
Is there way to handle multiple soil depths without shifting x coordinate values?
kind Regards,
Nirmala
________________________________________
From: ONKELINX, Thierry [Thierry.ONKELINX op inbo.be]
Sent: Monday, 15 September 2014 6:01 PM
To: Nirmala Liyanage; r-sig-mixed-models op r-project.org
Subject: RE: [R-sig-ME] Is there a way to include both time correlation term and spatial correlation term in single lme model?
Dear Nir,
I doubt that 7 irregular time points allows to estimate a sensible autocorrelation structure...
The INLA package allows models with multiple random effects. Each random effect can have a different correlation structure. Note that with INLA the random effects are correlated whereas nlme adds a correlation structure to the residuals.
You can find the INLA package at r-inla.org
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-sig-mixed-models-bounces op r-project.org [mailto:r-sig-mixed-models-bounces op r-project.org] Namens Nirmala Liyanage
Verzonden: maandag 15 september 2014 9:48
Aan: r-sig-mixed-models op r-project.org
Onderwerp: [R-sig-ME] Is there a way to include both time correlation term and spatial correlation term in single lme model?
Dear All,
I have an irregular time series dataset of soil moisture measured over two years period on a forest soil in Australia which I collected as a student. I suspect my dataset has a temporal and spatial correlation structure. The data were collected in seven sampling events (first two within six months apart, second and third within year and after that approximately one month apart between sampling). Data were also collected in two soil depths. I have six predictor variables and I want to add both spatial and temporal correlation in a single model. The summary of the model I tried, which only includes spatial correlation and time as a random effect, is as follows.
ARSMC7Gaus.lme <- lme(LogMC~V1 + V2 +V3 + V4 + V5 + V6 + as.factor(SDepth), random = ~1|Time,correlation = corGaus(1, form = ~xmga+ymga, nugget = TRUE), data=ARSMC6)
summary (ARSMC7Gaus.lme)
Linear mixed-effects model fit by REML
Data: ARSMC6
AIC BIC logLik
-488.679 -441.782 256.3395
Random effects:
Formula: ~1 | Time
(Intercept) Residual
StdDev: 0.01643712 0.1243742
Correlation Structure: Gaussian spatial correlation
Formula: ~xmga + ymga | Time
Parameter estimate(s):
range nugget
1.5809160 0.3307183
Fixed effects: LogMC ~ V1 + V2 + V3 + V4 + V5 + V6 + as.factor(SDepth)
Value Std.Error DF t-value p-value
(Intercept) 3.728646 0.4874570 365 7.649179 0.0000
V1 0.001482 0.0004610 3 3.214425 0.0488
V2 0.005831 0.0020212 365 2.884979 0.0041
V3 -0.061032 0.0060525 3 -10.083730 0.0021
V4 0.002323 0.0001736 3 13.381117 0.0009
V5 0.008451 0.0029611 365 2.853999 0.0046
V6 0.003676 0.0005210 365 7.054582 0.0000
as.factor(SDepth)15 -0.029451 0.0080961 365 -3.637632 0.0003
Correlation:
(Intr) V1 V2 V3 V4 V5 V6
V1 -0.101
V2 0.181 0.000
V3 0.276 -0.017 -0.001
V4 0.732 -0.128 0.001 0.402
V5 -0.488 -0.013 -0.097 0.001 0.011
V6 -0.657 -0.031 -0.328 0.001 0.027 0.688
as.factor(SDepth)15 -0.096 0.048 -0.097 0.047 -0.094 0.009 0.030
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-3.55288638 -0.60507563 -0.04411639 0.54770394 3.87767186
Number of Observations: 376
Number of Groups: 7
Above model is significantly different from the null model (without spatial structure and time as a random effect).
Model df AIC BIC logLik Test L.Ratio p-value
ARSMC7.lme 1 10 -396.4002 -357.3194 208.2001
ARSMC7Gaus.lme 2 12 -488.6790 -441.7820 256.3395 1 vs 2 96.2788 <.0001
I used R 3.0.1 and package nlme
Note; to make this model to work I had to add 0.05cm to x coordinate of the second soil depth (shift from original x coordinates of all second depth values). Otherwise I got following error message (##Error in getCovariate.corSpatial(object, data = data) :
##cannot have zero distances in "corSpatial")
My questions are
1. Ideally, we would like to have time as a correlation term in the model and no random effect (i.e. gls). Is there a way that I could also include time as a correlation term in addition to the spatial correlation term?
2. Currently Time is coded as 1-7 but they are not recorded in regular time intervals. What is the best way to put that in to the model?
Thank you very much,
Kind regards,
Nir
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models op r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * * Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
More information about the R-sig-mixed-models
mailing list