Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R中GARCH模型的限制测试(H0:alpha1+;beta1=1,H1:alpha1+;beta1≠;1)不起作用_R_Time Series_Restriction_Chi Squared_Hypothesis Test - Fatal编程技术网

R中GARCH模型的限制测试(H0:alpha1+;beta1=1,H1:alpha1+;beta1≠;1)不起作用

R中GARCH模型的限制测试(H0:alpha1+;beta1=1,H1:alpha1+;beta1≠;1)不起作用,r,time-series,restriction,chi-squared,hypothesis-test,R,Time Series,Restriction,Chi Squared,Hypothesis Test,我尝试使用以下假设对GARCH模型(来自“rugarch”包的ugarch)进行限制性检验: H0: alpha1 + beta1 = 1 H1: alpha1 + beta1 ≠ 1 因此,我正试图听从来自中国的建议 1.使用带有选项variance.model=list(model=“sGARCH”)的ugarchspec指定受限模型,并使用ugarchfit进行估算。从时隙拟合子时隙似然中获取对数似然 2.使用带有选项variance.model=list(model=“iGA

我尝试使用以下假设对GARCH模型(来自“rugarch”包的ugarch)进行限制性检验:

 H0: alpha1 + beta1 = 1

 H1: alpha1 + beta1 ≠ 1 
因此,我正试图听从来自中国的建议

1.使用带有选项variance.model=list(model=“sGARCH”)的ugarchspec指定受限模型,并使用ugarchfit进行估算。从时隙拟合子时隙似然中获取对数似然

2.使用带有选项variance.model=list(model=“iGARCH”)的ugarchspec指定受限模型,并使用ugarchfit进行估算。获得如上所述的对数似然

3.计算LR=2(无限制模型的对数似然)− 记录受限模型的可能性),并获得p值为pchisq(q=LR,df=1)

我有以下“sGARCH”和“iGARCH”模型,我使用的是“rugarch”软件包

(A) sGARCH(无限制模型):

