Git Product home page Git Product logo

factorcopula's Introduction

factorcopula - r package for high dimensional specification, simulation and estimation of factor copula models

Travis-CI Build Status

This project is archived and no longer actively maintained.

features

  • simulation from user specified factor copula models (e.g. factors and error terms from the skew t, normal, t distribution)
  • estimation of high dimensional dependence structures using the simulated methods of moments
  • unrestricted, equi-dependence and block-equi-dependence model specification
  • implementation of a structural break test
  • estimation of asymptotic variance and confidence intervalls
  • implementation of the J test for overidentifying restrictions
  • implementation of faster C++ code with Rcpp

citation information

Please cite the following paper when using any parts of this library in your research:

@phdthesis{bonart_malte_2020_3749627,
  author       = {Bonart, Malte},
  title        = {{Testing for Structural Breaks in Factor Copula 
                   Models - Implementation and Application in Social
                   Media Topic Analysis}},
  school       = {University of Cologne},
  year         = 2020,
  month        = apr,
  note         = {{Submitted for the Master Examination in Economics 
                   at the Faculty of Management, Economics and Social
                   Sciences of the University of Cologne in June
                   2018.}},
  doi          = {10.5281/zenodo.3749627},
  url          = {https://doi.org/10.5281/zenodo.3749627}
}

installation from github master branch

install.packages("devtools")
devtools::install_github("bonartm/factorcopula")

usage

library(factorcopula)
help(package = "factorcopula")

# define a one factor skew-t copula
t <- 1500
k <- c(1, 1) # all variables in the same groups for an equidependence model
beta <- config_beta(k = k, Z = 1)
Z <- config_factor(rst = list(nu = 1/0.25, lambda = lambda), par = c("lambda"))
eps <- config_error(rt = list(df = 1/0.25))

# define the vector of true parameters
theta0 <- c(beta1 = 1.5, lambda = -0.8)

# generate the copula function and simulate values from the copua model
cop <- fc_create(Z, eps, beta)
U <- cop(theta0, t)


# use some marginal distributions (here normal distribution) to simulate some Y values
Y <- qnorm(U)

# define boundaries for optimzation
lower <- c(beta1 = 0, lambda = -0.9)
upper <- c(beta1 = 5, lambda =  0.9)


# fit the copula 


m <- fc_fit(Y, Z, eps, beta, lower, upper, S = 20000, se = TRUE)
m$theta.second.stage
m$Q
m$message

# plot observed and simulated values
plot(Y, pch = 20)
points(qnorm(cop(m$theta.second.stage, 2000)), col = "red", pch = 20)

# confidence intervalls and p-values
round(m$ci, 4)

factorcopula's People

Contributors

bonartm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.