# Re: st: nlcom question

 From "Eva Poen" To statalist@hsphsun2.harvard.edu Subject Re: st: nlcom question Date Fri, 11 Jul 2008 14:14:16 +0100

```Hm, I might be missing something, but why do you do it in two steps?
I.e. first alpha and then beta and gamma?

Here is your example, using the auto data. Is this what you want?
Hope this helps,
Eva

*****
sysuse auto
regress price rep78 mpg foreign

estimates store automodel

local alp "_b[rep78]/(1+_b[rep78])"

nlcom (alpha: `alp') (beta: _b[foreign]*(1-`alp')) (gamma:
_b[mpg]*(1-`alp')), post

scalar balpha=_b[alpha]
scalar sealpha=_se[alpha]
scalar bbeta=_b[beta]
scalar sebeta=_se[beta]
scalar bgamma=_b[gamma]
scalar segamma=_se[gamma]

estimates restore automodel

outreg using myfile.out, coefastr se 10pct replace /*
*/ "alpha", balpha, "se of alpha", sealpha, "beta", bbeta, "se of
beta", sebeta, /*
*/ "gamma", bgamma, "se of gamma", segamma) adec(2)

******

2008/7/11 Prof. Dr. Aysit Tansel <atansel@metu.edu.tr>:
> Dear Statalist,
> I am running the following regression after which I am trying to compute the
> nonlinear combinations of the coefficients as defined in "alpha", "beta" and
> "gamma".
> in the "nlcom" command as given below. As you would notice, the"alpha"
> computed in the first "nlcom" appears in the computations of "beta  and
> "gamma" in the subsequent "nlcom" commands. while this set of commands gives
> me the correct values for  "alpha" and the "standard error of alpha", there
> is a problem with the subsequent computations. namely, the computed values
> of "beta" and "gamma" are correct, but their standard errors are incorrect
> since these computations treat
> "alpha" as a scalar in these computations.
> My first question is how to overcome this and the second question is how to
> output the values of "alpha" "beta" and "gamma" and their standard errors
>  and/ or their t-ratios in the outreg file after the usual regression
> statistics....
> Will be grateful for your help....
>
> regress Y X1 X2 X3
> _estimates hold model7500, copy
> nlcom alpha:_b[X1]/(1+_b[X1], post
> scalar balpha=_b[alpha]
> scalar sealpha=_se[alpha]
> *scalar palpha=_p[alpha]
> _estimates unhold model7500
> nlcom (beta: _b[X3]*(1-balpha)) (gamma: _b[X2]*(1-balpha)), post
> scalar bbeta=_b[beta]
> scalar sebeta=_se[beta]
> scalar bgamma=_b[gamma]
> scalar segamma=_se[gamma]
> regress Y X1 X2 X3
> outreg using myfile.out, coefastr se 10pct replace /*
> */ "alpha", balpha, "se of alpha", sealpha, "beta", bbeta, "se of beta",
> sebeta, /*
> */ "gamma", bgamma, "se of gamma", segamma) adec(2)
>
>
>
*
*   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/
```