필터 지우기
필터 지우기

Weighted Least Squares, Need Help!!

조회 수: 1 (최근 30일)
SB
SB 2012년 10월 26일
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.

답변 (1개)

Tom Lane
Tom Lane 2012년 10월 27일
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.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by