Learn R Programming

userfriendlyscience (version 0.7.2)

confIntV: crossTab, confIntV and cramersV

Description

These functions compute the point estimate and confidence interval for Cramer's V. The crossTab function also shows a crosstable.

Usage

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)

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.

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 crossTab are passed on to confIntV.

Value

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.

Examples

Run this code
# NOT RUN {
crossTab(infert$education, infert$induced, samples=50);

### 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));

# }

Run the code above in your browser using DataLab