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]

RE: Re: st: RE: AW: ratio function


From   "Roman Kasal" <[email protected]>
To   <[email protected]>
Subject   RE: Re: st: RE: AW: ratio function
Date   Tue, 6 Apr 2010 12:51:30 +0200

thank you!

this is exactly what I want! Still need to learn Stata syntax! Now just need to handle the same way with quantiles....I wish the complex survey bootstrap weights (even without replacement) was finished.....

rk

ps: I didn't say that the function you meant was in R.....I said that just R was better equipped (quantiles)...it is just a wish to finish quantiles in Stata

 
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Steve Samuels
Sent: Friday, April 02, 2010 2:58 PM
To: [email protected]
Subject: Re: Re: st: RE: AW: ratio function

Roman
Perhaps we misunderstand what you are asking for. I  We have been
assuming that you  want the ratio of the means of two variables
("columns"?) measured possibly on the same person.  Perhaps you want
the ratio of the means of one variable for two subpopulations.   Both
analyses will ignore missing values.

If this is not what you desire, then please demonstrate by hand what
you do want on a small, non-survey data set.. Also I'd like to know
which R function does what are asking for

 The following do file computes the ratio of means with CI and then
does the same for the log ratio and transforms to the original scale.

-Steve


**************************CODE BEGINS**************************
capture program drop _all
program antilog
local lparm  el(r(b),1,1)
local se    sqrt(el(r(V),1,1))
local bound  invttail(e(df_r),.025)*`se'
local parm  exp(`lparm')
local ll  exp(`lparm'  - `bound')
local ul  exp( `lparm' + `bound')
di  "parm =" `parm'  "    ll = " `ll'  "   ul = " `ul'
end

sysuse auto, clear
svyset _n
svy: mean mpg, over(foreign)
nlcom (myratio1: _b[Domestic]/_b[Foreign])   //ratio
nlcom (myratio2: log(_b[Domestic]/_b[Foreign]))   // log ratio
// Confidence interval of last -nlcom- on antilog scale
antilog
***************************CODE ENDS***************************



.

On Fri, Apr 2, 2010 at 2:37 AM, Roman Kasal <[email protected]> wrote:
> I don't agree...so how to do it when you want to find out ratio between
> years, male X female, ...? So there is no solution? Just to keep N,mean,
> SE, degrees of freedom, N_strata, N_psu, .... and calculate it manually?
> I think it is not appropriate solution, at least to have it as an
> option. I think there is missing a lot with complex survey in Stata and
> complex survey is needed for almost every survey research, even freeware
> R-project is better equipped :(
>
> so have a hope Stata will get it soon....immediately we are buying it
> again :)
>
>>
>>
> And it should.   Data (x,y) (1,2) (2,4) (3,6) (100,.)    will give an
> entirely different view of the data if the unpaired observation is
> included in a mean or ratio calculation.  Or consider data with x
> missing in half the pairs and y missing in the other half; the ratio
> of means would be meaningless.
>
> The formulas for standard errors for ratios  assume that the data are
> paired. Formally, they are based on the residual MSE of a regression
> of y on x through the origin. You cannot do that regression with
> unpaired data.
>
> If your concern is missing data, the solution is to impute the missing
> values before analysis.
>
> Steve
>
>
> *
> *   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

*
*   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