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 "Martin Weiss" To Subject RE: st: AW: confidence interval of a ratio of coefficients Date Thu, 8 Apr 2010 21:52:37 +0200

```<>

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/
```