class Gauss2dErrorDistribution( GaussErrorDistribution ) | Source |
---|
To calculate a Gauss likelihood in case of errors in X and Y
For one residual in x and y it holds
L = 1 / ( 2 π √ det ) exp( - 0.5 ( x / s )2 )
where s is the scale. s is a hyperparameter, which might be estimated from the data.
The scale s is also the square root of the variance of this error distribution.
The function is mostly used to calculate the likelihood L over N residuals, or easier to use log likelihood, logL.
logL = log( N / ( √( 2 π ) s ) ) - 0.5 ∑( x / s )2
Using weights this becomes
logL = log( ∑( w ) / ( √( 2 π ) s ) ) - 0.5 ∑( w ( x / s )2 )
Author Do Kester.
Gauss2dErrorDistribution( scale=1.0, limits=None, copy=None ) |
---|
Default Constructor.
Parameters
-
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 : GaussErrorDistribution
distribution to be copied.
copy( ) |
---|
TBDgetScale( 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
updateDeterminant( problem, scale ) |
---|
Parameters
- problem : ErrorsInXandYProblem
problem at hand - scale : float
present vale for the cale
logLikelihood_alt( problem, allpars ) |
---|
Alternate calculation
Parameters
- problem : Problem
to be solved - allpars : array_like
list of all parameters in 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
partialLogL_alt( problem, allpars, fitIndex ) |
---|
Alternate calculation
Parameters
- problem : Problem
to be solved. - allpars : array_like
(hyper)parameters of the problem - fitIndex : array_like
indices of parameters to be fitted
nextPartialData( problem, allpars, fitIndex, mockdata=None ) |
---|
Parameters
- problem : Problem
to be solved - allpars : array_like
(hyper)parameters of the problem - fitIndex : array_like of int
indices of allpars to fit - mockdata : array_like
as calculated for the problem
Methods inherited from GaussErrorDistribution |
---|
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 )
- numPartialLogL( problem, allpars, fitIndex )
- updateLogL( problem, allpars, parval=None )
- setResult( )
- hyparname( k )