Re: Linear fit with user defined weights [message #67248] |
Sat, 18 July 2009 02:43 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Jul 16, 2:03 pm, loknath <ladhik...@gmail.com> wrote:
> Hi,
> Is there a way to calculate the best fit curve for linear fit with
> user defined weights? I looked up linfit, but it does not take weight.
> Ladfit also does not take user defined weights.
Wayne's solution is a fine one. If you insist on using weights
explicitly, you can use MPFITFUN() with the WEIGHTS= keyword.
http://purl.com/net/mpfit
Happy fitting,
Craig
|
|
|
Re: Linear fit with user defined weights [message #67327 is a reply to message #67248] |
Thu, 16 July 2009 12:04  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Jul 16, 2:03 pm, loknath <ladhik...@gmail.com> wrote:
> Hi,
> Is there a way to calculate the best fit curve for linear fit with
> user defined weights? I looked up linfit, but it does not take weight.
> Ladfit also does not take user defined weights.
>
> thanks
Most of the IDL fitting routines (including LINFIT) use the
MEASURE_ERROR keyword to assign weights. Internally, the program
then assigns a weight, wt for a given measurement error, sdev by the
formula
wt = 1/sdev^2
So you if have weights from some other origin besides measurement
errors, you could set MEASURE_ERROR = 1./sqrt(wt)
--Wayne
|
|
|