s-news
[Top] [All Lists]

Re: Options(contrasts=..) in glm

To: Arsad Tanjung <arsad_tanjung@hotmail.com>
Subject: Re: Options(contrasts=..) in glm
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
Date: Sat, 28 Apr 2001 13:31:18 +0100 (GMT Daylight Time)
Cc: <s-news@wubios.wustl.edu>
In-reply-to: <F1109T3TGJ2TUSzbAUf00004893@hotmail.com>
On Sat, 28 Apr 2001, Arsad Tanjung wrote:

> When I fit a model using glm (e.g. low birth weight dataset, V&R pp
> 234-235), I found the results when stating this option:
>
> options(contrasts=c("contr.treatment", "contr.poly"))
>
> exactly the same as in the book:

>
> Coefficients:
>                   Value  Std. Error    t value
> (Intercept)  0.82301258 1.244073209  0.6615467
>         age -0.03723398 0.038677748 -0.9626718
>         lwt -0.01565297 0.007075944 -2.2121383
> raceblack  1.19240920 0.535745758  2.2256998
> raceother  0.74068107 0.461460949  1.6050785
>       smoke  0.75552501 0.424764466  1.7786916
>         ptd  1.34376082 0.480444518  2.7969115
>          ht  1.91316170 0.720434406  2.6555668
>          ui  0.68019467 0.464215580  1.4652560
>        ftv1 -0.43637856 0.479161054 -0.9107138
>       ftv2+  0.17900705 0.456209017  0.3923795
>
> BUT... when I do not state this option, the results are:
>
> Coefficients:
>                   Value  Std. Error    t value
> (Intercept)  3.72790660 1.344892247  2.7718998
>         age -0.03723398 0.038677748 -0.9626718
>         lwt -0.01565297 0.007075944 -2.2121383
>       race1  0.59620460 0.267872879  2.2256998
>       race2  0.04815882 0.144406014  0.3334960
>       smoke  0.37776250 0.212382233  1.7786916
>         ptd  0.67188041 0.240222259  2.7969115
>          ht  0.95658085 0.360217203  2.6555668
>          ui  0.34009734 0.232107790  1.4652560
>        ftv1 -0.21818928 0.239580527 -0.9107138
>        ftv2  0.13239878 0.148931932  0.8889885
>
> QUestion: Why do we need to state the option in order to get the correct
> result?

Both results are correct!  They mean different things, as the book
*does* explain.

And see page 233, BTW.  You can't jump into the middle of an example
and expect to reproduce the results.


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


<Prev in Thread] Current Thread [Next in Thread>