# How to treat year variable in observational longitudinal data analysis?

I have a huge multilevel longitudinal observational data of the concentration of certain chemical collected at various sites over 10 years (1990-2010). Sites are classified into different type of sites as A, B, and C. In the dataset year variable is coded as 1990,1991, 1993 etc. At one year, there can be many sample collects at 1 site. It is not like there is only 1 data point at 1 year period per site (like many experimental longitudinal data where there is repeated measurements per 1 subject and there is only 1 data point at each time point). Some sites have also but shut down over the years but I am grouping them together into groups because I am not interested in individual sites.

str(data)

data.frame': 60,000 obs. of 22 variables:

$ID : int... 3453, 3492, 4385$ SiteID      : Factor w/ 15000 levels "1234","1235”, “1236”, ecttg
$Year : int 1993 1993 1993 1993 1993 1993 1993 1993 1993 1993 ...$ NewCom.Group: Factor w/ 5 levels "A”,  “B”, “C",..: 1 1 1 1 2
$NewLoc.Group: Factor w/ 3 levels "","Type1",”Type2 “,..: 1 2 1$ NewJobGroup : Factor w/ 4 levels "Production",..: 4 2 4 2 2
$NewIndJob : Factor w/ 109 levels "TramOp",..: ..$ Log.conc : num  -0.5978 -0.0726 -0.7765 -1.1712 -1.273 ...
\$ Log.Qconc   : num  3.5 3.14 3.76 2.89 3.09 ...


I would like to see if the concentration has decreased over the years and by group.
My mixed model looks something like this:

Model.1 = lme(log.conc ~ Year + NewCom.Group, random=~1|siteID, data=data)


My question is how should I treat Year variable to answer the question of concentration over years.

1. Should I recode year as 1, 2, 3, 4 and leave it as continuous

2. Should I recode year as 1, 2, 3, 4 and make it categorical, Time <- factor(Time)

3. Leave the year as it is and treat it as continuous variable (Is this the same as in 1?)

4. Make it categorical, Year <- factor(Year)

I just want to make sure that the model does not compare the concentration of subsequent years the first year only.
What does each of those option imply in the interpretation of the output?

• Could you report the output of str(data)? Also, what is Time? It does not appear in your model.
– chl
Commented Feb 14, 2012 at 21:20
• What I mean is should I create a new variable for Time. Time is not part of the original data but if it is necessary that I recode year, I will add the time variable. Commented Feb 14, 2012 at 21:41