| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.evomodel.coalescent; |
| 27 |
|
| 28 |
import dr.evolution.coalescent.DemographicFunction; |
| 29 |
import dr.evolution.coalescent.FlexibleGrowth; |
| 30 |
import dr.evomodelxml.coalescent.AsymptoticGrowthModelParser; |
| 31 |
import dr.inference.model.Parameter; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public class AsymptoticGrowthModel extends DemographicModel { |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public AsymptoticGrowthModel(Parameter asymptoteValueParameter, Parameter shapeParameter, Type units) { |
| 47 |
|
| 48 |
this(AsymptoticGrowthModelParser.ASYMPTOTIC_GROWTH_MODEL, asymptoteValueParameter, shapeParameter, units); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
public AsymptoticGrowthModel(String name, Parameter asymptoteValueParameter, Parameter shapeParameter, |
| 55 |
Type units) { |
| 56 |
|
| 57 |
super(name); |
| 58 |
|
| 59 |
flexibleGrowth = new FlexibleGrowth(units); |
| 60 |
|
| 61 |
this.asyptoteValue = asymptoteValueParameter; |
| 62 |
addVariable(asymptoteValueParameter); |
| 63 |
asymptoteValueParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 64 |
|
| 65 |
|
| 66 |
this.shapeParameter = shapeParameter; |
| 67 |
addVariable(shapeParameter); |
| 68 |
shapeParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0, 1)); |
| 69 |
|
| 70 |
|
| 71 |
setUnits(units); |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
public DemographicFunction getDemographicFunction() { |
| 78 |
|
| 79 |
double asymptoteValue = asyptoteValue.getParameterValue(0); |
| 80 |
double shapeValue = shapeParameter.getParameterValue(0); |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
double flexibleN0 = asymptoteValue/shapeValue; |
| 85 |
|
| 86 |
|
| 87 |
flexibleGrowth.setN0(flexibleN0); |
| 88 |
flexibleGrowth.setK(shapeValue); |
| 89 |
flexibleGrowth.setR(0); |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
return flexibleGrowth; |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
Parameter asyptoteValue = null; |
| 101 |
Parameter shapeParameter = null; |
| 102 |
FlexibleGrowth flexibleGrowth = null; |
| 103 |
|
| 104 |
} |