[R-sig-Geo] spatial correlation structure in lme
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sat Jun 16 23:26:49 CEST 2012
On 06/16/2012 07:01 PM, Gary Dong wrote:
> Thanks for your advice. Let me re-phrase my question with a reproducible
> example. Same message was also posted to the mixed-model list. Sorry for
> the cross-posting.
>
> The example and data are from UCLA's R FAQ webpage. The link for the
> webpage is: http://www.ats.ucla.edu/stat/r/faq/spatial_regression.htm
>
> First, following the instructions on the webpage, I did the following:
>
> install.packages("nlme")
> library(nlme)
>
> spdata <- read.table("http://www.ats.ucla.edu/stat/R/faq/thick.csv", header
> = T, sep = ",")
> dummy <- rep(1, 75)
> spdata <- cbind(spdata, dummy)
>
> ### estimated the null model ###
>
> soil.model <- lme(fixed = thick ~ soil, data = spdata, random = ~ 1 |
> dummy, method = "ML")
> summary(soil.model)
> plot(Variogram(soil.model,form=~north+east))
>
> ### then updated the model by the spatial correlation structure ####
>
> soil.gaus <- update(soil.model, correlation=corGaus(1,form=~north+east))
> summary(soil.gaus)
> plot(Variogram(soil.gaus,form=~north+east))
>
> *My first question is*: the variogram of soil.gaus indicates a range of 40,
> but the estimated range is 20.43725. Does this mean the model "soil.gaus"
> failed?
no, it means that the range parameter is not identical to the value you
interpret from the plot as range. This is usual for Gaussian and
exponential models and some others, try:
library(gstat)
show.vgms(range=20, model="Gau", max=50)
>
> Next, I define the range and nugget manually as below. The variogram of
> soil.model indicates a range at 40 and nugget at about 0.1.
>
> soil.gaus.1 <- update(soil.model,
> correlation=corGaus(c(40,0.1),form=~north+east,nugget=T))
> summary(soil.gaus.1)
> plot(Variogram(soil.gaus.1,form=~north+east))
>
> The estimated range looks right (very close to 40). But the estimated
> nugget and variogram plot still look weird. *So my question is*: what I can
> do next step to improve the model?
>
> Any advice would be greatly appreciated!
>
> Best
> Gary
>
> On Sat, Jun 16, 2012 at 2:23 AM, Edzer Pebesma <
> edzer.pebesma at uni-muenster.de> wrote:
>
>> It would have helped us when you would have provided an example that was
>> reproducible for readers of this list.
>>
>> I tried some things out, along that way, but didn't manage. Maybe you
>> could try the mixed-models list:
>>
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>> If you find out how these things work, feedback to this list would be
>> appreciated.
>>
>> On 06/16/2012 04:52 AM, wudadan wrote:
>>> Dear R users,
>>>
>>> I need some help in understanding the spatial correlation structure. Is
>>> there a document or paper that explains how to use spatial correlation
>>> structure such as "corExp"?
>>>
>>> Here is the problem I run into. With the spatial correlation structure:
>>>
>>> "correlation = corExp(c(10,0.8),form = ~ north + east)"
>>>
>>> I tried to define the range and nugget as 10 miles and 0.8,
>> respectively.
>>
>> the help pages here suggest you'd have to add nugget=TRUE to the corExp
>> arguments.
>>
>>> However, I got the error message "Error in
>> initialize.corSpatial....Initial
>>> value for corSpatial parameters of wrong dimension". Can anyone tell me
>> what
>>> this means?
>>>
>>> I then tried the script:
>>>
>>> "correlation = corExp(10,form = ~ north + east)"
>>>
>>> It worked. However, it seems the range "10" was not used because after I
>>> changed it to "3", I got exactly the same estimation results. I'm
>> wondering
>>> what the right way to do this.
>>>
>>> Any advice is appreciated!
>>>
>>> Best
>>> Gary
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://r-sig-geo.2731867.n2.nabble.com/Need-help-understanding-the-spatial-correlation-structure-applied-in-lme-tp6049193p7580220.html
>>> Sent from the R-sig-geo mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>> --
>> Edzer Pebesma
>> Institute for Geoinformatics (ifgi), University of Münster
>> Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
>> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
>> http://www.52north.org/geostatistics e.pebesma at wwu.de
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> [[alternative HTML version deleted]]
>
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list