[R] model formula

Bond, Stephen Stephen.Bond at cibc.com
Thu Aug 11 18:23:13 CEST 2011


Using glm.fit

I can remove the unwanted column from model.matrix(glm.turn.2) manually and then call glm.fit directly.

Q: how can I stuff the output from glm.fit into a regular glm object, so I can use prediction functions, etc.?? the help does not describe how to use output from glm.fit in the way a glm model can be used.

Thanks everybody.

Stephen 

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent: Thursday, August 11, 2011 11:40 AM
To: Bond, Stephen
Cc: r-help at r-project.org
Subject: Re: [R] model formula



On 11.08.2011 17:27, Bond, Stephen wrote:
> Hello useRs,
>
> Pls help with removing a single interaction term from a formula:
>
> summary(
>          glm.turn.2<- glm(cbind(turn.cnt,tot.cnt-turn.cnt)~sn+poly(relAge,2,raw=T)+termfac+rate:termfac,data=fix,
>                    family="quasibinomial")
>          )
>
> Gives
>
> Coefficients:
>                             Estimate Std. Error t value Pr(>|t|)
> (Intercept)               -7.028467   0.106002 -66.305<  2e-16 ***
> snFeb                      0.156963   0.023660   6.634 3.27e-11 ***
> snMar                      0.317540   0.022883  13.876<  2e-16 ***
> snApr                      0.526084   0.022004  23.908<  2e-16 ***
> snMay                      1.026710   0.020347  50.460<  2e-16 ***
> snJun                      0.841044   0.021318  39.452<  2e-16 ***
> snJul                      0.668790   0.022530  29.685<  2e-16 ***
> snAug                      0.544267   0.022580  24.104<  2e-16 ***
> snSep                      0.389667   0.023363  16.679<  2e-16 ***
> snOct                      0.351294   0.023586  14.894<  2e-16 ***
> snNov                      0.391464   0.024057  16.272<  2e-16 ***
> snDec                     -0.373369   0.028755 -12.985<  2e-16 ***
> poly(relAge, 2, raw = T)1  2.952887   0.067455  43.776<  2e-16 ***
> poly(relAge, 2, raw = T)2 -1.783907   0.064074 -27.841<  2e-16 ***
> termfac2                  -0.681719   0.128571  -5.302 1.14e-07 ***
> termfac3                  -1.032416   0.146396  -7.052 1.77e-12 ***
> termfac4                  -1.267011   0.108940 -11.630<  2e-16 ***
> termfac5                  -1.009922   0.213129  -4.739 2.15e-06 ***
> termfac6                   3.300301   0.203465  16.221<  2e-16 ***
> termfac1:rate              0.012274   0.019895   0.617    0.537
> termfac2:rate              0.121724   0.013472   9.036<  2e-16 ***
> termfac3:rate              0.175232   0.018987   9.229<  2e-16 ***
> termfac4:rate              0.197726   0.005787  34.164<  2e-16 ***
> termfac5:rate              0.145622   0.027295   5.335 9.56e-08 ***
> termfac6:rate             -0.362379   0.025261 -14.345<  2e-16 ***
>
> and I would like to remove the termfac1:rate interaction. Is there a way to do that?
> Thank you

And what do you want to do with the observations with termfac=1 then? 
Ignore? Also move to the Intercept?

Uwe Ligges



>
> Stephen Bond
>
>
> 	[[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.



More information about the R-help mailing list