Jaigus
Jaigus

Reputation: 1502

How can I tell what arima model this code is running?

I'm reading over some R code, and I've come across a line that where the function prototype doesn't seem to match what I've seen in the library's api (fabletools).

fitted_model = a_time_series %>%
filter(date <= tsibble::year(someyear)) %>%
fabletools::model(arima = ARIMA(time)

...Where time is a column from a a_time_series. How do I tell what arima model this is using?

(e.g. arima(1,1,1) or arima(0,1,1) ,etc)

I've checked this documentation however, the function prototypes don't seem to match.

Upvotes: 0

Views: 74

Answers (1)

Mitchell O&#39;Hara-Wild
Mitchell O&#39;Hara-Wild

Reputation: 2459

You can identify the ARIMA output by looking at the formatted output in the console. If you need to obtain this display as text, you can use the format() function.

library(fable)
#> Loading required package: fabletools
library(tsibble)
library(dplyr)
tourism %>% 
  group_by(Purpose) %>% 
  summarise(Trips = sum(Trips)) %>% 
  model(auto_arima = ARIMA(Trips)) %>% 
  mutate(format(auto_arima))
#> # A mable: 4 x 3
#> # Key:     Purpose [4]
#>   Purpose                auto_arima `format(auto_arima)`    
#>   <chr>                     <model> <chr>                   
#> 1 Business <ARIMA(0,1,1)(0,1,1)[4]> <ARIMA(0,1,1)(0,1,1)[4]>
#> 2 Holiday  <ARIMA(0,1,1)(0,1,1)[4]> <ARIMA(0,1,1)(0,1,1)[4]>
#> 3 Other    <ARIMA(0,1,1)(1,0,0)[4]> <ARIMA(0,1,1)(1,0,0)[4]>
#> 4 Visiting <ARIMA(1,0,1)(2,1,0)[4]> <ARIMA(1,0,1)(2,1,0)[4]>

Created on 2020-06-12 by the reprex package (v0.3.0)

Session info

devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.2 (2019-12-12)
#>  os       Ubuntu 18.04.4 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_AU:en                    
#>  collate  en_AU.UTF-8                 
#>  ctype    en_AU.UTF-8                 
#>  tz       Australia/Melbourne         
#>  date     2020-06-12                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package        * version    date       lib source                            
#>  anytime          0.3.7      2020-01-20 [1] CRAN (R 3.6.1)                    
#>  assertthat       0.2.1      2019-03-21 [1] CRAN (R 3.6.1)                    
#>  backports        1.1.7      2020-05-13 [1] RSPM (R 3.6.3)                    
#>  callr            3.4.3      2020-03-28 [1] CRAN (R 3.6.2)                    
#>  cli              2.0.2      2020-02-28 [1] RSPM (R 3.6.2)                    
#>  colorspace       1.4-1      2019-03-18 [1] CRAN (R 3.6.1)                    
#>  crayon           1.3.4      2017-09-16 [1] CRAN (R 3.6.1)                    
#>  desc             1.2.0      2018-05-01 [1] CRAN (R 3.6.1)                    
#>  devtools         2.2.2      2020-02-17 [1] RSPM (R 3.6.2)                    
#>  digest           0.6.25     2020-02-23 [1] RSPM (R 3.6.2)                    
#>  distributional   0.1.0.9000 2020-06-10 [1] local                             
#>  dplyr          * 1.0.0      2020-05-29 [1] CRAN (R 3.6.2)                    
#>  ellipsis         0.3.1      2020-05-15 [1] CRAN (R 3.6.2)                    
#>  evaluate         0.14       2019-05-28 [1] CRAN (R 3.6.1)                    
#>  fable          * 0.2.1      2020-06-11 [1] local                             
#>  fabletools     * 0.2.0      2020-06-11 [1] local                             
#>  fansi            0.4.1      2020-01-08 [1] RSPM (R 3.6.2)                    
#>  farver           2.0.3      2020-01-16 [1] CRAN (R 3.6.1)                    
#>  feasts           0.1.4      2020-06-04 [1] local                             
#>  fs               1.4.1      2020-04-04 [1] RSPM (R 3.6.3)                    
#>  generics         0.0.2      2018-11-29 [1] CRAN (R 3.6.1)                    
#>  ggplot2          3.3.1      2020-05-28 [1] CRAN (R 3.6.2)                    
#>  glue             1.4.1.9000 2020-05-26 [1] Github (tidyverse/glue@a605000)   
#>  gtable           0.3.0      2019-03-25 [1] CRAN (R 3.6.1)                    
#>  highr            0.8        2019-03-20 [1] CRAN (R 3.6.1)                    
#>  htmltools        0.4.0      2019-10-04 [1] CRAN (R 3.6.1)                    
#>  knitr            1.28       2020-02-06 [1] RSPM (R 3.6.2)                    
#>  lattice          0.20-38    2018-11-04 [2] CRAN (R 3.6.2)                    
#>  lifecycle        0.2.0.9000 2020-03-19 [1] Github (r-lib/lifecycle@355dcba)  
#>  lubridate        1.7.8      2020-04-06 [1] RSPM (R 3.6.3)                    
#>  magrittr         1.5        2014-11-22 [1] CRAN (R 3.6.1)                    
#>  memoise          1.1.0      2017-04-21 [1] CRAN (R 3.6.1)                    
#>  munsell          0.5.0      2018-06-12 [1] CRAN (R 3.6.1)                    
#>  nlme             3.1-142    2019-11-07 [2] CRAN (R 3.6.2)                    
#>  pillar           1.4.4      2020-05-25 [1] Github (r-lib/pillar@2f5ad11)     
#>  pkgbuild         1.0.8      2020-05-07 [1] RSPM (R 3.6.3)                    
#>  pkgconfig        2.0.3      2019-09-22 [1] CRAN (R 3.6.1)                    
#>  pkgload          1.1.0      2020-05-29 [1] CRAN (R 3.6.2)                    
#>  prettyunits      1.1.1      2020-01-24 [1] CRAN (R 3.6.2)                    
#>  processx         3.4.2      2020-02-09 [1] RSPM (R 3.6.2)                    
#>  progressr        0.6.0      2020-05-19 [1] CRAN (R 3.6.2)                    
#>  ps               1.3.3      2020-05-08 [1] RSPM (R 3.6.3)                    
#>  purrr            0.3.4      2020-04-17 [1] RSPM (R 3.6.3)                    
#>  R6               2.4.1      2019-11-12 [1] CRAN (R 3.6.1)                    
#>  Rcpp             1.0.4.6    2020-04-09 [1] CRAN (R 3.6.2)                    
#>  remotes          2.1.1      2020-02-15 [1] RSPM (R 3.6.2)                    
#>  rlang            0.4.6.9000 2020-05-20 [1] Github (r-lib/rlang@691b5a8)      
#>  rmarkdown        2.1        2020-01-20 [1] CRAN (R 3.6.2)                    
#>  rprojroot        1.3-2      2018-01-03 [1] CRAN (R 3.6.1)                    
#>  scales           1.1.1      2020-05-11 [1] RSPM (R 3.6.3)                    
#>  sessioninfo      1.1.1      2018-11-05 [1] CRAN (R 3.6.1)                    
#>  stringi          1.4.6      2020-02-17 [1] CRAN (R 3.6.2)                    
#>  stringr          1.4.0      2019-02-10 [1] CRAN (R 3.6.1)                    
#>  testthat         2.3.2      2020-03-02 [1] RSPM (R 3.6.3)                    
#>  tibble           3.0.1      2020-04-20 [1] RSPM (R 3.6.3)                    
#>  tidyr            1.1.0      2020-05-20 [1] RSPM (R 3.6.3)                    
#>  tidyselect       1.1.0      2020-05-11 [1] RSPM (R 3.6.3)                    
#>  tsibble        * 0.9.0      2020-06-02 [1] Github (tidyverts/tsibble@c837e83)
#>  urca             1.3-0      2016-09-06 [1] CRAN (R 3.6.1)                    
#>  usethis          1.5.1.9000 2020-01-31 [1] Github (r-lib/usethis@7d8b066)    
#>  utf8             1.1.4      2018-05-24 [1] CRAN (R 3.6.1)                    
#>  vctrs            0.3.0.9000 2020-05-28 [1] Github (r-lib/vctrs@373e1ce)      
#>  withr            2.2.0      2020-04-20 [1] RSPM (R 3.6.3)                    
#>  xfun             0.13       2020-04-13 [1] RSPM (R 3.6.3)                    
#>  yaml             2.2.1      2020-02-01 [1] RSPM (R 3.6.2)                    
#> 
#> [1] /home/mitchell/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /opt/R/3.6.2/lib/R/library

Upvotes: 1

Related Questions