如何在R中使用mgarchbekk包?

问题描述 投票:-1回答:1

我试图通过使用mgarchBEKK pachage来估计BEKK Garch模型,这是可用的here

library(quantmod)
library(rugarch)
library(mgarchBEKK)

eps<- read.csv("C.csv", header=TRUE)

  > head(eps)

       v1        v2
1 -0.001936598  0.001968415
2 -0.000441797 -0.002724438
3  0.003752762 -0.010221719
4 -0.004511632 -0.014637860
5 -0.001426905  0.010597786
6  0.007435739 -0.005880712
> tail(eps)
           v1           v2
1954 -0.043228944  0.0000530712
1955  0.082546871 -0.0028188110
1956  0.025058992  0.0058264010
1957  0.001751445 -0.0298050150
1958 -0.007973320 -0.0037243560
1959 -0.005207348  0.0012664230

## Simulate a BEKK process:
simulated <- simulateBEKK(2,1959, c(1,1), params = NULL)


## Prepare the input for the estimation process:
simulated1 <- do.call(cbind, simulated$eps)

## Estimate with default arguments:
estimated <- BEKK(simulated1)

  H IS SINGULAR!...
H IS SINGULAR!...
Warning message:
In BEKK(simulated1) : negative inverted hessian matrix element


## Show diagnostics:
diagnoseBEKK(estimated)

## Likewise, you can estimate an mGJR process:
estimated2 <- mGJR(simulated[,1], simulated[,2])

我不知道,我的代码中有什么问题,因为在结果中它显示的是3968个系列,而不是2个系列。

r time-series quantitative-finance
1个回答
1
投票

您正在估算模型。

那是什么意思?

引用我的统计学教授的话,哲学是“找到一个随机模型,可能已经创造了观察到的系列”。

这正是mgarchBEKK正在做的事情。该型号适用于您提供的数据(V1和V2系列)。简单来说,这意味着,尝试了许多不同的参数组合,在那些(在您的情况下为3968次尝试)中,“最适合”的组合就是您在结果中看到的。

我使用长度为8596的3个时间序列做了同样的事情。我的结果看起来像这样:

Number of estimated series :  25788 
Length of estimated series :  8596 
Estimation Time            :  3.258482 

所以估计的序列数量远高于我使用的3个向量。

估计看起来像这样(因为这是一个双变量或多变量模型估计,你有参数矩阵,而不是像一维GARCH模型那样的单个值):

C estimates:
      [,1]      [,2]        [,3]
      [1,] 0.9797469 0.2189191 0.202451941
      [2,] 0.0000000 1.0649323 0.003050169
      [3,] 0.0000000 0.0000000 0.896492130

ARCH estimates:
        [,1]         [,2]        [,3]
        [1,]  0.29110077 -0.008445699 0.008570904
        [2,] -0.02109381  0.419092657 0.325321939
        [3,] -0.01280835 -0.057648910 0.482502301

GARCH estimates:
        [,1]        [,2]        [,3]
        [1,] -0.27770297  0.03587415 -0.73029389
        [2,] -0.05172256 -0.25601327  0.01918367
        [3,]  0.07945086  0.03364686 -0.50664759

我不能描述这个拟合背后的数学,据我所知,使用某种形式的maximum likelihood estimation

我是统计学的新手,所以如果我说错了,请随时纠正我。

© www.soinside.com 2019 - 2024. All rights reserved.