Page 431 - Numerical Methods for Chemical Engineering
P. 431
420 8 Bayesian statistics and parameter estimation
2
θ 1 2
1
1
1 1 2 2
−
θ 1 ×1
Figure 8.9 Marginal 1-D density for k 1 computed from multiresponse data of a chemical reaction
using MCMC simulation.
This MCMC routine is used in turn by other routines that compute marginal posterior
densities and generate HPD regions. 1-D marginal densities and their corresponding HPD
regions are generated by the routines
[bin 1Dc, bin 1Dp, frac above, frac below] = . . .
Bayes MCMC 1Dmarginal MR( X pred, Y, . . .
fun yhat, j plot 1D, val lo, val hi, . . .
N bins, theta 0, MCOPTS);
and
[HPD lo, HPD hi] = Bayes 1D HPD MR( . . .
bin 1Dc, bin 1Dp, j plot 1D, alpha);
The definitions of the arguments in these routines are the same as for the corresponding
single-response routines.
For the multiresponse data of Table 8.3 for the chemical reaction A + B → C, the
following code computes the 1-D marginal posterior density for k 1 (Figure 8.9) and the
corresponding 95% HPD.
k1 0 = k1;
j plot 1D=1;
val lo = 0.001; val hi = 0.004;
N bins = 100;
MCOPTS.N equil = 1000;
MCOPTS.N samples = 25000;
[bin 1Dc, bin 1Dp, frac above, frac below] = . . .