| 1 |
<?xml version="1.0" standalone="yes"?> |
| 2 |
|
| 3 |
<beast> |
| 4 |
|
| 5 |
|
| 6 |
<distributionLikelihood id="samplingDensity.random"> |
| 7 |
<distribution> |
| 8 |
<normalDistributionModel> |
| 9 |
<mean> |
| 10 |
<parameter id="mu" value="0"/> |
| 11 |
</mean> |
| 12 |
<precision> |
| 13 |
<parameter id="tau" value="1"/> |
| 14 |
</precision> |
| 15 |
</normalDistributionModel> |
| 16 |
</distribution> |
| 17 |
<data> |
| 18 |
<parameter id="x" value="5"/> |
| 19 |
</data> |
| 20 |
</distributionLikelihood> |
| 21 |
|
| 22 |
<distributionLikelihood id="samplingDensity.fixed"> |
| 23 |
<distribution> |
| 24 |
<normalDistributionModel> |
| 25 |
<mean> |
| 26 |
<parameter idref="mu"/> |
| 27 |
</mean> |
| 28 |
<precision> |
| 29 |
<parameter id="tau.fixed" value="1"/> |
| 30 |
</precision> |
| 31 |
</normalDistributionModel> |
| 32 |
</distribution> |
| 33 |
<data> |
| 34 |
<parameter idref="x"/> |
| 35 |
</data> |
| 36 |
</distributionLikelihood> |
| 37 |
|
| 38 |
|
| 39 |
<normalPrior id="normalMeanPrior.fixed" mean="0" stdev="1"> |
| 40 |
<parameter idref="mu"/> |
| 41 |
</normalPrior> |
| 42 |
|
| 43 |
|
| 44 |
<distributionLikelihood id="normalMeanPrior.random"> |
| 45 |
<distribution> |
| 46 |
<normalDistributionModel id="priorDistributionModel.random"> |
| 47 |
<mean> |
| 48 |
<parameter value="0"/> |
| 49 |
</mean> |
| 50 |
<precision> |
| 51 |
<parameter idref="tau"/> |
| 52 |
</precision> |
| 53 |
</normalDistributionModel> |
| 54 |
</distribution> |
| 55 |
<data> |
| 56 |
<parameter idref="mu"/> |
| 57 |
</data> |
| 58 |
</distributionLikelihood> |
| 59 |
|
| 60 |
<gammaPrior id="gammaPrecisionPrior" shape="1" scale="1" offset="0"> |
| 61 |
<parameter idref="tau"/> |
| 62 |
</gammaPrior> |
| 63 |
|
| 64 |
<operators id="operators.fixed"> |
| 65 |
<randomWalkOperator windowSize="0.75" weight="1"> |
| 66 |
<parameter idref="mu"/> |
| 67 |
</randomWalkOperator> |
| 68 |
</operators> |
| 69 |
|
| 70 |
<operators id="operators.random"> |
| 71 |
<randomWalkOperator windowSize="0.75" weight="1"> |
| 72 |
<parameter idref="mu"/> |
| 73 |
</randomWalkOperator> |
| 74 |
<scaleOperator scaleFactor="0.75" weight="1"> |
| 75 |
<parameter idref="tau"/> |
| 76 |
</scaleOperator> |
| 77 |
</operators> |
| 78 |
|
| 79 |
<mcmc id="mcmc.fixed" chainLength="1000000" autoOptimize="true"> |
| 80 |
<posterior id="posterior.fixed"> |
| 81 |
<likelihood id="likelihood.fixed"> |
| 82 |
<distributionLikelihood idref="samplingDensity.fixed"/> |
| 83 |
</likelihood> |
| 84 |
<prior id="prior.fixed"> |
| 85 |
<normalPrior idref="normalMeanPrior.fixed"/> |
| 86 |
<gammaPrior idref="gammaPrecisionPrior"/> |
| 87 |
</prior> |
| 88 |
</posterior> |
| 89 |
<operators idref="operators.fixed"/> |
| 90 |
<log logEvery="100000"> |
| 91 |
<column label="posterior" dp="4" width="12"> |
| 92 |
<likelihood idref="likelihood.fixed"/> |
| 93 |
<prior idref="prior.fixed"/> |
| 94 |
</column> |
| 95 |
<column label="Mean" sf="6" width="12"> |
| 96 |
<parameter idref="mu"/> |
| 97 |
</column> |
| 98 |
<column label="Precision" sf="6" width="12"> |
| 99 |
<parameter idref="tau"/> |
| 100 |
</column> |
| 101 |
</log> |
| 102 |
<log logEvery="1000" fileName="testSimplePathSampling.fixed.log"> |
| 103 |
<likelihood idref="likelihood.fixed"/> |
| 104 |
<prior idref="prior.fixed"/> |
| 105 |
<parameter idref="mu"/> |
| 106 |
<parameter idref="tau"/> |
| 107 |
</log> |
| 108 |
</mcmc> |
| 109 |
|
| 110 |
<traceAnalysis fileName="testSimplePathSampling.fixed.log" stdError="true"/> |
| 111 |
|
| 112 |
<marginalLikelihoodAnalysis fileName="testSimplePathSampling.fixed.log"> |
| 113 |
<likelihoodColumn name="likelihood.fixed" harmonicOnly="true" bootstrap="true"/> |
| 114 |
</marginalLikelihoodAnalysis> |
| 115 |
|
| 116 |
<marginalLikelihoodEstimator chainLength="500000" pathSteps="11" pathScheme="oneSidedBeta"> |
| 117 |
<samplers> |
| 118 |
<mcmc idref="mcmc.fixed"/> |
| 119 |
</samplers> |
| 120 |
<pathLikelihood id="pathLikelihood.fixed"> |
| 121 |
<source> |
| 122 |
<posterior idref="posterior.fixed"/> |
| 123 |
</source> |
| 124 |
<destination> |
| 125 |
<prior idref="prior.fixed"/> |
| 126 |
</destination> |
| 127 |
</pathLikelihood> |
| 128 |
<log logEvery="100" fileName="testSimplePathSampling.fixed.log"> |
| 129 |
<pathLikelihood idref="pathLikelihood.fixed"/> |
| 130 |
</log> |
| 131 |
</marginalLikelihoodEstimator> |
| 132 |
|
| 133 |
<pathSamplingAnalysis fileName="testSimplePathSampling.fixed.log"> |
| 134 |
<likelihoodColumn name="pathLikelihood.fixed.delta"/> |
| 135 |
<thetaColumn name="pathLikelihood.fixed.theta"/> |
| 136 |
</pathSamplingAnalysis> |
| 137 |
|
| 138 |
<report> |
| 139 |
Fixed logML = -0.5 * log(4 * \pi) - x^2 / 4 = -7.5155 |
| 140 |
|
| 141 |
</report> |
| 142 |
|
| 143 |
<mcmc id="mcmc.random" chainLength="1000000" autoOptimize="true"> |
| 144 |
<posterior id="posterior.random"> |
| 145 |
<likelihood id="likelihood.random"> |
| 146 |
<distributionLikelihood idref="samplingDensity.random"/> |
| 147 |
</likelihood> |
| 148 |
<prior id="prior.random"> |
| 149 |
<distributionLikelihood idref="normalMeanPrior.random"/> |
| 150 |
<gammaPrior idref="gammaPrecisionPrior"/> |
| 151 |
</prior> |
| 152 |
</posterior> |
| 153 |
<operators idref="operators.random"/> |
| 154 |
<log logEvery="100000"> |
| 155 |
<column label="posterior" dp="4" width="12"> |
| 156 |
<likelihood idref="likelihood.random"/> |
| 157 |
<prior idref="prior.random"/> |
| 158 |
</column> |
| 159 |
<column label="Mean" sf="6" width="12"> |
| 160 |
<parameter idref="mu"/> |
| 161 |
</column> |
| 162 |
<column label="Precision" sf="6" width="12"> |
| 163 |
<parameter idref="tau"/> |
| 164 |
</column> |
| 165 |
</log> |
| 166 |
<log logEvery="1000" fileName="testSimplePathSampling.random.log"> |
| 167 |
<likelihood idref="likelihood.random"/> |
| 168 |
<prior idref="prior.random"/> |
| 169 |
<parameter idref="mu"/> |
| 170 |
<parameter idref="tau"/> |
| 171 |
</log> |
| 172 |
</mcmc> |
| 173 |
|
| 174 |
<traceAnalysis fileName="testSimplePathSampling.random.log" stdError="true"/> |
| 175 |
|
| 176 |
<marginalLikelihoodAnalysis fileName="testSimplePathSampling.random.log"> |
| 177 |
<likelihoodColumn name="likelihood.random" harmonicOnly="true" bootstrap="true"/> |
| 178 |
</marginalLikelihoodAnalysis> |
| 179 |
|
| 180 |
<marginalLikelihoodEstimator chainLength="500000" pathSteps="21" pathScheme="oneSidedBeta" beta="0.25"> |
| 181 |
<samplers> |
| 182 |
<mcmc idref="mcmc.random"/> |
| 183 |
</samplers> |
| 184 |
<pathLikelihood id="pathLikelihood.random"> |
| 185 |
<source> |
| 186 |
<posterior idref="posterior.random"/> |
| 187 |
</source> |
| 188 |
<destination> |
| 189 |
<prior idref="prior.random"/> |
| 190 |
</destination> |
| 191 |
</pathLikelihood> |
| 192 |
<log logEvery="100" fileName="testSimplePathSampling.random.log"> |
| 193 |
<pathLikelihood idref="pathLikelihood.random"/> |
| 194 |
</log> |
| 195 |
</marginalLikelihoodEstimator> |
| 196 |
|
| 197 |
<pathSamplingAnalysis fileName="testSimplePathSampling.random.log"> |
| 198 |
<likelihoodColumn name="pathLikelihood.random.delta"/> |
| 199 |
<thetaColumn name="pathLikelihood.random.theta"/> |
| 200 |
</pathSamplingAnalysis> |
| 201 |
|
| 202 |
<report> |
| 203 |
Fixed logML = logGamma(3/2) - 0.5*log(4 * pi) - 3/2*log(1 + x^2 / 4) = -4.3578 |
| 204 |
|
| 205 |
</report> |
| 206 |
|
| 207 |
<marginalLikelihoodEstimator chainLength="500000" pathSteps="21" pathScheme="beta" alpha="0.5" beta="0.25"> |
| 208 |
<samplers> |
| 209 |
<mcmc idref="mcmc.random"/> |
| 210 |
<mcmc idref="mcmc.fixed"/> |
| 211 |
</samplers> |
| 212 |
<pathLikelihood id="pathLikelihood"> |
| 213 |
<source> |
| 214 |
<posterior idref="posterior.fixed"/> |
| 215 |
</source> |
| 216 |
<destination> |
| 217 |
<posterior idref="posterior.random"/> |
| 218 |
</destination> |
| 219 |
</pathLikelihood> |
| 220 |
<log logEvery="100" fileName="testSimplePathSampling.log"> |
| 221 |
<pathLikelihood idref="pathLikelihood"/> |
| 222 |
<posterior idref="posterior.random"/> |
| 223 |
<posterior idref="posterior.fixed"/> |
| 224 |
</log> |
| 225 |
</marginalLikelihoodEstimator> |
| 226 |
|
| 227 |
<pathSamplingAnalysis fileName="testSimplePathSampling.log"> |
| 228 |
<likelihoodColumn name="pathLikelihood.delta"/> |
| 229 |
<thetaColumn name="pathLikelihood.theta"/> |
| 230 |
</pathSamplingAnalysis> |
| 231 |
|
| 232 |
<report> |
| 233 |
Analytic answer = 3.158 |
| 234 |
|
| 235 |
</report> |
| 236 |
|
| 237 |
</beast> |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|