class ExponentialErrorDistribution( ScaledErrorDistribution ) | Source |
---|
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 = s2 Γ( 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.
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.
copy( ) |
---|
acceptWeight( ) |
---|
toSigma( hypar ) |
---|
- hypar : array_like (2 floats)
the [scale,power] of this Exponential distribution.
logLikelihood_alt( problem, allpars ) |
---|
Parameters
- problem : Problem
to be solved - allpars : array_like
parameters of the problem
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
getChipow( problem, allpars=None, scale=1 ) |
---|
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 ) |
---|
Parameters
- problem : Problem
to be solved - allpars : array_like
None take parameters from problem.model
list of all parameters in the problem
partialLogL_alt( problem, allpars, fitIndex ) |
---|
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
nextPartialData( problem, allpars, fitIndex, mockdata=None ) |
---|
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
Methods inherited from ScaledErrorDistribution |
---|
Methods inherited from ErrorDistribution |
---|
- getGaussianScale( problem, allpars=None )
- getResiduals( problem, allpars=None )
- getChisq( problem, allpars=None )
- isBound( )
- keepFixed( fixed=None )
- setPriors( priors )
- domain2Unit( dval, ks )
- unit2Domain( uval, ks )
- logCLhood( problem, allpars )
- logLhood( problem, allpars )
- partialLogL( problem, allpars, fitIndex )
- numPartialLogL( problem, allpars, fitIndex )
- updateLogL( problem, allpars, parval=None )
- setResult( )
- hyparname( k )