This is my first question is this forum. I have the a problem that I want to solve with the lme function of the nlme package of R.
The goal of my study is analyse if the cholesterol level (quantitative) change in a series of patients depending of 3 different treatments and the genetic profile (SNPs, a factor variable with three categories). We have two repeated measures of the cholesterol (before the intervention and 1 year after).
The general question is to know if some of the treatment "works" (change in the cholesterol) for some of the 3 categories of the SNP.
My analysis in R is the next, but I don't know if it is correct:
w.lme.1 <- lme( colesterol ~ tiempo * treatment + SNP ,
random = ~1 | ID , data=xx, na.action=na.omit, method="ML")
w.lme.2 <- lme( colesterol ~ tiempo * treatment * SNP ,
random = ~1 | ID , data=xx, na.action=na.omit, method="ML")
anova(w.lme.1, w.lme.2)
where:
- ID , identification of the individuals
- time, 2 factors : baseline time and 1-year after
- treatment, 3 levels
- SNP, 3 levels
R output:
> head(xx)
ID colesterol tiempo treatment SNP
1 1 312.47 0 1 1
2 1 221.61 12 1 1
3 10 221.33 0 1 1
4 10 227.67 12 1 1
5 100 229.07 0 2 1
6 100 NA 12 2 1
> str(xx)
'data.frame': 594 obs. of 5 variables:
$ ID : int 1 1 10 10 100 100 101 101 102 102 ...
$ colesterol: num 312 222 221 228 229 ...
$ tiempo : Factor w/ 2 levels "0","12": 1 2 1 2 1 2 1 2 1 2 ...
$ treatment : Factor w/ 3 levels "1","2","3": 1 1 1 1 2 2 1 1 3 3 ...
$ SNP : Factor w/ 3 levels "0","1","2": 2 2 2 2 2 2 1 1 1 1 ...