[R] how to model a numeric factor as a non-ordinal factor

David Winsemius dwinsemius at comcast.net
Wed Oct 28 18:44:57 CET 2009


So is this factor ordered or not. Is it just in your model to create  
unordered strata? What does the Time variable look like now?

summary(Time)

Depending on how Time and Treatment are associated with the subjects  
you may choose different options. And are they sitting in a dataframe?

-- 
David.

On Oct 28, 2009, at 1:12 PM, Mark Kimpel wrote:

> I am analyzing an experiment in which time is a factor, represented by
> numbers indicating time since last treatment, but in this particular  
> case
> there is no reason to think that time has a numeric meaning in the  
> sense
> that 24 would be greater than 6. We have no idea which genes will be
> increasing or decreasing at different times.
>
> So I have the following model (to be applied over many genes):
>
> mod <- lm(gene.expression ~ Treatment + Time)
>
> If I wanted to just hack my way around this I could just paste a  
> character
> to all of the times, but I'm curious as to the right way to do this.
>
> What would be the correct syntax or transformation? Would Time <-
> factor(as.character(Time)) do it? I want to make sure that it does  
> not get
> coerced back to numeric.
>
> Thanks,
>
> Mark
>
> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
> Indiana University School of Medicine
>
> 15032 Hunter Court, Westfield, IN  46074
>
> (317) 490-5129 Work, & Mobile & VoiceMail
> (317) 399-1219 Skype No Voicemail please
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list