association {mmstat4}R Documentation

Association measures

Description

Various association coefficients for nominal and ordinal data; the input formats follows stats::chisq.test().

Usage

concordant(x, y = NULL)

discordant(x, y = NULL)

ties.row(x, y = NULL)

ties.col(x, y = NULL)

nom.phi(x, y = NULL)

nom.cc(x, y = NULL)

nom.TT(x, y = NULL)

nom.CV(x, y = NULL)

nom.lambda(x, y = NULL)

nom.uncertainty(x, y = NULL)

ord.gamma(x, y = NULL)

ord.tau(x, y = NULL)

ord.somers.d(x, y = NULL)

eta(x, y, breaks = NULL)

Arguments

x

a numeric vector, table or matrix. x and y can also both be factors.
For eta the independent nominal variable (factor or numeric).

y

a numeric vector; ignored if x is a table or matrix. If x is a factor, y should be a factor of the same length.
For eta the dependent interval variable (numeric).

breaks

either a numeric vector of two or more unique cut points or a single number (greater than or equal to 2) giving the number of intervals into which x is to be cut (only for eta).

Value

the association coefficient(s)

Source

From the archived ryouready package by Mark Heckmann. The code for the calculation of nom.lambda, nom.uncertainty, ord.gamma, ord.tau, ord.somers.d was supplied by Marc Schwartz (under GPL 2) and checked against SPSS results.

Examples

## Nominal data
# remove gender from the table
hec <- apply(HairEyeColor, 1:2, sum)
nom.phi(hec)
nom.cc(hec)
nom.TT(hec)
nom.CV(hec)
nom.lambda(hec)
nom.uncertainty(hec)
## Ordinal data
# create a fake data set
ordx <- sample(5, size=100, replace=TRUE)
ordy <- sample(5, size=100, replace=TRUE)
concordant(ordx, ordy)
discordant(ordx, ordy)
ties.row(ordx, ordy)
ties.col(ordx, ordy)
ord.gamma(ordx, ordy)
ord.tau(ordx, ordy)
ord.somers.d(ordx, ordy)
## Interval/nominal data
eta(iris$Species, iris$Sepal.Length)


[Package mmstat4 version 0.2.1 Index]