Package pal.coalescent
Class DemographicModel
- java.lang.Object
-
- pal.coalescent.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pal.misc.Parameterized
Parameterized.Null, Parameterized.ParameterizedBase, Parameterized.ParameterizedUser, Parameterized.Utils
-
-
Field Summary
Fields Modifier and Type Field Description protected FormattedOutput
fo
-
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
-
-
Constructor Summary
Constructors Constructor Description DemographicModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Object
clone()
double
computeLogLikelihood(double width, double timeOfPrevCoal, int numLineages)
Returns the likelihood of a given *coalescent* intervaldouble
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 likelihoodvoid
setUnits(int u)
sets units of measurement.void
testConsistency(int steps, double maxTime)
This function tests the consistency of the getIntensity and getInverseIntensity methods of this demographic model.-
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.Summarizable
getSummaryTypes, getSummaryValue
-
-
-
-
Field Detail
-
fo
protected FormattedOutput fo
-
-
Method Detail
-
clone
public abstract java.lang.Object clone()
- Overrides:
clone
in classjava.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.
-
-