[R] Marginal (type II) SS for powers of continuous variables in a linear model?

Bjørn-Helge Mevik bhx2 at mevik.net
Mon Aug 11 15:30:00 CEST 2003


I've used Anova() from the car package to get marginal (aka type II)
sum-of-squares and tests for linear models with categorical
variables.  Is it possible to get marginal SSs also for continuous
variables, when the model includes powers of the continuous variables?

For instance, if A and B are categorical ("factor"s) and x is
continuous ("numeric"),

Anova (lm (y ~ A*B + x, ...))

will produce marginal SSs for all terms (A, B, A:B and x).  However,
with 

Anova (lm (y ~ A*B + x + I(x^2), ...))

the SS for 'x' is calculated with I(x^2) present in the model, i.e. it
is no longer marginal.

Using poly (x, 2) instead of x + I(x^2), one gets a marginal SS for
the total effect of x, but not for the linear and quadratic effects
separately.  (summary.aov() has a 'split' argument that can be used to
get separate SSs, but these are not marginal.)


-- 
Bjørn-Helge Mevik




More information about the R-help mailing list