MRec {SBCK} | R Documentation |
MRec (Matrix Recorrelation) method
Description
Perform a multivariate bias correction with Gaussian assumption.
Details
Only pearson correlations are corrected.
Public fields
n_features
[integer] Numbers of features
Methods
Public methods
Method new()
Create a new MRec object.
Usage
MRec$new(distY = NULL, distX = NULL)
Arguments
distY
[A list of ROOPSD distribution or NULL] Describe the law of each margins. A list permit to use different laws for each margins. Default is empirical.
distX
[A list of ROOPSD distribution or NULL] Describe the law of each margins. A list permit to use different laws for each margins. Default is empirical.
Returns
A new 'MRec' object.
Method fit()
Fit the bias correction method
Usage
MRec$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
MRec$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
MRec$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
References
Bárdossy, A. and Pegram, G.: Multiscale spatial recorrelation of RCM precipitation to produce unbiased climate change scenarios over large areas and small, Water Resources Research, 48, 9502–, https://doi.org/10.1029/2011WR011524, 2012.
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 MRec
mrec = SBCK::MRec$new()
## Step 2 : Fit the bias correction model
mrec$fit( Y0 , X0 , X1 )
## Step 3 : perform the bias correction, Z is a list containing corrections.
Z = mrec$predict(X1,X0) ## X0 is optional, in this case Z0 is NULL
Z$Z0 ## Correction in calibration period
Z$Z1 ## Correction in projection period