| 1 |
<?xml version="1.0" standalone="yes"?> |
| 2 |
<beast> |
| 3 |
|
| 4 |
<taxa id="taxa"> |
| 5 |
<taxon id="A"/> |
| 6 |
<taxon id="B"/> |
| 7 |
|
| 8 |
</taxa> |
| 9 |
|
| 10 |
<alignment id="alignment" dataType="nucleotide"> |
| 11 |
<sequence> <taxon idref="A"/> AGAGCTCTAAGAGCTCTAAGAGCTCTAAGAGCTCTA </sequence> |
| 12 |
<sequence> <taxon idref="B"/> AAGGCCTTTAAGGCCTTTAAGGCCTTTAAGGCCTTT </sequence> |
| 13 |
</alignment> |
| 14 |
|
| 15 |
<patterns id="patterns" strip="false"> |
| 16 |
<alignment idref="alignment"/> |
| 17 |
</patterns> |
| 18 |
|
| 19 |
<newick id="tree"> |
| 20 |
(A:1,B:1); |
| 21 |
</newick> |
| 22 |
|
| 23 |
<treeModel id="treeModel"> |
| 24 |
<newick idref="tree"/> |
| 25 |
<rootHeight> |
| 26 |
<parameter id="treeModel.rootHeight"/> |
| 27 |
</rootHeight> |
| 28 |
<nodeHeights internalNodes="true"> |
| 29 |
<parameter id="treeModel.internalNodeHeights"/> |
| 30 |
</nodeHeights> |
| 31 |
<nodeHeights internalNodes="true" rootNode="true"> |
| 32 |
<parameter id="treeModel.allInternalNodeHeights"/> |
| 33 |
</nodeHeights> |
| 34 |
</treeModel> |
| 35 |
|
| 36 |
<hkyModel id="hky.random"> |
| 37 |
<frequencies> |
| 38 |
<frequencyModel dataType="nucleotide"> |
| 39 |
<frequencies> |
| 40 |
<parameter id="hky.frequencies" value="0.25 0.25 0.25 0.25"/> |
| 41 |
</frequencies> |
| 42 |
</frequencyModel> |
| 43 |
</frequencies> |
| 44 |
<kappa> |
| 45 |
<parameter id="hky.kappa" value="1.0" lower="1.0E-8" upper="Infinity"/> |
| 46 |
</kappa> |
| 47 |
</hkyModel> |
| 48 |
|
| 49 |
<hkyModel id="hky.fixed"> |
| 50 |
<frequencies> |
| 51 |
<frequencyModel dataType="nucleotide"> |
| 52 |
<frequencies> |
| 53 |
<parameter idref="hky.frequencies"/> |
| 54 |
</frequencies> |
| 55 |
</frequencyModel> |
| 56 |
</frequencies> |
| 57 |
<kappa> |
| 58 |
<parameter id="hky.kappa.fixed" value="10.0"/> |
| 59 |
</kappa> |
| 60 |
</hkyModel> |
| 61 |
|
| 62 |
<siteModel id="siteModel.random"> |
| 63 |
<substitutionModel> |
| 64 |
<hkyModel idref="hky.random"/> |
| 65 |
</substitutionModel> |
| 66 |
<mutationRate> |
| 67 |
<parameter id="clock.rate" value="1.0" lower="0.0" upper="10.0"/> |
| 68 |
</mutationRate> |
| 69 |
</siteModel> |
| 70 |
|
| 71 |
<siteModel id="siteModel.fixed"> |
| 72 |
<substitutionModel> |
| 73 |
<hkyModel idref="hky.fixed"/> |
| 74 |
</substitutionModel> |
| 75 |
<mutationRate> |
| 76 |
<parameter idref="clock.rate"/> |
| 77 |
</mutationRate> |
| 78 |
</siteModel> |
| 79 |
|
| 80 |
<treeLikelihood id="treeLikelihood.random"> |
| 81 |
<patterns idref="patterns"/> |
| 82 |
<treeModel idref="treeModel"/> |
| 83 |
<siteModel idref="siteModel.random"/> |
| 84 |
<hkyModel idref="hky.random"/> |
| 85 |
</treeLikelihood> |
| 86 |
|
| 87 |
<treeLikelihood id="treeLikelihood.fixed"> |
| 88 |
<patterns idref="patterns"/> |
| 89 |
<treeModel idref="treeModel"/> |
| 90 |
<siteModel idref="siteModel.fixed"/> |
| 91 |
<hkyModel idref="hky.fixed"/> |
| 92 |
</treeLikelihood> |
| 93 |
|
| 94 |
<operators id="operators.random"> |
| 95 |
<scaleOperator weight="1" scaleFactor="0.75"> |
| 96 |
<parameter idref="hky.kappa"/> |
| 97 |
</scaleOperator> |
| 98 |
<scaleOperator weight="1" scaleFactor="0.75"> |
| 99 |
<parameter idref="treeModel.rootHeight"/> |
| 100 |
</scaleOperator> |
| 101 |
</operators> |
| 102 |
|
| 103 |
<operators id="operators.fixed"> |
| 104 |
<scaleOperator weight="1" scaleFactor="0.75"> |
| 105 |
<parameter idref="treeModel.rootHeight"/> |
| 106 |
</scaleOperator> |
| 107 |
</operators> |
| 108 |
|
| 109 |
<mcmc id="mcmc.random" chainLength="1000000"> |
| 110 |
<posterior id="posterior.random"> |
| 111 |
<prior id="prior.random"> |
| 112 |
<gammaPrior offset="0" shape="0.1" scale="1.0"> |
| 113 |
<parameter idref="hky.kappa"/> |
| 114 |
</gammaPrior> |
| 115 |
<gammaPrior offset="0" shape="1" scale="1"> |
| 116 |
<parameter idref="treeModel.rootHeight"/> |
| 117 |
</gammaPrior> |
| 118 |
</prior> |
| 119 |
<likelihood id="likelihood.random"> |
| 120 |
<treeLikelihood idref="treeLikelihood.random"/> |
| 121 |
</likelihood> |
| 122 |
</posterior> |
| 123 |
<operators idref="operators.random"/> |
| 124 |
<log id="lograndom50000" logEvery="50000"> |
| 125 |
<posterior idref="posterior.random"/> |
| 126 |
<likelihood idref="likelihood.random"/> |
| 127 |
<prior idref="prior.random"/> |
| 128 |
<parameter idref="hky.kappa"/> |
| 129 |
<parameter idref="treeModel.rootHeight"/> |
| 130 |
</log> |
| 131 |
<log id="lograndom1000" logEvery="1000" fileName="testTreePathSampling.random.log" > |
| 132 |
<posterior idref="posterior.random"/> |
| 133 |
<likelihood idref="likelihood.random"/> |
| 134 |
<prior idref="prior.random"/> |
| 135 |
<parameter idref="hky.kappa"/> |
| 136 |
<parameter idref="treeModel.rootHeight"/> |
| 137 |
</log> |
| 138 |
</mcmc> |
| 139 |
|
| 140 |
<marginalLikelihoodAnalysis fileName="testTreePathSampling.random.log"> |
| 141 |
<likelihoodColumn name="likelihood.random" harmonicOnly="true" bootstrap="true"/> |
| 142 |
</marginalLikelihoodAnalysis> |
| 143 |
|
| 144 |
<marginalLikelihoodEstimator chainLength="50000" pathSteps="20" pathScheme="oneSidedBeta" beta="0.25"> |
| 145 |
<samplers> |
| 146 |
<mcmc idref="mcmc.random"/> |
| 147 |
</samplers> |
| 148 |
<pathLikelihood id="pathLikelihood.random"> |
| 149 |
<source> |
| 150 |
<posterior idref="posterior.random"/> |
| 151 |
</source> |
| 152 |
<destination> |
| 153 |
<prior idref="prior.random"/> |
| 154 |
</destination> |
| 155 |
</pathLikelihood> |
| 156 |
<log id="testMarginalOne" logEvery="100" fileName="testTreePathSamplingMLE.random.log"> |
| 157 |
<pathLikelihood idref="pathLikelihood.random"/> |
| 158 |
</log> |
| 159 |
</marginalLikelihoodEstimator> |
| 160 |
|
| 161 |
<pathSamplingAnalysis fileName="testTreePathSamplingMLE.random.log"> |
| 162 |
<likelihoodColumn name="pathLikelihood.random.delta"/> |
| 163 |
<thetaColumn name="pathLikelihood.random.theta"/> |
| 164 |
</pathSamplingAnalysis> |
| 165 |
|
| 166 |
<report> |
| 167 |
True logMarginalLikelihood = -97.9 (random kappa) |
| 168 |
</report> |
| 169 |
|
| 170 |
<mcmc id="mcmc.fixed" chainLength="1000000"> |
| 171 |
<posterior id="posterior.fixed"> |
| 172 |
<prior id="prior.fixed"> |
| 173 |
<gammaPrior offset="0" shape="1" scale="1"> |
| 174 |
<parameter idref="treeModel.rootHeight"/> |
| 175 |
</gammaPrior> |
| 176 |
|
| 177 |
<gammaPrior offset="0" shape="0.1" scale="1.0"> |
| 178 |
<parameter idref="hky.kappa"/> |
| 179 |
</gammaPrior> |
| 180 |
</prior> |
| 181 |
<likelihood id="likelihood.fixed"> |
| 182 |
<treeLikelihood idref="treeLikelihood.fixed"/> |
| 183 |
</likelihood> |
| 184 |
</posterior> |
| 185 |
<operators idref="operators.fixed"/> |
| 186 |
<log id="logfixed50000" logEvery="50000"> |
| 187 |
<posterior idref="posterior.fixed"/> |
| 188 |
<likelihood idref="likelihood.fixed"/> |
| 189 |
<prior idref="prior.fixed"/> |
| 190 |
<parameter idref="hky.kappa.fixed"/> |
| 191 |
<parameter idref="treeModel.rootHeight"/> |
| 192 |
</log> |
| 193 |
<log id="logfixed1000" logEvery="1000" fileName="testTreePathSampling.fixed.log" > |
| 194 |
<posterior idref="posterior.fixed"/> |
| 195 |
<likelihood idref="likelihood.fixed"/> |
| 196 |
<prior idref="prior.fixed"/> |
| 197 |
<parameter idref="hky.kappa.fixed"/> |
| 198 |
<parameter idref="treeModel.rootHeight"/> |
| 199 |
</log> |
| 200 |
</mcmc> |
| 201 |
|
| 202 |
<marginalLikelihoodAnalysis fileName="testTreePathSampling.fixed.log"> |
| 203 |
<likelihoodColumn name="likelihood.fixed" harmonicOnly="true" bootstrap="true"/> |
| 204 |
</marginalLikelihoodAnalysis> |
| 205 |
|
| 206 |
<marginalLikelihoodEstimator chainLength="50000" pathSteps="20" pathScheme="betaquantile" alpha="0.30"> |
| 207 |
<samplers> |
| 208 |
<mcmc idref="mcmc.fixed"/> |
| 209 |
</samplers> |
| 210 |
<pathLikelihood id="pathLikelihood.fixed"> |
| 211 |
<source> |
| 212 |
<posterior idref="posterior.fixed"/> |
| 213 |
</source> |
| 214 |
<destination> |
| 215 |
<prior idref="prior.fixed"/> |
| 216 |
</destination> |
| 217 |
</pathLikelihood> |
| 218 |
<log id="testMarginalTwo" logEvery="100" fileName="testTreePathSamplingMLE.fixed.log"> |
| 219 |
<pathLikelihood idref="pathLikelihood.fixed"/> |
| 220 |
</log> |
| 221 |
</marginalLikelihoodEstimator> |
| 222 |
|
| 223 |
<pathSamplingAnalysis fileName="testTreePathSamplingMLE.fixed.log"> |
| 224 |
<likelihoodColumn name="pathLikelihood.fixed.delta"/> |
| 225 |
<thetaColumn name="pathLikelihood.fixed.theta"/> |
| 226 |
</pathSamplingAnalysis> |
| 227 |
|
| 228 |
<report> |
| 229 |
True logMarginalLikelihood = -89.40 (kappa = 10) |
| 230 |
</report> |
| 231 |
|
| 232 |
<marginalLikelihoodEstimator chainLength="50000" pathSteps="20" pathScheme="sigmoid" alpha="8.0"> |
| 233 |
<samplers> |
| 234 |
<mcmc idref="mcmc.fixed"/> |
| 235 |
</samplers> |
| 236 |
<pathLikelihood id="pathLikelihood.sigmoid"> |
| 237 |
<source> |
| 238 |
<posterior idref="posterior.fixed"/> |
| 239 |
</source> |
| 240 |
<destination> |
| 241 |
<prior idref="prior.fixed"/> |
| 242 |
</destination> |
| 243 |
</pathLikelihood> |
| 244 |
<log id="testMarginalThree" logEvery="100" fileName="testTreePathSamplingMLE.sigmoid.log"> |
| 245 |
<pathLikelihood idref="pathLikelihood.sigmoid"/> |
| 246 |
</log> |
| 247 |
</marginalLikelihoodEstimator> |
| 248 |
|
| 249 |
<pathSamplingAnalysis fileName="testTreePathSamplingMLE.sigmoid.log"> |
| 250 |
<likelihoodColumn name="pathLikelihood.sigmoid.delta"/> |
| 251 |
<thetaColumn name="pathLikelihood.sigmoid.theta"/> |
| 252 |
</pathSamplingAnalysis> |
| 253 |
|
| 254 |
<report> |
| 255 |
True logMarginalLikelihood = -89.40 (kappa = 10) |
| 256 |
</report> |
| 257 |
|
| 258 |
<marginalLikelihoodEstimator chainLength="500000" pathSteps="21" pathScheme="beta" alpha="0.5" beta="0.25"> |
| 259 |
<samplers> |
| 260 |
<mcmc idref="mcmc.random"/> |
| 261 |
<mcmc idref="mcmc.fixed"/> |
| 262 |
</samplers> |
| 263 |
<pathLikelihood id="pathLikelihood"> |
| 264 |
<source> |
| 265 |
<posterior idref="posterior.fixed"/> |
| 266 |
</source> |
| 267 |
<destination> |
| 268 |
<posterior idref="posterior.random"/> |
| 269 |
</destination> |
| 270 |
</pathLikelihood> |
| 271 |
<log id="testBayesFactor" logEvery="100" fileName="testTreePathSamplingBF.log"> |
| 272 |
<pathLikelihood idref="pathLikelihood"/> |
| 273 |
<posterior idref="posterior.random"/> |
| 274 |
<posterior idref="posterior.fixed"/> |
| 275 |
</log> |
| 276 |
</marginalLikelihoodEstimator> |
| 277 |
|
| 278 |
<pathSamplingAnalysis fileName="testTreePathSamplingBF.log"> |
| 279 |
<likelihoodColumn name="pathLikelihood.delta"/> |
| 280 |
<thetaColumn name="pathLikelihood.theta"/> |
| 281 |
</pathSamplingAnalysis> |
| 282 |
|
| 283 |
<report> |
| 284 |
Analytic answer = 8.5 |
| 285 |
</report> |
| 286 |
|
| 287 |
|
| 288 |
</beast> |