The Chapter 3 example. Each replication throws n uniform points at the
square \([-1, 1]^2\) and estimates \(\pi\) as four times the fraction
that land inside the unit circle.
Arguments
- n
Sample size for each replication.
- set_up
One element of
make_set_up().- ...
Ignored.
See also
Other workers:
iqr_worker(),
regression_worker()
Examples
out <- sim_template(pi_worker, 1234, 100, 1000, 2)
mean(bind_results(out))
#> [1] 3.14924