ExponentialErrorDistribution = class ExponentialErrorDistribution(ScaledErrorDistribution) |
|
ExponentialErrorDistribution(scale=1.0, power=2.0, limits=None, copy=None)
Also known as generalized gaussian errordistribution.
To calculate an Exponential likelihood.
For one residual, x, it holds
f( x ) = p / ( 2 s Γ( 1 / p ) ) exp( - ( |x| / s ) ^ p )
where s is the scale and p is the power.
s and p are hyperparameters, which might be estimated from the data.
The variance of this function is
σ ^ 2 = s ^ 2 Γ( 3 / p ) / Γ( 1 / p )
See toSigma()
The function is mostly used to calculate the likelihood L over N residuals,
or easier to use log( L )
logL = log( N p / ( 2 s Γ( 1 / p ) ) ) - ∑( ( |x| / s ) ^ p )
Using weights this becomes:
logL = log( ∑( w ) p / ( 2 s Γ( 1 / p ) ) ) - ∑( w ( |x| / s ) ^ p )
Note
----
The scale s in Exponential is NOT the same as the scale in Gaussian or in Laplace.
Attributes from ErrorDistibution
--------------------------------
hyperpar, deltaP, ncalls, nparts, sumweight,
ndata, hypar, nphypar
Author Do Kester. |
|
- Method resolution order:
- ExponentialErrorDistribution
- ScaledErrorDistribution
- ErrorDistribution
- builtins.object
Constructor:
- ExponentialErrorDistribution( scale=1.0, power=2.0, limits=None, copy=None )
- Default Constructor.
Parameters
----------
scale : float
noise scale
power : float
power of the distribution
limits : None or [low,high] or [[low],[high]]
None : no limits implying fixed scale
low low limit on scale (needs to be >0)
high high limit on scale
[low] low limit on [scale,power] (need to be >0)
[high] high limit on [scale,power]
when limits are set, the scale cq. power are *not* fixed.
copy : ExponentialErrorDistribution
distribution to be copied.
Methods defined here:
- acceptWeight()
- True if the distribution accepts weights.
Always true for this distribution.
- copy()
- Return copy of this.
- getChipow( problem, allpars=None, scale=1)
- Return chisq.
return Sum over the (weighted) powered residuals
Parameters
----------
problem : Problem
to be solved
allpars : array_like
None take parameters from problem.model
list of all parameters in the problem
scale : float or array_like
present scale
- getScale( problem, allpars=None )
- Return the noise scale calculated from the residuals.
Parameters
----------
problem : Problem
to be solved
allpars : array_like
None take parameters from problem.model
list of all parameters in the problem
- logLdata( problem, allpars, mockdata=None )
- Return the log( likelihood ) for each residual
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
- logLikelihood_alt( problem, allpars )
- Return the log( likelihood ) for a Gaussian distribution.
Parameters
----------
problem : Problem
to be solved
allpars : array_like
parameters of the problem
- nextPartialData( problem, allpars, fitIndex, mockdata=None )
- Return the partial derivative of all elements of the log( likelihood )
to the parameters.
dL/ds is not implemented for problems with accuracy
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 by the model
- partialLogL_alt( problem, allpars, fitIndex )
- Return the partial derivative of log( likelihood ) to the parameters.
dL/ds is not implemented for problems with accuracy
Parameters
----------
problem : Problem
to be solved
allpars : array_like
parameters of the problem
fitIndex : array_like
indices of parameters to be fitted
- toSigma( hypar )
- Return sigma, the squareroot of the variance.
Parameter
--------
hypar : array_like (2 floats)
the [scale,power] of this Exponential distribution.
Methods inherited from ScaledErrorDistribution:
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 )
- setPriors( priors )
- setResult()
- unit2Domain( uval, ks )
- updateLogL( problem, allpars, parval=None )
|
|