GoodmanKruskal (version 0.0.2)

GKtau: Compute Goodman and Kruskal tau measure of association.

Description

GKtau returns forward and backward Goodman and Kruskal tau measures between categorical variables.

Usage

GKtau(x, y, dgts = 3, includeNA = "ifany")

Arguments

x

A categorical vector (factor).

y

A categorical vector (factor).

dgts

Integer, number of digits for results; optional (default = 3).

includeNA

Character, passed to useNA parameter for table; default is "ifany"; other valid options are "no" and "always"

Value

A one-row dataframe with the following columns:

  • the names of the x and y variables,

  • the numbers of distinct values Nx and Ny for each variable, and

  • the forward and backward associations, tau(x,y) and tau(y,x).

Details

The Goodman and Kruskal tau measure is an asymmetric association measure between two categorical variables, based on the extent to which variation in one variable can be explained by the other. This function returns a dataframe with both forward and backward associations.

Examples

Run this code
# NOT RUN {
x <- rep(c("a", "b", "c", "d"), each = 3)
y <- rep(c("a", "b", "c", "d"), times = 3)
z <- rep(c("a", "b", "a", "c"), each = 3)
GKtau(x, y)
GKtau(x, z)
GKtau(y, z)
# }

Run the code above in your browser using DataLab