CorShrinkData: Adaptive shrinkage of correlations from a data matrix

Description Usage Arguments Value References Examples

View source: R/CorShrinkData.R

Description

Performs adaptive shrinkage of the sample correlations starting from a data matrix (possibly containing NAs).

Usage

1
2
3
4
5
CorShrinkData(data, sd_boot = FALSE, type = "cor", cor_method,
  thresh_up = 0.99, thresh_down = -0.99, image = c("both",
  "original", "corshrink", "output", "null"), tol = 1e-06,
  dosym = TRUE, nboot = 50, image.control = list(),
  report_model = FALSE, maxiter = 1000, ash.control = list())

Arguments

data

The samples by features data matrix. May contain NA values.

sd_boot

A Boolean variable indicating if the standard errors of the Fisher z-scores should be computed via Bootstrap methods or through asymptotic formulation of the problem.

type

character. Either "cor" or "pcor" - depending on whether to use correlation or partial correlation. Default is "cor".

cor_method

The method of correlation used. May be "pearson", "spearman" or "kendall" depending on the type of correlation to be used by the user.

thresh_up

Upper threshold for correlations. Defaults to 0.99

thresh_down

Lower threshold for correlations. Defaults to -0.99.

image

character. options for plotting the original or the corshrink matrix. If image = "both", then the function outputs both the plot for original and shrunk correlationmatrix. If image = "original", then the function outputs the correlation plot for the original matrix only. If image = "corshrink", then the function outputs the correlation plot for the CorShrink matrix only.If image = "output", then the function outputs the saved ggplot figure without displaying it. If image = "null", no image is output.Defaults to "both".

tol

The tolerance chosen to check how far apart the CorShrink matrix is from the nearest positive definite matrix before applying PD completion.

nboot

The number of bootstrap samples if sd_boot = TRUE.

image.control

Control parameters for the image when image = TRUE.

report_model

if TRUE, outputs the full adaptive shrinkage output, else outputs the shrunken vector. Defaults to FALSE.

maxiter

The maximum number of iterations run for the adaptive shrinkage EM algorithm. Default is 1000.

ash.control

The control parameters for adaptive shrinkage

Value

Returns an adaptively shrunk version of the sample correlations matrix.

References

False Discovery Rates: A New Deal. Matthew Stephens bioRxiv 038216; doi: http://dx.doi.org/10.1101/038216

Examples

1
2
data("sample_by_feature_data")
out <- CorShrinkData(sample_by_feature_data, image = "null")

kkdey/CorShrink documentation built on May 20, 2019, 10:28 a.m.