poly_rescale: Rescale the range of a polynomial matrix

View source: R/polypoly-package.R

poly_rescaleR Documentation

Rescale the range of a polynomial matrix

Description

Rescale the range of a polynomial matrix

Usage

poly_rescale(x, scale_width = 1)

Arguments

x

a matrix created by stats::poly()

scale_width

the desired range (max - min) for the first column of the matrix

Details

This function strips away the poly class and the coefs attribute of the matrix. This is because those attributes no longer describe the transformed matrix.

Value

the rescaled polynomial matrix (as a plain matrix with coefs attribute removed)

Examples

m <- poly(1:10, degree = 4)

# Difference between min and max values of first column is 10
scaled <- poly_rescale(m, scale_width = 10)
scaled

# Rescaled values are still orthogonal
zapsmall(cor(scaled))

polypoly documentation built on Oct. 20, 2022, 9:05 a.m.