simul_mle_fit¶
- nbi_stat.simul_mle_fit(regions, p0, *args, **kwargs)[source]¶
Perform simulatinous MLE fit over several regions
This will fit a combined function to data in several regions.
Each region has it’s own data and it’s own model function. The kind of MLE to do in each region can also be customized.
- Parameters:
regions (sequence of containers) –
A sequence of regions. Each region is specified as
- dataarray-like, (array-like,array-like)
Data for the region (either observations, or a binned data)
- funccallable
Function to model the data in the region. Note, all functions receive all parameters (except extended overall scaling). It is up to the user to extract the needed parameters for a given region
- kwdict (optional)
Additional keyword arguments to pass to the logarithmic likelihood function (either binned_llh or llh). These update the general keywords passed to simul_mle_fit
p0 (array-like) –
Initial parameters. This must be _all_ parameters used in the fit. Extended scale parameters must come first in the container.
Note, all functions in all regions receive _all_ parameters (except the extended scale parameters), and it is up to the user to filter out hte relevant parameters for a given region.
*args (tuple) – Additional arguments
**kwargs (dict) –
Keyword arguments
- extendedbool
Perform an extended MLE
- logpdfbool
If the functions are logarithmic PDFs pass True for this
- normalizedbool
If we’re doing extended fits, and the PDFs are not normalised pass False for this. Has no effect for Poisson binned fits.
- xtracallable
Extra stuff to add to logarithmic PDF
- densitybool, int, float
For binned likelihood fits.
- cdfbool
For binned likelihood fits
- poissonbool
For binned likelihood fits.
- raw_narray-like
Cached calculation of raw count equivalent
- log_Gamma_Nnfloat
Cached calculation of binned corrections
Other arguments are passed to scipy.optimize.minimize
- Returns:
p (array-like) – Found parameter values (including possibly extended normalisations)
cov (array-like) – Covariance of parameters
opt (OptimizeResult (optional)) – If full_output=True is passed, also get full result from minimize.
See also
mle_fit
,llh
,binned_llh
,plot_fit
,plot_nsigma_contour
,fit