pal.coalescent
Class ConstExpGrowth

java.lang.Object
  extended by pal.coalescent.DemographicModel
      extended by pal.coalescent.ConstantPopulation
          extended by pal.coalescent.ExponentialGrowth
              extended by pal.coalescent.ConstExpGrowth
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Parameterized, Report, Summarizable, Units
Direct Known Subclasses:
ConstExpConst

public class ConstExpGrowth
extends ExponentialGrowth
implements Report, Parameterized, java.io.Serializable

This class models a population that grows exponentially from an inital population size alpha N0 to a present-day size N0. (Parameters: N0=present-day population size; r=growth rate; alpha: ratio of population sizes). or (Parameters: N0=present-day population size; r=growth rate; N1: pre-growth ancestral population size). This model is nested with the exponential-growth model (alpha -> 0 or N1 = N0). It is similar but not identical to the model used in ExpandingPopulation.

Version:
$Id: ConstExpGrowth.java,v 1.10 2002/02/16 00:51:43 alexi Exp $
Author:
Alexei Drummond, Andrew Rambaut, 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
 double alpha
          ratio of pop.
static int ALPHA_PARAMETERIZATION
          use alpha instead of N1 parameterization
 double alphaSE
          standard error of time alpha
static int LX_PARAMETERIZATION
          use lx instead of growth parameterization
 double N1
          ancestral pop.
static int N1_PARAMETERIZATION
          use N1 instead of alpha parameterization
 double N1SE
          standard error of ancestral pop.
 int parameterization
          parameterization bit string:
first bit: 0 = ALPHA, 1 = N1
second bit: 0 = GROWTH RATE, 1 = LX
 
Fields inherited from class pal.coalescent.ExponentialGrowth
r, rSE
 
Fields inherited from class pal.coalescent.ConstantPopulation
N0, N0SE
 
Fields inherited from class pal.coalescent.DemographicModel
fo
 
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
 
Constructor Summary
ConstExpGrowth(double size, double growthParam, double ancestral, int units, int parameterization)
          Construct demographic model of an expanding population.
ConstExpGrowth(int units, int parameterization)
          Construct demographic model with default settings.
 
Method Summary
protected  void calculateRFromLx()
           
 java.lang.Object clone()
           
 double getAncestral()
          returns ancestral parameter.
 double getAncestralN0()
          returns ancestral population size
 double getDefaultValue(int k)
          get default value of parameter
 double getDemographic(double t)
          Gets the value of the demographic function N(t) at time t.
 double getGrowthParam()
           
 double getGrowthPhaseDuration()
           
 double getGrowthRate()
          This method overrides superclass to check parameterization.
 double getIntensity(double t)
          Returns value of demographic intensity function at time t (= integral 1/N(x) dx from 0 to t).
 double getInverseIntensity(double x)
          Returns value of inverse demographic intensity function (returns time, needed for simulation of coalescent intervals).
 double getLowerLimit(int k)
          get lower parameter limit
 int getNumParameters()
          get number of parameters
 double getParameter(int k)
          get model parameter
 int getParameterization()
           
 double getTransitionTime()
          Gets the time of transition from ancestral constant phase to exponential phase.
 double getUpperLimit(int k)
          get upper parameter limit
 boolean isLxParameterized()
           
 boolean isN1Parameterized()
           
 void report(java.io.PrintWriter out)
          print human readable report (e.g., on parameters and associated model)
 void setAncestral(double ancestral)
          Sets the ancestral parameter.
 void setGrowthParam(double g)
          Sets the growth parameter.
 void setGrowthPhaseDuration(double lx)
          Sets the length of the growth phase.
 void setParameter(double value, int k)
          set model parameter
 void setParameterization(int p)
          Sets the parameterization.
 void setParameterSE(double value, int k)
          set standard errors for model parameter
 java.lang.String toString()
           
 
Methods inherited from class pal.coalescent.ExponentialGrowth
getSummaryTypes, getSummaryValue
 
Methods inherited from class pal.coalescent.ConstantPopulation
getN0
 
Methods inherited from class pal.coalescent.DemographicModel
computeLogLikelihood, computeLogLikelihood, getIntegral, getLogL, getSimulatedInterval, getUnits, setLogL, setUnits, testConsistency
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALPHA_PARAMETERIZATION

public static final int ALPHA_PARAMETERIZATION
use alpha instead of N1 parameterization

See Also:
Constant Field Values

N1_PARAMETERIZATION

public static final int N1_PARAMETERIZATION
use N1 instead of alpha parameterization

See Also:
Constant Field Values

LX_PARAMETERIZATION

public static final int LX_PARAMETERIZATION
use lx instead of growth parameterization

See Also:
Constant Field Values

parameterization

public int parameterization
parameterization bit string:
first bit: 0 = ALPHA, 1 = N1
second bit: 0 = GROWTH RATE, 1 = LX


alpha

public double alpha
ratio of pop. sizes


alphaSE

public double alphaSE
standard error of time alpha


N1

public double N1
ancestral pop. size


N1SE

public double N1SE
standard error of ancestral pop. size

Constructor Detail

ConstExpGrowth

public ConstExpGrowth(int units,
                      int parameterization)
Construct demographic model with default settings.

