Polynomial feature expansion + OLS via stats::poly +
stats::lm. Uses raw (not orthogonal) polynomials for parity
with scikit-learn's PolynomialFeatures.
Examples
morie_polynomial_regression(x = rnorm(50), y = rnorm(50))
#> $estimate
#> [1] 0.11632367 -0.06084771 -0.07095972
#>
#> $se
#> [1] 0.1741398 0.1648033 0.1230420
#>
#> $feature_names
#> [1] "(intercept)" "x0" "x0^2"
#>
#> $degree
#> [1] 2
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "Polynomial regression (degree=2)"
#>
