s-news
[Top] [All Lists]

[S] Summary: Ajusting coefficients of a glm.

To: s-news@wubios.wustl.edu
Subject: [S] Summary: Ajusting coefficients of a glm.
From: "Gérald Jean" <Gerald.Jean@spgdag.ca>
Date: Tue, 29 Feb 2000 11:42:15 -0500
Sender: owner-s-news@wubios.wustl.edu
Thanks to Brian Ripley for his response.  He suggests using offset instead of
fiddling with the coefficients of the model; I'll look into his suggestion.  In
the mean time I found out what was going on.  By using the assignment:

ttt$coef[1]_ aut4.freq.glm.final$coef[1] + log(0.96)

Splus was creating a new component of the object ttt called "coef".  ttt$coef
was accessing this new component while coef(ttt) was accessing the old
component, called "coefficients"; the new one reflected the change while the old
one didn't of course.


> ttt_aut4.freq.glm.final
> names(ttt)
 [1] "coefficients"      "residuals"         "fitted.values"
 [4] "effects"           "R"                 "rank"
 [7] "assign"            "df.residual"       "weights"
[10] "prior.weights"     "family"            "linear.predictors"
[13] "deviance"          "null.deviance"     "call"
[16] "iter"              "y"                 "contrasts"
[19] "terms"             "formula"           "control"

> ttt$coef[1]_ aut4.freq.glm.final$coef[1] + log(0.96)
> names(ttt)
 [1] "coefficients"      "residuals"         "fitted.values"
 [4] "effects"           "R"                 "rank"
 [7] "assign"            "df.residual"       "weights"
[10] "prior.weights"     "family"            "linear.predictors"
[13] "deviance"          "null.deviance"     "call"
[16] "iter"              "y"                 "contrasts"
[19] "terms"             "formula"           "control"
[22] "coef"

Thanks to prof. Ripley for his suggestion, original post follows.

Gérald Jean
Analyste-conseil (statistiques), Actuariat
télephone            : (418) 835-8839
télecopieur          : (418) 835-5865
courrier électronique: gerald.jean@spgdag.ca

"In God we trust all others must bring data"

>
> Dear S-users,
>
> for non-statistical reasons I would like to adjust, before using predict, some
> coefficients of a glm.  For the sake of argument suppose I only want to adjust
> the constant as follows.

> > ttt_aut4.freq.glm.final
> > ttt$coef[1]_ aut4.freq.glm.final$coef[1] + log(0.96)
> > ttt$coef[1]
>  (Intercept)
>    -5.385395
> > coef(ttt)[1]
>  (Intercept)
>    -5.344573
>
> What is going on?  The correct answer is -5.385395, see the original
> constant below.


> > aut4.freq.glm.final$coef[1]
>  (Intercept)
>    -5.344573
> > coef(aut4.freq.glm.final)[1]
>  (Intercept)
>    -5.344573
>
> When I call predict passing ttt as the model and using the newdata argument
> which version of the constant will be used?
>
> Thanks for your help,


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Summary: Ajusting coefficients of a glm., "Gérald Jean" <=