sagarnikam123
2012-Apr-20 04:35 UTC
[R] want to forecast AR model & calculate R square (but which method is good)
i used "itsmr" package , want to forecast AR model & calculate R square to judge my forecasting/prediction ,that is it good or not ? i take original model(i) & make example/demo model(j) ( 20 numbers less from original model) #AR model forecasting i<-read.table(file.choose(),skip=1) #taking times series data used file:---> http://r.789695.n4.nabble.com/file/n4572840/1AIS_B.txt 1AIS_B.txt i<-i$V1 #original data> j<-i[1:(length(i)-20)] #withdrawing last 20 numbers > > dynamite_ori_20<-i[(length(i)-19):length(i)] #original numbers(last 20) > arar_j<-arar(y=j,h=20) #AR forecasting> #plotting to visualize > k<-append(j,arar_j$pred) > plotc(i,k) > > > #calculates R squred for AR forcasted > #1st method > x<-dynamite_ori_20 #original value > y<-arar_j$pred #predicted value > f<-lm(y~x) > > beta=f$coeff["x"]*(sd(x)/sd(y)) > r_square<-beta*cov(x,y) > r_squarex 0.0008692213 ______________________________________________________________________ #2) method> summary(f)[c("r.squared", "adj.r.squared")]$r.squared [1] 0.0173342 $adj.r.squared [1] -0.03725834 ______________________________________________________________________ which r_square i used to check my forecasting is good or bad? is there any other method to check forecasting quality ? -- View this message in context: http://r.789695.n4.nabble.com/want-to-forecast-AR-model-calculate-R-square-but-which-method-is-good-tp4572840p4572840.html Sent from the R help mailing list archive at Nabble.com.