BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class JeffreysPrior( Prior )Source

Jeffreys prior distribution, for scale-like parameters.

Jeffreys prior is a improper prior ( i.e. its integral is unbound ).

Because of that it always needs limits, low and high, such that 0 < low < high < +Inf.

  Pr( x ) = 1.0 / ( x * norm ) if ( low < x < high ) else 0

where norm = log( high ) - log( low )

No limits are set by default.

domain2unit:
     u = ( log( d ) - log( lo ) ) / ( log( hi ) - log( lo ) ); unit2domain:
     d = exp( u * ( log( hi ) - log( lo ) ) + log( lo ) );

Examples

pr = JeffreysPrior()                       # unbound prior
pr = JeffreysPrior( limits=[0.1,1.0] )     # limited to the range [0.1,1.0]

Hidden Attributes

  • _logLo : float
         log( lowLimit )
  • _norm : float
         log( highLimit / lowLimit )

Attributes from Prior

lowLimit, highLimit, deltaP, _lowDomain, _highDomain

The default of lowLimit and _lowDomain is zero.

JeffreysPrior( limits=None, prior=None )

Default constructor.

Parameters

  • limits : list of 2 floats
         2 limits resp. low and high
  • prior : JeffreysPrior
         prior to copy (with new limits if applicable)

copy( )

getIntegral( )
Return the integral of JeffreysPrior from lowLimit to highLimit.

domain2Unit( dval )
Return a value in [0,1] given a value within the valid domain of a parameter for a Jeffreys distribution.

Parameters

  • dval : float
         value within the domain of a parameter

unit2Domain( uval )
Return a value within the valid domain of the parameter given a value between [0,1] for a Jeffreys distribution.

Parameters

  • uval : float
         value within [0,1]

result( x )
Return a the result of the distribution function at x.

Parameters

  • x : float
         value within the domain of a parameter

partialLog( p )
Return partial derivative of log( Prior ) wrt parameter.

Parameters

  • p : float
         the value

isBound( )

Return true if the integral over the prior is bound.

shortName( )

Return a string representation of the prior.

Methods inherited from Prior