Polynomial feature expansion + OLS via stats::poly +
stats::lm. Uses raw (not orthogonal) polynomials for parity
with scikit-learn's PolynomialFeatures.
Examples
set.seed(1)
morie_polynomial_regression(x = rnorm(50), y = rnorm(50))
#> $estimate
#> [1] 0.14070770 -0.05448775 -0.02604877
#>
#> $se
#> [1] 0.1762995 0.1771258 0.1469950
#>
#> $feature_names
#> [1] "(intercept)" "x0" "x0^2"
#>
#> $degree
#> [1] 2
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "Polynomial regression (degree=2)"
#>
