昨天我尝试在gogarchspec
中使用gogarchfit
,gogarchforecast
和rmgarch
,但发现没有可检索的aic值。
> fit
*------------------------------*
* GO-GARCH Fit *
*------------------------------*
Mean Model : VAR
(Lag) : 1
(Robust) : FALSE
GARCH Model : gjrGARCH
Distribution : mvnorm
ICA Method : fastica
No. Factors : 3
No. Periods : 1475
Log-Likelihood : NA
------------------------------------
U (rotation matrix) :
[,1] [,2] [,3]
[1,] -0.059 0.9973 0.0435
[2,] -0.594 -0.0701 0.8017
[3,] 0.803 0.0214 0.5962
A (mixing matrix) :
[,1] [,2] [,3]
[1,] 4.49e-05 -0.0258 0.000127
[2,] 1.80e-03 -0.0260 -0.004237
[3,] 4.19e-03 -0.0257 -0.000478
[4,] 6.78e-05 -0.0259 0.000116
上面是拟合模型,下面是模型的属性,但显示aic值无法检索。
> ## attributes of univariate stage 1
> attributes(attributes(fit)$mfit$ufit)
$`fit`
$`fit`[[1]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : gjrGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
omega 0.005346 0.002855 1.8723 0.061167
alpha1 0.057142 0.012491 4.5746 0.000005
beta1 0.955136 0.006263 152.4948 0.000000
gamma1 -0.026556 0.012794 -2.0756 0.037931
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
omega 0.005346 0.004330 1.2344 0.217043
alpha1 0.057142 0.014525 3.9340 0.000084
beta1 0.955136 0.004851 196.9049 0.000000
gamma1 -0.026556 0.016780 -1.5826 0.113509
LogLikelihood : -2016.878
Information Criteria
------------------------------------
Akaike 2.7402
Bayes 2.7545
Shibata 2.7402
Hannan-Quinn 2.7455
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.003505 0.952788
Lag[2*(p+q)+(p+q)-1][2] 6.443923 0.016755
Lag[4*(p+q)+(p+q)-1][5] 12.082773 0.002649
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 2.143 0.1432
Lag[2*(p+q)+(p+q)-1][5] 3.096 0.3898
Lag[4*(p+q)+(p+q)-1][9] 3.467 0.6801
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 1.363 0.500 2.000 0.2430
ARCH Lag[5] 1.384 1.440 1.667 0.6233
ARCH Lag[7] 1.470 2.315 1.543 0.8274
Nyblom stability test
------------------------------------
Joint Statistic: 1.0821
Individual Statistics:
omega 0.07099
alpha1 0.10828
beta1 0.11995
gamma1 0.09015
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.2798 0.7796
Negative Sign Bias 1.0104 0.3125
Positive Sign Bias 0.3739 0.7086
Joint Effect 1.9887 0.5748
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 292.2 8.015e-51
2 30 322.3 3.064e-51
3 40 315.2 6.495e-45
4 50 345.2 3.814e-46
Elapsed time : 0.6845639
$`fit`[[2]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : gjrGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
omega 0.002153 0.000008 261.73 0
alpha1 0.102055 0.000012 8831.33 0
beta1 0.884322 0.002903 304.64 0
gamma1 -0.102709 0.000139 -740.41 0
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
omega 0.002153 0.000282 7.6367 0
alpha1 0.102055 0.000145 704.3463 0
beta1 0.884322 0.046124 19.1728 0
gamma1 -0.102709 0.006434 -15.9638 0
LogLikelihood : -215.4113
Information Criteria
------------------------------------
Akaike 0.29751
Bayes 0.31187
Shibata 0.29749
Hannan-Quinn 0.30286
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 3.416 0.06456
Lag[2*(p+q)+(p+q)-1][2] 3.526 0.10118
Lag[4*(p+q)+(p+q)-1][5] 3.744 0.28773
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.0001372 0.9907
Lag[2*(p+q)+(p+q)-1][5] 0.0008338 1.0000
Lag[4*(p+q)+(p+q)-1][9] 0.0035321 1.0000
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.0001646 0.500 2.000 0.9898
ARCH Lag[5] 0.0004930 1.440 1.667 1.0000
ARCH Lag[7] 0.0032936 2.315 1.543 1.0000
Nyblom stability test
------------------------------------
Joint Statistic: 3.7551
Individual Statistics:
omega 0.3142
alpha1 1.6889
beta1 0.2903
gamma1 1.7023
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.16496 0.8690
Negative Sign Bias 0.19577 0.8448
Positive Sign Bias 0.17061 0.8646
Joint Effect 0.07736 0.9944
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 66.98 2.901e-07
2 30 89.45 4.416e-08
3 40 84.46 3.381e-05
4 50 108.76 2.002e-06
Elapsed time : 2.061266
$`fit`[[3]]
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : gjrGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
omega 0.002290 0.001686 1.35806 0.174445
alpha1 0.033963 0.007582 4.47926 0.000007
beta1 0.966294 0.003796 254.58599 0.000000
gamma1 -0.002514 0.007508 -0.33489 0.737707
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
omega 0.002290 0.002543 0.90055 0.367828
alpha1 0.033963 0.007854 4.32413 0.000015
beta1 0.966294 0.004485 215.46707 0.000000
gamma1 -0.002514 0.009729 -0.25844 0.796069
LogLikelihood : -1976.537
Information Criteria
------------------------------------
Akaike 2.6855
Bayes 2.6998
Shibata 2.6855
Hannan-Quinn 2.6908
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 4.856e-04 9.824e-01
Lag[2*(p+q)+(p+q)-1][2] 1.243e+01 4.364e-04
Lag[4*(p+q)+(p+q)-1][5] 3.929e+01 7.361e-11
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.5075 0.4762
Lag[2*(p+q)+(p+q)-1][5] 1.6769 0.6964
Lag[4*(p+q)+(p+q)-1][9] 4.2823 0.5417
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.5119 0.500 2.000 0.4743
ARCH Lag[5] 2.0544 1.440 1.667 0.4593
ARCH Lag[7] 3.8795 2.315 1.543 0.3643
Nyblom stability test
------------------------------------
Joint Statistic: 1.5558
Individual Statistics:
omega 0.28550
alpha1 0.12862
beta1 0.18188
gamma1 0.09135
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 1.15840 0.24689
Negative Sign Bias 1.72872 0.08407 *
Positive Sign Bias 0.03879 0.96906
Joint Effect 3.23634 0.35660
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 317.7 4.733e-56
2 30 345.8 6.180e-56
3 40 351.4 6.851e-52
4 50 339.5 4.331e-45
Elapsed time : 0.7231081
$desc
$desc$`type`
[1] "equal"
$class
[1] "uGARCHmultifit"
attr(,"package")
[1] "rugarch"
当我检查姓名列表时,Information Criteria
之后没有log.likelihoods
之类的东西。与使用str()
检查列表中的所有可用字符串相同。
> ## attributes of univariate stage 2
> names(attributes(attributes(attributes(fit)$mfit$ufit)[[1]][[1]])$fit)
[1] "hessian" "cvar" "var" "sigma"
[5] "condH" "z" "LLH" "log.likelihoods"
[9] "residuals" "coef" "robust.cvar" "A"
[13] "B" "scores" "se.coef" "tval"
[17] "matcoef" "robust.se.coef" "robust.tval" "robust.matcoef"
[21] "fitted.values" "convergence" "kappa" "persistence"
[25] "timer" "ipars" "solver"
> names(attributes(attributes(attributes(fit)$mfit$ufit)[[1]][[2]])$fit)
[1] "hessian" "cvar" "var" "sigma"
[5] "condH" "z" "LLH" "log.likelihoods"
[9] "residuals" "coef" "robust.cvar" "A"
[13] "B" "scores" "se.coef" "tval"
[17] "matcoef" "robust.se.coef" "robust.tval" "robust.matcoef"
[21] "fitted.values" "convergence" "kappa" "persistence"
[25] "timer" "ipars" "solver"
> names(attributes(attributes(attributes(fit)$mfit$ufit)[[1]][[3]])$fit)
[1] "hessian" "cvar" "var" "sigma"
[5] "condH" "z" "LLH" "log.likelihoods"
[9] "residuals" "coef" "robust.cvar" "A"
[13] "B" "scores" "se.coef" "tval"
[17] "matcoef" "robust.se.coef" "robust.tval" "robust.matcoef"
[21] "fitted.values" "convergence" "kappa" "persistence"
[25] "timer" "ipars" "solver"
答案 0 :(得分:1)
您没有提供可复制的示例,因此该代码未经测试,但可能提供解决方案:
export FLASK_APP=faceParser
export FLASK_ENV=development
flask run
答案 1 :(得分:1)
我研究了源代码,以下代码为您提供了所需的信息:
object = fit
if(object@model$modelinc[1]>0){
npvar = dim(object@model$varcoef)[1] * dim(object@model$varcoef)[2]
} else{
npvar = 0
}
m = dim(object@model$modeldata$data)[2]
T = object@model$modeldata$T
itest = rugarch:::.information.test(object@mfit$llh, nObs = T, nPars = npvar + (m^2 - m)/2 + length(object@mfit$matcoef[,1]))
itest$AIC