[R] Basic Dummy Variable Creation
spencer.graves at pdf.com
Fri Sep 5 20:49:31 CEST 2003
One must estimate 2 coefficients for a 3-level factor. I therefore
prefer to look for a plausible order between the 3 levels so I can code
them as -1, 0, +1 and then estimate linear and quadratic coefficients.
Then for interactions, I look first for interactions between the linear
effect of this factor and others, especially if the data do not support
reasonable estimation of both interaction terms. This sounds to me to
be pretty close to what your client was requesting.
hope this helps.
Rolf Turner wrote:
> In response to a question from Francisco J. Bido, about how to create
> dummy variables, Doug Bates and others essentially said ``Don't.''
> Which is good advice, but ....
> Recently I encountered a problem involving a linear model with a
> three level factor (levels low, medium, and high) crossed with linear
> and quadratic terms in a continuous variate. The client wanted (for
> some reason --- perhaps I should have discouraged him more
> forcefully) to compare the full model with a model in which there
> were linear and quadratic terms for the high level of the factor, but
> only linear terms for the low and medium levels.
> The only way I could see of specifying the reduced model was through
> using dummy variables explicitly. I.e. I could see no way of
> specifying such a model in the standard general linear model syntax.
> (The client was actually working in SAS, but the same considerations
> apply whether one is speaking SAS or R/Splus, it seems to me.)
> Did I miss something obvious (or even not-so-obvious)?
> Rolf Turner
> rolf at math.unb.ca
> R-help at stat.math.ethz.ch mailing list
More information about the R-help