CorTable: Generate a correlation table

View source: R/faststats.R

CorTableR Documentation

Generate a correlation table

Description

This computes correlations from the imputed data, yielding a correlation matrix as well as matrices for sample size, p-values, and holdout values (computed with [cor.holdout()]). The latter is a robustness check for the obtained correlation, denoting how many observations need to be removed before a certain goal is achieved, such as non-significance, or a flip of the sign of the correlation coefficient (represented by the argument holdout.goal).

Usage

CorTable(
  x,
  method = c("pearson", "spearman"),
  holdout.goal = c("nsig", "flip"),
  alpha = 0.05
)

Arguments

x

A matrix or data.frame of which the columns will be correlated with each other

method

Whether to use pearson or spearman correlations

holdout.goal

When computing the holdout statistic with [cor.holdout()], what should the goal be - non-significance ("nsig") or a flip of the sign ("flip")?

alpha

Alpha level for non-significance testing in case holdout.goal="nsig"

Details

The output of this object can be printed with [print.CorTable()].

Value

A list with 5 items - 4 matrices (r - correlation, n = sample size, p = p-value, h = holdout value) and a list of parameters, such as the correlation type. NA values among the holdout values indicate that computation failed, e.g. due to insufficient variance or an inability to achieve the holdout goal without depleting the sample size.

Author(s)

Sercan Kahveci

Examples

test<-CorTable(mtcars,holdout.goal="flip")
print(test)

test<-CorTable(mtcars,holdout.goal="nsig")
print(test,type="r/h")


Spiritspeak/skMisc documentation built on April 12, 2025, 5:40 a.m.