# st: Changing beta coefficients - w/ logistic regression

 From Kirsten P Smith <[email protected]> To [email protected] Subject st: Changing beta coefficients - w/ logistic regression Date Thu, 21 Jul 2005 17:55:45 -0400 (EDT)

```Back in April, someone posted a question about how to change beta
coefficients.

The answer given (more specifically, the sample code) works perfectly
for linear regression output. But I can't seem to get it to work when
the estimated model is a logistic regression.

Any ideas how to make the code work for LOGISTIC regression?

I've exactly replicted the code that works for regress, changing only
the dependent variable (from price to foreign) and the estimation
command, to logit.

Output from stata is the following:

. program foo, eclass
1.         tempname bmat
2.         matrix `bmat' = e(b)
3.         matrix `bmat'[1,1] = 122
4.         ereturn repost b = `bmat'
5. end

.
.
. clear

.
. sysuse auto
(1978 Automobile Data)

. quietly logit foreign mpg weight

. matrix list e(b)

e(b)[1,3]
mpg     weight      _cons
y1  -.1685869  -.0039067  13.708367

.
. foo

*****

For comparison, the following is the (successful) output for regress:

. program foo, eclass
1.         tempname bmat
2.         matrix `bmat' = e(b)
3.         matrix `bmat'[1,1] = 122
4.         ereturn repost b = `bmat'
5. end

.
.
. clear

.
. sysuse auto
(1978 Automobile Data)

. quietly regress price mpg weight

. matrix list e(b)

e(b)[1,3]
mpg      weight       _cons
y1  -49.512221   1.7465592   1946.0687

.
. foo

.
. matrix list e(b)

e(b)[1,3]
mpg     weight      _cons
y1        122  1.7465592  1946.0687