Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: AW: Creating a variable taking the value of elasticity


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: AW: Creating a variable taking the value of elasticity
Date   Tue, 8 Sep 2009 15:51:53 +0100

If Dorothy wants to store these elasticities with their t-statistics, confidence intervals and P-values, then Dorothy might like to use the -parmest- package. The Stata 11 version can be downloaded from SSC using the -ssc- command in Stata. Earlier versions (in Stata 10, 9, 8, 7, 6 or 5) can be downloaded from my website by typing

net from http://www.imperial.ac.uk/nhli/r.newson/

and selecting the version preferred. The -parmest- package creates output datasets (or resultssets) with 1 observation per estimated parameter, and variables containing parameter estimates, confidence intervals, test statistics, P-values and (optionally) other parameter attributes specified by the user. If Dorothy generates a large number of these output datasets for multiple regressions, then, then they can be concatenated using the -append- command in Stata 11, or the -dsconcat- package (downloadable from SSC or from my website) in earlier versions of Stata. The coefficients and/or confidence limits and/or t-statistics and/or P-values can then be plotted any way the user chooses.

I hope this helps.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: 08 September 2009 15:16
To: statalist@hsphsun2.harvard.edu
Subject: AW: st: AW: Creating a variable taking the value of elasticity


<> 

" Why is storage in a variable not
recommended?  "


Generally, a constant value of whatever nature will take up an entire column
in Stata, although each row carries the same -redundant- information. So you
would be better off storing this thing in a -local- or using the solutions
proposed in my earlier post. On -postfile- which is often neglected, you may
want to consult 

http://www.stata-journal.com/article.html?article=pr0036


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dorothy Bridges
Gesendet: Dienstag, 8. September 2009 16:06
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: AW: Creating a variable taking the value of elasticity

Perfect, thank you!  That worked.  Why is storage in a variable not
recommended?  I am doing this so that I can make a histogram comparing
the elasticities (coefficients) from a dozen different regressions.

On Tue, Sep 8, 2009 at 9:58 AM, Martin Weiss<martin.weiss1@gmx.de> wrote:
>
> <>
>
> Here is an example, although storage in a variable is not exactly
> recommended. Note the last line which shows you how to get the correct
name
> for the coefficient...
>
>
> *************
> sysuse auto, clear
>
> gen logmpg=ln(mpg)
> gen loglength=log(len)
> gen logturn=log(turn)
>
> reg logmpg loglength logturn
> *store in variable
> gen mycoeff=_b[loglength]
>
> l mycoeff in 1/10, noo
>
> reg, coeflegend
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dorothy
Bridges
> Gesendet: Dienstag, 8. September 2009 15:55
> An: statalist@hsphsun2.harvard.edu
> Betreff: st: Creating a variable taking the value of elasticity
>
> Dear Statalist,
>
> I have a simple dataset containing two variables, x and y.  I regress
> ln(y) on ln(x) and observe the coefficient on x as elasticity.  I then
> want to create a variable taking the value of this coefficient.  How
> would I do this?  Something like local elas=e(b); gen elas=`elas',
> except e(b) contains all the coefficients, and I just want one.
>
> A related question: when I regress y on x and then input "mfx, eyex,"
> the ey/ex value is not the same as the coefficient I obtain using
> regress ln(y) ln(x).  Why?  Also: how would I extract the ey/ex value
> from the mfx output in order to create a variable taking that value?
>
> Thank you,
> Dorothy
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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