Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

4_R_ARIMA.R 706 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  1. ### ARIMA
  2. library(forecast)
  3. library(tseries)
  4. # Lynx: Número anual de linces atrapados entre 1821-1934 en Canadá
  5. plot(lynx)
  6. tsdisplay(lynx) # autoregresion?
  7. ### AR(2)
  8. myarima = arima(lynx, order = c(2,0,0))
  9. myarima
  10. tail(lynx)
  11. plot(residuals(myarima))
  12. ### MA(2)
  13. myarima = arima(lynx, order = c(0,0,2))
  14. myarima
  15. plot(residuals(myarima))
  16. ### DF test
  17. adf.test(lynx)
  18. ### Arima del paquete forecast
  19. myarima <- Arima(lynx, order = c(4,0,0))
  20. myarima
  21. checkresiduals(myarima)
  22. ### ARIMA Forecast
  23. # Forecast de 10 años
  24. arimafore <- forecast(myarima, h = 10)
  25. plot(arimafore)
  26. # Valores estimados del futuro
  27. arimafore$mean
  28. # Ultimas observaciones y forecast
  29. plot(arimafore, xlim = c(1930, 1944))
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...