corral_preproc: Preprocess a matrix for SVD to perform Correspondence...

View source: R/corral.R

corral_preprocR Documentation

Preprocess a matrix for SVD to perform Correspondence Analysis (CA)

Description

This function performs the row and column scaling pre-processing operations, prior to SVD, for the corral methods. See corral for single matrix correspondence analysis and corralm for multi-matrix correspondence analysis.

Usage

corral_preproc(
  inp,
  rtype = c("standardized", "indexed", "hellinger", "freemantukey", "pearson"),
  vst_mth = c("none", "sqrt", "freemantukey", "anscombe"),
  powdef_alpha = NULL,
  row.w = NULL,
  col.w = NULL,
  smooth = FALSE,
  ...
)

Arguments

inp

matrix, numeric, counts or logcounts; can be sparse Matrix or matrix

rtype

character indicating what type of residual should be computed; options are '"indexed"', '"standardized"' (or '"pearson"' is equivalent), '"freemantukey"', and '"hellinger"'; defaults to '"standardized"' for corral and '"indexed"' for corralm. '"indexed"', '"standardized"', and '"freemantukey"' compute the respective chi-squared residuals and are appropriate for count data. The '"hellinger"' option is appropriate for continuous data.

vst_mth

character indicating whether a variance-stabilizing transform should be applied prior to calculating chi-squared residuals; defaults to '"none"'

powdef_alpha

numeric for the power that should be applied if using power deflation. Must be in (0,1), and if provided a number outside this range, will be ignored. Defaults to 'NULL' which does not perform this step.

row.w

numeric vector; Default is NULL, to compute row.w based on inp. Use this parameter to replace computed row weights with custom row weights

col.w

numeric vector; Default is NULL, to compute col.w based on inp. Use this parameter to replace computed column weights with custom column weights

smooth

logical; Whether or not to perform the additional smoothing step with 'trim_matdist'. Default is FALSE. Incompatible with 'powdef_alpha', so that parameter takes precedence over this one.

...

(additional arguments for methods)

Value

matrix, processed for input to compsvd to finish CA routine

Examples

mat <- matrix(sample(0:10, 500, replace=TRUE), ncol=25)
mat_corral <- corral_preproc(mat)
corral_output <- compsvd(mat_corral, ncomp = 5)

laurenhsu1/corral documentation built on Feb. 19, 2023, 10:37 p.m.