WEIGHT option |
WEIGHT=SERIES/FRML/expression of (relative) weights for the data points
The WEIGHT option serves a different purpose from the SPREAD option. WEIGHT is for weighting observations (typically with probability weights), while SPREAD is for "weighting" data due to assumed variance differences. The difference is subtle, as the two options will produce the same regression coefficients when given compatible options (if the two are reciprocals). If you are doing "weighted least squares" for correcting for heteroscedasticity, use SPREAD, not WEIGHT.
If \({w_t}\) is the series of weights (they don't have to sum to 1—they are normalized as part of the calculation), then the mean for any function of the data \(\left\{ {{x_t}} \right\}\) is computed as
\(\bar f(x) = \frac{{\sum {{w_t}f\left( {{x_t}} \right)} }}{{\sum {{w_t}} }} = \sum {\left[ {\frac{{{w_t}}}{{\sum {{w_t}} }}} \right]f\left( {{x_t}} \right)} \)
Note that the weight applies to the function, not to the data. In particular for least squares of \(y\) on \(X\):
\(\hat \beta = {\left( {\sum {{w_t}{X_t}^\prime {X_t}} } \right)^{ - 1}}\left( {\sum {{w_t}{X_t}^\prime {y_t}} } \right)\)
where the sum of weights will cancel out since one is in the inverse and so becomes a reciprocal. By contrast, weighted least squares for heteroscedasticity (in effect) divides through the data by \({\sigma _t}\) (both \(y\) on \(X\) in the case of a regression) right at the start and carries that through all calculations.
WEIGHT is usually used as part of a much more complicated calculation, as the probability weights are generated by another calculation. The following is part of the ROBUSTSTAR.RPF program—it does 10 passes through a loop that adjusts the weights on observations based upon how extreme the residuals are.
set weight = 1.0
do iters=1,10
linreg(weight=weight,noprint) xc
# constant xc{1 to 11}
compute sigma=sqrt(%seesq)
set weight %regstart() %regend() = $
stdu=abs(%resids)/sigma,%if(stdu<2.576,1.0,%if(stdu>3.291,0.0,%polyvalue(px,stdu)/stdu))
end do iters
Copyright © 2025 Thomas A. Doan