'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
Solution 1:[1]
Your syntax isn't quite right here. When using ts
, you should set a frequency
(here 12, to represent months). Then, the start
argument needs two integers - the starting year and starting month.
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.
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |