Dear all, I am trying to do a GEE on count data and I am having problems with how to order the data. Below is a simplified example of what my data looks like.. Route Time Day Pass Distance 1 30 1 4 0 1 60 1 12 200 1 120 1 25 600 1 30 2 8 0 1 60 2 17 200 1 120 2 32 600 2 30 1 0 0 2 60 1 4 200 2 120 1 11 600 2 30 2 3 0 2 60 2 42 200 2 120 2 3 600 etc... My basic model: geeglm(Pass~Distance, id=Route, corstr="ar1") Pass is the response variable (counts). I collected data along different routes (these represent the grouping structure, id=Route). As I walked each route I collected count data at different distances and times, therefore I need an AR-1 auto-correlation structure for the within route correlation. I gather that data must be organised within each block according to the time variable. However, I also completed each route on 2 separate nights, which makes ordering the data more complicated. Do I still just order the data within each block according to time (ignoring the fact that data were collected on different days), or do I need to somehow specifiy that the data were collected at different times on different days within each route? And how would this be done correctly? I hope that makes sense. Any help would be much appreciated. Thanks in advance, Anna
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.