# Weighted Least Squares

Description | Usage | Options | Output | Method | See Also

## Description

The weighted least squares regression performs an ordinary least squares regression after applying a user-specified weighting to the data.

## Usage

After selecting Weighted Least Squares... from the Regress Menu, the user will be presented with the window above. The user can then select the indpendent and dependent variables. Furthermore, the variable acting as the weighting for the regression may also be selected. Once all applicable selections are made, the regression may be run by selecting Compute Regression... from the Regression Menu. The results will appear as soon as calculations complete.

## Options

The user may select to override matrix conditioning checks during the regression in the options dialog. The options dialog is accessed by selecting Options... from the Regression Menu.

## Output

Once the regression is complete, the user will be presented with results similar to the following:

# Weighted Least Squares Results Independent: C Dependent: Y Weighting: r
Coefficient | Estimate | Std Err. | t-score
Constant | 440.73422 | 37.72461 | 11.68294
Coef (C) | 1.38199 | 0.00842 | 164.20766
Sum Squared of the Residuals (weighted) | 3.0172E+07
Standard Error of the Fit (weighted) | 809.89018
R-Squared Value (weighted) | 0.99896
Adjusted R-Squared Value (weighted) | 0.99898
Sum Squared of the Residuals (unweighted) | 5.4123E+05
Standard Error of the Fit (unweighted) | 108.47045
R-Squared Value (unweighted) | 0.99829
Adjusted R-Squared Value (unweighted) | 0.99833
Covariance Matrix:
| Constant | Coef (C)
Constant | 1.4231E+03 | -0.28886
Coef (C) | -0.28886 | 7.0831E-05
Draco Plugin System Copyright © 2008 Approximatrix, LLC

If the regression fails for some reason, the failure message will be displayed in the results window rather than results.

## Method

The weighted least squares regression is implemented in pure JRuby using the Draco Plugin System. The regression solves the following system:
The weighting matrix, W, is composed of a purely diagonal matrix with the values of the weighting vector along the diagonal. The system is solved using the JLMatrix inverse method.
Because weighted least squares is implemented as a plugin, the source code is available in the scripts/ruby/plugin directory.

## See Also

Plugin System Overview
Least Squares Regression

Copyright © 2008 Approximatrix, LLC
Text licensed under the Creative Commons Attribution-Share Alike 3.0 License
DracoTM and the Approximatrix logo are trademarks of Approximatrix, LLC
Other trademarks are property of their respective owners