Code To Compute a Linear Regression.

Category:
Office/VBA
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6, Visual Basic.NET

More information:
The attached workbook contains a user defined function that performs sweep operations on an augmented crossproducts matrix to estimate an ordinary least squares regression model. The approach is immplemented in many statistical packages (e.g. SAS) and is easily adapted to perform stepwise selection procedures. The bulk of the computational work required is the formation of the crossproducts matrix--sweeping the matrix is rather numerically efficient. The sweep routine also includes a built-in test for rank deficiency (multicollinearity). The workbook contains the results of the sweep function along with most of the usual regression output (i.e., ANOVA table, coefficient variance-covariance matrix, coefficient estimates, standard errors, and p-values).

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download sweep.zip.zip