Re: Need help in fixing confidence intervals
- From: "Rune Allnor" <allnor@xxxxxxxxxxxx>
- Date: 22 Mar 2006 03:39:58 -0800
Jack Vincennes wrote:
I'm trying to calculate a 95% confidence interval for the difference
in approval rate of two independent surveys (in the first 22 out of
30 people approved a diet, in the second 18 out of 30 approved it).
This is what I have so far:
p=22/30
n=30
Y=norm(n*p,n*p*(1-p))
phat=norm(p,(p*(1-p))/n)
Lci=phat-1.96*(phat*(1-phat)/n)^(1/2)
Uci=phat+1.96*(phat*(1-phat)/n)^(1/2)
p2=18/30
n2=30
Y2=norm(n2*p2,n2*p2*(1-p2))
phat2=norm(p2,(p2*(1-p2))/n2)
Lci2=phat2-1.96*(phat2*(1-phat2)/n2)^(1/2)
Uci2=phat2+1.96*(phat2*(1-phat2)/n2)^(1/2)
Lcidiff=phat-phat2-1.96*((phat*(1-phat)/n)+(phat2*(1-phat2)/n2))^(1/2)
Ucidiff=phat-phat2+1.96*((phat*(1-phat)/n)+(phat2*(1-phat2)/n2))^(1/2)
where Lci and Uci are lower and upper confidence intervals, and
Lcidiff and Ucidiff are lower and upper confidence difference
intervals.
Unfortunately my lower confidence interval is negative (-0.1028)
which I don't think is possible.
Can somebody help me please?
I can't help with solving your problem, but I'll have a go at
explaining
what you see.
As far as I can tell, you are computing your numbers based on a
Gaussian distribution of your data. A number generated by a
Gaussian process can take on any value, positive or negative.
The data you analyze can only take on non-zero values, suggesting
that the distribution you use is inappropriate.
It seems that you need to base your analysis on a distribution that
better suits your data, and use the corresponding formulas for
computing the confidence intervals.
Rune
.
- References:
- Need help in fixing confidence intervals
- From: Jack Vincennes
- Need help in fixing confidence intervals
- Prev by Date: Transparent Image and Patch Background
- Next by Date: Re: 3D rotation with transparency
- Previous by thread: Need help in fixing confidence intervals
- Next by thread: Griddata too slow
- Index(es):
Relevant Pages
|