# RE: st: RE: how to generate a variable using the estimation results

 From "Nick Cox" <[email protected]> To <[email protected]> Subject RE: st: RE: how to generate a variable using the estimation results Date Fri, 3 Nov 2006 16:43:31 -0000

```This is standard stuff covered in the help and
the manuals or learnable by simple experiments.

But in short

_b[]

is Stata standard notation for a parameter (coefficient) in
a model. Usually a varname belongs in the [], with
the important exception _cons. But with non-linear
models there is typically not a one-to-one correspondence
between parameters and variables -- else they would be
linear -- and so the notation /parametername is the
alternative adopted. Or so I surmise.

Try

. sysuse auto
. gen gpm = 1/mpg
. nl (gpm = {a}*weight)

or any other example. (I know it's linear).

Nick
[email protected]

Kyle Hood

> what does the notation _b[/rho] do?  Why _b[]?  why /?

Oleksandr Shepotylo wrote:
>
> > Thank you,
> >
> > I need this rho to transform my exogenous variables X(NxK)
> by mulitplying
> > them by the following matrix:
> >
> > X*=rho*W*X, where W is (NxN)
> >
> > so I planned to calcualte rho*X and use mata to calculate W*(rho*X).
> >
> > But you are right, I can save a scalar rho and use it in
> mata expressions
> > when I need it.

Nick Cox wrote:

> >> This sounds like a bad idea. The parameter can be saved as
> a scalar or a
> >> local macro, but using a variable for
> >> the same number again and again is usually unnecessary.
> >> Still, there might be a good idea, or you might insist, so
> if so try
> >> gen rho = _b[/rho]
> >> but consider also
> >>
> >> scalar rho = _b[/rho]

Oleksandr Shepotylo

> >>> After non linear estimaition which estimates parameters
> rho and sigma of
> >>> the following form
> >>>
> >>> nl (z=h1*{rho}+h2*{rho}^2+h3*{sigma2}), in(rho -0.5
> sigma2 1) iterate(200)
> >>>
> >>> I want to generate a variable rho that takes the value of
> the estimated
> >>> parameter {rho}
> >>>
> >>> gen rho=???

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