On Sun, 24 Jan 1999, Joel Dubin wrote:
>
>
>
> Hello,
>
> I have found some inconsistent behavior of function
> calls on lm objects when weights are specified in lm().
> To begin, in matrix notation, the unweighted regression
> equation is y = X * \beta + \epsilon . In weighted regression,
> we simply premultiply each side of the equation by W^(1/2),
> where W is a diagonal matrix of the weights for each
> observation. This results in: y_w = X_w * \beta + \epsilon_w,
> where y_w = W^(1/2) * y, x_w = W^(1/2) * X,
> and \epsilon_w = W^(1/2) * \epsilon.
>
> Say we run a weighted least squares regression
> with the following code: wls.fit _ lm(formula = y ~ x, weights = wgts),
> where y is of length n, and wgts is a vector of weights of length n.
>
> The inconsistency is this:
>
> summary(wls.fit) outputs some quantile information
> on the residuals, where the residuals are defined as:
> y_w - (sqrt(wgts) * fitted(wls.fit)). In addition, the square root
> of the MSE and the standard errors of the coefficient
> estimates are consistent with this definition of the residuals.
>
> However, residuals(wls.fit) outputs
> the residuals as: y - fitted(wls.fit). That is,
> the function residuals.lm() does not adjust the
> residual values with the provided weights.
>
> Why are the two functions coded to output
> different residuals values from the same weighted regression?
> Shouldn't this be considered a bug?
Possibly, but I think they serve different purposes. It would come as a
considerable surprise to find that residuals from a regression are not
observed - expected, especially if they were zero for observations with
weight zero. I think if there is a problem it is in summary, where if the
five-number summary of residuals serves any purpose, it should be of
standardized or studentized residuals (which should take account of the
weights, by definition).
As for the s.e.'s of the coefficients and the `Residual standard error'
you need to check the model, but these seems correct if it is
var(e_i) = s^2 w_i and the estimate is of s.
As a last resort, read the manual: ?summary.lm gives
residuals: the model residuals. These are the weighted
residuals if weights were given in the model.
sigma: the residual standard error estimate.
and the first is clear even if the second is not.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|