# st: RE: logistic regression: changing a coefficient

 From "Schonlau, Matthias" To Subject st: RE: logistic regression: changing a coefficient Date Tue, 15 Feb 2005 09:03:09 -0800

```Good point. My example failed to say that I have about 100 explanatory variables. This line
gen xb2 = _b[_cons] + -.35*mpg + _b[weight]*weight
is cumbersome in my case - but I' ll think about whether I can automate it in a loop.

Thanks for your suggestion!

Matt

Date: Mon, 14 Feb 2005 21:41:12 -0600
From: "Scott Merryman" <smerryman@kc.rr.com>
Subject: st: RE: logistic regression: changing  a coefficient

How about something like this:

. sysuse auto
(1978 Automobile Data)

. qui logit fore mpg weight

. gen xb2 = _b[_cons] + -.35*mpg + _b[weight]*weight

. gen prob2 = exp(xb2)/(1 + exp(xb2))

Scott

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Schonlau, Matthias
> Sent: Monday, February 14, 2005 7:00 PM
> To: statalist@hsphsun2.harvard.edu
> Cc: Schonlau, Matthias
> Subject: st: logistic regression: changing a coefficient
>
> Dear stata listers:
>
> Is it possible to change a coefficient after running logistic regression
> and run a predict statement?
>
> e.g.
>
> logistic y x1 x2 x3
> matrix A=e(b)
> /* change the value of the first  coefficient, e.g. to lower limit of CI
> */
> matrix A[1,1]=0.5
> replace e(b)=A   /* this line does not work */
> predict pred
>
> Thanks ,
>
> matt
>
>
>
>
>
> Matthias Schonlau
> Statistician, RAND
> http://www.rand.org/methodology/stat/members/matt/

Matthias Schonlau
Statistician, RAND
http://www.rand.org/methodology/stat/members/matt/

--------------------

This email message is for the sole use of the intended recipient(s) and
may contain privileged information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
of the original message.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```