Effacer les filtres
Effacer les filtres

Weighted Least Squares, Need Help!!

1 vue (au cours des 30 derniers jours)
SB
SB le 26 Oct 2012
A question asks to determine write a function to solve the weighted least squares problem, without using advanced functions (limited to mldivide, for loops,etc). I know a weighted least squares problem can be solved by the basic least squares method after multiplying both Yi and the ith row of X by wi, but I'm not sure how to write any of the code in this case.

Réponses (1)

Tom Lane
Tom Lane le 27 Oct 2012
Well, y.*w multiplies each element of y by the corresponding element of w. To do this with a matrix x having multiple columns, try "help repmat" or "help bsxfun". Also consider whether you need to use sqrt(w) or w -- it depends on how you define your weights.

Catégories

En savoir plus sur Descriptive Statistics dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by