rowZs: rowZs: Fast Calculation of Z-Scores by Row

Description Usage Arguments Details Value Author(s) See Also

View source: R/rowZs.R

Description

rowZs() calculates Z-scores across rows of a matrix using fast row methods.

Usage

1
rowZs(X, vs, robust = F, parts = F, na.rm = T, min.sd)

Arguments

X

Numeric matrix, or object that can be coerced to matrix.

vs

Indices (numeric or character) of the columns of X to be used in the calculation of the mean or median and sd or mad of each row. If omitted, defaults to all columns of X.

robust

Logical. If TRUE, calculate Z-scores as (x-median)/mad; otherwise, as (x - mean) / sd.

parts

Logical; if TRUE, return the mean/median and sd/mad of each row as named attributes, CALCULATED ACROSS THE COLUMNS SPECIFIED BY vs.

na.rm

Logical; should NA's be omitted?

min.sd

Optional numeric value, *quantile* of the non-zero sd's (or mad's) to replace very low (~zero) sd or mad values with. A typical value might be in the range 0 to 0.1. Meant to prevent very large or unrealistic Z-scores when the sd is small by chance or because of pile-up at a signal limit (e.g., saturation).

Details

This function is meant to help find samples or groups of samples with extreme values, typically relative to a control group (vs)

Value

Returns a matrix with the same dimensions as X with z-scores for each element of X calculated from the row means/medians and sds/mads. If parts==TRUE, will have named attributes: "vs.mean" and "vs.sd" or "vs.median" and "vs.mad", plus "vs".

Author(s)

M.W.Rowe, mwr.stats@gmail.com

See Also

mad.


mwrowe/microRutils documentation built on June 12, 2021, 2:41 p.m.