Learn R Programming

polypoly (version 0.0.2)

poly_rescale: Rescale the range of a polynomial matrix

Description

Rescale the range of a polynomial matrix

Usage

poly_rescale(x, scale_width = 1)

Value

the rescaled polynomial matrix (as a plain matrix with coefs

attribute removed)

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.

Examples

Run this code
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))

Run the code above in your browser using DataLab