> 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
at hand (for example constraints in log linear models with Poisson).
Hence, my point is that glm should not print out such nonsense, the
same as my argument against printing p-values and stars. They are all
pure nonsense in many applications of glm and mislead the user.

> the deviance in the Bernoulli model (0-1 outcome) is
> simply equal to 
>      -2 log lik = -2 sum (y*log phat + (1-y)*log(1-phat) )
> where phat is the estimated prob's from the model.
> 
> > y <- rbinom(20,1,0.5)
> > ind <- rep(1,20)
> > glm(y~1,family=binomial)
> the null deviance here is the deviance of the model with constant
> term, which the same as the full model, so the null-dev is the same
> as the residual deviance. 
> 
> > glm(y~ind-1,family=binomial)
> Here the null-model is logit p =0, so under this model phat=0.5,
> and the null-dev has n degrees of freedom. If this is not a 
> meaningful model, then make the constant model the null
> model. The residual deviance is from the model with constant
> term, so the same as the first case.
> 
> > glm(y~ind-1,family=binomial(link=log))
> Here null-model is log p = 0, so phat = 1. The deviance 
> formula then computes log (1-1)=Inf for null-dev.
> Residual deviance  is from the model with constant
> term, so the same as the first case.
> 
> > glm(y~ind-1,family=binomial(link=cloglog))
> here the null model is log(-log(1-p))=0, so 
> phat = 1- exp(-exp(0))= 0.63. Again, the
> residual deviance  is from the model with constant
> term, so the same as the first case.
> 
> 
> Question to the devel:
>        shouldn't the cloglog = log(-log(p))?
>        rather than   log(-log(1-p)) as implemented?

the c in cloglog stands for complementary, i.e. 1-p. log(-log(p)) is
simply the loglog link.
  Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

