虽然滞后,但在原始系列中长度与原始系列相同的残差

时间:2015-09-07 14:33:49

标签: r

我正在使用R中的library(rugarch) set.seed(123) x <- rnorm(1000) spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,1)), mean.model = list(armaOrder = c(1,0))) fit <- ugarchfit(spec, x) coef <- fit@fit$coef xhat <- fit@fit$fitted.values myxhat <- coef["mu"] + coef["ar1"]*c(NA, x[-length(x)]) resid <- fit@fit$residuals myresid <- x-myxhat length(resid)==length(x) [1] TRUE head(cbind(x, xhat, myxhat, resid, myresid)) x xhat myxhat resid myresid [1,] -0.56047565 0.01615305 NA -0.57662870 NA [2,] -0.23017749 0.03207118 0.03162527 -0.26224867 -0.26180276 [3,] 1.55870831 0.02295313 0.02250722 1.53575518 1.53620110 [4,] 0.07050839 -0.02642998 -0.02687590 0.09693838 0.09738429 [5,] 0.12928774 0.01465254 0.01420663 0.11463519 0.11508111 [6,] 1.71506499 0.01302991 0.01258399 1.70203508 1.70248099 tail(cbind(x, xhat, myxhat, resid, myresid)) x xhat myxhat resid myresid [995,] 0.3132288 0.022487416 0.022041503 0.29074136 0.2911873 [996,] -0.0899752 0.007952121 0.007506207 -0.09792732 -0.0974814 [997,] 1.0705160 0.019082774 0.018636861 1.05143326 1.0518792 [998,] -1.3511004 -0.012953185 -0.013399098 -1.33814720 -1.3377013 [999,] -0.5226167 0.053896785 0.053450872 -0.57651348 -0.5760676 [1000,] -0.2491907 0.031026066 0.030580152 -0.28021674 -0.2797708 包来拟合平均等式中具有ARMA顺序(1,0)的GARCH模型。尽管存在滞后,但残差序列在某种程度上与原始序列的长度相同。

rugarch

有谁知道(或为什么?)OpenQuery(){ try { Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe"); Thread.sleep(5000); p.destroy(); File folder = new File("C:/Users/SAVAGD05/Documents/RMP/QUERIES/"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { String url = "C:/Users/Sammy/Documents/RMP/QUERIES/" + listOfFiles[i].getName(); File htmlFile = new File(url); Desktop.getDesktop().browse(htmlFile.toURI()); } } catch (Exception e) {} } 计算第一次观察的残差?我发现有人试图在here之前提出这个问题而没有回答。感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

rugarch使用截距作为那些通常在估算具有滞后值的方程时被移除的观测值的拟合值。

coef["mu"]
mu 
0.01615305