以下是sGARCH输出:

    *---------------------------------*
    *          GARCH Model Fit        *
    *---------------------------------*

    Conditional Variance Dynamics   
    -----------------------------------
    GARCH Model     : sGARCH(1,1)
    Mean Model      : ARFIMA(0,0,0)
    Distribution    : norm 

    Optimal Parameters
    ------------------------------------
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001004 -0.35377 0.723508
    archm   0.096364    0.039646  2.43059 0.015074
    omega   0.000049    0.000010  4.91096 0.000001
    alpha1  0.289964    0.021866 13.26117 0.000000
    beta1   0.709036    0.023200 30.56156 0.000000

    Robust Standard Errors:
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001580 -0.22482 0.822122
    archm   0.096364    0.056352  1.71002 0.087262
    omega   0.000049    0.000051  0.96346 0.335316
    alpha1  0.289964    0.078078  3.71375 0.000204
    beta1   0.709036    0.111629  6.35173 0.000000

    LogLikelihood : 5411.828 

    Information Criteria
    ------------------------------------

    Akaike       -3.9180
    Bayes        -3.9073
    Shibata      -3.9180
    Hannan-Quinn -3.9141

    Weighted Ljung-Box Test on Standardized Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      233.2       0
    Lag[2*(p+q)+(p+q)-1][2]     239.1       0
    Lag[4*(p+q)+(p+q)-1][5]     247.4       0
    d.o.f=0
    H0 : No serial correlation

    Weighted Ljung-Box Test on Standardized Squared Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      4.695 0.03025
    Lag[2*(p+q)+(p+q)-1][5]     5.941 0.09286
    Lag[4*(p+q)+(p+q)-1][9]     7.865 0.13694
    d.o.f=2

    Weighted ARCH LM Tests
    ------------------------------------
                Statistic Shape Scale P-Value
    ARCH Lag[3]     0.556 0.500 2.000  0.4559
    ARCH Lag[5]     1.911 1.440 1.667  0.4914
    ARCH Lag[7]     3.532 2.315 1.543  0.4190

    Nyblom stability test
    ------------------------------------
    Joint Statistic:  5.5144
    Individual Statistics:             
    mu     0.5318
    archm  0.4451
    omega  1.3455
    alpha1 4.1443
    beta1  2.2202

    Asymptotic Critical Values (10% 5% 1%)
    Joint Statistic:         1.28 1.47 1.88
    Individual Statistic:    0.35 0.47 0.75

    Sign Bias Test
    ------------------------------------
                       t-value   prob sig
    Sign Bias           0.2384 0.8116    
    Negative Sign Bias  1.1799 0.2381    
    Positive Sign Bias  1.1992 0.2305    
    Joint Effect        2.9540 0.3988    


    Adjusted Pearson Goodness-of-Fit Test:
    ------------------------------------
      group statistic p-value(g-1)
    1    20     272.1    9.968e-47
    2    30     296.9    3.281e-46
    3    40     313.3    1.529e-44
    4    50     337.4    1.091e-44


    Elapsed time : 0.4910491 
    *---------------------------------*
    *          GARCH Model Fit        *
    *---------------------------------*

    Conditional Variance Dynamics   
    -----------------------------------
    GARCH Model     : iGARCH(1,1)
    Mean Model      : ARFIMA(0,0,0)
    Distribution    : norm 

    Optimal Parameters
    ------------------------------------
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001001 -0.35485 0.722700
    archm   0.096303    0.039514  2.43718 0.014802
    omega   0.000049    0.000008  6.42826 0.000000
    alpha1  0.290304    0.021314 13.62022 0.000000
    beta1   0.709696          NA       NA       NA

    Robust Standard Errors:
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001488  -0.2386 0.811415
    archm   0.096303    0.054471   1.7680 0.077066
    omega   0.000049    0.000032   1.5133 0.130215
    alpha1  0.290304    0.091133   3.1855 0.001445
    beta1   0.709696          NA       NA       NA

    LogLikelihood : 5412.268 

    Information Criteria
    ------------------------------------

    Akaike       -3.9190
    Bayes        -3.9105
    Shibata      -3.9190
    Hannan-Quinn -3.9159

    Weighted Ljung-Box Test on Standardized Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      233.2       0
    Lag[2*(p+q)+(p+q)-1][2]     239.1       0
    Lag[4*(p+q)+(p+q)-1][5]     247.5       0
    d.o.f=0
    H0 : No serial correlation

    Weighted Ljung-Box Test on Standardized Squared Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      4.674 0.03063
    Lag[2*(p+q)+(p+q)-1][5]     5.926 0.09364
    Lag[4*(p+q)+(p+q)-1][9]     7.860 0.13725
    d.o.f=2

    Weighted ARCH LM Tests
    ------------------------------------
                Statistic Shape Scale P-Value
    ARCH Lag[3]    0.5613 0.500 2.000  0.4538
    ARCH Lag[5]    1.9248 1.440 1.667  0.4881
    ARCH Lag[7]    3.5532 2.315 1.543  0.4156

    Nyblom stability test
    ------------------------------------
    Joint Statistic:  1.8138
    Individual Statistics:             
    mu     0.5301
    archm  0.4444
    omega  1.3355
    alpha1 0.4610

    Asymptotic Critical Values (10% 5% 1%)
    Joint Statistic:         1.07 1.24 1.6
    Individual Statistic:    0.35 0.47 0.75

    Sign Bias Test
    ------------------------------------
                       t-value   prob sig
    Sign Bias           0.2252 0.8218    
    Negative Sign Bias  1.1672 0.2432    
    Positive Sign Bias  1.1966 0.2316    
    Joint Effect        2.9091 0.4059    


    Adjusted Pearson Goodness-of-Fit Test:
    ------------------------------------
      group statistic p-value(g-1)
    1    20     273.4    5.443e-47
    2    30     300.4    6.873e-47
    3    40     313.7    1.312e-44
    4    50     337.0    1.275e-44


    Elapsed time : 0.365 
(B) iGARCH(受限模型):

然而,我得到了beta1的以下输出,其标准误差、t值和p值中的N/A

