Install any skill in seconds. Free to start, no credit card required.
Get Started Free →brycewang-stanford/time-series-guide
Apply ARIMA, VAR, cointegration, and time series econometric methods
Passed 20 of 23 test cases with the skill, and 16 of 23 without it.
and 1 more in the full report
4 fixed16 passed either way3 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
Can you write a Python function using statsmodels ARIMA to fit time series data? If a specific (p, d, q) order tuple is provided, fit that; otherwise, run an AIC-based grid search across orders to select the best model. Return a dictionary containing the selected order, AIC, BIC, parameter coefficients dict, and residual diagnostics with the Ljung-Box p-value.
| Checked | Without skill | With skill |
|---|---|---|
| The function selects the model order by minimizing Akaike Information Criterion across grid search candidates. | Passed | Passed |
| The output dictionary uses the key 'coefficients' to store parameter values mapped from model parameter names. | Missed | Passed |
| The Ljung-Box residual correlation diagnostic is evaluated at lag 10. | Passed | Passed |
The instructions your model reads when the skill loads.
A skill for applying time series econometric methods including ARIMA modeling, VAR systems, cointegration analysis, and unit root tests. Covers stationarity concepts, model selection, forecasting, and diagnostic checking for economic and financial data.
A time series is stationary when its statistical properties (mean, variance, autocorrelation) do not change over time. Most econometric methods require stationarity. Non-stationary series can produce spurious regressions.
from statsmodels.tsa.stattools import adfuller, kpss
import pandas as pd
def test_stationarity(series: pd.Series, name: str = "Series") -> dict:
"""
Test for stationarity using ADF and KPSS tests.
Args:
series: Time series data
name: Label for the series
"""
# Augmented Dickey-Fuller test
# H0: Unit root exists (non-stationary)
adf_result = adfuller(series.dropna(), autolag="AIC")
# KPSS test
# H0: Series is stationary
kpss_result = kpss(series.dropna(), regression="c", nlags="auto")
return {
"series": name,
"adf": {
"statistic": adf_result[0],
"p_value": adf_result[1],
"lags_used": adf_result[2],
"conclusion": (
test cases passed, vs 16 / 23 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.