SI.SPM {SI} | R Documentation |
Stochastic Point Method
Description
Stochastic Point Method
Usage
SI.SPM(h, from, to, M, N)
Arguments
h |
Density function to be integrated |
from |
The start point |
to |
The end point |
M |
The upper bound of h(x) in [from,to] |
N |
The number of trials |
Value
I |
Approximated integration |
Var |
Estimated variance |
Examples
## To integrate exp(x) from -1 to 1
set.seed(0)
h <- function(x){
exp(x)
}
N <- 100000
SPMresult <- SI.SPM(h,-1,1,exp(1),N)
I1 <- SPMresult[[1]]
VarI1 <- SPMresult[[2]]
[Package SI version 0.2.0 Index]