以下是iGARCH输出:

    *---------------------------------*
    *          GARCH Model Fit        *
    *---------------------------------*

    Conditional Variance Dynamics   
    -----------------------------------
    GARCH Model     : sGARCH(1,1)
    Mean Model      : ARFIMA(0,0,0)
    Distribution    : norm 

    Optimal Parameters
    ------------------------------------
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001004 -0.35377 0.723508
    archm   0.096364    0.039646  2.43059 0.015074
    omega   0.000049    0.000010  4.91096 0.000001
    alpha1  0.289964    0.021866 13.26117 0.000000
    beta1   0.709036    0.023200 30.56156 0.000000

    Robust Standard Errors:
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001580 -0.22482 0.822122
    archm   0.096364    0.056352  1.71002 0.087262
    omega   0.000049    0.000051  0.96346 0.335316
    alpha1  0.289964    0.078078  3.71375 0.000204
    beta1   0.709036    0.111629  6.35173 0.000000

    LogLikelihood : 5411.828 

    Information Criteria
    ------------------------------------

    Akaike       -3.9180
    Bayes        -3.9073
    Shibata      -3.9180
    Hannan-Quinn -3.9141

    Weighted Ljung-Box Test on Standardized Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      233.2       0
    Lag[2*(p+q)+(p+q)-1][2]     239.1       0
    Lag[4*(p+q)+(p+q)-1][5]     247.4       0
    d.o.f=0
    H0 : No serial correlation

    Weighted Ljung-Box Test on Standardized Squared Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      4.695 0.03025
    Lag[2*(p+q)+(p+q)-1][5]     5.941 0.09286
    Lag[4*(p+q)+(p+q)-1][9]     7.865 0.13694
    d.o.f=2

    Weighted ARCH LM Tests
    ------------------------------------
                Statistic Shape Scale P-Value
    ARCH Lag[3]     0.556 0.500 2.000  0.4559
    ARCH Lag[5]     1.911 1.440 1.667  0.4914
    ARCH Lag[7]     3.532 2.315 1.543  0.4190

    Nyblom stability test
    ------------------------------------
    Joint Statistic:  5.5144
    Individual Statistics:             
    mu     0.5318
    archm  0.4451
    omega  1.3455
    alpha1 4.1443
    beta1  2.2202

    Asymptotic Critical Values (10% 5% 1%)
    Joint Statistic:         1.28 1.47 1.88
    Individual Statistic:    0.35 0.47 0.75

    Sign Bias Test
    ------------------------------------
                       t-value   prob sig
    Sign Bias           0.2384 0.8116    
    Negative Sign Bias  1.1799 0.2381    
    Positive Sign Bias  1.1992 0.2305    
    Joint Effect        2.9540 0.3988    


    Adjusted Pearson Goodness-of-Fit Test:
    ------------------------------------
      group statistic p-value(g-1)
    1    20     272.1    9.968e-47
    2    30     296.9    3.281e-46
    3    40     313.3    1.529e-44
    4    50     337.4    1.091e-44


    Elapsed time : 0.4910491 
    *---------------------------------*
    *          GARCH Model Fit        *
    *---------------------------------*

    Conditional Variance Dynamics   
    -----------------------------------
    GARCH Model     : iGARCH(1,1)
    Mean Model      : ARFIMA(0,0,0)
    Distribution    : norm 

    Optimal Parameters
    ------------------------------------
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001001 -0.35485 0.722700
    archm   0.096303    0.039514  2.43718 0.014802
    omega   0.000049    0.000008  6.42826 0.000000
    alpha1  0.290304    0.021314 13.62022 0.000000
    beta1   0.709696          NA       NA       NA

    Robust Standard Errors:
            Estimate  Std. Error  t value Pr(>|t|)
    mu     -0.000355    0.001488  -0.2386 0.811415
    archm   0.096303    0.054471   1.7680 0.077066
    omega   0.000049    0.000032   1.5133 0.130215
    alpha1  0.290304    0.091133   3.1855 0.001445
    beta1   0.709696          NA       NA       NA

    LogLikelihood : 5412.268 

    Information Criteria
    ------------------------------------

    Akaike       -3.9190
    Bayes        -3.9105
    Shibata      -3.9190
    Hannan-Quinn -3.9159

    Weighted Ljung-Box Test on Standardized Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      233.2       0
    Lag[2*(p+q)+(p+q)-1][2]     239.1       0
    Lag[4*(p+q)+(p+q)-1][5]     247.5       0
    d.o.f=0
    H0 : No serial correlation

    Weighted Ljung-Box Test on Standardized Squared Residuals
    ------------------------------------
                            statistic p-value
    Lag[1]                      4.674 0.03063
    Lag[2*(p+q)+(p+q)-1][5]     5.926 0.09364
    Lag[4*(p+q)+(p+q)-1][9]     7.860 0.13725
    d.o.f=2

    Weighted ARCH LM Tests
    ------------------------------------
                Statistic Shape Scale P-Value
    ARCH Lag[3]    0.5613 0.500 2.000  0.4538
    ARCH Lag[5]    1.9248 1.440 1.667  0.4881
    ARCH Lag[7]    3.5532 2.315 1.543  0.4156

    Nyblom stability test
    ------------------------------------
    Joint Statistic:  1.8138
    Individual Statistics:             
    mu     0.5301
    archm  0.4444
    omega  1.3355
    alpha1 0.4610

    Asymptotic Critical Values (10% 5% 1%)
    Joint Statistic:         1.07 1.24 1.6
    Individual Statistic:    0.35 0.47 0.75

    Sign Bias Test
    ------------------------------------
                       t-value   prob sig
    Sign Bias           0.2252 0.8218    
    Negative Sign Bias  1.1672 0.2432    
    Positive Sign Bias  1.1966 0.2316    
    Joint Effect        2.9091 0.4059    


    Adjusted Pearson Goodness-of-Fit Test:
    ------------------------------------
      group statistic p-value(g-1)
    1    20     273.4    5.443e-47
    2    30     300.4    6.873e-47
    3    40     313.7    1.312e-44
    4    50     337.0    1.275e-44


    Elapsed time : 0.365 
