Debian Codegraph @

examples/TestXML/TreePriors/testCataclysmCoalescent.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!-- $Id: testCoalescent.xml,v 1.2 2005/07/11 23:22:40 rambaut Exp $ -->
3 <!-- Tests the coalescent prior -->
4
5 <beast>
6
7 <taxa id="taxa1">
8 <taxon id="A"/>
9 <taxon id="B"/>
10 <taxon id="C"/>
11 <taxon id="D"/>
12 </taxa>
13
14 <date id="date1" value="5000" units="days" direction="backwards"/>
15 <date id="date2" value="0" units="days" direction="backwards"/>
16
17 <taxa id="taxa2">
18 <taxon id="E">
19 <date idref="date1"/>
20 </taxon>
21 <taxon id="F">
22 <date idref="date1"/>
23 </taxon>
24 <taxon id="G">
25 <date idref="date2"/>
26 </taxon>
27 <taxon id="H">
28 <date idref="date2"/>
29 </taxon>
30 </taxa>
31
32 <!-- create a demographic model and intialize currentPopulationSize parameter -->
33 <constantSize id="demoForStartingTree" units="years">
34 <populationSize>
35 <parameter id="demoForStartingTree.pop1" value="10000.0"/>
36 </populationSize>
37 </constantSize>
38
39 <!--
40 public static String POPULATION_SIZE = "populationSize";
41 public static String GROWTH_RATE = "growthRate";
42 public static String SPIKE_SIZE = "spikeFactor";
43 public static String TIME_OF_CATACLYSM = "timeOfCataclysm";
44
45 public static String CATACLYSM_MODEL = "cataclysm";
46 -->
47 <cataclysm id="demo1" units="years">
48
49 <!-- population size at current day -->
50 <!-- normally sample this with scale operator and lower limit of 0 -->
51 <populationSize>
52 <parameter id="demo1.pop1" value="10000.0"/>
53 </populationSize>
54
55 <!-- growth rate from ancient times up to peak going forward in time -->
56 <!-- normally sample this with scale operator and lower limit of 0 -->
57 <growthRate>
58 <parameter id="demo1.growthRate" value="0.001"/>
59 </growthRate>
60
61 <!-- relative size of peak compared to modern population -->
62 <!-- normally sample this with scale operator and lower limit of 1 -->
63 <spikeFactor>
64 <parameter id="demo1.relativeSizeOfPeak" value="2.0"/>
65 </spikeFactor>
66
67 <!-- time back to peak of function -->
68 <!-- normally sample this with scale operator and lower limit of 0 -->
69 <timeOfCataclysm>
70 <parameter id="demo1.time" value="2500.0"/>
71 </timeOfCataclysm>
72 </cataclysm>
73
74 <!-- simulate a coalescent tree -->
75 <coalescentTree id="tree1">
76 <constantSize idref="demoForStartingTree"/>
77 <taxa idref="taxa1"/>
78 </coalescentTree>
79
80 <!-- simulate a coalescent tree -->
81 <coalescentTree id="tree2">
82 <constantSize idref="demoForStartingTree"/>
83 <taxa idref="taxa2"/>
84 </coalescentTree>
85
86 <treeModel id="treeModel1">
87 <tree idref="tree1"/>
88 <rootHeight>
89 <parameter id="treeModel1.rootHeight"/>
90 </rootHeight>
91 <nodeHeights rootNode="false" internalNodes="true">
92 <parameter id="treeModel1.internalNodeHeights"/>
93 </nodeHeights>
94 <nodeHeights rootNode="true" internalNodes="true">
95 <parameter id="treeModel1.allNodeHeights"/>
96 </nodeHeights>
97 </treeModel>
98
99 <treeModel id="treeModel2">
100 <tree idref="tree2"/>
101 <rootHeight>
102 <parameter id="treeModel2.rootHeight"/>
103 </rootHeight>
104 <nodeHeights rootNode="false" internalNodes="true">
105 <parameter id="treeModel2.internalNodeHeights"/>
106 </nodeHeights>
107 <nodeHeights rootNode="true" internalNodes="true">
108 <parameter id="treeModel2.allNodeHeights"/>
109 </nodeHeights>
110 </treeModel>
111
112 <!-- create a coalescent model from a tree model and demographic model -->
113 <coalescentLikelihood id="coalescent1">
114 <model>
115 <demographicModel idref="demo1"/>
116 </model>
117 <populationTree>
118 <treeModel idref="treeModel1"/>
119 </populationTree>
120 </coalescentLikelihood>
121
122 <!-- create a second coalescent model -->
123 <coalescentLikelihood id="coalescent2">
124 <model>
125 <demographicModel idref="demo1"/>
126 </model>
127 <populationTree>
128 <treeModel idref="treeModel2"/>
129 </populationTree>
130 </coalescentLikelihood>
131
132 <mcmc id="mcmc1" chainLength="1000000" verbose="false">
133 <coalescentLikelihood idref="coalescent1"/>
134 <log id="logScreen2" logEvery="5000">
135 <column dp="4">
136 <likelihood idref="coalescent1"/>
137 <parameter idref="treeModel1.rootHeight"/>
138 </column>
139 </log>
140 <log id="log1" logEvery="5" fileName="coalescentPrior.log">
141 <likelihood idref="coalescent1"/>
142 <parameter idref="treeModel1.rootHeight"/>
143 </log>
144 <logTree id="logTree1" logEvery="100" nexusFormat="true"
145 fileName="coalescentPrior.trees">
146 <treeModel idref="treeModel1"/>
147 </logTree>
148 <operators>
149 <subtreeSlide weight="1" gaussian="true" size="14000">
150 <treeModel idref="treeModel1"/>
151 </subtreeSlide>
152 </operators>
153 </mcmc>
154
155 <report>
156 Time taken:
157 <property name="timer">
158 <mcmc idref="mcmc1"/>
159 </property>
160 </report>
161
162 <traceAnalysis fileName="coalescentPrior.log" burnIn="1000">
163 <expectation name="treeModel1.rootHeight" value="15000"/>
164 </traceAnalysis>
165
166 <treeTraceAnalysis fileName="coalescentPrior.trees"/>
167
168
169 <mcmc id="mcmc2" chainLength="1000000" verbose="false">
170 <posterior>
171 <coalescentLikelihood idref="coalescent2"/>
172 </posterior>
173 <log id="logScreen" logEvery="5000">
174 <column dp="4">
175 <likelihood idref="coalescent2"/>
176 <parameter idref="treeModel2.rootHeight"/>
177 </column>
178 </log>
179 <log id="log2" logEvery="5" fileName="coalescentPrior_2.log">
180 <likelihood idref="coalescent2"/>
181 <parameter idref="treeModel2.rootHeight"/>
182 </log>
183 <logTree id="logTree2" logEvery="100" nexusFormat="true"
184 fileName="coalescentPrior_2.trees">
185 <treeModel idref="treeModel2"/>
186 </logTree>
187 <operators>
188 <subtreeSlide weight="1" gaussian="true" size="14000">
189 <treeModel idref="treeModel2"/>
190 </subtreeSlide>
191 </operators>
192 </mcmc>
193
194 <report>
195 Time taken:
196 <property name="timer">
197 <mcmc idref="mcmc2"/>
198 </property>
199 </report>
200
201 <traceAnalysis fileName="coalescentPrior_2.log" burnIn="1000">
202 <!-- the expectation for 4 leaves with Theta=10000 and tau=5000 -->
203 <expectation name="treeModel2.rootHeight" value="19344.2178"/>
204 </traceAnalysis>
205
206 <treeTraceAnalysis fileName="coalescentPrior_2.trees"/>
207
208
209 </beast>
210
211