Recursive multivariate Ordinary Least Squares. More...
#include <RecursiveMultivariateOLS.hpp>
Public Member Functions | |
| RecursiveMultivariateOLS () | |
| Initialises without data. | |
| RecursiveMultivariateOLS (Eigen::Ref< const Eigen::MatrixXd > X, Eigen::Ref< const Eigen::VectorXd > y) | |
| Initialises with the first sample and calculates the first beta estimate. More... | |
| void | update (Eigen::Ref< const Eigen::MatrixXd > X, Eigen::Ref< const Eigen::VectorXd > y) |
| Updates the beta estimate with a new sample. More... | |
| unsigned int | n () const |
| Returns the number of data points seen so far. | |
| unsigned int | d () const |
| Returns the dimension of data points. If n() == 0, returs 0. | |
| const Eigen::VectorXd & | beta () const |
| Returns the current estimate of beta. If n() == 0, returns an empty vector. | |
Recursive multivariate Ordinary Least Squares.
Given a stream of pairs \((X_i, \vec{y}_i)\), updates the least-squares estimate for \(\vec{\beta}\) using the model
\( \vec{y}_0 = X_0^T \vec{\beta} + \vec{e}_0 \)
\( \vec{y}_1 = X_1^T \vec{\beta} + \vec{e}_1 \)
...
where \(\vec{e}_i\) are i.i.d. Gaussian.
Based on https://cpb-us-w2.wpmucdn.com/sites.gatech.edu/dist/2/436/files/2017/07/22-notes-6250-f16.pdf
| ml::LinearRegression::RecursiveMultivariateOLS::RecursiveMultivariateOLS | ( | Eigen::Ref< const Eigen::MatrixXd > | X, |
| Eigen::Ref< const Eigen::VectorXd > | y | ||
| ) |
Initialises with the first sample and calculates the first beta estimate.
| [in] | X | D x N matrix of X values, with data points in columns. |
| [in] | y | Y vector with length N. |
| std::invalid_argument | If y.size() != X.cols() or X.cols() < X.rows(). |
| void ml::LinearRegression::RecursiveMultivariateOLS::update | ( | Eigen::Ref< const Eigen::MatrixXd > | X, |
| Eigen::Ref< const Eigen::VectorXd > | y | ||
| ) |
Updates the beta estimate with a new sample.
| [in] | X | D x N matrix of X values, with data points in columns. |
| [in] | y | Y vector with length N. |
| std::invalid_argument | If (X, y) is the first sample (i.e., n() == 0) and X.cols() < X.rows(), or y.size() != X.cols(). |