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:10:43 +0200

<> 

If you are keen on -egen-, say 

*************
egen ll=pctile(ratio), p(2.5)
egen ul=pctile(ratio), p(97.5)
*************

which saves you one line :-) Those are constant, so you could simply
-display- them instead of -summ- them...


HTH
Martin


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


<> 



What is your -egen- line good for?



HTH
Martin


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

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

Rodolphe



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Steve Samuels
Sent: vendredi 9 avril 2010 15:30
To: [email protected]
Subject: Re: st: AW: confidence interval of a ratio of coefficients

The bootstrap command should have been:
bootstrap ratio = (-_b[price]/_b[weight]), rep(500): logit foreign
price weight rep78

Steve
On Fri, Apr 9, 2010 at 10:07 AM, Steve Samuels <[email protected]> wrote:
> Thanks, Arne!
>
> Steve
> :
> ************************************
> sysuse auto, clear
> set seed 2940688
> logit foreign price weight rep78
>
> nlcom  - _b[price]/_b[weight]  //ratio
>
> logit foreign price weight rep78
> wtp   price weight, delta
> wtp   price weight, fieller
> wtp   price weight, krinsky reps(2000)
>
> bootstrap ratio = (-_b[price]/_b[weight]), rep(500): logit foreign price
weight rep78
> estat bootstrap, bc
> *****************************
>
>
>
> On Fri, Apr 9, 2010 at 8:56 AM, Arne Risa Hole <[email protected]> wrote:
>> Steve, Martin and Shehzad,
>>
>> I've written the -wtp- module (available from SSC) with this
>> particular problem in mind. It calculates CIs for the ratio of two
>> coefficients using either the delta method, Fieller's method or the
>> parametric bootstrap. I've done some simulations to investigate which
>> method is more accurate, they are reported in the paper referenced in
>> the -wtp- help file.
>>
>> Arne
>>
>> On 9 April 2010 13:14, Steve Samuels <[email protected]> wrote:
>>> The following paper
>>> (http://mrvar.fdv.uni-lj.si/pub/mz/mz1.1/cedilnik.pdf)  shows that the
>>> distribution of the ratio of two jointly-Normal variables is far from
>>> simple.  This suggests to me that a bootstrap may be the best approach
>>> to the CI that Shehzad originally asked for.
>>>
>>> Steve
>>>
>>> On Thu, Apr 8, 2010 at 5:29 PM, Steve Samuels <[email protected]>
wrote:
>>>> Martin,
>>>>
>>>> I have to withdraw that code. It gives incorrect results if the ratio
>>>> is negative. So, your original -nlcom- statement is  Shehzad's best
>>>> approach.   Note, however that the confidence intervals for the ratio
>>>> and  for 1/ratio are not compatible (perhaps "consonant" is the better
>>>> word).  One set of limits cannot be derived by inverting the endpoints
>>>> of the other set.
>>>>
>>>> Steve
>>>>
>>>>
>>>> ********************
>>>> sysuse auto, clear
>>>> logit foreign rep78 price weight
>>>>
>>>> nlcom _b[price]/_b[weight]  //ratio
>>>> nlcom _b[weight]/_b[price] // 1/ratio
>>>> ***********************
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Apr 8, 2010 at 3:52 PM, Martin Weiss <[email protected]>
wrote:
>>>>>
>>>>> <>
>>>>>
>>>>> Steve,
>>>>>
>>>>> are you following your own script with this code, or is it necessary
for
>>>>> Shehzad to obtain a correct answer?
>>>>>
>>>>> HTH
>>>>> Martin
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [email protected]
>>>>> [mailto:[email protected]] On Behalf Of Steve
Samuels
>>>>> Sent: Donnerstag, 8. April 2010 21:40
>>>>> To: [email protected]
>>>>> Subject: Re: st: AW: confidence interval of a ratio of coefficients
>>>>>
>>>>> Here are some details.  It's necessary to operate on the log of the
>>>>> absolute value of the ratio and attach the sign afterwards:
>>>>>
>>>>> *************
>>>>> sysuse auto, clear
>>>>> logit foreign rep78 price weight
>>>>> local sgn = sign(_b[price]/_b[weight])
>>>>>
>>>>> nlcom _b[price]/_b[weight]  //ratio
>>>>> nlcom log(abs( _b[price]/_b[weight]))  //log ratio
>>>>> return list
>>>>> local lratio = el(r(b),1,1)
>>>>> local ratio = `sgn'*exp(`lratio')
>>>>> local bound = invnormal(1-.05/2)*sqrt(el(r(V),1,1))
>>>>> local llim = exp(`lratio' -`bound')
>>>>> local ulim = exp(`lratio' + `bound')
>>>>> di "ratio =  " `ratio'   " llimit = " `llim'  "  ulimit = " `ulim'
>>>>>  *************
>>>>>
>>>>>
>>>>> On Wed, Apr 7, 2010 at 1:21 PM, Steve Samuels <[email protected]>
wrote:
>>>>>> Martin is right, but I think that this calculation is better done on
>>>>>> the log  of the  ratio and then converted back to the ratio scale.
In
>>>>>> that way, the CIs for  x/y and y/x  will be compatible.
>>>>>>
>>>>>> Steve
>>>>>>
>>>>>> On Wed, Apr 7, 2010 at 11:53 AM, Martin Weiss <[email protected]>
>>>>> wrote:
>>>>>>>
>>>>>>> <>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *************
>>>>>>> sysuse auto, clear
>>>>>>> logit foreign rep78 price weight
>>>>>>> nlcom (ratio: _b[price]/_b[weight])
>>>>>>> *************
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> HTH
>>>>>>> Martin
>>>>>>>
>>>>>>>
>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>> Von: [email protected]
>>>>> [mailto:[email protected]] Im Auftrag von Shehzad
Ali
>>>>>>> Gesendet: Mittwoch, 7. April 2010 17:50
>>>>>>> An: Stata List
>>>>>>> Betreff: st: confidence interval of a ratio of coefficients
>>>>>>>
>>>>>>> Dear listers,
>>>>>>>
>>>>>>> I am modelling choice behaviour using a logit model. I want to
calculate
>>>>> the marginal rates of subsititution of the attributes of choice
alternatives
>>>>> by taking the ratio of coefficients (similar to what people do when
>>>>> calculating willingness to pay estimates by taking attribute/cost
>>>>> coefficients). I need help with calculating the confidence interval
around
>>>>> the ratio of two coefficients.
>>>>>>>
>>>>>>> Any help would be appreciated.
>>>>>>> Shehzad
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *
>>>>>>> *   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/
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Steven Samuels
>>>>>> [email protected]
>>>>>> 18 Cantine's Island
>>>>>> Saugerties NY 12477
>>>>>> USA
>>>>>> Voice: 845-246-0774
>>>>>> Fax:    206-202-4783
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Steven Samuels
>>>>> [email protected]
>>>>> 18 Cantine's Island
>>>>> Saugerties NY 12477
>>>>> USA
>>>>> Voice: 845-246-0774
>>>>> Fax:    206-202-4783
>>>>>
>>>>> *
>>>>> *   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/
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Steven Samuels
>>>> [email protected]
>>>> 18 Cantine's Island
>>>> Saugerties NY 12477
>>>> USA
>>>> Voice: 845-246-0774
>>>> Fax:    206-202-4783
>>>>
>>>
>>>
>>>
>>> --
>>> Steven Samuels
>>> [email protected]
>>> 18 Cantine's Island
>>> Saugerties NY 12477
>>> USA
>>> Voice: 845-246-0774
>>> Fax:    206-202-4783
>>>
>>> *
>>> *   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/
>>
>
>
>
> --
> Steven Samuels
> [email protected]
> 18 Cantine's Island
> Saugerties NY 12477
> USA
> Voice: 845-246-0774
> Fax:    206-202-4783
>



--
Steven Samuels
[email protected]
18 Cantine's Island
Saugerties NY 12477
USA
Voice: 845-246-0774
Fax:    206-202-4783

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