mpfit question [message #78786] |
Tue, 20 December 2011 09:02  |
Russell[1]
Messages: 101 Registered: August 2011
|
Senior Member |
|
|
I searched these pages thinking this has been raised. I'm sure this
is my mistake or misunderstanding, but if anyone has advice I'm all
ears.
I'm using mpfit.pro as part of a multi-stage fitting routine to model
the spectra of galaxies (1) brute-force fit over a grid of models, (2)
mpfit to refine that solution so it's "off-the-grid", and (3) run an
MCMC to marginalize over a few parameters --- the initial conditions
of each stage are taken from the previous stage. I know certain
parameters must be constrained within a range (for example, the
distance cannot be negative), so I'm using that in the parinfo
structure. For most galaxies this procedure works perfectly, but
occasionally, I run into a problem child where the covariance matrix
as returned by mpfit has a column (and row) of all 0.0. I'm using
this covariance matrix as initial proposal distribution for the MCMC,
so things go haywire when this happens. I suspect the column/row of
zeroes is because that parameter hit the boundary or isn't properly
varied in the LM-fitting. Does anyone have any experience with this?
Will the parameters GTOL, XTOL, FTOL help? Or is this a problem with
the entries in the parinfo structure (such as STEP or RELSTEP)?
Thanks!
Russell
|
|
|
Re: mpfit question [message #78839 is a reply to message #78786] |
Wed, 21 December 2011 18:44  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Dec 20, 12:02 pm, Russell <rryan....@gmail.com> wrote:
> I searched these pages thinking this has been raised. I'm sure this
> is my mistake or misunderstanding, but if anyone has advice I'm all
> ears.
>
> I'm using mpfit.pro as part of a multi-stage fitting routine to model
> the spectra of galaxies (1) brute-force fit over a grid of models, (2)
> mpfit to refine that solution so it's "off-the-grid", and (3) run an
> MCMC to marginalize over a few parameters --- the initial conditions
> of each stage are taken from the previous stage. I know certain
> parameters must be constrained within a range (for example, the
> distance cannot be negative), so I'm using that in the parinfo
> structure. For most galaxies this procedure works perfectly, but
> occasionally, I run into a problem child where the covariance matrix
> as returned by mpfit has a column (and row) of all 0.0. I'm using
> this covariance matrix as initial proposal distribution for the MCMC,
> so things go haywire when this happens. I suspect the column/row of
> zeroes is because that parameter hit the boundary or isn't properly
> varied in the LM-fitting. Does anyone have any experience with this?
> Will the parameters GTOL, XTOL, FTOL help? Or is this a problem with
> the entries in the parinfo structure (such as STEP or RELSTEP)?
Greetings--
This *could* be a problem of your parameter touching a boundary. But
that should be obvious for you to find out since you set the
boundaries.
But I suspect this is more likely to be a problem of the category "why
doesn't my fit converge?"
http://www.physics.wisc.edu/~craigm/idl/fitqa.html#parstep
Basically I recommend checking that your parameter values are all of
about the same magnitude. If they aren't, then scale and/or offset
them so that they are.
Also, I don't say it in my FAQ but the model should have approximately
the same *sensitivity* to parameter variations. So if you are fitting
parameters a and b, where a=1.00000000+/-0.00000001 and b=1.0+/-0.1,
then you are likely have problems. Again, scale and/or offset your
parameters so that they have comparable magnitudes and variations.
This means that your model will need to understand how to re-scale and/
or re-offset the variable to make a real physically meaningful
parameter, but so be it. Doing this often helps a lot.
Happy {fitting,new year}!
Craig
|
|
|