These functions compute the point estimate and confidence interval for Cramer's V. The crossTab function also shows a crosstable.
crossTab(x, y=NULL, conf.level=.95, digits=2, pValueDigits=3, ...) cramersV(x, y = NULL, digits=2) confIntV(x, y = NULL, conf.level=.95, samples = 500, digits=2, method=c('bootstrap', 'fisher'), storeBootstrappingData = FALSE)
x | Either a crosstable to analyse, or one of two vectors to use to generate that crosstable. The vector should be a factor, i.e. a categorical variable identified as such by the 'factor' class). |
---|---|
y | If x is a crosstable, y can (and should) be empty. If x is a vector, y must also be a vector. |
digits | Minimum number of digits after the decimal point to show in the result. |
pValueDigits | Minimum number of digits after the decimal point to show in the Chi Square p value in the result. |
conf.level | Level of confidence for the confidence interval. |
samples | Number of samples to generate when bootstrapping. |
method | Whether to use Fisher's Z or bootstrapping to compute the confidence interval. |
storeBootstrappingData | Whether to store (or discard) the data generating during the bootstrapping procedure. |
... | Extra arguments to |
The cramersV and confIntV functions return either a point estimate or a confidence interval for Cramer's V, an effect size to describe the association between two categorical variables. The crossTab function is just a wrapper around confIntV.
crossTab(infert$education, infert$induced, samples=50);#> 0 1 2 #> 0-5yrs 4 2 6 #> 6-11yrs 78 27 15 #> 12+ yrs 61 39 16 #> #> Cramér's V 95% confidence interval (point estimate = .18): #> Bootstrapped: [.11; .3] #> Using Fisher's z: [.06; .3] #> #> Chi-square[4] = 16.53, p = .002### Get confidence interval for Cramer's V ### Note that by using 'table', and so removing the raw data, inhibits ### bootstrapping, which could otherwise take a while. confIntV(table(infert$education, infert$induced));#> Cramér's V 95% confidence interval (point estimate = .18): #> Using Fisher's z: [.06; .3]