[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OT: finding the weights used in weighted least squares regression
From: |
Kamaraju S Kusumanchi |
Subject: |
Re: OT: finding the weights used in weighted least squares regression |
Date: |
Wed, 27 Apr 2011 10:11:44 -0400 |
User-agent: |
KNode/4.4.7 |
Ben Abbott wrote:
> Ok. I see my mistake now. Essentially you want to solve for W where ...
>
> diag (W) * (A * x - b) = c
>
> But you don't know "c". However, you do know that "c" are the least square
> errors.
>
> I don't see a direct solution. Would an iterative solution work?
Yes, an iteration solution is also fine.
> I don't know how stable it would be but, is something like below
> acceptable?
>
> err = @(u) x - (diag (u) * A) \ (diag (u) * b);
> W = fsolve (err, ones (n, 1))
>
This gives me an error
octave:11> err = @(u) x - (diag (u) * A) \ (diag (u) * b);
octave:12> W = fsolve (err, ones (n, 1))
error: fsolve: unable to solve non-square systems
error: fsolve: evaluation of user-supplied function failed
error: evaluating assignment expression near line 12, column 3
The documentation of fsolve (help fsolve), does not clearly tell how to
specify the FCN argument. Could you please help me out with the error?
thanks
--
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/
Re: OT: finding the weights used in weighted least squares regression, Mike Miller, 2011/04/28