# Repeated measure t test with covariates in R

I have a two data-sets of a set of subjects with values for their baseline and followup visit. I would like to do a repeated measure test to see whether there is a significant difference between the two sets (baseline & followup). I know I can do a simple paired t-test. But I need to adjust my values for covariates like age, etc...

I would like to perform a GLM method (if possible) to see whether there is a significant difference between the two sets with the covariate adjustments. Please advice how can I do this in R.

-
Can you clarify why you want to use a generalized linear model? If it would be possible to use a t-test, then your response variable is presumably continuous & normal enough. Why not use a regular mixed effects model or a multiple regression? Of course, these are special cases of GLiMs, but we don't usually refer to them as generalized LMs, we typically reserve those terms for cases where the response variable is not continuous (eg, binary or a count, etc). – gung Feb 2 '14 at 14:25
My mistake. Can you explain how can I use multiple regression(or mixed effect model) to do a repeated measure test to find out whether there is a significant difference between the two sets? (I need to adjust for my covariates too) – ssm Feb 2 '14 at 16:38

I gather you have only 2 repeated measures. That makes this simpler. If you had >2, you would need to use a mixed effects model, which is more advanced. Given that you have only 2, there are two basic possibilities: use differences as your response variable, or use an ANCOVA. Which you should use has traditionally been a matter of great contention in statistics. A basic rule is that ANCOVA makes more sense if you believe your groups were the same at baseline (i.e., this is an experiment), and using differences as your response variable makes more sense if you don't have reason to believe the groups were the same (i.e., this is an observational study). For more on this topic, read: Best practice when analysing pre-post treatment-control designs.

If you choose to use differences as your response variable, the approach is quite simple. You just subtract the baseline value for each subject from the subject's followup value. Then use those differences as Y in a multiple regression model. In R it might be something like:

difs = followup-baseline
lm(difs~covariates)


If you choose to use ANCOVA, then you use the followup value as the response variable and include the baseline value as on of your covariates. In R it might be something like:

lm(followup~covariates)  # ("covariates" includes "baseline" & the original covariates)

-
Thanks a lot for this response. I have one more question, this may be becuase my lack of stat knowledge, but given that I do dif methods, how can i conclude that my baseline and followup has a significant difference? What is the parameter I should look at? – ssm Feb 2 '14 at 17:18
Perhaps I misunderstood your question. Is the only thing you are trying to find out if the followup values differ from the baseline values? The two methods I discuss above are for if one group differs from another group. – gung Feb 2 '14 at 17:36
May be the way I explained is wrong. I have a set of subjects, for which I have two data-sets of values which are values of the same measurement taken at baseline and followup. I want to find whether there is a significant difference between the baseline values and followup values. I performed a simple paired t-test which gave good results. But it was pointed out to me that I need to adjust my measurements to correct for effects from covariates like age, etc... (So that I would only look at the effect on the measurement from my treatment but not from any other covariate(age).) – ssm Feb 2 '14 at 17:51
The paired t-test you performed was the right answer. Whoever told you you need to adjust for covariates was wrong. Whatever covariate values you might have for a given subject will be the same at both baseline & followup--there is nothing left to adjust for. – gung Feb 2 '14 at 17:58
But my followup was 2 years late,so would it change the age covariate? And one other note, my measurement is actually the cortical thickness of a particular brain region. Which actually depends on the age of a person. Does this fact makes any effect? – ssm Feb 2 '14 at 18:02