[R] Coding methods for factors

Rolf Turner r.turner at auckland.ac.nz
Tue Apr 22 02:07:54 CEST 2008


On 22/04/2008, at 11:59 AM, Paul Lynch wrote:

> Is there a way in R to control how factors are coded?  It looks like
> reference cell coding is used by default.  Is there a way to get
> effects coding?
>
> (I could just set up the factor dummy variables as I wish and use lm,
> but I'm wondering if there is a better way.)

I think you want to consider contrasts.  You probably want to do

	options(contrasts=c("contr.sum","contr.poly")

or

	options(contrasts=c("contr.helmert","contr.poly")


		cheers,

			Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list