[R-sig-ME] Help with script for adding X and Y coordinates into a correlation formula

Douglas Bates bates at stat.wisc.edu
Tue Mar 8 15:07:05 CET 2011


On Tue, Mar 8, 2011 at 4:15 AM, Karen Moore <kmoore at tcd.ie> wrote:
> Thanks for getting back to me. Do you mean that I'm incorrect in adding
> random factor AND trying to add correlation structure??

It's the nature of a generalized linear model or generalized linear
mixed model.  When the distribution of the response is multivariate
Gaussian you can model the mean and the variance-covariance structure
separately.  For other distributions, like a Bernoulli or binomial or
Poisson you can't.  Once you have specified the mean you have
specified the entire distribution.

For spatial structure one approach is to incorporate the spatial
correlation into the Gaussian distribution of the random effects where
you define one random effect per location.

May I suggest that re-route the discussion to the
R-SIG-Mixed-Models at R-project.org mailing list, which I have cc:'d on
this reply?  Several of those who read that list have more experience
than I do in this area.

> On 7 March 2011 18:33, Douglas Bates <bates at stat.wisc.edu> wrote:
>>
>> On Mon, Mar 7, 2011 at 12:07 PM, Karen Moore <kmoore at tcd.ie> wrote:
>> > opps for got to send data
>> >
>> > On 7 March 2011 18:05, Karen Moore <kmoore at tcd.ie> wrote:
>> >>
>> >> Hi,
>> >>
>> >> Tryign to add correlation strcuture to a glm model as there are
>> >> geographical pairs of sites in my data set and resids of model plotted
>> >> against Site no. showed clear patterns
>> >>
>> >> VASCmix3<-glm( AVVAS~ fForesttype + CANOPEN +TREENO10+ LOI+ WELLF+
>> >> DISTWOOD+ MATNAT1000+ MATNAT1000:CANOPEN +DISTEDGE +MATFOR1000
>> >> ,family=poisson, data = VASCmix3stanb)
>> >>
>> >> Here trying to add structures:
>> >>
>> >> globalmix<-  formula (AVVAS~ fForesttype + CANOPEN +TREENO10+ LOI+
>> >> WELLF+
>> >> DISTWOOD+ MATNAT1000+ MATNAT1000:CANOPEN +DISTEDGE
>> >> +MATFOR1000+(1|fSITENO) )
>> >>
>> >> globalmixSpher <- lmer(globalmix, correlation = corSpher(form = ~ X +
>> >> Y ,
>> >> nugget= TRUE), family = poisson, data =  VASCmix3stanb)
>> >>
>> >> How do I tell R I want to take the X and Y variables from my data sheet
>> >> "VASCmix3stanb.txt" (attached FYI) and put into the formula adding a
>> >> correlation structure
>>
>> You don't.  The definition of a generalized linear model or a
>> generalized linear mixed model requires that the responses are
>> conditionally independent, given the random effects.  It is not
>> possible to modify the correlation structure of the responses given
>> the random effects because the distribution is completely determined
>> by the conditional mean.
>>
>
>
>
> --
> Karen Moore
> PhD Researcher,
> FORESTBIO,
> Department of Botany,
> Trinity College Dublin
> Ireland
>
> Ph: 00 353 (0)87 9422 502
>
> http://www.ucc.ie/en/planforbio
>




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