Parameters:
parameterization - is a combination of bits representing the parameterization. Valid values are:
ALPHA_PARAMETERIZATION
N1_PARAMETERIZATION
ALPHA_PARAMETERIZATION | LX_PARAMETERIZATION
N1_PARAMETERIZATION | LX_PARAMETERIZATION

ConstExpGrowth

public ConstExpGrowth(double size,
                      double growthParam,
                      double ancestral,
                      int units,
                      int parameterization)
Construct demographic model of an expanding population.

Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class ExponentialGrowth

getTransitionTime

public double getTransitionTime()
Gets the time of transition from ancestral constant phase to exponential phase.


getAncestral

public double getAncestral()
returns ancestral parameter. This may be either N1 or alpha depending on the parameterization.


getGrowthParam

public double getGrowthParam()
Returns:
the growth parameter. This may be either growth rate or growth phase duration depending on the parameterization.

getGrowthRate

public double getGrowthRate()
This method overrides superclass to check parameterization.

Overrides:
getGrowthRate in class ExponentialGrowth

setAncestral

public void setAncestral(double ancestral)
Sets the ancestral parameter. This may be either N1 or alpha depending on the parameterization.


setGrowthParam

public void setGrowthParam(double g)
Sets the growth parameter. This may be either growth rate (r) or growth pahse duration (lx) depending on the parameterization.


getAncestralN0

public double getAncestralN0()
returns ancestral population size


getGrowthPhaseDuration

public double getGrowthPhaseDuration()
Returns:
the duration of the growth phase

setGrowthPhaseDuration

public void setGrowthPhaseDuration(double lx)
Sets the length of the growth phase. This method is only valid if ALPHA_LX_PARAMETERIZATION is used.


getParameterization

public int getParameterization()
Returns:
parameterization

isLxParameterized

public boolean isLxParameterized()
Returns:
true if using lx instead of growth rate.

isN1Parameterized

public boolean isN1Parameterized()
Returns:
true if using N1 instead of alpha.

setParameterization

public void setParameterization(int p)
Sets the parameterization.

Parameters:
parameterization - is a combination of bits representing the parameterization. Valid values are:
ALPHA_PARAMETERIZATION
N1_PARAMETERIZATION
ALPHA_PARAMETERIZATION | LX_PARAMETERIZATION
N1_PARAMETERIZATION | LX_PARAMETERIZATION

calculateRFromLx

protected void calculateRFromLx()

getDemographic

public double getDemographic(double t)
Description copied from class: DemographicModel
Gets the value of the demographic function N(t) at time t.

Overrides:
getDemographic in class ExponentialGrowth

getIntensity

public double getIntensity(double t)
Description copied from class: DemographicModel
Returns value of demographic intensity function at time t (= integral 1/N(x) dx from 0 to t).

Overrides:
getIntensity in class ExponentialGrowth

getInverseIntensity

public double getInverseIntensity(double x)
Description copied from class: DemographicModel
Returns value of inverse demographic intensity function (returns time, needed for simulation of coalescent intervals).

Overrides:
getInverseIntensity in class ExponentialGrowth

getNumParameters

public int getNumParameters()
Description copied from interface: Parameterized
get number of parameters

Specified by:
getNumParameters in interface Parameterized
Overrides:
getNumParameters in class ExponentialGrowth
Returns:
number of parameters

getParameter

public double getParameter(int k)
Description copied from interface: Parameterized
get model parameter

Specified by:
getParameter in interface Parameterized
Overrides:
getParameter in class ExponentialGrowth
Parameters:
k - parameter number
Returns:
parameter value

getUpperLimit

public double getUpperLimit(int k)
Description copied from interface: Parameterized
get upper parameter limit

Specified by:
getUpperLimit in interface Parameterized
Overrides:
getUpperLimit in class ExponentialGrowth
Parameters:
k - parameter number
Returns:
upper bound

getLowerLimit

public double getLowerLimit(int k)
Description copied from interface: Parameterized
get lower parameter limit

Specified by:
getLowerLimit in interface Parameterized
Overrides:
getLowerLimit in class ExponentialGrowth
Parameters:
k - parameter number
Returns:
lower bound

getDefaultValue

public double getDefaultValue(int k)
Description copied from interface: Parameterized
get default value of parameter

Specified by:
getDefaultValue in interface Parameterized
Overrides:
getDefaultValue in class ExponentialGrowth
Parameters:
k - parameter number
Returns:
default value

setParameter

public void setParameter(double value,
                         int k)
Description copied from interface: Parameterized
set model parameter

Specified by:
setParameter in interface Parameterized
Overrides:
setParameter in class ExponentialGrowth
Parameters:
value - parameter value
k - parameter number

setParameterSE

public void setParameterSE(double value,
                           int k)
Description copied from interface: Parameterized
set standard errors for model parameter

Specified by:
setParameterSE in interface Parameterized
Overrides:
setParameterSE in class ExponentialGrowth
Parameters:
value - standard error of parameter value
k - parameter number

toString

public java.lang.String toString()
Overrides:
toString in class ExponentialGrowth

report

public void report(java.io.PrintWriter out)
Description copied from interface: Report
print human readable report (e.g., on parameters and associated model)

Specified by:
report in interface Report
Overrides:
report in class ExponentialGrowth
Parameters:
out - output stream