Skip to content
Prev 336997 / 398502 Next

GLM with Numeric and Factor as an Input

On 26/02/14 01:40, Lorenzo Isella wrote:
From the help for glm.fit:
(Emphasis mine.)

So if you want to/insist on using glm.fit() rather than glm() you will 
have construct your own design matrix.  I.e. replace
each factor column by k-1 columns of dummy variables (where k is the 
number of levels of the given factor).  Note that "x" should really be a 
*matrix*, not a data frame although it seems that data frames (all of 
whose columns are numeric) get coerced to matrices so it doesn't matter 
much.

cheers,

Rolf Turner