Standardization

In statistics, standardization plays a crucial role as we have various attributes for modeling and all of them have different scales. So for comparison purposes, we need to standardize the variables to bring them on the same scale. Centering the values and creating the z scores is done in R by the scale() function. It takes the following arguments:

  • x: A numeric object
  • center: If TRUE, the object's column means are subtracted from the values in those columns (ignoring NAs); if FALSE, centering is not performed
  • scale: If TRUE, the centered column values are divided by the column's standard deviation (when center is also TRUE; otherwise, the root mean square is used); if FALSE, scaling is not performed

If we want to center the data of ...

Get Learning Quantitative Finance with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.