下面代码可以复制原图。
<br />
data=read.table("://mydata")<br />
V1=data[,1]<br />
fit=arima(V1,order=c(3,0,0))<br />
pre=predict(fit,n.ahead=10)$pre<br />
plot(c(V1,pre),type="n")<br />
points(V1,pch=20,col="red")<br />
lines(V1,col="red")<br />
points(V1-residuals(fit),pch=20,col="blue")<br />
lines(pre,col="green",lwd=2)<br />
legend(0,55,legend=c("真实值","拟合值","预测值"),col=c("red","blue","green"),pch=rep(20,3))<br />
</p>