在arch包顶部构建的多个单变量arch建模工具箱

muarch的Python项目详细描述


muarch

连续积分

Build StatusBuild status

文档

Documentation Status

覆盖范围

Coverage Status

安装

使用pip并在conda上安装和更新。

这是kevin sheppard的ARCH包上的包装。其目的是:

  1. 启用更快的蒙特卡罗模拟
  2. 通过copula marginals模拟创新

在包中,有两个类可以帮助您-UArchMUArch。可以使用与原始arch包中的arch_model相似的api来定义UArch类。MUArch是这些UArch模型的集合。

因此,如果你有一个生成统一边值的函数,比如copula,你可以在模拟garch过程时在不同边值之间创建一个依赖结构。

如果你需要一个copula包,我有一个here。:)

示例

我将列出一个简单的过程做ar-garch-copula模拟。

frommuarchimportMUArch,UArchfrommuarch.datasetsimportload_etffromcopulaeimportNormalCopulareturns=load_etf()# load returns datanum_assets=returns.shape[1]# sets up a MUArch model collection where each model defaults to # mean: AR(1)# vol: GARCH(1, 1)# dist: normal models=MUArch(num_assets,mean='AR',lags=1)# set first model to AR(1)-GARCH(1, 1) with skewt innovations  models[0]=UArch('AR',lags=1,dist='skewt')# fit model, if you get complaints regarding non-convergence, you can scale the data up # using the scale parameter in the UArch or MUArch. i.e. UArch(..., scale=100). This will# reduce numerical errors. Don't worry, I'll rescale the simulation values subsequentlymodels.fit(returns)# Usually you'll want to fit the residuals to the copula, use the copula to generate the# residuals and subsequently transform it back to returns residuals=models.residuals()# defaults to return the standardized residualscop=NormalCopula(dim=num_assets)# use a normal copula, you could of course use a TCopulacop.fit(residuals)# simulate 10 steps into the future, over 4 repetitions. This will return a (10 x 4 x 3) arraymodels.simulate_mc(10,4,custom_dist=cop.random)

未来工作

这实际上是一个临时的黑客,以便其他人可以做garch copula模拟。另一个问题是arfima mean模型不太容易用原始的arch包指定(并从中模拟)。你可以指定一个arfima(或者仅仅是一个arma模型),分别对其进行拟合,然后使用残差拟合一个零均值模型(纯garch)。然而,以这种方式,模拟并不是那么简单,因为您将不得不将garch过程和mean模型过程的模拟缝合起来。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
由于测试失败,java testcontainers maven构建失败   java实现jacobi算法实现laplace方程   java中的多线程:如何在不等待所有线程使用ExecutorService完成任务的情况下终止所有线程的执行?   java Hello World不在Android Studio 3中工作   ubuntu Tomcat7的Java版本不正确   java Javafx内存泄漏   对于手动实现的Spring数据存储库方法,我应该使用Java8默认方法吗?   googleappengine中的java添加过滤查询   html当使用JSOUP库在Java中读取标签时,如何保留标签(如<br>、<ul>、<li>、<p>等)的含义?   编码为什么jasper生成的报告在Java中不显示西里尔语(保加利亚语)?   java有没有办法隐藏当前位置和jdk动作?   java找出编译原型文件的版本   有没有办法在运行时更改java方法的访问修饰符?   语法字符串。。。Java中的参数   java数组元素在添加其他元素时会相互覆盖   eclipse中的java GWT项目   java如何为spring rest模板请求将动态json属性名映射到jackson   java无法在Windows 10上找到特定的JDK   在xml字符串和java字符串之间提取正则表达式子字符串