Transforms the entries an arbitrary copula so they can be compatible with the first two moments of a timeseries.

copula_transformation(x, copula)

Arguments

x

A multivariate (non-tidy) dataset.

copula

A multivariate copula.

Value

A tabular (non-tidy) tibble.

Details

Under the hood, the copula transformation is a 4-step recipe:

  • 1. Normalize the copula to have a standard normal distribution;

  • 2. Operate an affine transformation on the normalized variables;

  • 3. Do the CMA Separation step on the new rotated variables;

  • 4. Extract the copula component that results from step 3.

Examples

x       <- matrix(diff(log(EuStockMarkets)), ncol = 4)

sep     <- cma_separation(x)
clayton <- fit_copula_clayton(sep)
gen     <- generate_copulas(clayton, 10)

copula_transformation(x, gen)
#> # A tibble: 10 × 4
#>      ...1   ...2   ...3   ...4
#>     <dbl>  <dbl>  <dbl>  <dbl>
#>  1 0.909  0.909  0.545  0.545 
#>  2 0.364  0.818  0.727  0.818 
#>  3 0.182  0.727  0.182  0.364 
#>  4 0.636  0.273  0.818  0.909 
#>  5 0.0909 0.0909 0.0909 0.0909
#>  6 0.545  0.455  0.455  0.455 
#>  7 0.818  0.636  0.909  0.636 
#>  8 0.455  0.364  0.636  0.182 
#>  9 0.273  0.182  0.364  0.273 
#> 10 0.727  0.545  0.273  0.727