[R] Longitudinal analysis: contrasting time points

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Feb 23 11:08:46 CET 2010


Dear Denis,

Have a look at the lme() and nlme() functions, both in the nlme package.
You find more details in Pinheiro & Bates (2000).

A linear trend over time:
lme(Y ~ Year, random = ~1|Department/Person)

Contrasts between years:
lme(Y ~ factor(Year), random = ~1|Department/Person)

You might want to add a correlation structure:
lme(Y ~ Year, random = ~1|Department/Person, correlation =
CorAR1(form~Year))

HTH,

Thierry

PS R-sig-mixed-models is a better list for questions on longitudinal
data

@BOOK{PinheiroBates2000,
  title = {Mixed-Effects Models in {S} and {S-Plus}},
  publisher = {Springer},
  year = {2000},
  author = {Pinheiro, Jose C. and Bates, Douglas M.},
  note = {{ISBN 0-387-98957-0}},
  abstract = {A comprehensive guide to the use of the `nlme' package for
linear
	and nonlinear mixed-effects models.},
  orderinfo = {springer.txt},
  publisherurl =
{http://www.springeronline.com/sgw/cda/frontpage/0,11855,4-10129-22-2102
822-0,00.html?changeHeader=true}
}

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org 
> [mailto:r-help-bounces op r-project.org] Namens Denis.Aydin op unibas.ch
> Verzonden: dinsdag 23 februari 2010 9:27
> Aan: r-help op r-project.org
> Onderwerp: [R] Longitudinal analysis: contrasting time points
> 
> Hi everyone
> 
> I have the following situation:
> 
> In a longitudinal study, subjects fill out a questionnaire 
> every year (repeated measurements over time). Also, the
> subjects are nested within departments. There is an 
> intervention going on over time. The outcome variable is 
> continuous. Now I'd like to analyse two things:
> 
> 1. Is there a significant change over time? I think this is 
> done by a mixed-effects model with time as an independent 
> variable (also called growth-curves according to Jos W.R. Twisk 2006).
> 
> 2. I want to build contrasts between the years (i.e., time 
> points). Thus, I'd like to know which years are different 
> from each other. Normally, I would do an ANOVA with a 
> TukeyHSD-posthoc test, but I'm not sure how to do this with 
> repeated measurements over time and a nested design. Could 
> anybody help me on this?
> 
> Thanks for any help.
> 
> Regards,
> Denis Aydin
> 
> 
> References:
> 
> Applied Multilevel Analysis: A Practical Guide. Jos WR Twisk. 
> Cambridge University Press, UK 2006
> 
> --------------------------------------------------------------
> ------------
> This email and any files transmitted with it are 
> confide...{{dropped:8}}
> 
> ______________________________________________
> R-help op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.



More information about the R-help mailing list