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

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

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: AW: confidence interval of a ratio of coefficients Date Fri, 9 Apr 2010 10:36:41 -0400

```Actually, I got the order of the variables in -wtp- confused.  The
denominator variable is the first one in the variable list:

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

nlcom - _b[weight]/_b[price]  //ratio

logit foreign price weight rep78
wtp   price weight, delta
wtp   price weight, fieller
wtp   price weight, krinsky reps(20000)

bootstrap ratio = (-_b[weight]/_b[price]), rep(500): logit foreign
price weight rep78
estat bootstrap, bc
***********************************************************
>>
>>
>> On Fri, Apr 9, 2010 at 8:56 AM, Arne Risa Hole <arnehole@gmail.com> wrote:
>>>
>>> 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 <sjsamuels@gmail.com> 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
>>>>
>>>> Steve
>>>>
>>>> On Thu, Apr 8, 2010 at 5:29 PM, Steve Samuels <sjsamuels@gmail.com> wrote:
>>>>> Martin,
>>>>>
>>>>> I have to withdraw that code. It gives incorrect results if the ratio
>>>>> 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 <martin.weiss1@gmx.de> wrote:
>>>>>>
>>>>>> <>
>>>>>>
>>>>>> Steve,
>>>>>>
>>>>>> are you following your own script with this code, or is it necessary for
>>>>>>
>>>>>> HTH
>>>>>> Martin
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: owner-statalist@hsphsun2.harvard.edu
>>>>>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Steve Samuels
>>>>>> Sent: Donnerstag, 8. April 2010 21:40
>>>>>> To: statalist@hsphsun2.harvard.edu
>>>>>> 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 <sjsamuels@gmail.com> 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 <martin.weiss1@gmx.de>
>>>>>> wrote:
>>>>>>>>
>>>>>>>> <>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> *************
>>>>>>>> sysuse auto, clear
>>>>>>>> logit foreign rep78 price weight
>>>>>>>> nlcom (ratio: _b[price]/_b[weight])
>>>>>>>> *************
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> HTH
>>>>>>>> Martin
>>>>>>>>
>>>>>>>>
>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>> Von: owner-statalist@hsphsun2.harvard.edu
>>>>>> [mailto:owner-statalist@hsphsun2.harvard.edu] 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.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> *
>>>>>>>> *   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
>>>>>>> sjsamuels@gmail.com
>>>>>>> 18 Cantine's Island
>>>>>>> Saugerties NY 12477
>>>>>>> USA
>>>>>>> Voice: 845-246-0774
>>>>>>> Fax:    206-202-4783
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Steven Samuels
>>>>>> sjsamuels@gmail.com
>>>>>> 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
>>>>> sjsamuels@gmail.com
>>>>> 18 Cantine's Island
>>>>> Saugerties NY 12477
>>>>> USA
>>>>> Voice: 845-246-0774
>>>>> Fax:    206-202-4783
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Steven Samuels
>>>> sjsamuels@gmail.com
>>>> 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
>> sjsamuels@gmail.com
>> 18 Cantine's Island
>> Saugerties NY 12477
>> USA
>> Voice: 845-246-0774
>> Fax:    206-202-4783
>>
>
>
>
> --
> Steven Samuels
> sjsamuels@gmail.com
> 18 Cantine's Island
> Saugerties NY 12477
> USA
> Voice: 845-246-0774
> Fax:    206-202-4783
>

--
Steven Samuels
sjsamuels@gmail.com
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/
```