AR2D2 {SBCK} | R Documentation |
AR2D2 (Analogues Rank Resampling for Distributions and Dependences) method
Description
Perform a multivariate (non stationary) bias correction.
Details
Use Quantiles shuffle in calibration and projection period with CDFt
Public fields
mvq
[MVQuantilesShuffle] Class to transform dependance structure
bc_method
[SBCK::] Bias correction method
bckwargs
[list] List of arguments of bias correction
bcm_
[SBCK::] Instancied bias correction method
reverse
[bool] If we apply bc_method first and then shuffle, or reverse
Methods
Public methods
Method new()
Create a new AR2D2 object.
Usage
AR2D2$new( col_cond = base::c(1), lag_search = 1, lag_keep = 1, bc_method = SBCK::CDFt, shuffle = "quantile", reverse = FALSE, ... )
Arguments
col_cond
Conditionning colum
lag_search
Number of lags to transform the dependence structure
lag_keep
Number of lags to keep
bc_method
Bias correction method
shuffle
Shuffle method used, can be quantile or rank
reverse
If we apply bc_method first and then shuffle, or reverse
...
Others named arguments passed to bc_method$new
Returns
A new 'AR2D2' object.
Method fit()
Fit the bias correction method. If X1 is NULL, the method is considered as stationary
Usage
AR2D2$fit(Y0, X0, X1 = NULL)
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
AR2D2$predict(X1 = NULL, X0 = NULL)
Arguments
X1
[matrix: n_samples * n_features or NULL] 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 (and vice-versa), 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
AR2D2$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
References
Vrac, M. et S. Thao (2020). “R2 D2 v2.0 : accounting for temporal dependences in multivariate bias correction via analogue rank resampling”. In : Geosci. Model Dev. 13.11, p. 5367-5387. doi :10.5194/gmd-13-5367-2020.
Examples
## Three 4-variate random variables
Y0 = matrix( stats::rnorm( n = 1000 ) , ncol = 4 ) ## Biased in calibration period
X0 = matrix( stats::rnorm( n = 1000 ) , ncol = 4 ) / 2 + 3 ## Reference in calibration period
X1 = matrix( stats::rnorm( n = 1000 ) , ncol = 4 ) * 2 + 6 ## Biased in projection period
## Bias correction
cond_col = base::c(2,4)
lag_search = 6
lag_keep = 3
## Step 1 : construction of the class AR2D2
ar2d2 = SBCK::AR2D2$new( cond_col , lag_search , lag_keep )
## Step 2 : Fit the bias correction model
ar2d2$fit( Y0 , X0 , X1 )
## Step 3 : perform the bias correction
Z = ar2d2$predict(X1,X0)