1
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Could you report the output of str(data)? Also, what is Time? It does not appear in your model. $\endgroup$ – chl Feb 14 '12 at 21:20
  • $\begingroup$ 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. $\endgroup$ – Amateur Feb 14 '12 at 21:41
5
$\begingroup$

The only difference between the results for approaches (1) and (3) is that the intercept of your model will be different. Regression puts a line through the mean of the outcome and of every predictor; since the mean of 1990--2010 is different than the mean of 1--21, the intercept has to shift to make the regressions go through these points.

The only difference between the results for approaches (2) and (4) is the labels that will be attached to your output---1--21 or 1990--2010.

Typically, we follow approach 2/4. This strategy permits a different "effect" for each year (a "fixed effect"). In contrast, approach 1/3 assumes that the expected difference between 1991 and 1992 is the same as the expected difference between 2001 and 2002 (a "linear time trend").

We might prefer the linear time trend if we don't have very many observations (we only have to estimate one slope, rather than 20 fixed effects coefficients), but that doesn't sound like a problem for you.

We could go beyond the linear time trend model and allow each site to have its own linear time trend by using approach 1/3 with a random effect on the time variable. I think that fixed effects are easier to work with, though, and generally prefer them. (Note: there are some cases where fixed effects cannot be used alongside other variables in your model, in which case I would use random effects. This doesn't appear to be a problem for you.)

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Thank you for your explanation. I guess I don't know how to interprete 20 Year fixed effects if i treat it as categorical because I just want to know that the overall 20 year effect rather than year by year. If that is the case would you recommend that I add contrast= contr.helmert in order to see the trend? At the beginning, I only know how to interpret Year as continuous because you could just say every unit increase in year is associate with decrease or increase in the concentration. Now I am a little confused. $\endgroup$ – Amateur Feb 15 '12 at 3:40
  • $\begingroup$ I was assuming that the year effects were not of particular interest. If you are trying to forecast into the future, year fixed effects will not be helpful in that endeavor. If you just want to see the trend over the history of the data, just plot the coefficients from these variables. The trend won't be monotonic; there will likely be ups and downs. One year fixed effect is excluded so that your model is identified; every other fixed effect is measured relative to this year. $\endgroup$ – Charlie Feb 15 '12 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.