Monte Carlo Simulation of Dynamic Systems 97
In the open class interval (a, b), u(x) = 1 and is 0 elsewhere (see also Section
2-8b). We find the desired statistical relative frequency
hh easily and quickly
with
DOT hh = u * 1.
Statistical relative frequencies can be computed as post-run Monte Carlo
statistics. Vectorized Monte Carlo studies can, instead, compute statistical
relative frequencies at each sampling point to produce their time histories.
For a given Monte Carlo sample
(x[1], x[2], …, x[n]), the sample range
range = xmax – xmin is the difference between the largest value xmax and
the smallest value
xmin in the sample. The DYNAMIC program segment of a
vectorized Monte Carlo study can compute
xmax, xmin, and range at each
point of time to produce their time histories. With reference to Section 3-8, we
declare an
n-dimensional vector xx and add the DYNAMIC-segment lines
Vector xx^ = x | DOT xmax = xx * 1
Vector xx^ = - x | DOT mxmin = xx * 1
The experiment-protocol script then computes range = xmax + mxmin.For
repeated-run Monte Carlo simulation, post-run computation of
xmax and
xmin requires a search loop in the experiment protocol.
As we already noted, many other statistics (correlation and regression
coefficients, and test statistics such as
t and χ
2
)[5] are functions of sample
averages. Post-run estimation of probability densities will be discussed in the
next section.
4-9. Post-run Probability-density Estimation [8,9]
(a) A Simple Probability-density Estimate
For continuous random variables x the probability density
ϕ
x
(X) for each
value
X of x is approximated by
ϕ
x
(X)
≈
Prob{X – h
<
–
x < X + h}/2h = p/2h
(4-12)
where
2h is a small class-interval width. For a given Monte Carlo sample
(x[1], x[2], ... , x[n]) of x-values, we again estimate p by the sample average
<u(x – X)> of an indicator function u(x – X) equal to 1 if X – h
<
–
x < X + h
and 0 otherwise. Specifically, u(x – X) ≡ rect((x – X)/h), where rect(x) is the
library function defined in Fig. 2-5c. For small “window widths”
2h we thus
estimate the probability density
ϕ
x
(X)
≈
p/2h by
f(X)
≡
(1/2h) <rect [(x – X)/h]
>
≡
(1/2hn)
n
k=1
rect ((x[k] – X)/h) (4-13)