pal.coalescent
Class DemographicModel

java.lang.Object
  |
  +--pal.coalescent.DemographicModel
All Implemented Interfaces:
java.lang.Cloneable, Parameterized, Report, java.io.Serializable, 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 inspired by C++ code generously provided by Oliver Pybus.

See Also:
Serialized Form

Field Summary
protected  FormattedOutput fo
           
 
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, YEARS
 
Constructor Summary
DemographicModel()
           
 
Method Summary
abstract  java.lang.Object clone()
           
 double computeLogLikelihood(double width, double timeOfPrevCoal, int numLineages)
          Returns the likelihood of a given *coalescent* interval
 double computeLogLikelihood(double width, double timeOfPrevCoal, int numLineages, int type)
          Returns the likelihood of a given interval,coalescent or otherwise.
abstract  double getDemographic(double t)
          Gets the value of the demographic function N(t) at time t.
 double getIntegral(double start, double finish)
          Calculates the integral 1/N(x) dx between start and finish.
abstract  double getIntensity(double t)
          Returns value of demographic intensity function at time t (= integral 1/N(x) dx from 0 to t).
abstract  double getInverseIntensity(double x)
          Returns value of inverse demographic intensity function (returns time, needed for simulation of coalescent intervals).
 double getLogL()
          returns log-likelihood.
 double getSimulatedInterval(int numLin, double timeOfLastCoal)
          Returns an random interval size selected from the Kingman prior of the demographic model.
 int getUnits()
          returns units of measurement.
 void setLogL(double l)
          sets log likelihood
 void setUnits(int u)
          sets units of measurement.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pal.misc.Parameterized
getDefaultValue, getLowerLimit, getNumParameters, getParameter, getUpperLimit, setParameter, setParameterSE
 
Methods inherited from interface pal.misc.Report
report
 
Methods inherited from interface pal.misc.Summarizable
getSummaryTypes, getSummaryValue
 

Field Detail

fo

protected FormattedOutput fo
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.