RE: [R] logistic regression (glm binary)

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Wed 08 Jun 2005 - 14:05:18 EST

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of
> Stephen Choularton
> Sent: Tuesday, June 07, 2005 11:49 PM
> To: R Help
> Subject: [R] logistic regression (glm binary)
>
>
> Hi
>
> I am looking for a couple of pointers using glm (family = binary).

Do you mean "binomial" instead of "binary"?   

> 1. I want to add all the products of my predictive features as
> additional features (and I have 23 of them). Is there some easy way to
> add them?

Probably something along the line:

> dat <- data.frame(y=sample(0:1, 100, replace=TRUE), matrix(runif(300),
ncol=3))
> fm <- glm(y ~ .^2, family="binomial", data=dat)
> summary(fm)

Call:
glm(formula = y ~ .^2, family = "binomial", data = dat)

Deviance Residuals:

   Min 1Q Median 3Q Max -1.654 -1.175 0.608 1.116 1.651

Coefficients:

            Estimate Std. Error z value Pr(>|z|)  
(Intercept)    3.264      1.536   2.125   0.0336 *
X1            -3.379      2.026  -1.668   0.0953 .
X2            -4.659      2.244  -2.077   0.0378 *
X3            -3.531      2.060  -1.714   0.0865 .
X1:X2          4.535      2.775   1.634   0.1022  
X1:X3          2.123      2.639   0.804   0.4212  
X2:X3          4.315      2.746   1.571   0.1161  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 137.99  on 99  degrees of freedom
Residual deviance: 131.84  on 93  degrees of freedom
AIC: 145.84

Number of Fisher Scoring iterations: 3

  

> 2. I want to drop each feature in turn and get the most significant,
> then drop two and get the next most significant, etc. Is there some
> function that allows me to do this?
Not that I know of, and most likely for a very, very good reason... Andy
> Thanks
>
> Stephen
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
> ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Jun 08 14:12:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:27 EST