Azzera filtri
Azzera filtri

Weighted Least Squares, Need Help!!

1 visualizzazione (ultimi 30 giorni)
SB
SB il 26 Ott 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.

Risposte (1)

Tom Lane
Tom Lane il 27 Ott 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.

Categorie

Scopri di più su Descriptive Statistics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by