MixedErrorDistribution = class MixedErrorDistribution(ErrorDistribution) |
|
MixedErrorDistribution(errdis1, errdis2, fraction=0.5, limits=None, copy=None)
To calculate a mixture of two likelihoods.
For one residual, x, it holds
L( x ) = f * L1( x ) + ( 1 - f ) * L2( x )
where f is the contributing fraction while L, L1 and L2 are likelihoods
f is a hyperparameter between [0..1]
The likelihood over N datapoints is
L = Π{ L( x ) } = Π( f * L1( x ) + ( 1 - f ) * L2( x ) )
And the log of L is
logL = ∑ logL( x ) = ∑( log( f * L1(x) + ( 1 - f ) * L2(x) ) )
Note
----
The mixture, i.e. the weighted sum of 2 distributions for each residual, is
the raison-d'etre for the methods logLdata and nextPartialData, so individual
contributions can be weighted, added, log-ged and summed.
Author Do Kester. |
|
- Method resolution order:
- MixedErrorDistribution
- ErrorDistribution
- builtins.object
Constructor:
- MixedErrorDistribution( errdis1, errdis2, fraction=0.5, limits=None, copy=None )
- Constructor.
Make a new error distribution as a fraction of errdis1 plus the rest of errdis2.
Parameters
----------
errdis1 : ErrorDistribution
First error distribution
errdis2 : ErrorDistribution
Second error distribution (might be of the same class as errdis1)
It *must* have the same xdata, data, weights as errdis1.
fraction : float
contributing fraction
limits : None or list of 2 floats [low,high]
None : no limits implying fixed fraction
low low limit on fraction ( >0)
high high limit on fraction ( <1)
when limits are set, the scale is *not* fixed.
copy : MixedErrorDistribution
distribution to be copied.
Methods defined here:
- acceptWeight()
- True if the distribution accepts weights.
Always true for this distribution.
- copy()
- Return copy of this.
- logLdata( problem, allpars, mockdata=None )
- Return the log( likelihood ) for a Mixedian distribution.
Parameters
----------
problem : Problem
to be solved
allpars : array_like
list of all parameters in the problem
mockdata : array_like
as calculated for the problem
- nextPartialData( problem, allpars, fitIndex, mockdata=None )
- Return the partial derivative of log( likelihood ) to the parameters in fitIndex.
Parameters
----------
problem : Problem
to be solved
allpars : array_like
parameters of the problem
fitIndex : array_like
indices of parameters to be fitted
mockdata : array_like
as calculated for the problem
Methods inherited from ErrorDistribution:
- domain2Unit( dval, ks )
- getChisq( problem, allpars=None )
- getGaussianScale( problem, allpars=None )
- getResiduals( problem, allpars=None )
- hyparname( k )
- isBound()
- keepFixed( fixed=None )
- logCLhood( problem, allpars )
- logLhood( problem, allpars )
- numPartialLogL( problem, allpars, fitIndex )
- partialLogL( problem, allpars, fitIndex )
- partialLogL_alt( problem, allpars, fitIndex )
- setLimits( limits )
- setPriors( priors )
- setResult()
- toSigma( scale )
- unit2Domain( uval, ks )
- updateLogL( problem, allpars, parval=None )
|
|