[R] simple question about contrasts, lm and factors

David.Epstein David.Epstein at warwick.ac.uk
Sun Apr 11 12:28:29 CEST 2010


I have a data frame with two variables that are factors. One is actually a
TRUE/FALSE factor, and I have coded it as 1/0, a continuous variable, but I
could turn it back into a factor. The second is an ordered factor and
consists of five timepoints. There are several continuous variables as well.
Now I want to fit a linear model to my data, using lm (or another R
procedure if recommended).

Question: should I use polynomial contrasts? My timepoints are very far from
being evenly spaced, so ordinary R contrasts seem more natural. But I'm
totally inexperienced (this is my first serious regression).

I also want to choose my base value. In the first call to lm, I want to
choose base value equal to FirstTimePoint.
In my second call to lm, I want to choose base value to be the interaction
term FirstTimePoint:FALSE or FirstTimePoint:0.

Does all this make sense? Please excuse my inexperience if it doesn't. If it
makes sense, then there must be two simple calls to lm. But I'm floundering.

Thanks a lot
David
-- 
View this message in context: http://n4.nabble.com/simple-question-about-contrasts-lm-and-factors-tp1835964p1835964.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list