Re: [R] logistic regression with a sample missing subjects with a value of an independent variable

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 21 Oct 2006 - 15:03:56 GMT

On Sat, 21 Oct 2006, Gabriele Stocco wrote:

> Dear R-help,
> I am trying to make logistic regression analysis using the R function
> "glm", with the parameter family set to binomial, in order to use a
> logistic regression model.
> I have 70 samples. The dependent variables has two levels (0 and 1) and
> one of the independent variables has too two levels (0 and 1).
> The variables associate in the way shown in the table:
>
> Dependent 0 1
> Independent 0 55 10
>
> 1 0 5
>
> This gives a strong association evaluated by the fisher test (p-value =
> 0.0002481), but with the logistic regression it gives a p-value of 0.99
> with very high values of estimate and standard error (respectively and
> -19.27 and 1769.26).

Please see the comment at the bottom of this message, as your claims are not supported by any code.

> Is there any way (other function, different setting of a parameter) to
> perform logistic regression analysis with these data with R?

fit <- glm(matrix(c(55,0,10,5), 2, 2) ~ factor(c(0,1)), binomial()) fit0 <- glm(matrix(c(55,0,10,5), 2, 2) ~ 1, binomial()) anova(fit0, fit, test="Chisq")

   Resid. Df Resid. Dev Df Deviance P(>|Chi|)

1         1     16.929
2         0  2.208e-10  1   16.929 3.880e-05

is a reasonable way to do this. Beware the Hauck-Donner phenomenon (see e.g. MASS, the book) for t-tests of coefficients, although I do not get the values you quote. Since the expected values are low, you should not take the p value too seriously.

> Thank you.
>
> Gabriele Stocco
> University of Trieste
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.
Received on Sun Oct 22 04:29:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 21 Oct 2006 - 19:30:11 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.