make_compute_far_simple: Creates function to compute the FAR

Description Usage Arguments Value Examples

Description

Creates function to compute the FAR

Usage

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())

Arguments

ebm_bsamples

a function to simulates the EBM responses. it should return a list of two list :

  • bsamples : a list of data.frame with the original dataset merged with the bootstrap EBM simulations

  • bindexes : a list of vectors of indexes indicating the rows that will be used for the bootstrap

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

Value

a function with the following arguments :

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
# 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)

thaos/FARallnat documentation built on May 25, 2019, 8:18 a.m.