• 数学建模算法(六):时间序列


    1.R(世博会

    x<-c(1.37,1.46,1.65,1.53,1.66,1.81,2.38,2.73);
    pri<-ts(data=x,frequency =10)
    library(forecast)
    pri.arima<-auto.arima(pri,ic=c('bic'))
    fore<-forecast.Arima(pri.arima,h=12)
    fore
    1、境外游客数:
    > pri.arima
    Series: pri
    ARIMA(0,1,0) with drift
    
    Coefficients:
           drift
          0.1943
    s.e.  0.0758
    
    sigma^2 estimated as 0.04017:  log likelihood=1.32
    AIC=1.36   AICc=4.36   BIC=1.25
    > fore
       Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
     9       2.924286 2.667440 3.181132 2.531474 3.317098
    10       3.118571 2.755336 3.481806 2.563051 3.674091
    11       3.312857 2.867987 3.757727 2.632487 3.993227
    12       3.507143 2.993451 4.020835 2.721519 4.292767
    13       3.701429 3.127104 4.275753 2.823074 4.579783
    14       3.895714 3.266573 4.524856 2.933526 4.857903
    15       4.090000 3.410450 4.769550 3.050717 5.129283
    16       4.284286 3.557816 5.010756 3.173246 5.395326
    17       4.478571 3.708034 5.249109 3.300136 5.657007
    18       4.672857 3.860639 5.485075 3.430677 5.915038
    19       4.867143 4.015281 5.719004 3.564333 6.169953
    20       5.061429 4.171688 5.951169 3.700688 6.422169

     2.(2014D研究生

    library(zoo)
    x<-c(0.489945984,0.528481066,2.600427657,2.918029633,2.589649436,1.438194248,1.257541996,1.361928647
    
      )
    #y<-log(x);
    pri<-ts(data=x,frequency =1,start=c(2005))
    plot(pri)
    acf(pri)
    pacf(pri)
    p<-shapiro.test(pri)  #p-vaule 大于0.05即可认为服从残差服从正p态分布
    library(forecast)
    pri.arima<-auto.arima(pri)
    pri2<-arima(pri,c(0,2,0),method = "ML")
    r<-pri.arima$residuals
    p2<-Box.test(r,type="Ljung-Box",lag=3, fitdf=1)
    p3<-Box.test(pri2$residuals,type="Ljung-Box",lag=3, fitdf=1)
    tsdiag(pri2)
    fore<-forecast.Arima(pri.arima,h=8,level = c(99.5))
    fore2<-predict(pri2,8,se.fit=TRUE,level=99.5)
    fore
  • 相关阅读:
    库函数(汇总)
    IE jQuery ajax 请求缓存问题
    Jarvis OJ-level3
    在64位的linux中运行32位的应用程序
    ROP之linux_x64知识杂记
    2017年网络空间安全技术大赛部分writeup
    Sniper OJ部分writeup
    gdb插件使用方法
    pwntools学习
    linux虚拟机安装值得注意的几点
  • 原文地址:https://www.cnblogs.com/pursuit1996/p/5149538.html
Copyright © 2020-2023  润新知