[R] CI using ci.numeric

David Winsemius dwinsemius at comcast.net
Wed Oct 20 16:11:11 CEST 2010


On Oct 20, 2010, at 4:10 AM, David A. wrote:

>
> Hi,
>
> I am trying to calculate confidence intervals using ci.numeric from  
> epicalc package. If I generate a normal set of data and find the 99%  
> and 95% CI, they seem too narrow to me. Am I doing something wrong??

The next sentence suggests that what you are doing wrong is assuming  
that population parameters like the 0.75 and 0.25 quantiles (the IQR)  
are on the same scale as the confidence intervals around the  
population mean. As the number of samples increases the CI will narrow  
while the expected value of the IQR will remain the same. If you  
wanted to compare two values that remain on the same scale you ought  
to be looking at the SD rather than maen +/- 1.96*se(mean).


> The IQR goes from -0.62 to 0.62, so I thought the CI limits should  
> be more extreme than these values.
>
> x<- rnorm(200,0,1)
> ci.numeric(x=mean(x),n=200,sds=sd(x),alpha=0.05)
>    n        mean       sd         se  lower95ci upper95ci
> 1 200 -0.07129813 1.015668 0.07181859 -0.2129213 0.0703250
>
> ci.numeric(x=mean(x),n=200,sds=sd(x),alpha=0.01)
>   n        mean       sd         se  lower99ci upper99ci
> 200 -0.07129813 1.015668 0.07181859 -0.2580811 0.1154848
>
> quantile(x)
>         0%         25%         50%         75%        100%
> -3.23354673 -0.61926758 -0.06672757  0.62000897  2.43763696
>
> Thanks,
>
> D.
> 		 	   		
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list