Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8828469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:36:48+00:00 2026-06-14T07:36:48+00:00

I am performing weighted least squares regression as described on wiki: WLS I need

  • 0

I am performing weighted least squares regression as described on wiki: WLS

I need to solve this equation: $B= (t(X)WX)^{-1}*t(X)Wy$

I use SVD to find: $(t(X)WX)^{-1}$ and store it in a matrix. In addition I store the matrix $H= (t(X)WX)^{-1}*t(X)W$ and simply do the following for any new value of y: B= Hy. This way I am able to save the cost of repeating SVD and matrix multiplications as y’s change.

W is a diagonal matrix and generally does not change. However sometimes I change one or two elements on the diagonal in the W matrix. In that case I need to do SVD again and recalc the H matrix. This is clearly slow and time consuming.

My question is: If I know what changed in W and nothing changes in X is there a more efficient method to recalculate (t(X)WX)^-1?

Or put differently is there an efficient analytic method to find B given that only diagonal elements in W can change by a known amount?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:36:49+00:00Added an answer on June 14, 2026 at 7:36 am

    There is such a method, in the case that the inverse you compute is a true inverse and not a generalised inverse (ie none of the singular values are 0). However some caution in using this is recommended. If you were doing your sums in infinite precision, all would be well. With finite precision, and particularly with nearly singular problems — if some of the singular values are very large — these formulae could result in loss of precision.

    I’ll call inverse you store C. If you add d (which can be positive or negative) to the m’th weight, then the modified C matrix, C~ say, and the modified H, H~, can be computed like this:

    (‘ denotes transpose, and e_m is row the vector that’s all 0, except the m’th slot is 1)

    Let

    c = the m'th column of H, divided by the original m'th weight    
    a = m'th row of the data matrix X    
    f = e_m - a*H    
    gamma = 1/d + a*c
    

    (so c is a column vector, while a and f are row vectors)

    Then

    C~ = C - c*c'/gamma
    H~ = H + c*f/gamma
    

    If you want to find the new B, B~ say, for a given y, it can be calculated via:

    r = y[m] - a*B
    B~ = B + (r/gamma) * c
    

    The derivation of these formulae is straightforward, but tedious, matrix algebra. The matrix inversion lemma comes in handy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When performing many inserts into a database I would usually have code like this:
I'm performing a while loop in C#, this is going through some records being
After performing processing I want to calculate the percentage of white pixels between this
When performing UPDATE and INSERT queries using Zend_Db, I frequently need to set values
When performing introspection on a class, I use the following code: if([object isKindOfClass:[NSNumber class]]){
After performing a find on a model I would expect the result to be
After performing some Google-fu and searching Stack Overflow I've been unable to find a
For performing file IO in C++ we use the ofstream, ifstream and fstream classes.
When performing a code review my approach is to use meld to view the
I'm performing linear regression analyses (y=xb, solving for b with a given [nx1] vector

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.