[R] lags for unbalanced panel data

Dieter Menne dieter.menne at menne-biomed.de
Tue Mar 8 18:44:36 CET 2011


Geoffrey Smith-3 wrote:
> 
> Hello, I was wondering if there was an easy way to calculate the rate of
> change in a variable for an unbalanced panel data set.  Below is a
> detailed
> description in R of what I am asking.  Thank you.  Geoff
> 
> 

A classic for mixed models, which simply does not know what  "missing data"
are (= handles those cases graciously). 

Dieter

library(nlme)
Person <- c(rep('Frank',5), rep('Tony',4), rep('Edward',4));
Year <- c(2005,2006,2007,2008,2009,2005,2006,2008,2009,2006,2007,2008,2009);
Score <- c(55,58,63,23,34,38,56,87,44,32,98,45,56);

Data <- data.frame(Person=Person, Year=Year, Score=Score);
Data;
summary(lme(Score~Year, random=~1|Person,data=Data))





--
View this message in context: http://r.789695.n4.nabble.com/lags-for-unbalanced-panel-data-tp3341764p3341882.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list