Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain how to get n-sigma errors/covariance matrix in basic tutorial #173

Closed
jetteodder opened this issue Nov 11, 2015 · 6 comments · Fixed by #563
Closed

Explain how to get n-sigma errors/covariance matrix in basic tutorial #173

jetteodder opened this issue Nov 11, 2015 · 6 comments · Fixed by #563

Comments

@jetteodder
Copy link

After running migrad I get out the sigma=1 errors if I initially set errordef=1. However, I'd also like to access the sigma=2 errors without running migrad again (extremely slow!). In pyminuit I could simply run hesse setting up=4, but it seems the parameter up is not defined for iminuit. I cannot find the workaround anywhere in the documentation and would therefore like to ask here for a solution.
Thanks a lot,
Jette

@cdeil cdeil added the question label Feb 6, 2016
@cdeil cdeil added this to the long term milestone Feb 6, 2016
@cdeil
Copy link
Collaborator

cdeil commented Feb 6, 2016

@jetteodder - Could you please post a minimal working example of what you want to compute using pyminuit?

I'll then try to reproduce it with iminuit. At the moment it's not clear to me if what you ask is possible and I don't have time to play around myself.

@jetteodder
Copy link
Author

Hi Christoph,

Thanks for looking into this.
Attached please find a minimum working example of code using pyminuit that I’d like to port to iminut.
The key is that I want to change the value of the parameter called errordef for iminuit (up for pyminuit) and see what that does to the estimated errors (rerunning hesse) without having to minimise the function all over again (as I typically work with very complex functions where rerunning migrad takes longer than just rerunning hesse).

Best,
Jette

@cdeil
Copy link
Collaborator

cdeil commented Feb 8, 2016

@jetteodder - Github doesn't allow attachments.

Can you put the example e.g. into a gist and link to it from the Github issue?

@jetteodder
Copy link
Author

Just pasted it below, seems a whole lot easier…
/Jette

import minuit as minuit
import time

def f(x,y,z):
return (x-1)**2+(y-2)**2+(z-3)**2

m = minuit.Minuit(f)
t1=time.clock()
m.migrad()
t2=time.clock()
print "time for migrad: %0.1e" %(t2-t1)
print m.up
print m.values
print m.errors
m.up = 0.25
t1=time.clock()
m.hesse()
t2=time.clock()
print "time for hesse: %0.1e" %(t2-t1)
print m.up
print m.values
print m.errors
t1=time.clock()
m.migrad()
t2=time.clock()
print "time for second migrad: %0.1e" %(t2-t1)

From: Christoph Deil <notifications@github.commailto:notifications@github.com>
Reply-To: iminuit/iminuit <reply@reply.github.commailto:reply@reply.github.com>
Date: Monday 8 February 2016 11:56
To: iminuit/iminuit <iminuit@noreply.github.commailto:iminuit@noreply.github.com>
Cc: Jette Oddershede <jeto@fysik.dtu.dkmailto:jeto@fysik.dtu.dk>
Subject: Re: [iminuit] What is the iminuit-equivalent to "up" for hesse in pyminuit? (#173)

@jetteodderhttps://github.com/jetteodder - Github doesn't allow attachments.

Can you put the example e.g. into a gisthttps://gist.github.com/ and link to it from the Github issue?


Reply to this email directly or view it on GitHubhttps://github.com//issues/173#issuecomment-181306077.

@cdeil
Copy link
Collaborator

cdeil commented Aug 24, 2018

@jetteodder - You can get 1, 2, 3 sigma errors like this:

errors_1_sigma = 1 * m.np_errors()
errors_2_sigma = 2 * m.np_errors()
errors_3_sigma = 3 * m.np_errors()

No need to run MIGRAD or HESSE multiple times.

This was discussed at length by @HDembinski and me in #215

@HDembinski - the only place sigma is mentioned in the tutorial is here for plotting:
http://nbviewer.jupyter.org/github/iminuit/iminuit/blob/master/tutorial/tutorial.ipynb#Plotting

I'd suggest to add a short mention of how to get errors and merrrors with sigma !=1 already before the plotting section, in http://nbviewer.jupyter.org/github/iminuit/iminuit/blob/master/tutorial/tutorial.ipynb#Parameter-uncertainties,-covariances,-and-confidence-intervals

@HDembinski - Can you make a notebook edit or should I?

@HDembinski
Copy link
Member

I am really busy for the next two months, so if you could do it I would be very grateful.

@cdeil cdeil self-assigned this Aug 24, 2018
@HDembinski HDembinski changed the title What is the iminuit-equivalent to "up" for hesse in pyminuit? Explain how to get n-sigma errors/covariance matrix in basic tutorial Sep 11, 2018
@HDembinski HDembinski modified the milestones: 1.4, 2.0 Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants