Borrar filtros
Borrar filtros

Weighted Least Squares, Need Help!!

1 visualización (últimos 30 días)
SB
SB el 26 de Oct. de 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.

Respuestas (1)

Tom Lane
Tom Lane el 27 de Oct. de 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.

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by