Hello , i am working in the functional time series using themultivariate time series data(hourly time series data). Sir i am usingFAR model more than one order for which no statistical package is available inR, so for this i convert my data into functional form and obtained thefunctional principle component and from those FPCA i extract theircorresponding FPCscores. Know i use the VAR model on those FPCscores forthe forecasting of each 24 hours through the VAR model, but the VAR give me theforecasted value for all 23hours when i put phat=23, but whenever i putphat=24 i.e want to predict each 24 hours its give the results in the form ofNA. the code is given below
fdata<- function(mat){ nb = 27 # number of basis functions for the data fbf = create.fourier.basis(rangeval=c(0,1), nbasis=nb) #basis for data args=seq(0,1,length=24) fdata1=Data2fd(args,y=t(mat),fbf) # functions generatedfrom discretized y return(fdata1) } prediction.ffpe = function(fdata1){ n = ncol(fdata1$coef) D = nrow(fdata1$coef) #center the data #mu = mean.fd(fdata1) data = center.fd(fdata1) #ffpe = fFPE(fdata1, Pmax=10) #p.hat = ffpe[2] #order of the model d.hat=23 p.hat=6 #fPCA fpca = pca.fd(data,nharm=D, centerfns=TRUE) scores = fpca$scores[,0: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=1,type="const")$fcst } kindly guide me that how can i solve out my problem or whaterror i doing. THANKS [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.