The following code will perform the following steps:
First, it will filter the data so that it only includes the ALL AGES category.
Then, it creates a time series object.
Finally, it runs a simple exponential model, using the ets() function.
Note that we did not specify a smoothing factor. The ets() function calculates the optimal smoothing factor (alpha, shown via the summary() function (in bold below)), which in this case is .99, which means that model time series takes about 99% of the previous value to incorporate into the next time series prediction:
library(dplyr) > > Attaching package: 'dplyr' > The following objects are masked from 'package:stats':> > filter, lag > The following objects are masked ...