[R] Strange behavior with poisosn and glm

Noah Silverman noah at smartmediacorp.com
Tue Mar 2 09:02:27 CET 2010


Hi,

I'm just learning about poison links for the glm function.

One of the data sets I'm playing with has several of the variables as 
factors (i.e. month, group, etc.)

When I call the glm function with a formula that has a factor variable, 
R automatically converts the variable to a series of variables with 
unique names and binary values.

For example, with this pseudo data:

y        v1        month
2        1            january
3        1.4        februrary
1.5    6.3        february
1.2    4.5        january
5.5    4.0        march

I use this call:

m <- glm(y ~ v1 + month, family="poisson")

R gives me back a model with variables of
Intercept
v1
monthJanuary
monthFebruary
monthMarch

I'm concerned that this might be doing some strange things to my model.  
Can anyone offer some enlightenment?

Thanks!



More information about the R-help mailing list