如果我计算对数似然差得出卡方值 正如建议的那样,我得到负值:

 2*(5411.828-5412.268)=-0.88
受限模型“iGARCH”的对数似然为5412.268,高于非受限模型“sGARCH”的对数似然为5411.828 这是不应该发生的

我使用的数据以时间序列的方式如下(由于篇幅限制,我只发布前100个数据):


为了根据我的H0和H1假设进行限制测试,我可以知道如何解决这个问题吗

估计程序似乎有问题。。。由于一个模型是另一个模型的受限版本,因此使用iGARCH确实会导致更低的可能性

使用数据的子集

fit1 <- ugarchfit(speca, data = data.matrix(P)) 
# [1] 161.7373
fit2 <- ugarchfit(speca2, data = data.matrix(P))
# [1] 165.333
这意味着我的怀疑是错误的(必须是密度值大于1)。因此,我认为没有办法使用当前输出来构造测试。iGARCH的限制非常适合

然而,一些实验表明,使用

fit.control = list(scale = 1)
改变事情。特别是,

fit1 <- ugarchfit(speca, data = data.matrix(P), fit.control = list(scale = 1))
likelihood(fit1)
# [1] 161.7373
-sum(log(2 * pi * sigma(fit1)^2)) / 2 - sum(residuals(fit1, standardize = TRUE)^2) / 2
# [1] 161.7373

fit2 <- ugarchfit(speca2, data = data.matrix(P), fit.control = list(scale = 1))
likelihood(fit2)
# [1] 19.5233
-sum(log(2 * pi * sigma(fit2)^2)) / 2 - sum(residuals(fit2, standardize = TRUE)^2) / 2
# [1] 19.5233

fit1这是我从软件包作者“Alexios Galanos”那里得到的答案:

问题在于,GARCH模型的平稳性受到限制,这可能会干扰 在平稳边界上的模型的解算器收敛。以下是解决方案:

  library(rugarch)
  library(xts)
  dat<-read.table("data.txt",header = TRUE, stringsAsFactors = FALSE)
  dat = xts(dat[,2], as.Date(strptime(dat[,1],"%d/%m/%Y")))

  spec1<-ugarchspec(mean.model=list(armaOrder=c(0,0), archm=TRUE, archpow=1), variance.model=list(model="iGARCH"))
  spec2<-ugarchspec(mean.model=list(armaOrder=c(0,0), archm=TRUE, archpow=1), variance.model=list(model="sGARCH"))
  mod1<-ugarchfit(spec1, dat, solver="solnp")
  mod2<-ugarchfit(spec2,dat)
  persistence(mod2)
  >0.999

 # at the limit of the internal constraint

 mod2<-ugarchfit(spec2, dat, solver="solnp", fit.control = list(stationarity=0))
  likelihood(mod2)
  >5428.871


  likelihood(mod1)

  >5412.268
  persistence(mod2)
  1.08693
  # above the limit

  Here is one solution to change the constraint:

  .garchconbounds2= function(){
    return(list(LB = 1e-12,UB = 0.99999999999))
  }
  assignInNamespace(x = ".garchconbounds", value=.garchconbounds2, ns="rugarch")
  mod2<-ugarchfit(spec2, dat, solver="solnp")

  likelihood(mod2)
  >5412.268
库(rugarch)
图书馆(xts)

