简体   繁体   English

如何在r中找到时间序列数据的AR,MA,ARIMA.ARMA,SARIMA,SARMA

[英]How to find AR,MA,ARIMA.ARMA,SARIMA,SARMA of a time series data in r

library(readxl) export1 <- read_excel("C:/Users/Hazeeb/OneDrive/Desktop/data/export1.xlsx") View(export1) class(export1) #> [1] "tbl_df" "tbl" "data.frame" #> export1t=ts(export1$`CURRENT TOTAL EXPORT`, frequency = 12, start = c(2007, 1),end = c(2019,12)) #> export1t #> Jan Feb Mar Apr May Jun Jul Aug Sep #> 2007 21.97 52.46 53.69 67.32 58.01 53.44 78.83 41.49 37.05 #> 2008 60.26 73.61 51.58 52.95 51.85 86.90 27.57 72.81 42.29 #> 2009 32.80 49.09 53.57 84.30 50.06 46.05 44.04 38.87 47.03 #> 2010 30.46 54.54 48.64 56.41 32.14 48.26 36.17 41.42 39.25 #> 2011 50.17 32.29 45.84 38.02 59.10 46.73 65.44 42.21 64.97 #> 2012 39.99 47.38 77.35 37.34 57.62 46.82 37.32 38.87 75.89 #> 2013 42.36 32.51 88.73 78.91 42.73 55.51 53.42 49.05 82.50 #> 2014 789.81 115.17 39.49 38.70 46.60 33.98 46.87 44.69 406.71 #> 2015 50.74 38.98 41.21 69.58 49.10 46.40 49.03 61.16 91.44 #> 2016 48.08 41.32 50.20 86.05 45.18 60.36 64.85 60.35 187.72 #> 2017 136.71 121.77 152.54 109.91 83.52 120.64 131.19 59.21 110.85 #> 2018 104.66 88.19 98.40 86.78 61.65 61.22 96.28 70.20 107.98 #> 2019 93.99 78.26 57.61 72.30 89.50 138.46 99.57 71.32 81.77 #> Oct Nov Dec #> 2007 74.55 41.66 32.44 #> 2008 145.88 132.63 136.22 #> 2009 49.55 36.44 43.18 #> 2010 42.14 32.13 46.10 #> 2011 59.12 57.85 67.52 #> 2012 72.72 58.14 37.51 #> 2013 72.06 601.60 43.00 #> 2014 61.96 67.01 54.34 #> 2015 82.08 89.70 71.91 #> 2016 227.43 106.45 100.47 #> 2017 134.85 145.95 118.22 #> 2018 139.42 117.76 99.14 #> 2019 136.79 146.66 197.65 class(export1t) #> [1] "ts" library(tseries) library(forecast) plot(export1t,xlab="YEAR",ylab="CURRENT TOTAL EXPORT") #> Error in plot.new() : figure margins too large plot.ts(export1t,xlab="YEAR",ylab="CURRENT TOTAL EXPORT") #> Error in plot.new() : figure margins too large acf(export1t) #> Error in plot.new() : figure margins too large pacf(export1t) #> Error in plot.new() : figure margins too large

Your syntax isn't quite right here.你的语法在这里不太对。 When using ts , you should set a frequency (here 12, to represent months).使用ts时,您应该设置一个frequency (此处为 12,表示月份)。 Then, the start argument needs two integers - the starting year and starting month.然后, start参数需要两个整数 - 起始年份和起始月份。

You are trying to pass the first item of DATE to start, but a) that's not the type of argument start takes, b) you didn't have quotes around the character string, and c) even if you did, this is not a date format recognised by R.您正在尝试将DATE的第一项传递给 start,但是 a) 这不是start需要的参数类型,b) 您在字符串周围没有引号,并且 c) 即使您这样做了,这也不是R 识别的日期格式。

You need only do:你只需要做:

ts(export1$`CURRENT TOTAL EXPORT`, frequency = 12, start = c(2007, 1))
#>       Jan  Feb  Mar  Apr  May  Jun  Jul  Aug  Sep  Oct
#> 2007 22.0 52.5 53.7 67.3 58.0 53.4 78.8 41.5 37.0 74.6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用auto.arima函数专门检查ARIMA中AR或MA的顺序值,用于使用R的时间序列数据 - How to specifically check value of order of AR or MA in ARIMA using auto.arima function for time series data using R 如何使用 auto.arima 函数专门检查 ARIMA 中 AR 或 MA 的 RMSE 值,用于使用 R 的时间序列数据 - How to specifically check value of RMSE of AR or MA in ARIMA using auto.arima function for time series data using R 是否可以使用AR,MA和ARMA等统计模型对基于时间序列的数据进行分类? - is it possible to classify time series-based data using statistical models like AR, MA and ARMA? 在时间序列中插入缺失值并使用 R 创建一个时间序列 model,如协整、ARIMA(X) 和 SARIMA(X) - Interpolate missing values in a time-series and create a time-series model like Cointegration, ARIMA(X) and SARIMA(X) using R 在R中模拟AR时间序列数据 - simulate AR time series data in r ARIMA与ARMA时间序列的一阶差异 - ARIMA vs. ARMA of time series in first differences R中的ARIMA时间序列图 - ARIMA Time Series Graph in R R,有马市的每周时间序列 - weekly time series in r, arima 时间序列预测-ARIMA / ARIMAX,每日数据为R - Time series forecast - ARIMA/ARIMAX with daily data in R 如何使用 R 模拟指定订单的 10 个 ARIMA 时间序列数据 - How do I simulate 10 ARIMA time series data of specified orders using R
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM