Wraps stats::lm and returns coefficients plus classical OLS
standard errors.
Usage
morie_linear_regression_ols(x, y)
Arguments
- x
Numeric matrix or vector of predictors.
- y
Numeric response vector.
Value
Named list with estimate (intercept + slopes),
se, n, method.
References
Hastie, Tibshirani & Friedman, Elements of Statistical Learning (2009).
Examples
morie_linear_regression_ols(x = rnorm(50), y = rnorm(50))
#> $estimate
#> [1] 0.07968212 0.17384096
#>
#> $se
#> [1] 0.1269659 0.1390738
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "OLS via closed-form normal equations"
#>