Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Changing beta coefficients - w/ logistic regression

From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: RE: Changing beta coefficients - w/ logistic regression
Date   Thu, 21 Jul 2005 19:18:57 -0500

At 05:33 PM 7/21/2005 -0500, Scott Merryman wrote:
Change the program to:

program foo2, eclass
         tempname bmat
         matrix `bmat' = e(b)
         matrix b = e(b)
         ereturn post b
         matrix `bmat'[1,1] = 122
         ereturn repost b = `bmat'

This seems to work for both -regress- and -logit-

I'm surprised the original program doesn't work. Something to be aware of with Scott's solution: most of the ereturned stuff gets zapped once you run foo2. In particular, since e(predict) gets zapped, the p option on predict doesn't work. You can probably add lines to Scott's program to revive the ereturned stuff that gets lost but maybe there is a better way. The following shows what I am talking about:

. sysuse auto
(1978 Automobile Data)
. qui logit foreign mpg weight
. ereturn list

...Bunch of stuff...

e(title) : "Logistic regression"
e(depvar) : "foreign"
e(cmd) : "logit"
e(crittype) : "log likelihood"
e(predict) : "logit_p"
e(properties) : "b V"
e(estat_cmd) : "logit_estat"
e(chi2type) : "LR"

e(b) : 1 x 3
e(V) : 3 x 3


. predict prob1, p
. foo2
. ereturn list

e(properties) : "b"

e(b) : 1 x 3

. predict prob2, p
option p not allowed

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal):
WWW (department):

* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index