s-news
[Top] [All Lists]

Re: gee in S-Plus and R?

To: Fredrik Lundgren <fredrik.lundgren@norrkoping.mail.telia.com>
Subject: Re: gee in S-Plus and R?
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Wed, 12 Dec 2001 07:43:59 +0000 (GMT)
Cc: S-news <s-news@lists.biostat.wustl.edu>
In-reply-to: <002701c182a0$e8cfdf40$2d0ffea9@oemcomputer>
On Wed, 12 Dec 2001, Fredrik Lundgren wrote:

> Hello,
> I recently updated gee in R 1.3.1 (windows 98 SE)
>
> I happended to compare S-plus and R and found rather large differences in 
> coefficients.
> How come?

Didn't you notice the different coefficient names?  These are not the same
model.

The default contrasts are different in R and S-PLUS.  Try setting

        options(contrasts=c("contr.treatment", "contr.poly"))

in both.

BTW, the author and porters of gee might appreciate some credit,
including credit for knowing what they are doing.

>
> Fredrik Lundgren
> Norrköping, Sweden
>
> S-Plus 6 rel3 gives

> > summary(gee(breaks ~ tension, id = wool, data = warpbreaks, corstr = 
> > "exchangeable"), correlation = F)
> [1] "Beginning Cgee S-function, @(#) geeformula.q 5.2 99/06/03"
> [1] "running glm to get initial regression estimate"
> [1]  28.15   7.36  -0.88
>
>  GEE:  GENERALIZED LINEAR MODELS FOR DEPENDENT DATA
>  gee S-function, version 5.2 modified 99/06/03 (1998)
>
> Model:
>  Link:                      Identity
>  Variance to Mean Relation: Gaussian
>  Correlation Structure:     Exchangeable
>
> Call:
> gee(formula = breaks ~ tension, id = wool, data = warpbreaks, corstr = 
> "exchangeable")
>
> Summary of Residuals:
>    Min    1Q Median   3Q  Max
>  -22.4 -8.14  -2.67 6.33 33.6
>
>
> Coefficients:
>             Estimate Naive S.E. Naive z Robust S.E. Robust z
> (Intercept)    28.15       2.08  13.534        2.04   13.780
>    tension1     7.36       1.96   3.765        1.87    3.945
>    tension2    -0.88       1.13  -0.779        1.87   -0.471
>
> Estimated Scale Parameter:  141
> Number of Iterations:  1
>
> ....
>
> R 1.3.1 gives
> > summary(gee(breaks ~ tension, id=wool, data=warpbreaks, 
> > corstr="exchangeable"))
> summary(gee(breaks ~ tension, id=wool, data=warpbreaks, 
> corstr="exchangeable"))
> [1] "Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27"
> [1] "running glm to get initial regression estimate"
> [1]  36.38889 -10.00000 -14.72222
>
>  GEE:  GENERALIZED LINEAR MODELS FOR DEPENDENT DATA
>  gee S-function, version 4.13 modified 98/01/27 (1998)
>
> Model:
>  Link:                      Identity
>  Variance to Mean Relation: Gaussian
>  Correlation Structure:     Exchangeable
>
> Call:
> gee(formula = breaks ~ tension, id = wool, data = warpbreaks,
>     corstr = "exchangeable")
>
> Summary of Residuals:
>        Min         1Q     Median         3Q        Max
> -22.388889  -8.138889  -2.666667   6.333333  33.611111
>
>
> Coefficients:
>              Estimate Naive S.E.   Naive z Robust S.E.  Robust z
> (Intercept)  36.38889   3.069434 11.855246    5.774705  6.301428
> tensionM    -10.00000   3.910008 -2.557539    7.463905 -1.339781
> tensionH    -14.72222   3.910008 -3.765266    3.731952 -3.944912
>
> Estimated Scale Parameter:  141.1481
> Number of Iterations:  1
>
>
> ---------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
>

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