cramersV.results: Cramer's V Correlation Matrix Reformatted plus Statistical...

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Reports the statistical significance of the Cramer's V for each varaible pair in the correlation matrix returned by cramersV. Output is in 'long' format with one row per variable pair, allowing the the ordering of variable pairs by variable name or by size or p-value of Cramer's V.

Usage

1
  cramersV.results(cormat, sort.by="r", data=NULL, var.name=NULL, na.rm=TRUE)

Arguments

cormat

The correlation matrix produced by the function cramersV

sort.by

Indicates the order in which the results are to be reported. See 'Details' for options.

var.name

If NULL (the default), then results are returned for all variable pairs. If a specific variable in res is named, then only results for pairs involving that variable are returned.

data

If NULL (the default), then p-values and significance level of each correlation are not reported. If a data frame is supplied, results will include p-values and signficance level for each correlation, provided the data frame includes all the cases use to produce the input correlation matri res.

na.rm

If TRUE (default) records with a missing value of x or y are removed before calculating statistical significance; if FALSE, then the value of Cramer's V is set to NA if there are one or missing x or y values. If data = NULL then the value of na.rm is inherited from the call to cramers.V that produced res.

Details

sort.by offers three options. “r” (the default) sorts results in decreasing order of Cramer's V; “x” sorts results in alphabetic order of the x variable; “y” sorts results in alphabetic order of the y variable.

Value

A dataframe reporting, for each variable pair:

r

Cramer's V

p.value

p-value [if data != NULL]

sig

level of statistical significance (sig) [if data != NULL], where ** p >= 0.99; * p >= 0.95; else p < 0.95

Note

Adapted from http://www.sthda.com/english/wiki/correlation-matrix-an-r-function-to-do-all-you-need

Author(s)

Paul Williamson

See Also

cramersV; cramersV.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Default (using results from cramersV)
res <- cramersV(survey[, 3:8], fill=FALSE)
cramersV.results(res) # by default, results sorted by Cramer's V (r)

#  Sort results by variable name
cramersV.results( res, sort.by = "x" )
cramersV.results( res, sort.by = "y" )

# Reports only those results involving a specified variable
cramersV.results( res, var.name = "Tenure" )

# Report p-value and significance level
cramersV.results( res, data = survey[ , 3:8] )
cramersV.results( res, data = survey[ , 3:8], sort.by = "p.value" )

DrPaulWilliamson/ENVS450 documentation built on May 9, 2019, 3:23 a.m.