[問題] 迴圈不會跑...
[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
入門(寫過其他程式,只是對語法不熟悉)
[問題敘述]:
下列程式碼中的for迴圈不會執行...
是哪裡寫錯了?
[程式範例]:
garch <- garchFit(~garch(1,1),data=r.ts, trace=F)
magarch <- garchFit(~arma(0,1)+garch(1,1),data=r.ts, trace=F)
resgarch <-residuals(garch)
resmagarch <-residuals(magarch)
resgarch2 <-resgarch^2
resmagarch2 <-resmagarch^2
for (i in 1:20) {
Box.test(resgarch, lag = i, type = "Ljung-Box")
Box.test(resmagarch, lag = i, type = "Ljung-Box")
Box.test(resgarch2, lag = i, type = "Ljung-Box")
Box.test(resmagarch2, lag = i, type = "Ljung-Box")
}
[關鍵字]:
Box.test, Ljung-Box, for loop, GARCH
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.173.137.236
→
06/18 00:00, , 1F
06/18 00:00, 1F
→
06/18 00:48, , 2F
06/18 00:48, 2F
→
06/18 00:48, , 3F
06/18 00:48, 3F
推
06/18 01:33, , 4F
06/18 01:33, 4F
推
06/18 01:46, , 5F
06/18 01:46, 5F
討論串 (同標題文章)
R_Language 近期熱門文章
PTT數位生活區 即時熱門文章