Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

AW: st: AW: confidence interval of a ratio of coefficients


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: confidence interval of a ratio of coefficients
Date   Fri, 9 Apr 2010 17:30:54 +0200

<> 


While we are being pedantic, -qui- is implied by -su, meanonly-...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Rodolphe
Desbordes
Gesendet: Freitag, 9. April 2010 17:26
An: '[email protected]'
Betreff: RE: st: AW: confidence interval of a ratio of coefficients

Martin and Nick,

Very true:

***
sysuse auto, clear
set seed 2940688
logit foreign price weight rep78

preserve

drawnorm b1-b4, n(20000) means(e(b)) cov(e(V)) clear


gen ratio=-(b2)/(b1)

qui sum ratio,meanonly

dis "ratio: " r(mean)

qui _pctile ratio, p(2.5,97.5)

dis "ll: " r(r1)
dis "ul: " r(r2)



restore

***

Rodolphe

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: vendredi 9 avril 2010 16:17
To: [email protected]
Subject: RE: st: AW: confidence interval of a ratio of coefficients

Even for another purpose, using -egen- to create a variable containing a
single mean is hideously inefficient. Use -su, meanonly- and pick up
r(mean) afterwards.

Nick
[email protected]

Rodolphe Desbordes

Some leftover from another code. It is useless in that code.

Martin Weiss

What is your -egen- line good for?

Rodolphe Desbordes

Would this approach make sense?

sysuse auto, clear
set seed 2940688
logit foreign price weight rep78

preserve

drawnorm b1-b4, n(20000) means(e(b)) cov(e(V)) clear

gen ratio=-(b2)/(b1)

egen mean=mean(ratio)

_pctile ratio, p(2.5,97.5)
    gen ll=r(r1)
    gen ul= r(r2)

sum ratio ll ul

restore

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index