Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- slideFunc<- function(data, window, step){
- total<- length(data)
- spots<- seq(from=1, to=(total-window), by=step)
- result<- vector(length=length(spots))
- order.matrix<-matrix(0,nrow = 3, ncol = 6 * 2 * 6)
- aic.vec<- numeric(6 * 2 * 6)
- k<-1
- for(i in 1:length(spots)){
- for(p in 0:5) for(d in 0:1) for(q in 0:5){
- order.matrix[,k]<-c(p,d,q)
- aic.vec[k]<- AIC(arima(data[spots[i]:(spots[i]+window)], order=c(p,d,q)))
- k<-k+1
- }
- ind<- order(aic.vec,decreasing=F)
- aic.vec<- aic.vec[ind]
- order.matrix<- order.matrix[,ind]
- order.matrix<- t(order.matrix)
- result<- cbind(order.matrix,aic.vec)
- colnames(result)<- c("p","d","q","AIC")
- }
- return(result)}
- slideFunc(y,50,1)
- Error in `[<-`(`*tmp*`, , k, value = c(0L, 0L, 0L)) :
- subscript out of bounds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement