Displaying 1 result from an estimated 1 matches for "ctrfn".
Did you mean:
ctfn
2010 Jun 11
0
passing constrasts=FALSE to contrast functions -- why does this exist?
...ontr.poly).
But in fact, when R decides it wants dummy coding, it doesn't call the
contrast function, it just dummy codes unconditionally:
> a <- factor(c("a", "b", "c"))
> trace(contr.treatment)
> invisible(model.matrix(~ a)) # contrast coded
trace: ctrfn(levels(x), contrasts = contrasts)
> invisible(model.matrix(~ 0 + a)) # dummy coded
>
In fact, I can't find any code anywhere in R that ever uses contrasts=FALSE.
So what's going on? Is this a bug and R *should* be using
contrasts=FALSE to "dummy code" factors?
Confusedly...