31 const bool fit_intercept)
36 Eigen::VectorXd residuals;
45 y.array() -= y.mean();
50 auto [ols_intercept, ols_coefs] =
51 detail::fitOls(x.derived(), y, fit_intercept);
52 residuals = y - x.derived() * ols_coefs;
55 residuals.array() -= ols_intercept;
58 df = n - p -
static_cast<int>(fit_intercept) - 1;
63 return residuals.norm() / std::sqrt(df);
double estimateNoise(Eigen::EigenBase< T > &x, Eigen::MatrixXd &y, const bool fit_intercept)
Estimates noise (standard error) in a linear model using OLS residuals.