On Fri, 4 Dec 2009, Peng Yu wrote:
On Tue, Dec 1, 2009 at 4:04 PM, Charles C. Berry <cbe...@tajo.ucsd.edu> wrote:
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')
I don't understand. Where the contrast is?
The numbered curves are the terms of polynomial contrasts.
See
?poly
?contr.poly
and note
all( contr.poly(5) == poly(1:5,degree=4) )
BTW, what does 'schmextbook' mean?
Well, repeating a word and prepending 'schm' (in place of the initial
consonant sound, if any) is a slang idiom for asserting low regard for the
idea expressed by the word.
As in 'Birthday-Schmirthday' when moaning about getting older:
http://www.berkeleydailyplanet.com/issue/2009-01-29/article/32134?headline=First-Person-Birthday-Schmirthday-Whinings-on-Mortality
or 'Middle-schmiddle' which expresses low regard for the 'middle'
policy, see
http://aussiethule.blogspot.com/2006/03/olmerts-middle-schmiddle.html
Or 'Nilsson-Schmilsson', a self-deprecating title for an album by Harry
Nilsson:
http://en.wikipedia.org/wiki/Nilsson_Schmilsson
Or 'textbook-schmextbook', in which I express the idea that a textbook
really isn't needed.
Chuck
______________________________________________
R-help@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.
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
______________________________________________
R-help@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.