Skip to content

Commit

Permalink
Make InverseGamma dist accessible #327
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Dec 13, 2022
1 parent 451e2ff commit f26710c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/beast/base/inference/distribution/InverseGamma.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package beast.base.inference.distribution;


import org.apache.commons.math.MathException;
import org.apache.commons.math.distribution.ContinuousDistribution;
import org.apache.commons.math.distribution.Distribution;

import beast.base.core.Description;
import beast.base.core.Function;
import beast.base.core.Input;
import beast.base.inference.parameter.RealParameter;
import org.apache.commons.math.MathException;
import org.apache.commons.math.distribution.ContinuousDistribution;
import org.apache.commons.math.distribution.Distribution;



Expand All @@ -19,7 +17,7 @@ public class InverseGamma extends ParametricDistribution {
final public Input<Function> alphaInput = new Input<>("alpha", "shape parameter, defaults to 2");
final public Input<Function> betaInput = new Input<>("beta", "scale parameter, defaults to 2");

InverseGammaImpl dist = new InverseGammaImpl(2, 2);
protected InverseGammaImpl dist = new InverseGammaImpl(2, 2);

@Override
public void initAndValidate() {
Expand Down Expand Up @@ -51,7 +49,7 @@ public Distribution getDistribution() {
return dist;
}

class InverseGammaImpl implements ContinuousDistribution {
public class InverseGammaImpl implements ContinuousDistribution {
double m_fAlpha;
double m_fBeta;
// log of the constant beta^alpha/Gamma(alpha)
Expand All @@ -61,7 +59,7 @@ class InverseGammaImpl implements ContinuousDistribution {
setAlphaBeta(alpha, beta);
}

void setAlphaBeta(double alpha, double beta) {
public void setAlphaBeta(double alpha, double beta) {
m_fAlpha = alpha;
m_fBeta = beta;
C = m_fAlpha * Math.log(m_fBeta) - org.apache.commons.math.special.Gamma.logGamma(m_fAlpha);
Expand Down

0 comments on commit f26710c

Please sign in to comment.