s-news
[Top] [All Lists]

[S] inconsistency with weighted regression

To: s-news@wubios.wustl.edu
Subject: [S] inconsistency with weighted regression
From: Joel Dubin <dubin@wald.ucdavis.edu>
Date: Sun, 24 Jan 1999 13:05:40 -0800 (PST)
In-reply-to: <199901151506.QAA08018@elektra.zdv>
Sender: owner-s-news@wubios.wustl.edu


        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?
        

        Sincerely, 

        Joel Dubin
        Graduate Student
        Division of Statistics
        University of California - Davis

-----------------------------------------------------------------------
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

<Prev in Thread] Current Thread [Next in Thread>