comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Linear fit with user defined weights
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Linear fit with user defined weights [message #67248] Sat, 18 July 2009 02:43
Craig Markwardt is currently offline  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 Go to previous message
wlandsman is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: SIZE() vs. N_ELEMENTS()
Next Topic: Re: Best form factor for a NetCDF package of a dataset

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 22:31:36 PDT 2025

Total time taken to generate the page: 0.16118 seconds