
This function creates an object of class MonteCarloAverage
. The purpose of the function is to compute
Monte Carlo expectations online in the function lgcpPredict
, it is set in the argument gridmeans
of the argument output.control
.
MonteCarloAverage(funlist, lastonly = TRUE)
a character vector of names of functions, each accepting single argument Y
compute average using only time T? (see ?lgcpPredict for definition of T)
object of class MonteCarloAverage
A Monte Carlo Average is computed as:
lgcpPredict
).
For further examples, see below. The option last=TRUE
computes,
setoutput, lgcpPredict, GAinitialise, GAupdate, GAfinalise, GAreturnvalue, exceedProbs
# NOT RUN {
fun1 <- function(x){return(x)} # gives the mean
fun2 <- function(x){return(x^2)} # computes E(X^2). Can be used with the
# mean to compute variances, since
# Var(X) = E(X^2) - E(X)^2
fun3 <- exceedProbs(c(1.5,2,3)) # exceedance probabilities,
#see ?exceedProbs
mca <- MonteCarloAverage(c("fun1","fun2","fun3"))
mca2 <- MonteCarloAverage(c("fun1","fun2","fun3"),lastonly=TRUE)
# }
Run the code above in your browser using DataLab