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

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

Scott
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

scalars:
...Bunch of stuff...

macros:
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"

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

functions:
e(sample)

. predict prob1, p
. foo2
. ereturn list

macros:
e(properties) : "b"

matrices:
e(b) : 1 x 3

. predict prob2, p
option p not allowed
r(198);



-------------------------------------------
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): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc

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




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