Time series analysis involves studying data points collected or recorded over time. Its applications range from economics to biology, where understanding patterns, trends, and predicting future events is crucial.
Mathematically, a time series \(\left\{X_t\right\}\) is a sequence of random variables indexed by time \(t\). A central concept is stationarity. A time series is (weakly) stationary if its statistical properties do not change over time.
Formally, \(\left\{X_t\right\}\) is weakly stationary if: \(\mathbb{E}\left[X_t\right]=\mu, \quad \operatorname{Var}\left(X_t\right)=\sigma^2, \quad\) and \(\quad \operatorname{Cov}\left(X_t, X_{t+k}\right)=\gamma_k\) for all \(t\). Stationarity is crucial for reliable modeling and forecasting, as many models assume constant mean and variance over time.
Recap: Multiple Linear Regression
Multiple linear regression models a response variable \(Y\) as a linear function of predictors \(X_1, X_2, \ldots, X_p:\)
where \(\varepsilon\) is the error term. Regression analysis serves as a foundation for understanding relationships between variables, which extends into time series when considering trends and seasonality.
Using Tidyverts in the Tidyverse Ecosystem
The Tidyverts collection integrates time series analysis into the tidyverse framework, allowing seamless data manipulation and visualization with familiar syntax.
Understanding Time Series Data
Time series data for a single entity over time can be represented as a tsibble, which is a tidy data structure that inherently understands time.