bootstrap.start {bootstrap}R Documentation

Description

start the bootstrap simulation.

Usage

bootstrap.start(round = 100, percentile = TRUE)

Arguments

round
percentile

Value

Either a percentile matrix or reserves matrix. For the reserves output, the last column of the matrix is just a simple summary of the reserve for each year.
For percentile output, the last column is the percentile of the reserves, not the summary anymore.

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(round=100, percentile=TRUE){

        #percentiles
        p<-c(0.10, 0.20, 0.30, 0.50, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 0.99)
        #percentile label
        pLabel<- paste(p * 100 , "%", sep="")

        #now, let us do 1000 round of samples, and put result in to the reserves matrix
        l<-length(getAges(triangle))

        #simple reserve output
        reserves<-matrix(0.0, nrow = round, ncol = l+1, dimnames = list(c(1:round), c(getYears(triangle), "simple sum")))

        #percentile output
        percentiles<-matrix(0.0, nrow = length(pLabel), ncol = l+1, dimnames = list(pLabel , c(getYears(triangle), "perc. of sum")))

        for (n in 1: round){
                #now we do the second stage sampling, which is a gamma sampling
                lower<-Simulate(bootstrap)

                #finally get the reserve?
                reserves[n,]<-getReserveFromDevelop(lower)
        }

        if (percentile) {
                for (col in 1: length(dimnames(percentiles)[[2]])){
                        percentiles[, col]<-as.integer(quantile(reserves[, col],  p, type=7))
                }

                return (percentiles)
        }

        return (reserves)
  }

[Package bootstrap version 1.0-1 Index]