GenEnv.fun: Calculation of simulated envelopes

Description Usage Arguments Details Value See Also Examples

View source: R/GenEnv.fun.r

Description

This function calculates a point estimation and an envelope for a given statistic using a Monte Carlo approach. The statistic must be a function of the occurrence points of a NHPP.

It calls the auxiliary function funSim.fun (not intended for the users), see Details section.

Usage

1
2
GenEnv.fun(nsim, lambda, fun.name, fun.args = NULL, clevel = 0.95, 
cores = 1, fixed.seed=NULL)

Arguments

nsim

Number of simulations for the calculations.

lambda

Numeric vector of the intensity λ(t) (or \hat λ(t)) of the NHPP.

fun.name

Name of the function defining the statistic to be estimated.

fun.args

Additional arguments for the function fun.name.

clevel

Confidence level of the envelope.

cores

Optional. Number of cores of the computer to be used in the calculations. Default: one core is used.

fixed.seed

An integer or NULL. If it is an integer, that is the value used to set the seed in random generation processes. It it is NULL, a random seed is used.

Details

The auxiliary function funSim.fun generates a simulated sample of the occurrence points in a NHPP and calculates the corresponding statistic using the simulated points.

Value

A list with elements

valmed

Point estimation (mean value) of the statistic to be calculated.

valinf

Lower value of the simulated CI.

valsup

Upper value of the simulated CI.

lambda

Input argument.

nsim

Input argument.

nsimval

Number of valid simulations (used in the calculation of the CI and the point estimation).

fixed.seed

Input argument.

See Also

simNHP.fun, resQQplot.fun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Calculation of the point estimation and a 95% CI based on 100 simulations 
#for the second occurrence time of a NHPP with intensity lambdat.
#posk.fun(x, k) is a function that returns the value in the row k of vector x.

lambdat<-runif(1000,0.01,0.02)
aux<-GenEnv.fun(lambda=lambdat,fun.name="posk.fun",fun.args=2,nsim=100)

#if we want reproducible results, we can fixed the seed in the generation process
#(the number of cores used in the calculations must also be the same to reproduce 
#the result)

aux<-GenEnv.fun(lambda=lambdat,fun.name="posk.fun",fun.args=2,nsim=100,fixed.seed=123)

#the result (with 1 core): Lower interval:  25.55; Mean value:  136.06; Upper interval:  288

NHPoisson documentation built on Feb. 19, 2020, 5:07 p.m.