OTC | R Documentation |
Perform a multivariate bias correction of X0 with respect to Y0.
Joint distribution, i.e. all dependence are corrected.
bin_width
[vector or NULL] A vector of lengths of the cells discretizing R^numbers of variables. If NULL, it is estimating during the fit
bin_origin
[vector or NULL] Coordinate of lower corner of one cell. If NULL, c(0,...,0) is used
muX
[SparseHist] Histogram of the data from the model
muY
[SparseHist] Histogram of the data from the observations
ot
[OTSolver] Optimal Transport solver, default is the network simplex
plan
[matrix] The plan computed by the ot solver.
n_features
[integer] Numbers of features
new()
Create a new OTC object.
OTC$new(bin_width = NULL, bin_origin = NULL, ot = SBCK::OTNetworkSimplex$new())
bin_width
[vector or NULL] A vector of lengths of the cells discretizing R^numbers of variables. If NULL, it is estimating during the fit
bin_origin
[vector or NULL] Coordinate of lower corner of one cell. If NULL, c(0,...,0) is used
ot
[OTSolver] Optimal Transport solver, default is the network simplex
A new 'OTC' object.
fit()
Fit the bias correction method
OTC$fit(Y0, X0)
Y0
[matrix: n_samples * n_features] Observations in calibration
X0
[matrix: n_samples * n_features] Model in calibration
NULL
predict()
Predict the correction
Note: Only the center of the bins associated to the corrected points are returned, but all corrections of the form: >> bw = otc$bin_width / 2 >> n = base::prod(base::dim(X0)) >> Z0 = otc$predict(X0) >> Z0 = Z0 + t(matrix(stats::runif( n = n min = - bw , max = bw ) , ncol = dim(X0)[1] )) are equivalent for OTC.
OTC$predict(X0)
X0
[matrix: n_samples * n_features or NULL] Model in calibration
[matrix] Return the corrections of X0
clone()
The objects of this class are cloneable with this method.
OTC$clone(deep = FALSE)
deep
Whether to make a deep clone.
Robin, Y., Vrac, M., Naveau, P., Yiou, P.: Multivariate stochastic bias corrections with optimal transport, Hydrol. Earth Syst. Sci., 23, 773–786, 2019, https://doi.org/10.5194/hess-23-773-2019
## Two 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
## Bin length
bin_width = SBCK::bin_width_estimator( list(X0,Y0) )
## Bias correction
## Step 1 : construction of the class OTC
otc = SBCK::OTC$new( bin_width )
## Step 2 : Fit the bias correction model
otc$fit( Y0 , X0 )
## Step 3 : perform the bias correction, Z0 is the correction of
## X0 with respect to the estimation of Y0
Z0 = otc$predict(X0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.