quadratic: Linear and Quadratic Terms

View source: R/quadratic.R

quadraticR Documentation

Linear and Quadratic Terms

Description

Computes orthogonal polynomials of degree 2 (Cohn and others, 1992). Used primarily in a linear regression formula.

Usage

quadratic(x, center = NULL)

Arguments

x

a numeric vector. Missing values are permitted and result in corresponding missing values in the output.

center

an optional value to use for the center of x.

Value

A matrix of two columns—the centered value of x and its square.

Note

If center is specified, then the polynomials will not necessarily be orthogonal. If used in a linear regression formula, then the coefficient of the linear term is the slope at center.
The function quadratic differs from poly in that the data are not scaled, so the regression coefficients are directly interpretable in terms of the units of x.

References

Cohn, T.A., Caulder, D.L., Gilroy, E.J., Zynjuk, L.D., and Summers, R.M., 1992, The validity of a simple statistical model for estimating fluvial constituent loads—An empirical study involving nutrient loads entering Chesapeake Bay: Water Resources Research, v. 28, no. 5, p. 937–942.

See Also

poly

Examples


## first and second orthogonal polynomials for the sequence from 1 to 10
quadratic(seq(10))

USGS-R/smwrBase documentation built on Oct. 18, 2022, 9:55 a.m.