association: Association measures

associationR Documentation

Association measures

Description

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

  • concordant concordant pairs

  • discordant discordant pairs

  • ties.row pairs tied on rows

  • ties.col pairs tied on columns

  • nom.phi Phi Coefficient

  • nom.cc Contingency Coefficient (Pearson's C) and Sakoda' s Adjusted Pearson's C

  • nom.TT Tshuprow's T (not meaningful for non-square tables)

  • nom.CV Cramer's V (for 2 x 2 tables V = Phi)

  • nom.lambda Goodman and Kruskal's Lambda with

    • lambda.cr The row variable is used as independent, the column variable as dependent variable.

    • lambda.rc The column variable is used as independent, the row variable as dependent variable.

    • lambda.symmetric Symmetric Lambda (the mean of both above).

  • nom.uncertainty Uncertainty Coefficient (Theil's U) with

    • ucc.cr The row variable is used as independent, the column variable as dependent variable.

    • uc.rc The column variable is used as independent, the row variable as dependent variable.

    • uc.symmetric Symmetric uncertainty coefficient.

  • ord.gamma Gamma coefficient

  • ord.tau a vector with Kendall-Stuart Tau's

    • tau.a Tau-a (for quadratic tables only)

    • tau.b Tau-b

    • tau.c Tau-c

  • ord.somers.d Somers' d

  • eta Eta coefficient for nominal/interval data

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)


sigbertklinke/mmstat4 documentation built on Sept. 13, 2024, 4:46 p.m.