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

Home » Public Forums » archive » MPFIT: 95% Confidence Interval ?
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
MPFIT: 95% Confidence Interval ? [message #90206] Tue, 10 February 2015 16:20 Go to next message
limiqt is currently offline  limiqt
Messages: 27
Registered: October 2013
Junior Member
Hi everyone,

I was wondering if someone knows how to plot the 95% CI using the MPFIT curve fitting (http://www.physics.wisc.edu/~craigm/idl/fitting.html).

In the example I can fit my model but now I need to plot the 95% CI as well as the prediction intervals.

;====
Pro fitmydata

X=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Y=[5, 10, 6, 20, 30, 20, 60, 90, 70, 100]

expr='P[0]*(X^P[1])'
start = [1D, 0.5]
Yfit = MPFITEXPR(expr, X, Y, 1, start)
fitS=Yfit(0)*(X^Yfit(1))

cgwindow
cgplot, X, Y, psym=16,symsize=1, /noerase, /AddCMD
cgoplot,X, fitS, thick=2, color='red',/AddCMD

End

;====

I will appreciate any assistance,

Thanks,

Lim
Re: MPFIT: 95% Confidence Interval ? [message #90214 is a reply to message #90206] Wed, 11 February 2015 09:36 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Tuesday, February 10, 2015 at 6:20:42 PM UTC-6, Lim wrote:
> Hi everyone,
>
> I was wondering if someone knows how to plot the 95% CI using the MPFIT curve fitting (http://www.physics.wisc.edu/~craigm/idl/fitting.html).
>

According to the documentation, you can return the covariance matrix. From there, you can find the CI you're looking for (given some assumptions about how everything is distributed, of course.)

Might be a good idea to curl up with a good stats book. Bevington is good one to start with...
Re: MPFIT: 95% Confidence Interval ? [message #90216 is a reply to message #90206] Wed, 11 February 2015 13:44 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Tuesday, February 10, 2015 at 7:20:42 PM UTC-5, Lim wrote:
> Hi everyone,
>
> I was wondering if someone knows how to plot the 95% CI using the MPFIT curve fitting (http://www.physics.wisc.edu/~craigm/idl/fitting.html).
>
> In the example I can fit my model but now I need to plot the 95% CI as well as the prediction intervals.

For advanced usage I recommend using MPFITFUN instead of MPFITEXPR. Both functions return the 1-sigma standard errors with the PERROR keyword, and the covariance matrix with the COVAR keyword.

The MPPROPERR function can produce propagated confidence limits on your model function. An example is included in the documentation.

Note that 68% confidence is +/- 1 sigma, and
95% confidence is +/- 2 sigma, so just multiply the 1-sigma errors by 2.

I should also say that in my field of research, it's not simply enough to compute the parameter errors via the covariance matrix. Usually one does a parameter grid search. Numerical Recipes discusses this type of work.

Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: image function question
Next Topic: Motley library on Sourceforge

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

Current Time: Wed Oct 08 07:16:46 PDT 2025

Total time taken to generate the page: 0.00469 seconds