This function performs a standard multivariate OLS regression with the given regressors in x. The regressors are supposed to be column vectors and the observations in rows.
The regressand should be given by y, as column vector respectively. There is no need to add a constant manually in x. It is added automatically.
The regression coefficients, estimates and residuals of the model are given in separate matrices. Additional information can be found in stats.
The main advantage over the standard regression codes provided by Matlab is that it is faster and offers more information at a comprehense place so you have all information needed at your fingertips.
Furthermore this function does not (!) require any additional toolboxes like the statistics toolbox to be installed.
This function offers as well heteroscedasticity consistent standard errors (White 1980) and will soon be further expanded in that matter.
Additionally the ability to perform a rolling window regression on the given data is provided. Use the provided wreg() function for this. The function will give the exact same information and results as the standard reg() function but stores the model information of each regression. Hence the detection of structural breaks will be simplified, e.g. testing for Beta stability of the CAPM. You can specify the window size and the step size as well. See help wreg() for detailed information. In fact all statistics of the reg() function are provided, as well as heteroscedasticity consistent standard errors.
If you have any questions or suggestions for improvements, feel free to contact me.
Léon (2021). Fast & Detailed Multivariate OLS Regression (https://www.mathworks.com/matlabcentral/fileexchange/34394-fast-detailed-multivariate-ols-regression), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!