위해 나는 R 루프 "를"다음과 같은 것을 가정? 이미 이전 게시물에 대한 답변 (링크 : Loop for ARMA model estimation 참조)을 기반으로 명령을 작성하려고했지만 위의 루프에 대한 예상 결과를 얻을 수 없습니다.건물 계수 매트릭스는 순환적인 GARCH/ARMA + GARCH 모델
EDIT :
다음 "의사 코드"는 계수 매트릭스의 제 3, 제 4, 제 5 열 오메가 알파 1 및 베타 계수를 저장하지 않는다는 점에서 틀리다.
누구든지 오류를 찾아서 수정할 수 있습니까?
의사 코드 :
armagarchcoefmat=matrix(NA, 4, 6)
a=0
for(p in 0:1) for(q in 0:1){
a=a+1
model<-ugarchspec(variance.model = list(model="fGARCH", submodel = "GARCH", garchOrder = c(1, 1)),mean.model = list(armaOrder = c(p, q), include.mean = TRUE), distribution.model = "norm")
modelfit<-ugarchfit(spec=model, data=USDlogreturns, solver="hybrid")
if(p>0) armagarchcoefmat[a, c(1: p) ]=coef(modelfit)[2:6][c( 1 : p)]
if(q>0) armagarchcoefmat[a, c(2:(1+q))]=coef(modelfit)[2:6][c((p+1):(p+q))]
armagarchcoefmat[a, 6 ]=head(coef(modelfit),1)
}
당신은 [재현 예]를 설정해야합니다 (http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), 모든'라이브러리를 포함하여()'는 함수 코드, 입력 데이터,'modelfit'의 결과와 같은 현재 결과, 그리고 예상 결과를 호출합니다. – Parfait