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.16375851 0.04168190 -0.02893771
#>
#> $se
#> [1] 0.17569192 0.11612421 0.07272624
#>
#> $feature_names
#> [1] "(intercept)" "x0" "x0^2"
#>
#> $degree
#> [1] 2
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "Polynomial regression (degree=2)"
#>