[R-sig-ME] Is there a way to include both time correlation term and spatial correlation term in single lme model?
Nirmala Liyanage
nirmala.liyanage at sydney.edu.au
Mon Sep 15 09:47:51 CEST 2014
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]]
More information about the R-sig-mixed-models
mailing list