MBCn {SBCK} | R Documentation |
MBCn (Multivariate Bias Correction)
Description
Perform a multivariate bias correction.
Details
BC is performed with an alternance of rotation and univariate BC.
Public fields
n_features
[integer] Numbers of features
bc
[BC class] Univariate BC method
metric
[function] distance between two datasets
iter_slope
[Stopping class criteria] class used to test when stop
bc_params
[list] Parameters of bc
ortho_mat
[array] Array of orthogonal matrix
tips
[array] Array which contains the product of ortho and inverse of next
lbc
[list] list of BC method used.
Methods
Public methods
Method new()
Create a new MBCn object.
Usage
MBCn$new( bc = QDM, metric = wasserstein, stopping_criteria = SlopeStoppingCriteria, stopping_criteria_params = list(minit = 20, maxit = 100, tol = 0.001), ... )
Arguments
bc
[BC class] Univariate bias correction method
metric
[function] distance between two datasets
stopping_criteria
[Stopping class criteria] class use to test when to stop the iterations
stopping_criteria_params
[list] parameters passed to stopping_criteria class
...
[] Others arguments passed to bc.
Returns
A new 'MBCn' object.
Method fit()
Fit the bias correction method
Usage
MBCn$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
MBCn$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
MBCn$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
References
Cannon, A. J., Sobie, S. R., and Murdock, T. Q.: Bias correction of simulated precipitation by quantile mapping: how well do methods preserve relative changes in quantiles and extremes?, J. Climate, 28, 6938–6959, https://doi.org/10.1175/JCLI-D-14- 00754.1, 2015.
Examples
## Three bivariate random variables (rnorm and rexp are inverted between ref
## and bias)
XY = SBCK::dataset_gaussian_exp_2d(200)
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 MBCn
mbcn = SBCK::MBCn$new()
## Step 2 : Fit the bias correction model
mbcn$fit( Y0 , X0 , X1 )
## Step 3 : perform the bias correction, Z is a list containing
## corrections
Z = mbcn$predict(X1,X0)
Z$Z0 ## Correction in calibration period
Z$Z1 ## Correction in projection period