[R] Adding a subset to a glm messes up factors?

From: Muri Soares <murisoares_at_yahoo.com>
Date: Fri, 7 Dec 2007 05:41:47 -0800 (PST)


Hi everyone,
I have a problem with running a glm using a subset of my data. Whenever I choose a subset, in the summary the factors arent shown (as if the variable was a continuous variable). If I dont use subsets then all the factors are shown. I have copied the output from summary for both cases.

Thanks for the help,
Muri

> model<-glm(log(cpue)~year,family=gaussian)
Call:
glm(formula = log(cpue) ~ year, family = gaussian)

Deviance Residuals:

    Min 1Q Median 3Q Max -2.0962 -0.5851 -0.1241 0.4805 3.9236

Coefficients:

            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   0.8899     0.1844   4.825 1.42e-06 ***
year1990     -0.6107     0.1925  -3.173  0.00152 ** 
year1991     -1.7466     0.1902  -9.184  < 2e-16 ***
year1992     -1.4061     0.1864  -7.544 5.07e-14 ***
year1993     -1.4069     0.1860  -7.565 4.31e-14 ***
...

> model<-glm(log(cpue)~year,family=gaussian,subset(data.all,species=="n")
Call:
glm(formula = log(cpue) ~ year, family = gaussian, data = subset(data.all,

    species == "n"))

Deviance Residuals:

     Min 1Q Median 3Q Max -1.64577 -0.61671 -0.08972 0.55792 2.73737

Coefficients:

             Estimate Std. Error t value Pr(>|t|)   
(Intercept) 32.446570  10.076895   3.220  0.00135 **
year        -0.016345   0.005037  -3.245  0.00123 **
---










      ____________________________________________________________________________________
Looking for last minute shopping deals?  

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 07 Dec 2007 - 13:44:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Dec 2007 - 14:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.