| association {mmstat4} | R Documentation |
Association measures
Description
Various association coefficients for nominal and ordinal data; the input formats follows stats::chisq.test().
-
concordantconcordant pairs -
discordantdiscordant pairs -
ties.rowpairs tied on rows -
ties.colpairs tied on columns -
nom.phiPhi Coefficient -
nom.ccContingency Coefficient (Pearson's C) and Sakoda' s Adjusted Pearson's C -
nom.TTTshuprow's T (not meaningful for non-square tables) -
nom.CVCramer's V (for 2 x 2 tables V = Phi) -
nom.lambdaGoodman and Kruskal's Lambda with-
lambda.crThe row variable is used as independent, the column variable as dependent variable. -
lambda.rcThe column variable is used as independent, the row variable as dependent variable. -
lambda.symmetricSymmetric Lambda (the mean of both above).
-
-
nom.uncertaintyUncertainty Coefficient (Theil's U) with-
ucc.crThe row variable is used as independent, the column variable as dependent variable. -
uc.rcThe column variable is used as independent, the row variable as dependent variable. -
uc.symmetricSymmetric uncertainty coefficient.
-
-
ord.gammaGamma coefficient -
ord.taua vector with Kendall-Stuart Tau's-
tau.aTau-a (for quadratic tables only) -
tau.bTau-b -
tau.cTau-c
-
-
ord.somers.dSomers' d -
etaEta 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. |
y |
a numeric vector; ignored if |
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 |
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)