[R-sig-ME] Specifying correlation structure
Gang Chen
gangchen at mail.nih.gov
Wed May 16 16:00:30 CEST 2012
I really appreciate the suggestions, Alain! I'll try to check out your
books and play with more models...
Gang
On Tue, May 15, 2012 at 1:26 PM, Highland Statistics Ltd
<highstat at highstat.com> wrote:
> On 15/05/2012 12:59, Gang Chen wrote:
>> Thanks for the comments!
>>
>> Currently I'm only trying to work on the model specification part with
>> one subject. With multiple subjects, I can easily switch from gls to
>> lme. Also the issue of corARMA or corAR1 or others is not important
>> right now. Instead my focus is, how to correctly specify the
>> correlation structure across the three conditions? You've kindly
>> helped me out on imposing the same correlation structure for the three
>> conditions. The only dangling part is, how to specify a different
>> correlation structure for each condition while modeling the
>> correlation similarity across the three conditions?
>
> gls would use the same AR parameter (and therefore correlation
> structure) for all your conditions. If you use both random effects and
> AR1 then you would need to take a pen and paper to work out how exactly
> the correlation looks like (and also ensure that the two terms don't
> compete with each other). If you want to have different AR parameters,
> then one option would be to fit the model within an MCMC context. See
> our 2012 book (sperm whale chapter) for examples how to do this...or
> chapter 23 in our 2009 book for multiple AR parameters.
>
> A random intercept and slope model would be an alternative (the
> correlation would depend on the covariate used as random slope)....but
> whether this is sensible for your data depends on your data, questions
> and your variables.
>
>
> Alain
>
>>
>> Gang
>>
>>
>> On Tue, May 15, 2012 at 12:15 PM, Gavin Simpson<gavin.simpson at ucl.ac.uk> wrote:
>>> On Tue, 2012-05-15 at 11:47 -0400, Highland Statistics Ltd wrote:
>>>> Many thanks for the suggestion. It seems that gls does not like that either:
>>>>
>>>>> / (fm<- gls(res ~ 1+reg1+reg2+reg3, correlation=corARMA(c(0.02, 0.03), form=~time|condition, p=1,q=1), data=Dat))
>>>> /
>>>> Error in model.frame.default(formula = ~time + condition + res + reg1 + :
>>>> variable lengths differ (found for 'condition')
>>> <snip />
>>>
>>>> That is because 'condition' is not in your Dat object. I guess it should be cond.
>>>> Why corARMA and not corAR1?
>>>>
>>>> I'm actually not sure whether your modelling approach is correct. The
>>>> unit is the subject....but the time | cond is imposing the correlation
>>>> inside the observations from the same condition. Is that what you
>>>> want? It would ignore any correlation between 2 observations from
>>>> different
>>>> conditions....but still from the same subject. But perhaps I did not
>>>> fully understand your original post.
>>> Those are good points Alain. My comment would be that the OP mentioned
>>> that there was just a single subject; whether that was just the example
>>> or a real property of the data, who knows? ;-)
>>>
>>> Like you, without further info, whether the nested ARMA(1,1) is
>>> sufficient will depend on the OP providing more info.
>>>
>>> G
>>>
>>>> Alain
>>>>
>>>>
>>>> /
>>>>
>>> --
>>> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>>> Dr. Gavin Simpson [t] +44 (0)20 7679 0522
>>> ECRC, UCL Geography, [f] +44 (0)20 7679 0565
>>> Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
>>> Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
>>> UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
>>> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> --
>
> Dr. Alain F. Zuur
> First author of:
>
> 1. Analysing Ecological Data (2007).
> Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.
> URL: www.springer.com/0-387-45967-7
>
>
> 2. Mixed effects models and extensions in ecology with R. (2009).
> Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.
> http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9
>
>
> 3. A Beginner's Guide to R (2009).
> Zuur, AF, Ieno, EN, Meesters, EHWG. Springer
> http://www.springer.com/statistics/computational/book/978-0-387-93836-3
>
>
> 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno.
> http://www.highstat.com/book4.htm
>
> Other books: http://www.highstat.com/books.htm
>
>
> Statistical consultancy, courses, data analysis and software
> Highland Statistics Ltd.
> 6 Laverock road
> UK - AB41 6FN Newburgh
> Tel: 0044 1358 788177
> Email: highstat at highstat.com
> URL: www.highstat.com
> URL: www.brodgar.com
>
More information about the R-sig-mixed-models
mailing list