MCpriorIntFun {BMAmevt} | R Documentation |
Simple Monte-Carlo sampler approximating the integral of FUN
with respect to the prior distribution.
MCpriorIntFun(Nsim = 200, prior, Hpar, dimData, FUN = function(par, ...) { as.vector(par) }, store = TRUE, show.progress = floor(seq(1, Nsim, length.out = 20)), Nsim.min = Nsim, precision = 0, ...)
Nsim |
Maximum number of iterations |
prior |
The prior distribution: of type |
Hpar |
A list containing Hyper-parameters to be passed to
|
dimData |
The dimension of the model's sample space,
on which the parameter's dimension may depend.
Passed to |
FUN |
A function to be integrated. It may return a vector or an array. |
store |
Should the successive evaluations of |
show.progress |
same as in |
Nsim.min |
The minimum number of iterations to be performed. |
precision |
The desired relative precision ε. See Details below. |
... |
Additional arguments to be passed to |
The algorithm exits after n iterations,
based on the following stopping rule :
n is the minimum number of iteration, greater than
Nsim.min
, such that the relative
error is less than the specified precision
.
max (est.esterr(n)/ |est.mean(n)| ) ≤ ε ,
where
est.mean(n) is the estimated mean of FUN
at time
n, est.err(n) is the estimated standard
deviation of the estimate:
est.err(n) = √{est.var(n)/(nsim-1)} .
The empirical variance is computed component-wise and the maximum
over the parameters' components is considered.
The algorithm exits in any case after Nsim
iterations, if the above condition is not fulfilled before this time.
A list made of
stored.vals
: A matrix with nsim
rows and
length(FUN(par))
columns.
elapsed
: The time elapsed during the computation.
nsim
: The number of iterations performed
emp.mean
: The desired integral estimate: the empirical mean.
emp.stdev
: The empirical standard deviation of the sample.
est.error
: The estimated standard deviation of the estimate (i.e. emp.stdev/√(nsim)).
not.finite
: The number of non-finite values obtained (and discarded) when evaluating FUN(par,...)
Anne Sabourin