Description Usage Arguments Value Examples
Creates function to compute the FAR
1 2 3 | make_compute_far_simple(ebm_bsamples = ebm_bsamples.default,
ebm_args = list(model = "random"), decompose_x = dx.gam_allnat,
dx_args = list())
|
ebm_bsamples |
a function to simulates the EBM responses. it should return a list of two list :
|
ebm_args |
a list of argument to be used in the ebm_bsamples. It can be an expression if the variable in the list need to be evaluate within the compute_far function(Non-Standard-Evaluation NSE) |
decompose_x |
a function to decompose the covariate x into an ALL, an ANT and a NAT component. It has to takes as argument bsamples and bindexes which results of the ebm_samples functions |
dx_args |
a list of argument to be used in the ebm_bsamples. It can be |
a function with the following arguments :
mdata, a data.frame containg the variables whose names are given by x, y and time
y, the name of variable that will be used as the variable of interest y
x, the name of variable that will be used as the covariate x
time, the name of variable that will be used as the as the time variable
xp, the threshold used to define the FAR
R, the number of bootstrap samples
stat_model the statistical model to explain y in function of x, either gauss_fit, gev_fit, or gpd_fit from the FARg package
ci_p the level of the confidence intervals
... additional arguments if require by the stat_model function
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 | # creates a variante of the computing chain with the following properties
# EBM simulations:
# - takes model parameters if available, else takes a set of available
# parameters at random
# - random scaling factors
# Decompose x:
# - modèle gam :x_all = beta_nat * nat + s(ant)
# - shift mean(ant) to 0 between 1850 and 1879
compute_far_simple.default <- make_compute_far_simple(ebm_bsamples=ebm_bsamples.default,
ebm_args=expression(list(
model=model,
mdata=mdata
))
)
library(FARg)
model <- "cnrm"
#load data from the package
data(list=model)
# formating data, e.g passing from temperature to anomalie, keep only hist
# and rcp runs
mdata <- format_data(get(model))
if(model != "obs") mdata <- select_continuous_run(mdata)
ans <- compute_far_simple.default(mdata,
y="eur_tas", x="gbl_tas", time="year",
xp=1.6, stat_model=gauss_fit, ci_p=0.9)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.