I am working on the functional time series, i am trying to extend the "Functional Autoregressive model of order one to high order " by transforming " functional version" into "vector autoregressive model" then i predict the result through function "prediction.ffpe" apply to my data matrix "mat2" and trying to obtained the prediction for the whole year using the "for loop" then i got the following error. Can any body help me that how to solve this error.

```
prediction.ffpe = function(fdata1){
n = ncol(fdata1$coef)
D = nrow(fdata1$coef)
#center the data
#mu = mean(fdata1)
data = center.fd(fdata1)
d.hat=23
p.hat=4
#fPCA
fpca = pca.fd(data, nharm=D, centerfns=TRUE)
scores = fpca$scores[,1:d.hat]
# to avoid warnings from vars predict function below
colnames(scores) <- as.character(seq(1:d.hat))
VAR.pre= predict(VAR(scores, p.hat), n.ahead=365, type="const")$fcst
}
for(i in 1:365){
mat2 <- fdata(list[[i]])
pred.ff1[i,]<- prediction.ffpe(mat2)
}
```

i got the error "Error in pred.ff1[i, ] <- prediction.ffpe(mat2) :

incorrect number of subscripts on matrix"