[R] glm null deviance
yudi@hermes.ucd.ie
yudi at hermes.ucd.ie
Wed Feb 3 09:39:56 CET 1999
> Date: Wed, 03 Feb 1999 08:47:55 +0100 (MET)
> From: Jim Lindsey <jlindsey at alpha.luc.ac.be>
> > Before some people think this is a bug, there is nothing
> > pathological or undesirable in Jim's examples. First,
>
> pathological no, undesirable yes. a null deviance is generally
> meaningless. The important thing is the minimal model in a given
> context and software cannot detect that as it depends on the question
A change in deviance is typically meaningful, so in general we want the
null deviance too. In the following example:
> y_ rbinom(20,1,.8)
> sum(y)
[1] 15
> ind_ rep(1,20)
> glm(y~ind-1,family=binomial)
Call: glm(formula = y ~ ind - 1, family = binomial)
Coefficients:
ind
1.099
Degrees of Freedom: 20 Total (i.e. Null); 19 Residual
Null Deviance: 27.73
Residual Deviance: 22.49 AIC: 24.49
> 1-pchisq(27.73-22.49,1) # testing H_0: logit p=0 or p=0.5
[1] 0.02207327 # it'd be annoying to know null-deviance
> dbinom(15,20,.5) + 2*sum(dbinom(16:20,20,.5))
[1] 0.0266037 # mid-p value is closest to chi^2-based p-val.
> binom.test(15,20,.5)
number of successes = 15, number of trials = 20, p-value = 0.04139
# this is 'exact' 2-sided p-value, it's
# not necessarily 'better' than mid-p value above.
I know Jim knows all this stuff inside out, so maybe there is
some miscommunication here.
-Yudi-
------------------------------
Yudi Pawitan: yudi at ucd.ie
Department of Statistics, UCD
Dublin 4, Ireland
Ph : 353-1-706 7641
Fax: 353-1-706 1186
------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list