会飞的蝎子
Confidence Interval for Difference in Two Proportions
蝎子 发表于 2011-09-15 02:16:52
In many clinical trials, the outcome is binomial and a 2 x 2 table can be
constructed. The analysis can be based on the difference in two
proportions (treatment group vs. control group). SAS Proc Freq
can be used to obtain the difference between the proportions and the
asymptotic confidence interval can be calculated for the difference
between two proportions. The formula is (p1-p2) +/- Z(alpha/2)*sqrt((p1*q1/n1)+p2*q2/n2)).
However,
the asymptotic confidence interval produced by PROC FREQ requires a
somewhat large sample size (say cell counts of at least 12) - this is
the case at least for SAS version up to 9.2. For moderately small sample
size, it is better to use the formula provided in Fleiss (1981, page
29) Stokes (2000, page 29-30) where the confidence interval is adjusted
by 0.5*(1/n1 + 1/n2) - therefore a little wider. The confidence
interval directly from SAS Proc FREQ is a little narrower than those
using the formula. In practice, the statistician needs to make the
choice which one to use in calculating the confidence interval for
difference in proportions depending on the sample size situation.
Fleiss, JL (1981) Statistical Methods for Rates and Proportions. New York: John Wiley & Sons, Inc.
Stokes, Davis, and Kock (2000) Categorical Data Analysis using the SAS System, 2nd edition
The example from Stocks book can be implemented in SAS using the following SAS codes:
data respire2;
input treat $ outcome $ count @@;
datalines;
test f 40
test u 20
placebo f 16
placebo u 48
;
*** the confidence interval directly from SAS PROC FREQ;
proc freq order=data;
weight count;
tables treat*outcome / riskdiff;
run;
*** the confidence interval calculated from the formula (See section 2.4 Difference in Proportions
in Stokes et al 'Categorical Data Analysis Using the SAS System' 2nd edition;
proc freq data=respire2 order=data;
weight count;
tables treat/noprint out=tots (drop=percent rename=(count=bign));
run;
proc freq data=respire2;
weight count;
tables treat*outcome/noprint out=outcome (drop=percent);
run;
proc sort data=tots;
by treat;
run;
proc sort data=outcome;
by treat;
run;
data prop;
merge outcome tots;
by treat;
if treat='test' then p1=count/bign;
if treat='placebo' then p2=count/bign;
run;
data prop1(rename=(count=count1 bign=bign1)) prop2(rename=(count=count2 bign=bign2));
set prop;
if treat='test' then output prop1 ;
if treat='placebo' then output prop2;
run;
data proportion;
merge prop1(drop= p2 treat) prop2(drop = p1 treat);
run;
***Calculate the difference in proportions, SE, and 95% confidence interval using formula by Fleiss;
data cal;
set proportion;
variance=(p1*(1-p1)/(bign1)) + (p2*(1-p2)/(bign2));
diff=(p1-p2);
lower=(diff - ((1.96*(sqrt(variance)) + .5*(1/bign1 + 1/bign2))));
upper=(diff + ((1.96*(sqrt(variance)) + .5*(1/bign1 + 1/bign2))));
se=(sqrt(variance));
run;
proc print;
format p1 p2 variance diff lower upper se 5.3;
run;
Source:: http://onbiostatistics.blogspot.com/2011/09/confidence-interval-for-difference-in.html
constructed. The analysis can be based on the difference in two
proportions (treatment group vs. control group). SAS Proc Freq
can be used to obtain the difference between the proportions and the
asymptotic confidence interval can be calculated for the difference
between two proportions. The formula is (p1-p2) +/- Z(alpha/2)*sqrt((p1*q1/n1)+p2*q2/n2)).
However,
the asymptotic confidence interval produced by PROC FREQ requires a
somewhat large sample size (say cell counts of at least 12) - this is
the case at least for SAS version up to 9.2. For moderately small sample
size, it is better to use the formula provided in Fleiss (1981, page
29) Stokes (2000, page 29-30) where the confidence interval is adjusted
by 0.5*(1/n1 + 1/n2) - therefore a little wider. The confidence
interval directly from SAS Proc FREQ is a little narrower than those
using the formula. In practice, the statistician needs to make the
choice which one to use in calculating the confidence interval for
difference in proportions depending on the sample size situation.
Fleiss, JL (1981) Statistical Methods for Rates and Proportions. New York: John Wiley & Sons, Inc.
Stokes, Davis, and Kock (2000) Categorical Data Analysis using the SAS System, 2nd edition
The example from Stocks book can be implemented in SAS using the following SAS codes:
data respire2;
input treat $ outcome $ count @@;
datalines;
test f 40
test u 20
placebo f 16
placebo u 48
;
*** the confidence interval directly from SAS PROC FREQ;
proc freq order=data;
weight count;
tables treat*outcome / riskdiff;
run;
*** the confidence interval calculated from the formula (See section 2.4 Difference in Proportions
in Stokes et al 'Categorical Data Analysis Using the SAS System' 2nd edition;
proc freq data=respire2 order=data;
weight count;
tables treat/noprint out=tots (drop=percent rename=(count=bign));
run;
proc freq data=respire2;
weight count;
tables treat*outcome/noprint out=outcome (drop=percent);
run;
proc sort data=tots;
by treat;
run;
proc sort data=outcome;
by treat;
run;
data prop;
merge outcome tots;
by treat;
if treat='test' then p1=count/bign;
if treat='placebo' then p2=count/bign;
run;
data prop1(rename=(count=count1 bign=bign1)) prop2(rename=(count=count2 bign=bign2));
set prop;
if treat='test' then output prop1 ;
if treat='placebo' then output prop2;
run;
data proportion;
merge prop1(drop= p2 treat) prop2(drop = p1 treat);
run;
***Calculate the difference in proportions, SE, and 95% confidence interval using formula by Fleiss;
data cal;
set proportion;
variance=(p1*(1-p1)/(bign1)) + (p2*(1-p2)/(bign2));
diff=(p1-p2);
lower=(diff - ((1.96*(sqrt(variance)) + .5*(1/bign1 + 1/bign2))));
upper=(diff + ((1.96*(sqrt(variance)) + .5*(1/bign1 + 1/bign2))));
se=(sqrt(variance));
run;
proc print;
format p1 p2 variance diff lower upper se 5.3;
run;
Source:: http://onbiostatistics.blogspot.com/2011/09/confidence-interval-for-difference-in.html
收藏:
QQ书签
del.icio.us
转眼中秋已过,你巨头望月了么?
蝎子 发表于 2011-09-15 02:07:01
转眼间,中秋已过,家里的月饼还没吃完,节就过去了……
套用LA times的一段文章:
于是才知道: 原来中秋月是:harvest moon
你想过我们的农历是多么神奇呀?
现在采用科学证明,中秋的月亮是年中最圆的,
你想过为什么那么的月缺月圆,我们独独庆中秋么?

套用LA times的一段文章:
于是才知道: 原来中秋月是:harvest moon
你想过我们的农历是多么神奇呀?
现在采用科学证明,中秋的月亮是年中最圆的,
你想过为什么那么的月缺月圆,我们独独庆中秋么?
The moon has been a spectacular sight this week, and hopefully you've
had the chance to take at least a glance. Monday, September 12th marked
the full moon, and it was in one of its most legendary annual phases,
the Harvest Moon.
You may have experienced a bit of "moon illusion," as its called, when the moon appears to be bigger than it actually is. The L.A. Times explains a bit more:
Steve Edberg, an astronomer at the Jet Propulsion Laboratory, explained that
because of the tilt of the moon's orbit in September, the moon rises
just as the sun is setting for a few days after the full moon. Usually
the moon rises at sunset only on the day it is full and then rises about
an hour later each subsequent day.
The gorgeous Harvest Moon was captured in this photo submitted to our LAist Featured Photos pool on Flickr, and we couldn't resist sharing.

收藏:
QQ书签
del.icio.us
公信
蝎子 发表于 2011-09-09 01:59:45
我常常想,我们给出评价,给出建议,发表自己看法的时候,是从社会公平公正的角度出发,还是从自身好恶和价值观的出发。 我们衡量整个事件的尺度会不会因为牵连事件的是某个张三李四而发生偏移。 我们心中的公信度,究竟来源于社会的影响力,还是来源于我们自身对公信的需要?!
就说最近的“星二代”“富二代”违法事件中,我们在评论的时候,是否本着对大众客观公正的态度?我们是否因为他们是某个人的亲戚朋友,就罪加一等或者从轻发落。 法律面前是否真正的人人平等?
我想,我没有答案!

就说最近的“星二代”“富二代”违法事件中,我们在评论的时候,是否本着对大众客观公正的态度?我们是否因为他们是某个人的亲戚朋友,就罪加一等或者从轻发落。 法律面前是否真正的人人平等?
我想,我没有答案!
收藏:
QQ书签
del.icio.us


