class ModelDistribution( ScaledErrorDistribution ) | Source |
---|
To calculate the probability of a model M from a set of models S, given some data D, use Bayes rule
P( M|DS ) = P( M|S ) * P( D|MS ) / P( D|S )
posterior = prior * likelihood / evidence
This class calculates the likelihood P( D|MS ). On another level where we calculate the probability of the parameters p, we see this likelhood appear as evidence P( D|M ).
Again using Bayes
P( p|DM ) = P( p|M ) * P( D|pM ) / P( D|M )
The evidence here is calculated as the integral over a Gausian approximation of the posterior.
Author Do Kester.
ModelDistribution( arbiter=None, scale=1.0, limits=None, copy=None, **kwargs ) |
---|
Default Constructor.
Parameters
-
arbiter : None or BaseFitter or str
to provide the evidence
None select fitter automatically
BaseFiter Use this fitter
str "fitter", "levenberg", "curve", "amoeba", "NestedSampler" -
scale : float
noise scale -
limits : None or list of 2 floats [low,high]
None : no limits implying fixed scale
low low limit on scale (needs to be >0)
high high limit on scale
when limits are set, the scale is not fixed. -
copy : ModelDistribution
distribution to be copied. -
kwargs : dict
to be applied to arbiter
copy( ) |
---|
acceptWeight( ) |
---|
logLikelihood_alt( problem, allpars ) |
---|
Alternate calculation
Parameters
- problem : Problem
to be solved - allpars : array_like
list of all parameters in the problem
Return optimal parameters of the fit
logLdata( problem, allpars, mockdata=None ) |
---|
logL = sum( logLdata )
Parameters
- problem : Problem
to be solved - allpars : array_like
list of all parameters in the problem - mockdata : array_like
as calculated by the model
Methods inherited from ScaledErrorDistribution |
---|
Methods inherited from ErrorDistribution |
---|
- getGaussianScale( problem, allpars=None )
- getResiduals( problem, allpars=None )
- getChisq( problem, allpars=None )
- toSigma( scale )
- isBound( )
- keepFixed( fixed=None )
- setPriors( priors )
- domain2Unit( dval, ks )
- unit2Domain( uval, ks )
- logCLhood( problem, allpars )
- logLhood( problem, allpars )
- partialLogL( problem, allpars, fitIndex )
- partialLogL_alt( problem, allpars, fitIndex )
- numPartialLogL( problem, allpars, fitIndex )
- updateLogL( problem, allpars, parval=None )
- setResult( )
- hyparname( k )