[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: saving and later retrieving results from an estimated model
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)
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.*/
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.
* For searches and help try: