4.1 Some simple statistics

  • Time series numerical summary (ex. mean, median, minimum and maximum values) can be computed using the features() function.

  • Example: Compute the means of all the series in the Australian tourism data.

data("tourism")

tourism %>% 
     features(Trips, list(mean = mean)) %>% 
     arrange(mean)
## # A tibble: 304 × 4
##    Region          State              Purpose   mean
##    <chr>           <chr>              <chr>    <dbl>
##  1 Kangaroo Island South Australia    Other    0.340
##  2 MacDonnell      Northern Territory Other    0.449
##  3 Wilderness West Tasmania           Other    0.478
##  4 Barkly          Northern Territory Other    0.632
##  5 Clare Valley    South Australia    Other    0.898
##  6 Barossa         South Australia    Other    1.02 
##  7 Kakadu Arnhem   Northern Territory Other    1.04 
##  8 Lasseter        Northern Territory Other    1.14 
##  9 Wimmera         Victoria           Other    1.15 
## 10 MacDonnell      Northern Territory Visiting 1.18 
## # ℹ 294 more rows
  • The least average number of visits corresponds to “Other” purpose category.

4.1.1 Five summary statistics

  • Five summary statistics (minimum - 0%, first quantile - 25%, median - 50% quantile, third quantile - 75% and maximum values - 100%) for each series.
tourism %>% 
     features(Trips, quantile)
## # A tibble: 304 × 8
##    Region         State             Purpose    `0%`  `25%`   `50%`  `75%` `100%`
##    <chr>          <chr>             <chr>     <dbl>  <dbl>   <dbl>  <dbl>  <dbl>
##  1 Adelaide       South Australia   Busine…  68.7   134.   153.    177.   242.  
##  2 Adelaide       South Australia   Holiday 108.    135.   154.    172.   224.  
##  3 Adelaide       South Australia   Other    25.9    43.9   53.8    62.5  107.  
##  4 Adelaide       South Australia   Visiti… 137.    179.   206.    229.   270.  
##  5 Adelaide Hills South Australia   Busine…   0       0      1.26    3.92  28.6 
##  6 Adelaide Hills South Australia   Holiday   0       5.77   8.52   14.1   35.8 
##  7 Adelaide Hills South Australia   Other     0       0      0.908   2.09   8.95
##  8 Adelaide Hills South Australia   Visiti…   0.778   8.91  12.2    16.8   81.1 
##  9 Alice Springs  Northern Territo… Busine…   1.01    9.13  13.3    18.5   34.1 
## 10 Alice Springs  Northern Territo… Holiday   2.81   16.9   31.5    44.8   76.5 
## # ℹ 294 more rows