Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Refer to parameter vector using variable-name abbreviation


From   Falko Juessen <[email protected]>
To   [email protected]
Subject   st: Refer to parameter vector using variable-name abbreviation
Date   Fri, 2 Nov 2007 10:56:27 +0100 (CET)

Dear all,
I want to refer to elements of the estimated parameter vector after the
�regress- command, using variable-name abbreviation.

This is an example:

clear
use http://www.stata-press.com/data/r8/auto
generate weight2 = weight^2
generate weight3 = weight^3
reg mpg price weight*

[output omitted]

I want to get the coefficients for all parameters on "weight", but not the
coefficients for "price" and the constant. This works fine:

mat save = e(b)
mat mybetas = save[1,"weight".."weight3"]
mat list mybetas

ybetas[1,3]
        weight     weight2     weight3
y1  -.03065277   6.441e-06  -4.884e-10


I wonder whether the same result can be obtained using variable-name
abbreviation, which for some reasons would be much more convenient in my
analysis (because my actual variables have been coded using the �xi-
command). That is, I want something like

mat mybetas = save[1,"weight*"]
mat list mybetas

*weight* not found
*r(111);

which unfortunately does not seem to work. Is there a solution to this?

Cheers,

Falko.



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