i'm trying to apply weights for a linear regression and i was wondering how should i go about this, should i use one of the variables as weights or std of all variables or etc.

i've been looking for information about this on net but there is surprisingly very little information is available on the matter.

should i try to construct weights by analyzing different variables?

is there a set in stone approach to this?

what are some best practices for this?

**Contents**hide

#### Best Answer

There are plenty of sites to help with this sort of question, but I will highlight a few.

To have a better understanding of *"what is weighted least squares?"*, this link will help. It has a high-level overview of the method, as well as a pros-and-cons list to the method. It also goes over weighting schemes, which answers the question you stated.

For a mathematical basis of the answer to your question, see this thread, which describes the method used in most algorithms.

This link will show you some in-depth examples of *how* to implement Weighted OLS. Both examples and code are given along with the explanation.

If you are interested in Recency-weighted regressions (as to be used in time series), take a look at this article, which gives a nice overview of the method with a baseball analogy, where observations are highly autocorrelated.