[R] problem with glm(family=binomial) when some levels have only 0 proportion values
csrabak
crabak at acm.org
Wed Mar 2 16:01:06 CET 2011
Em 2/3/2011 08:01, Jürg Schulze escreveu:
> Hello everybody
This is not a R related problem, but rather more theoretic one, anyway:
>
> I want to compare the proportions of germinated seeds (seed batches of
> size 10) of three plant types (1,2,3) with a glm with binomial data
> (following the method in Crawley: Statistics,an introduction using R,
> p.247).
> The problem seems to be that in two plant types (2,3) all plants have
> proportions = 0.
> I give you my data and the model I'm running:
>
> success failure type
> [1,] 0 10 3
[snipped]
> [26,] 0 10 3
> [27,] 0 10 3
>
> y<- cbind(success, failure)
>
> Call:
> glm(formula = y ~ type, family = binomial)
>
> Deviance Residuals:
> Min 1Q Median 3Q
> -1.3521849 -0.0000427 -0.0000427 -0.0000427
> Max
> 2.6477556
>
> Coefficients:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) 0.04445 0.21087 0.211 0.833
> typeFxC -23.16283 6696.13233 -0.003 0.997
> typeFxD -23.16283 6696.13233 -0.003 0.997
>
> (Dispersion parameter for binomial family taken to be 1)
>
> Null deviance: 134.395 on 26 degrees of freedom
> Residual deviance: 12.622 on 24 degrees of freedom
> AIC: 42.437
>
> Number of Fisher Scoring iterations: 20
>
>
> Huge standard errors are calculated and there is no difference between
> plant type 1 and 2 or between plant type 1 and 3.
> If I add 1 to all successes, so that all the 0 values disappear, the
> standard error becomes lower and I find highly significant differences
> between the plant types.
>
> suc<- success + 1
> fail<- 11 - suc
> Y<- cbind(suc,fail)
>
> Call:
> glm(formula = Y ~ type, family = binomial)
>
> Deviance Residuals:
> Min 1Q Median 3Q
> -1.279e+00 -4.712e-08 -4.712e-08 0.000e+00
> Max
> 2.584e+00
>
> Coefficients:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) 0.2231 0.2023 1.103 0.27
> typeFxC -2.5257 0.4039 -6.253 4.02e-10 ***
> typeFxD -2.5257 0.4039 -6.253 4.02e-10 ***
> ---
> Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
>
> (Dispersion parameter for binomial family taken to be 1)
>
> Null deviance: 86.391 on 26 degrees of freedom
> Residual deviance: 11.793 on 24 degrees of freedom
> AIC: 76.77
>
> Number of Fisher Scoring iterations: 4
>
>
> So I think the 0 values of all plants of group 2 and 3 are the problem,
> do you agree?
It depends on the definition of "problem" here, if the result of your
experiment, maybe, for the difference in the two regressions, not.
> I don't know why this is a problem, or how I can explain to a reviewer
> why a data transformation (+ 1) is necessary with such a dataset.
You need to ascertain the modeling of your statistic test against the
epistemological analysis you're performing. Caveat: I'm not an expert in
agriculture, so this is just a comment.
If the success rates of your dataframe are the germinations of three
types of plants in a certain period of time, then perhaps it could make
sense to add one to all the values in the success column (and subtract
ones from the failure?) because that would cope with the possibility
that a certain time after the experiment has been stopped, it could have
germinated.
If in the other hand, the non germinated seeds are known to not
germinate anymore, then the calculation device would put you on wrong path.
>
> I would greatly appreciate any comments.
Get a look at the zero inflated (and perhaps hurdle as well)
distributions and the regressions associated with them.
Using sos I get more than 100 entries to look at, so I'll refrain to put
specific links here.
HTH
--
Cesar Rabak
DC Consulting LTDA
More information about the R-help
mailing list