dTSMBC: dTSMBC (dynamical Time Shifted Multivariate Bias Correction)

dTSMBCR Documentation

dTSMBC (dynamical Time Shifted Multivariate Bias Correction)

Description

Perform a bias correction of auto-correlation

Details

Correct auto-correlation with a shift approach, taking into account of non stationarity.

Public fields

shift

[Shift class] Shift class to shift data.

bc_method

[SBCK::BC_method] Underlying bias correction method.

Active bindings

method

[character] If inverse is by row or column, see class Shift

ref

[integer] reference column/row to inverse shift, see class Shift. Default is 0.5 * (lag+1)

Methods

Public methods


Method new()

Create a new dTSMBC object.

Usage
dTSMBC$new(lag, bc_method = dOTC, method = "row", ref = "middle", ...)
Arguments
lag

[integer] max lag of autocorrelation

bc_method

[SBCK::BC_METHOD] bias correction method to use after shift of data, default is OTC

method

[character] If inverse is by row or column, see class Shift

ref

[integer] reference column/row to inverse shift, see class Shift. Default is 0.5 * (lag+1)

...

[] All others arguments are passed to bc_method

Returns

A new 'dTSMBC' object.


Method fit()

Fit the bias correction method

Usage
dTSMBC$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
dTSMBC$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
dTSMBC$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

References

Robin, Y. and Vrac, M.: Is time a variable like the others in multivariate statistical downscaling and bias correction?, Earth Syst. Dynam. Discuss. [preprint], https://doi.org/10.5194/esd-2021-12, in review, 2021.

Examples


## arima model parameters
modelX0 = list( ar = base::c(  0.6 , 0.2 , -0.1 ) )
modelX1 = list( ar = base::c(  0.4 , 0.1 , -0.3 ) )
modelY0 = list( ar = base::c( -0.3 , 0.4 , -0.2 ) )

## arima random generator
rand.genX0 = function(n){ return(stats::rnorm( n , mean = 0.2 , sd = 1   )) }
rand.genX1 = function(n){ return(stats::rnorm( n , mean = 0.8 , sd = 1   )) }
rand.genY0 = function(n){ return(stats::rnorm( n , mean = 0   , sd = 0.7 )) }

## Generate two AR processes
X0 = stats::arima.sim( n = 1000 , model = modelX0 , rand.gen = rand.genX0 )
X1 = stats::arima.sim( n = 1000 , model = modelX1 , rand.gen = rand.genX1 )
Y0 = stats::arima.sim( n = 1000 , model = modelY0 , rand.gen = rand.genY0 )
X0 = as.vector( X0 )
X1 = as.vector( X1 )
Y0 = as.vector( Y0 + 5 )

## And correct it with 30 lags
dtsbc = SBCK::dTSMBC$new( 30 )
dtsbc$fit( Y0 , X0 , X1 )
Z = dtsbc$predict(X1,X0)


SBCK documentation built on Sept. 11, 2023, 5:10 p.m.

Related to dTSMBC in SBCK...