RSiteSearch("lme spatial correlation", "functions") produced
10
hits for me just now. The sixth title on that list was "spatial
correlation structure"
(http://finzi.psych.upenn.edu/R/library/nlme/html/corSpher.html). This
is the help page for the "corSpher" function. The Examples section
there includes references to selected pages in Pinheiro and Bates (2000)
Mixed-Effects Models in S and S-Plus (Springer), which for me is
essential documentation for 'lme' and is the best book I know on
mixed-effects models generally. The value of that book is greatly
enhanced by the availability of script files "ch01.R",
"ch02.R", ...,
"ch06.R", "ch08.R" (in the
"~R\library\nlme\scripts" subdirectory of
your R installation directory). These contain R code to reproduce all
the data analyses in the book. There are a very few cases where the
syntax is different between R and that documented in the book [e.g., x^2
must be I(x^2)]. Before I found the script files, I couldn't understand
why I got substantially different results from the book when just typing
the commands into R.
Hope this helps.
Spencer Graves
Mark Wilson wrote:> Hello.
>
> As advised by Mick Crawley in his book on S+, I'm trying to use the lme
> function to examine a linear relationship between two variables measured at
> 60 locations in 12 sites, while taking account of any spatial
> autocorrelation (i.e. similarity in variation between the two variables
that
> is due to site). I am using the function as follows:
>
> model<-lme(yvariable~xvariable,random=~xvariable|site)
>
> If you know your way around this function, I would be very grateful if you
> could confirm that this approach is a valid one, or point out why it
isn't.
> I'd also be very keen to hear any suggestions regarding alternative
ways to
> address the spatial autocorrelation in my data (I'm hoping to arrive at
a
> slightly more elegant solution than simply taking site averages for each of
> the two variables and running a correlation using these mean values).
>
> Thanks,
>
> Mark
>