step_pareto: Applies Pareto scaling on numeric data

Description Usage Arguments Details Value References Examples

View source: R/pareto.R

Description

step_pareto creates a specification of a recipe step that will perform Pareto scaling on the columns.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
step_pareto(
  recipe,
  ...,
  role = NA,
  trained = FALSE,
  means = NULL,
  sdroots = NULL,
  na_rm = TRUE,
  skip = FALSE,
  id = rand_id("pareto")
)

## S3 method for class 'step_pareto'
tidy(x, ...)

Arguments

...

One or more selector functions to choose which variables are affected by the step. See selections() for more details. For the tidy method, these are not currently used.

role

Not used by this step since no new variables are created.

means

A named numeric vector of means. This is NULL until computed by prep.recipe().

sdroots

A named numeric vector of standard deviation square roots. This is NULL until computed by prep.recipe().

na_rm

A logical value indicating whether NA values should be removed when computing the standard deviation and mean.

x

A step_pareto object.

Details

Pareto scaling is a variant of autoscaling whereby the data is scaled by the square root of its standard deviation. step_pareto estimates the standard deviations and means from the data used in the training argument of prep.recipe. bake.recipe then applies the scaling to new data sets using these estimates.

Value

An updated version of recipe with the new step added to the sequence of existing steps (if any). For the tidy method, a tibble with columns terms (the selectors or variables selected), value (the standard deviations and means), and statistic for the type of value.

References

van den Berg, R. A., Hoefsloot, H. C., Westerhuis, J. A., Smilde, A. K., & van der Werf, M. J. (2006). Centering, scaling, and transformations: improving the biological information content of metabolomics data. BMC genomics, 7, 142. https://doi.org/10.1186/1471-2164-7-142 https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1534033/

Examples

1
2
3
4
# requires the recipes package
pareto <- 
  recipe(Species ~. , iris) %>%
  step_pareto(all_predictors())

CVUA-RRW/NMRrecipes documentation built on Jan. 21, 2021, 1:53 a.m.