Description Usage Arguments Details Value Examples
Perform a chi-square two sample test that two data samples come from the same distribution. Note that we are not specifying what that common distribution is.
1 | chisq_test(R, S)
|
R, S |
Vectors containing the number of observations in each bin. Should be the same size. R is the reference sample and S is the new sample, but this is actually completely symetric. |
The chi-square two sample test is based on binned data. Note that the binning for both data sets should be the same. The basic idea behind the chi-square two sample test is that the observed number of points in each bin (this is scaled for unequal sample sized) should be similar if the two data samples come from common distributions.
See http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/chi2samp.htm for a more formal description.
The application is for example when we have a reference sample R computed on raw panel data giving the demographic distribution of the viewers for a target, and another demographic distribution S computed for the same target but on an expanded panel.
We can compare R and S using this two-sample chi-squared test.
Named list composed of the Chi-Squared value and the associated p-value.
1 2 3 4 | R <- c(5, 26, 52, 22, 9, 8)
S <- c(7, 35, 67, 36, 21, 10)
chisq_test(R, S)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.