[R] Understanding function residuals()

Andrew Criswell arc at arcriswell.com
Sun Nov 24 01:17:12 CET 2002


Hello:

I am trying to understand why glm() does not replicate the results in
Dobson, "Introduction to Generalized Linear Models," pp. 17-20.

I set up the following model. The variable CONDT is assumed as Poisson and
the objective is to estimate the expected value.

The data (chronic medical conditions among women in Australia) is as
follows:

    CONDT <- c(0, 1, 1, 0, 2, 3, 0, 1, 1, 1, 1, 2, 0, 1, 3, 0, 1,
                          2, 1, 3, 3, 4, 1, 3, 2, 0, 2, 0, 3, 0, 0, 1, 1, 1,
                          1, 0, 0, 2, 2, 0, 1, 2, 0, 0, 1, 1, 1, 0, 2)

The Poisson model estimating the mean:

    summary(fm1 <- glm(CONDT ~ 1, family = poisson(link = 'identity')))

The estimated coefficient obtained matches the results in Dobson exactly.
But I am unable to replicate the value for the log-likelihood using the
results on deviance or null deviance (the same here) from R. If you plug
into the log-likelihood function the coefficient value and the values for
CONDT, you get log(L) = - 68.3868  This is what is reported in Dobson. That
number I cannot seem to gleam from R.

Another question:  For a Poisson model like this, what is the difference
between the fm1$residuals and residuals(fm1)?  I expected, when taking the
ratio of one to the other, to get a vector of constants. Not so.  The values
for fm1$residuals are the difference between the actual and fitted values,
but what about residuals(fm1)?  They are not standardized residuals for a
Poisson model such as this.

Thanks for your help,
ANDREW









-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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