Hi, I have a typical gene expression matrix along with the samples age and gender. How to create a model matrix to test whether there is any association between age and gene expression is different in male and female samples?
Is it something like this?
x.r$AGE = as.numeric(x.r$AGE) x.r$Gender = as.factor(x.r$Gender_name) design <- model.matrix (~x.r$AGE+x.r$Gender, data=x.r)
# fit the linear model fit <- lmFit(mydata, design)