Skip to content

GLM Help

2 messages · CES, Weidong Gu

CES
#
Hey all,

 I am attempting to replicate my results achieved in another program within
R (so I can expand my options for methods). I am trying to run a GLM (Family
= Poisson) for count data in R. Some of my variables are factors and I am
under the impression that the function glm() cannot run a model with Poisson
dist and factors?? 

Here is why I think this, if I run two models using glm(), one treating a
variable (e.g., Harvest.Factor) as a Factor and the other treating a
variable as continuous (e.g., Harvest.Cont) I get the same results in R. 

Is there a package that will allow me to run a GLM using a Poisson dist and
factor variables? 

Thanks for any help!
-Chris





--
View this message in context: http://r.789695.n4.nabble.com/GLM-Help-tp3949104p3949104.html
Sent from the R help mailing list archive at Nabble.com.
#
Are you sure your variables are categorical or numeric? Of course, glm
differentiates these two kinds of variables. For example, I ran the
same variable with different modes, the results are very different.
Call:  glm(formula = y ~ xf, family = poisson, data = dat)

Coefficients:
(Intercept)          xf2          xf3          xf4
    1.60944     -0.12783     -0.11878     -0.09746

...
Call:  glm(formula = y ~ as.numeric(xf), family = poisson, data = dat)

Coefficients:
   (Intercept)  as.numeric(xf)
       1.59047        -0.02673


Weidong Gu
On Fri, Oct 28, 2011 at 4:21 PM, CES <smit4155 at umn.edu> wrote: