Re: Need help in fixing confidence intervals




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

.



Relevant Pages

  • Re: CONFIDENCE LIMITS AROUND A PERCENTILE
    ... CONFIDENCE LIMITS AROUND A PERCENTILE ... Fot the normal distribution, it's based on the ... CONFIDENCE INTERVALS FOR QUANTILES ... This algorithm is based on the Normal Distribution ...
    (sci.stat.math)
  • Re: Jarque-Bera test: confidence intervals for normal data
    ... So this has nothing to do with confidence intervals even though confidence intervals are in the title? ... the composite hypothesis of normality. ... eventually be drawn from the Distribution N? ... whatever the NORMAL mean and variance are. ...
    (sci.stat.math)
  • Re: Confidence Intervals for Bridge Simulations (long)
    ... range are impossible -- that's cookbook statistics. ... Grant me some sort of prior probability distribution assumption as to ... that's consistent with a population frequency as low as ... kind of prior distribution information to make confidence intervals ...
    (rec.games.bridge)
  • Re: Too narrow confidence intervals from generalized Pareto fit
    ... We use a generalized Pareto distribution to fit data. ... I take the confidence intervals from the gpfit function, ... The second arg to gpfit ought to be what is traditionally called alpha, i.e., the CIs will have coverage probability. ... Bootstrapping, as opposed to creating repeated samples from fixed parameters as I've done, is perhaps reasonable, but the thing you would want to bootstrap is the CIs, not the parameter estimates, to verify their coverage probabilities. ...
    (comp.soft-sys.matlab)
  • Re: Error on kurtosis and skewness
    ... I'm used to thinking of confidence intervals ... probability of containing the true value of the statistic [given ... >> But in your example you constrain the uniform distribution to be ... >> there is 100% chance that theta lies within the interval. ...
    (sci.stat.math)