boot_FAR_fit.emp: Empirical estimation of the FAR from bootstrap samples

Description Usage Arguments Details Value Examples

View source: R/bigFAR_nonpara_sthao.R

Description

boot_FAR_fit.emp returns an object of class ("boot_FARfit.emp", "boot_FARfit", "FARfit") which contains the estimates of the FAR for each bootstrap sample and for different return periods rp

Usage

1
2
3
4
5
6
7
boot_FAR_fit.emp(x, z, u, B = 100)

## S3 method for class 'FARfit'
print(x, ...)

## S3 method for class 'FARfit'
plot(x, ...)

Arguments

x

the variable of interest in the counterfactual world.

z

the variable of interest in the factual world.

u

the thresholds used to define the events.

B

the number of bootstrap samples to draw.

...

additional arguments for the plot.

Details

This function returns bootstrap empirical estimates of FAR, the fraction of attributable risk where events are defined in terms of a threshold exceendance. The FAR is estimate from the bootstrap samples of the data x and z that are obtained by resampling bootstrap. The first bootstrap sample corresponds to the original dataset of x and y.

Value

An object of class ("boot_FARfit.emp", "boot_FARfit", "FARfit"). It is a matrix where each columm contains the FAR estimated for the returns periods rp for a given bootstrap sample.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 library(evd)

 muF <-  1; xiF <- .15; sigmaF <-  1.412538 #  cst^(-xiF) # .05^(-xi1);
 # asymptotic limit for the far in this case with a Frechet distributiom
 boundFrechet <- 1 - sigmaF^(-1/xiF)
 # sample size
 size <- 100
 # level=.9
 set.seed(4)
 z = rgev(size, loc = (sigmaF), scale = xiF * sigmaF, shape = xiF)
 x = rgev(length(z), loc=(1), scale = xiF, shape=xiF)

 rp = seq(from = 2, to = 30, length = 200)
 u  = qgev(1 - (1 / rp),loc = muF, scale = xiF, shape = xiF)

 # Resampling bootstrap for the empirical estimation of the FAR
 boot_FAR.emp <- boot_FAR_fit.emp(x = x, z = z, u = u, B = 10)
 print(boot_FAR.emp)
 confint(boot_FAR.emp)

 ylim <- range(boundFrechet, boot_FAR.emp)
 plot(boot_FAR.emp, ylim = ylim, main = "boot FAR empirical")
 # Theoretical FAR for in this case (Z = sigmaF * X  with X ~ Frechet)
 lines(rp, frechet_FAR(u = u, sigma = sigmaF, xi = xiF), col = "red", lty = 2)
 abline(h = boundFrechet, col = "red", lty = 2)

thaos/farr documentation built on May 28, 2019, 8:42 a.m.