[R] GEE - order of data?

JoAnn Alvarez joann.alvarez at vanderbilt.edu
Wed Nov 21 19:52:33 CET 2012


Hi Anna,

In the geeglm help file, it states "Data are assumed to be sorted so that
observations on a cluster are contiguous rows for all entities in the
formula."

I'm not sure if you are asking how to sort data, or how your data should be
sorted. If your data come from a data frame called dat, it could be done in
this way:

dat <- dat[order(dat$Route), ]
geeglm(Pass~Distance, id=Route, corstr="ar1")

I think you only need to sort by the id variable. If you need to sort by two
variables, you can add them to the order function: 
dat[order(dat$Var1, dat$Var2), ]

I would think you may want to include the day or time as model covariates,
but it would depend on the nature of the problem. 

Hope this is helpful,
JoAnn



--
View this message in context: http://r.789695.n4.nabble.com/GEE-order-of-data-tp3248588p4650343.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list