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

st: saving and later retrieving results from an estimated model


From   <Colin.Vance@dlr.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: saving and later retrieving results from an estimated model
Date   Wed, 23 Nov 2005 11:11:40 +0100

Hello, 
I'd like to use the delta method (nlcom) to compute the standard error
for a non-linear function of regression coefficients, where the
regression coefficients are drawn from two different models. My
non-linear function also includes the predicted values from one of the
models. My problem is that after having estimated the second model, I
can't figure out how to access the results from the first model. That
is, I can save the coefficients estimated from the first model as a
fixed value, but I want nlcom to know that it is an estimated parameter.

Here's hypothetical code that demonstrates what I'm trying to do:
regress y1 x1 x2 x3
keep if e(sample)  
sum x1 
local x1=r(mean)
sum x2 
local x2=r(mean) 
sum x3 
local x3=r(mean)
local predxb "_b[x1]*`x1'+_b[x2]*`x2'+_b[x3]*`x3'+ _b[_cons]"

regress y2 x3 x4

local temp _b[x3]/_b[x1] + `predxb'/_b[x4]
/*The above line is where the problem occurs, since _b[x1] and `predxb'
are discarded with the estimation of the second model.*/
nlcom `temp'



As a hunch, I think I may need to write a program of the eclass variant
that estimates the first model, which I would then access when using
nlcom, but I'm not sure how to do this.

Any advice would be appreciated.

Many thanks,
Colin

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index