BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class PoissonErrorDistribution( ErrorDistribution )Source

To calculate a Poisson likelihood.

For one observation with n counts it holds

  f( n,x ) = xn / ( ex * n! )

where x is the expected counts

The function is mostly used to calculate the likelihood L, or easier to use log likelihood, logL.

     logL = ∑( n * log( x ) - x - log( n! ) )

Weights are not accepted in this ErrorDistribution; they are silently ignored.

Author Do Kester.

PoissonErrorDistribution( copy=None )

Constructor.

Parameters

  • copy : PoissonErrorDistribution
         distribution to be copied.

copy( )

Return copy of this.

acceptWeight( )
True if the distribution accepts weights. Always false for this distribution.

getScale( problem, allpars=None )
Return the noise scale.

*** Gaussian approximation ***

Parameters

  • problem : Problem
         to be solved
  • allpars : array_like
         None take parameters from problem.model
         list of all parameters in the problem

logLikelihood_alt( problem, allpars )
Return the log( likelihood ) for a Poisson distribution.

Parameters

  • problem : Problem
         to be solved
  • allpars : array_like
         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

partialLogL_alt( problem, allpars, fitIndex )
Return the partial derivative of log( likelihood ) to the parameters.

Parameters

  • problem : Problem
         to be solved
  • allpars : array_like
         list of all parameters in the problem
  • fitIndex : array_like
         indices of parameters to be fitted

nextPartialData( problem, allpars, fitIndex, mockdata=None )
Return the partial derivative of log( likelihood ) to the parameters.

Parameters

  • problem : Problem
         to be solved
  • allpars : array_like
         list of all parameters in the problem
  • fitIndex : array_like
         indices of parameters to be fitted
  • mockdata : array_like
         as calculated by the model
Methods inherited from ErrorDistribution