This function produces a cross table, computes Chi Square, and computes the point estimate and confidence interval for Cramer's V.

crossTab(x, y = NULL, conf.level = 0.95, digits = 2, pValueDigits = 3, ...)

# S3 method for crossTab
print(x, digits = x$input$digits, pValueDigits = x$input$pValueDigits, ...)

# S3 method for crossTab
pander(x, digits = x$input$digits, pValueDigits = x$input$pValueDigits, ...)

Arguments

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.

conf.level

Level of confidence for the confidence interval.

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.

...

Extra arguments to crossTab are passed on to ufs::confIntV().

Value

The results of ufs::confIntV(), but also prints the cross table and the chi square test results.

Examples


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: [.1; .3]  
#> Using Fisher's z: [.06; .3]
#> 
#> Chi-square[4] = 16.53, p = .002