Data Science with Python Certification Time Series Analysis and Forecasting 2 — Questions and Answers
Question 1: What does the 'd' parameter represent in the ARIMA(p, d, q) model?
- The number of autoregressive terms
- The degree of differencing required to make the series stationary (Correct answer)
- The number of moving average terms
- The seasonal period length
Correct answer: The degree of differencing required to make the series stationary
The 'd' parameter specifies how many times the series must be differenced to achieve stationarity before modeling.
Question 2: What is the purpose of seasonal decomposition in time series analysis?
- To remove outliers from the series
- To separate a series into trend, seasonal, and residual components (Correct answer)
- To convert the series to stationary form only
- To automatically calculate ARIMA parameters
Correct answer: To separate a series into trend, seasonal, and residual components
Seasonal decomposition splits a time series into trend, seasonal, and irregular residual components for separate analysis.
Question 3: Which pandas method creates a rolling window calculation on a time series?
- df.shift()
- df.rolling() (Correct answer)
- df.diff()
- df.cumsum()
Correct answer: df.rolling()
`df.rolling(window)` creates a rolling window object enabling moving averages and other window-based aggregations.
Question 4: What does the PACF (Partial Autocorrelation Function) help determine in ARIMA modeling?
- The MA (q) order
- The AR (p) order (Correct answer)
- The differencing (d) order
- The seasonal period
Correct answer: The AR (p) order
PACF shows the direct correlation between a series and each lag after removing intermediate lag effects, identifying the AR (p) order.
Question 5: How do you shift a pandas time series forward by one period to create a lagged feature?
- df.lag(1)
- df.shift(1) (Correct answer)
- df.roll(1)
- df.offset(1)
Correct answer: df.shift(1)
`df.shift(1)` moves all values forward by one period, inserting NaN at the start — a standard way to create lag features.
Question 6: Which forecasting model captures both trend and seasonality using exponential smoothing?
- ARIMA
- Holt-Winters model (Correct answer)
- Simple linear regression
- Random walk model
Correct answer: Holt-Winters model
The Holt-Winters (triple exponential smoothing) model accounts for level, trend, and seasonal components simultaneously.
What does the 'd' parameter represent in the ARIMA(p, d, q) model?