Class DemographicModel

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Parameterized, Report, Summarizable, Units
    Direct Known Subclasses:
    ConstantPopulation

    public abstract class DemographicModel
    extends java.lang.Object
    implements Units, Parameterized, Report, java.lang.Cloneable, java.io.Serializable, Summarizable
    This abstract class contains methods that are of general use for modelling coalescent intervals given a demographic model. Parts of this class were derived from C++ code provided by Oliver Pybus.
    Version:
    $Id: DemographicModel.java,v 1.12 2002/02/02 08:32:52 alexi Exp $
    Author:
    Alexei Drummond, Korbinian Strimmer
    See Also:
    Serialized Form
    • Constructor Detail

      • DemographicModel

        public DemographicModel()
    • Method Detail

      • clone

        public abstract java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • getDemographic

        public abstract double getDemographic​(double t)
        Gets the value of the demographic function N(t) at time t.
      • getIntensity

        public abstract double getIntensity​(double t)
        Returns value of demographic intensity function at time t (= integral 1/N(x) dx from 0 to t).
      • getInverseIntensity

        public abstract double getInverseIntensity​(double x)
        Returns value of inverse demographic intensity function (returns time, needed for simulation of coalescent intervals).
      • getSimulatedInterval

        public double getSimulatedInterval​(int numLin,
                                           double timeOfLastCoal)
        Returns an random interval size selected from the Kingman prior of the demographic model.
      • getIntegral

        public double getIntegral​(double start,
                                  double finish)
        Calculates the integral 1/N(x) dx between start and finish.
      • computeLogLikelihood

        public double computeLogLikelihood​(double width,
                                           double timeOfPrevCoal,
                                           int numLineages)
        Returns the likelihood of a given *coalescent* interval
      • computeLogLikelihood

        public double computeLogLikelihood​(double width,
                                           double timeOfPrevCoal,
                                           int numLineages,
                                           int type)
        Returns the likelihood of a given interval,coalescent or otherwise.
      • setUnits

        public void setUnits​(int u)
        sets units of measurement.
        Parameters:
        u - units
      • getUnits

        public int getUnits()
        returns units of measurement.
      • setLogL

        public void setLogL​(double l)
        sets log likelihood
        Parameters:
        l - log-likelihood
      • getLogL

        public double getLogL()
        returns log-likelihood.
      • testConsistency

        public void testConsistency​(int steps,
                                    double maxTime)
        This function tests the consistency of the getIntensity and getInverseIntensity methods of this demographic model. If the model is inconsistent then a RuntimeException will be thrown.
        Parameters:
        model - the demographic model to test.
        steps - the number of steps between 0.0 and maxTime to test.
        maxTime - the maximum time to test.