Git Product home page Git Product logo

cdcopula's Introduction

Covariate-dependent copula models

Copyright

Feng Li  <[email protected]>
School of Statistics and Mathematics
Central University of Finance and Economics
http://feng.li/

Cite the package

Prerequisites

Environment requirements

  • git tools (for downloading the library)

  • R > 3.0.0 with the following required packages:

    • devtools

    • mvtnorm Rmfpr numDeriv optimix

    • rugarch rmgarch fGarch stochvol teigen

    • VineCopula

    • snow, Rmpi (optional)

Installation

The package is currently under developments. We are not yet ready to make it as a standard R package. Please follow the following instructions to "load" the functionality.

Clone the repository and its dependencies

  • This package depends on flutils package. Install it with devtools
devtools::install_github("feng-li/flutils")
devtools::install_github("feng-li/cdcopula")

Run a covariate-dependent copula model

  • The example model configuration files are located at inst/config/.

  • Linux executable scripts are provided at inst/bin/. For more information, you may issue the following command in a terminal

inst/bin/CplRun --help
  • Or within R, use
library("cdcopula")
CplRun(Mdl.ConfigFile=file.path(system.file(package = "cdcopula"), 'config/config.BB7.GARCH.SP100-SP600.R'))

Cluster Parallelization

  • Run with SLURM cluster
mpirun -np 1  inst/bin/CplRun 4 inst/config/${CONFIG_FILE}

And submit to slurm with

sbatch inst/config/slurm.sh

Implementing a new covariate-dependent copula model

First you may need to consult the reference paper. Then you could edit the following files accordingly.

for the copula model

  • pCpl.R, dCpl.R Copula functions and their densities.

  • logCplGrad.R Gradient function for log copula density w.r.t. copula parameters.

  • logCplRepGrad.R Gradient function for reparameterized log copula density w.r.t. copula parameters which may require

    • parCplRep2Std.R

    • kendalltau.R, kendalltauGrad.R

    • lambda.R, lambdaGrad.R

for the marginal model

  • If you want to implement a native marginal model edit the following files

    • MargiModel.R CDF and PDF of the marginal distribution

    • MargiModelGrad.R Gradient for CDF and PDF of the marginal distribution

    • MargiModelInv.R The inverse for marginal model

  • If you want to include a foreign marginal model with existing algorithms, edit the following files

    • MargiModelForeignEval.R

    • MargiModelForeignPred.R

    • logCplPredict.R

  • If you want to include a foreign multivariate model for model comparison, edit the following files

    • ModelForeignEval.R

    • ModelForeignPred.R

References

Acknowledgments

Feng Li's research were supported by the National Natural Science Foundation of China (No. 11501587).

cdcopula's People

Contributors

feng-li avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.