# [R] score test for logistic regression

Thomas Lumley tlumley at uw.edu
Sun Jul 24 00:20:37 CEST 2011

```On Fri, Jul 22, 2011 at 8:00 PM, peter dalgaard <pdalgd at gmail.com> wrote:
>
> On Jul 21, 2011, at 23:11 , David Winsemius wrote:
>
>>
>> On Jul 21, 2011, at 3:38 PM, zlu wrote:
>>
>>> Hi Peter,
>>
>> I'm not sure how many people still have 9 month old postings on their mail client and will know that Peter Dalgaard is the intended recipient.
>>
>>> Do you have any idea or codes of construct a score test based confidence
>>> interval for coefficients in logistic regression?
>>
>> I realize that Peter knows more than I about this, so take this as working hypothesis and believe anything he says more than what I say. My idea: set the glm control ..., maxit=1, so you only get one iteration and then use the deviance results with the usual chi-square assuptions. I fear this could be too easy or else Peter would have already thought of this dodge.
>>
>
> I did think along those lines but couldn't convince myself that it would work. Rather, what you need is the deviance (SSD) of the approximating weighted regression analysis. Anyways, anova(..., test="Rao") has been implemented in R-devel for a while.
>
> This doesn't do confidence intervals, though.  That is a somewhat harder problem -- you'd basically need to redo the likelihood profiling code with a different criterion.
>
> For a slow and dirty technique, you could see if a parameter value beta0 is in the CI by including an offset of beta0*x and computing the score test for whether the shifted parameter (beta-beta0) is zero. Then use uniroot().
>

I think you basically have to do this computation.  The problem is
that you may not find exactly two endpoints.  For the deviance-based
intervals, a unimodal likelihood is sufficient to guarantee there are
exactly two places where the deviance differs from the maximum by the
desired amount.    Things can be much messier when you are trying to
get the score divided by its estimated standard error to be 1.96.

-thomas

--
Thomas Lumley
Professor of Biostatistics
University of Auckland

```