Skip to contents

This function performs Poisson scaling on a numeric matrix or data frame. Poisson scaling scales each variable by its square root mean value, with an optional scaling offset to avoid over-scaling when a variable has a near-zero mean.

Usage

poisson_scale(x, sc = NULL, drop.na = TRUE, options = list())

Arguments

x

A numeric matrix or data frame.

sc

A vector of previously calculated scales. If provided, these scales will be applied to the data.

drop.na

A logical value indicating whether to remove missing values (NA) from the calculations. If TRUE (the default), missing values will be removed. If FALSE, missing values will be included.

options

A list of options for Poisson scaling. See the 'Options' section below.

Value

If sc is not provided, the function returns a list with the following components:

xs

The Poisson-scaled data.

sc

A vector of scales calculated for the given data.

If sc is provided, the function returns the Poisson-scaled data xs.

Options

The options argument is a list with the following fields:

  • offset: A numeric value representing the percentage of the maximum mean value to be used as an offset on all scales. Avoids division by near-zero means. Default is 3.

  • mode: An integer value (1 or 2) specifying the dimension of the data on which to calculate the mean value for scaling. 1 = mean over rows (to scale variables); 2 = mean over columns (to scale samples). Default is 1.

Author

Christian L. Goueguel