DAT有人知道答案吗,特别是当我使用GARCH-M模型进行限制测试时?有没有一种方法可以发布我使用的完整数据集,以便您复制我的代码和结果?我想附加一个记事本文件,但不能。@Eric,我认为你不能直接附加;想到的两个选择是pastebin.com和dropbox。
fit1 <- ugarchfit(speca, data = data.matrix(P), fit.control = list(scale = 1))
likelihood(fit1)
# [1] 161.7373
-sum(log(2 * pi * sigma(fit1)^2)) / 2 - sum(residuals(fit1, standardize = TRUE)^2) / 2
# [1] 161.7373

fit2 <- ugarchfit(speca2, data = data.matrix(P), fit.control = list(scale = 1))
likelihood(fit2)
# [1] 19.5233
-sum(log(2 * pi * sigma(fit2)^2)) / 2 - sum(residuals(fit2, standardize = TRUE)^2) / 2
# [1] 19.5233
fit1 <- ugarchfit(speca, data = data.matrix(P), fit.control = list(scale = 0), solver.control = list(trace = TRUE))
# 
# Iter: 1 fn: -161.7373  Pars:  -0.0454619  0.0085993  0.0002706  0.0593231  # 0.6898473
# Iter: 2 fn: -161.7373  Pars:  -0.0454619  0.0085993  0.0002706  0.0593231  0.6898473
# solnp--> Completed in 2 iterations
coef(fit1)
#            mu        mxreg1         omega        alpha1         beta1 
# -0.0454619274  0.0085992743  0.0002706018  0.0593231138  0.6898472858 
fit1 <- ugarchfit(speca, data = data.matrix(P), fit.control = list(scale = 1), solver.control = list(trace = TRUE))

# Iter: 1 fn: 114.8143   Pars:  -0.72230  0.13663  0.06830  0.05930  0.68988
# Iter: 2 fn: 114.8143   Pars:  -0.72228  0.13662  0.06830  0.05931  0.68986
# solnp--> Completed in 2 iterations
coef(fit1)
#           mu       mxreg1        omega       alpha1        beta1 
# -0.045463099  0.008599494  0.000270610  0.059310622  0.689858216
fit2 <- ugarchfit(speca2, data = data.matrix(P), fit.control = list(scale = 0), solver.control = list(trace = TRUE))

# Iter: 1 fn: -165.3330  Pars:   0.0292439 -0.0051098  0.0002221  0.7495846
# Iter: 2 fn: -165.3330  Pars:   0.0292434 -0.0051097  0.0002221  0.7495853
# solnp--> Completed in 2 iterations
coef(fit2)
#            mu        mxreg1         omega        alpha1         beta1 
#  0.0292434276 -0.0051096984  0.0002221457  0.7495853224  0.2504146776 
fit2 <- ugarchfit(speca2, data = data.matrix(P), fit.control = list(scale = 1), solver.control = list(trace = TRUE))

# Iter: 1 fn: 111.2185   Pars:   0.46462 -0.08118  0.05607  0.74959
# Iter: 2 fn: 111.2185   Pars:   0.46458 -0.08118  0.05607  0.74959
# solnp--> Completed in 2 iterations
coef(fit2)
#          mu      mxreg1       omega      alpha1       beta1 
#  0.46458110 -0.08117626  0.05607215  0.74959242  0.25040758 
  library(rugarch)
  library(xts)
  dat<-read.table("data.txt",header = TRUE, stringsAsFactors = FALSE)
  dat = xts(dat[,2], as.Date(strptime(dat[,1],"%d/%m/%Y")))

  spec1<-ugarchspec(mean.model=list(armaOrder=c(0,0), archm=TRUE, archpow=1), variance.model=list(model="iGARCH"))
  spec2<-ugarchspec(mean.model=list(armaOrder=c(0,0), archm=TRUE, archpow=1), variance.model=list(model="sGARCH"))
  mod1<-ugarchfit(spec1, dat, solver="solnp")
  mod2<-ugarchfit(spec2,dat)
  persistence(mod2)
  >0.999

 # at the limit of the internal constraint

 mod2<-ugarchfit(spec2, dat, solver="solnp", fit.control = list(stationarity=0))
  likelihood(mod2)
  >5428.871


  likelihood(mod1)

  >5412.268
  persistence(mod2)
  1.08693
  # above the limit

  Here is one solution to change the constraint:

  .garchconbounds2= function(){
    return(list(LB = 1e-12,UB = 0.99999999999))
  }
  assignInNamespace(x = ".garchconbounds", value=.garchconbounds2, ns="rugarch")
  mod2<-ugarchfit(spec2, dat, solver="solnp")

  likelihood(mod2)
  >5412.268