[BioC] linear model and continous variable
James W. MacDonald
jmacdon at med.umich.edu
Thu Jun 30 22:12:29 CEST 2011
Hi Dimitris,
On 6/30/2011 3:24 PM, Dimitris Kampas wrote:
> Hello everyone,
>
> I would like to perfom a linear model like the following on my data using
> limma but i am not familiar with that.
>
> Y~ a + b*TYPE + c*TIME + d * TYPE * TIME
> I have 2 types of mice, CSB and WT, and 3 time points.
> I would like to model the time as a continous covariate.
> Unfortunately, the limma examples i found contain only categrical
> covariates.
> Can anybody provide me any help? Or does anybody know where to find an
> example of limma model with
> continous covariate.
You don't say what kind of data you are analyzing, so I will keep this
pretty general. What you need to understand is that the design matrix
set up by R is dependent on the class of the input data. So if you pass
numerical data to model.matrix(), then R will assume you want to model
those data as a continuous variable. For example,
> z <- 1:4
Fit z as a continuous variable:
> model.matrix(~z)
(Intercept) z
1 1 1
2 1 2
3 1 3
4 1 4
attr(,"assign")
[1] 0 1
Fit z as factor levels:
> model.matrix(~factor(z))
(Intercept) factor(z)2 factor(z)3 factor(z)4
1 1 0 0 0
2 1 1 0 0
3 1 0 1 0
4 1 0 0 1
attr(,"assign")
[1] 0 1 1 1
attr(,"contrasts")
attr(,"contrasts")$`factor(z)`
[1] "contr.treatment"
Does that help?
Best,
Jim
>
> Dimitris Kampas
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
--
James W. MacDonald, M.S.
Biostatistician
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
More information about the Bioconductor
mailing list