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

st: Re: altering e(b)

From   baum <>
Subject   st: Re: altering e(b)
Date   Thu, 05 Dec 2002 08:21:50 -0500

--On Thursday, December 5, 2002 2:33 -0500 statalist-digest <> wrote:

So, from a pure technical point of view, is it possible to change
values of e(b)?

I believe not. You can read from it but not
write to it directly.
That is certainly untrue; estimates post does that for a living. That is, write a program that is a wrapper for your estimation command, grab the e(b) and e(V) into matrices within the routine, and use estimates post to make them the active e(b) and e(V).

program define tweak
syntax ,coef(int) val(real)
mat b = e(b)
mat V = e(V)
mat b[1,`coef'] = `val'
estimates post b V

This program will change the specified element of the coefficient vector to the specified value. After it is run, e(b) will contain the altered coefficient vector. A well-written variant would check the appropriateness of coef before attempting to modify the b matrix.


* For searches and help try:

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