quadratic.fit {cta}R Documentation

Quadratic Fit

Description

Fits a quadratic curve that passes all three points on the two-dimensional Euclidean space R^2.

If the design matrix X of the quadratic fit has a condition number which is greater than 10^8, a linear regression line is fitted to the three points instead.

Usage

quadratic.fit(x, y)

Arguments

x

A vector of length three, which represents the x-values of the three points.

y

A vector of length three, which represents the y-values of the three points.

Value

quadratic.fit returns a vector of length three. The first, second, and third elements of the returned vector are the second degree, first degree, and zero-th degree coefficients, respectively, of the fitted quadratic curve, or of the fitted linear regression line.

Author(s)

Qiansheng Zhu

See Also

solve_quadratic

Examples

# Three points: (0, 1), (1, 0), (3, 4).
quadratic.fit(c(0, 1, 3), c(1, 0, 4))

[Package cta version 1.3.0 Index]