R2D2 {SBCK} | R Documentation |
R2D2 (Rank Resampling for Distributions and Dependences) method
Description
Perform a multivariate (non stationary) bias correction.
Details
Use rankshuffle in calibration and projection period with CDFt
Super class
SBCK::CDFt
-> R2D2
Public fields
irefs
[vector of int] Indexes for shuffle. Defaults is base::c(1)
Methods
Public methods
Method new()
Create a new R2D2 object.
Usage
R2D2$new(irefs = base::c(1), ...)
Arguments
irefs
[vector of int] Indexes for shuffle. Defaults is base::c(1) model
...
[] all others arguments are passed to CDFt class.
Returns
A new 'R2D2' object.
Method fit()
Fit the bias correction method
Usage
R2D2$fit(Y0, X0, X1)
Arguments
Y0
[matrix: n_samples * n_features] Observations in calibration
X0
[matrix: n_samples * n_features] Model in calibration
X1
[matrix: n_samples * n_features] Model in projection
Returns
NULL
Method predict()
Predict the correction
Usage
R2D2$predict(X1, X0 = NULL)
Arguments
X1
[matrix: n_samples * n_features] Model in projection
X0
[matrix: n_samples * n_features or NULL] Model in calibration
Returns
[matrix or list] Return the matrix of correction of X1 if X0 is NULL, else return a list containing Z1 and Z0, the corrections of X1 and X0
Method clone()
The objects of this class are cloneable with this method.
Usage
R2D2$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
References
Vrac, M.: Multivariate bias adjustment of high-dimensional climate simulations: the Rank Resampling for Distributions and Dependences (R2 D2 ) bias correction, Hydrol. Earth Syst. Sci., 22, 3175–3196, https://doi.org/10.5194/hess-22-3175-2018, 2018.
Examples
## Three bivariate random variables (rnorm and rexp are inverted between ref
## and bias)
XY = SBCK::dataset_gaussian_exp_2d(2000)
X0 = XY$X0 ## Biased in calibration period
Y0 = XY$Y0 ## Reference in calibration period
X1 = XY$X1 ## Biased in projection period
## Bias correction
## Step 1 : construction of the class R2D2
r2d2 = SBCK::R2D2$new()
## Step 2 : Fit the bias correction model
r2d2$fit( Y0 , X0 , X1 )
## Step 3 : perform the bias correction
Z = r2d2$predict(X1,X0)