Peng Yu
2009-Dec-01 21:40 UTC
[R] How to compute contrast where there are interaction terms in the linear model?
Could somebody recommend some textbook how to compute contrast when there are interactions terms? "Applied Linear Regression Models" (book) mentioned contrast, but I cannot extend it to the case where there are interaction terms.
Charles C. Berry
2009-Dec-01 22:04 UTC
[R] How to compute contrast where there are interaction terms in the linear model?
On Tue, 1 Dec 2009, Peng Yu wrote:> Could somebody recommend some textbook how to compute contrast when > there are interactions terms? "Applied Linear Regression Models" > (book) mentioned contrast, but I cannot extend it to the case where > there are interaction terms.Textbook? Schmextbook! You have the power of R at your fingertips! Use it to explore concepts you are trying to wrap your brain around!> df <- expand.grid(x1=1:20,x2=factor(letters[1:2])) > vanilla <- model.matrix(~0+poly(x1,degree=3), df ) > matplot(row( vanilla) , vanilla, type='b') > inter <- model.matrix(~0+poly(x1,degree=3):x2, df ) > matplot(row( inter ) , inter, type='b') >Chuck Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
Apparently Analagous Threads
- fit.contrast and interaction terms
- lm: how are polynomial functions interpreted?
- Great difference for piecewise linear function between R and SAS
- Looking for a textbook that is more concise than Applied Linear Statistical Models (2004 version)
- Unexpected behavior of predict and interval="confidence"