Bayesian fitter design criteria
A primary goal will be program modularity.
It must be possible to easily change the fitting function, fit criteria, etc, preferably at runtime.
To do this, it will be necessary to think of the program in a few separate black-boxes:
- model
- data
- priors
- chi^2 routine
- fitting routine
The input/output of each is described below:
model
The model is the functional form we want to fit to.
Since we will likely want to try many functions, this should be easy to tailor.
Inputs to the model should be a vector of parameters.
data
This is the stuff we want to fit to the model.
In its most basic form, the data is just a set of x-y values.
But in our case, the data will have additional information, such as
- the source and sink operators
- configuration number (or at least an ordering)
- a correlation matrix, possibly taking binning into account
priors
The priors help the Bayes fitter stay within a reasonable range.
They are a cross between the model and the data, since they depend on the
data, but the vector of priors must be of the same length as the vector of
model parameters.
We'll have to think about how to organize these in the program.
There should be a default prior as well, that doesn't constrain the fit at all.
chi^2 routine
The chi^2 routine simply calculates chi^2_aug.
fitter
The fitter is responsible for adjusting the fit parameters.
In the case of non-linear least-squares, we will use the Levenberg-Marquardt
method.
Therefore this routine must generate the alpha matrix and beta vector, as
well as having the ability to find alpha^{-1}, which will require a SVD inverse
algorithm.
Inputs to the fitter are the model and data (and priors).
It then uses the chi^2 routine to adjust the model parameters.
Questions
Probably the most confusing part of this is exactly where to put the priors (and even the model parameters).
Model parameters could be thought of as part of the model, or as separate entities, since they depend on the data.
A similar argument can be made for the priors.