[R] chi-square and error bars?

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Tue Jan 18 18:31:58 CET 2005


On Tue, 18 Jan 2005 17:16:46 +0000 (GMT) Dan Bolser wrote:

> 
> This may sound crazy but...
> 
> I have data like this...
> 
> > results.matrix
>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
> [1,]  949   93    2   11   26   20    7    6   10     5     0     3
> [2,] 1233  124   24   35   58   57   17   21   31    19    11    21
> 
> 
> Which is the result of binning (summing) the response variables of an
> underlying (nearly) continious range of predictor variable into 12
> bins.
> 
> I can see that each row is not drawn from the same underlying
> population using chisq.test.
> 
> What I would like to do is plot each proportion from each row with a
> confidence interval which represents the results of the chisq.test,
> i.e. put confidence intervals on each proportion.
> 
> I thought about doing the arcsine transformation on the proportions
> and then I can use the binomial distribution to get the variance and
> hence 95% confidence interval (then back transformation).

You could also sample from the indepence table using r2dtable() and
derive simultanous confidence intervals from that.

Other visualizations of departures from indepence include mosaicplots
with shading or association plots. See mosaicplot() and assocplot() and
the package vcd.
Z
 
> Clearly confidence in latter points is weaker (fewer observations),
> but I can't seem to find a plot to capture this fact.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list