web-install-tsa-lab 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- web_install_tsa_lab-0.3.0/PKG-INFO +5 -0
- web_install_tsa_lab-0.3.0/arima.py +3 -0
- web_install_tsa_lab-0.3.0/eighth.py +3 -0
- web_install_tsa_lab-0.3.0/eleventh.py +3 -0
- web_install_tsa_lab-0.3.0/fifth.py +3 -0
- web_install_tsa_lab-0.3.0/first.py +3 -0
- web_install_tsa_lab-0.3.0/fourth.py +3 -0
- web_install_tsa_lab-0.3.0/imports.py +3 -0
- web_install_tsa_lab-0.3.0/ninth.py +3 -0
- web_install_tsa_lab-0.3.0/pyproject.toml +12 -0
- web_install_tsa_lab-0.3.0/second.py +3 -0
- web_install_tsa_lab-0.3.0/setup.cfg +4 -0
- web_install_tsa_lab-0.3.0/seventh.py +3 -0
- web_install_tsa_lab-0.3.0/sixth.py +3 -0
- web_install_tsa_lab-0.3.0/tenth.py +3 -0
- web_install_tsa_lab-0.3.0/third.py +3 -0
- web_install_tsa_lab-0.3.0/web_install_tsa_lab.egg-info/PKG-INFO +5 -0
- web_install_tsa_lab-0.3.0/web_install_tsa_lab.egg-info/SOURCES.txt +18 -0
- web_install_tsa_lab-0.3.0/web_install_tsa_lab.egg-info/dependency_links.txt +1 -0
- web_install_tsa_lab-0.3.0/web_install_tsa_lab.egg-info/top_level.txt +13 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CODE = 'adf_result = adfuller(x)\nprint("ADF statistic:", adf_result[0])\nprint("p-value:", adf_result[1])\nif adf_result[1] < 0.05:\n print("At 5%, reject the unit-root null (Stationary)")\nelse:\n print("At 5%, do not reject the unit-root null (Non-stationary)")'
|
|
2
|
+
print('# Q5 ADF test')
|
|
3
|
+
print(CODE)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CODE = 'rng = np.random.default_rng(42)\ndates = pd.date_range("2025-01-01", periods=100, freq="D")\nvalues = 100 + np.linspace(0, 15, 100) + rng.normal(0, 5, 100)\ndaily = pd.Series(values, index=dates, name="Value")\n\nprint(daily.head())\ndaily.plot(title="Illustrative daily time series")\nplt.xlabel("Date")\nplt.ylabel("Value")\nplt.grid(True, alpha=0.3)\nplt.show()\n\nmonthly = daily.resample("MS").mean() # Replace .mean() with .sum() as needed\nprint(monthly)'
|
|
2
|
+
print('# Q1 Daily series + monthly resample')
|
|
3
|
+
print(CODE)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CODE = 'import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport statsmodels.api as sm\n\nfrom statsmodels.tsa.holtwinters import ExponentialSmoothing\nfrom statsmodels.tsa.stattools import adfuller\nfrom statsmodels.graphics.tsaplots import plot_acf, plot_pacf\nfrom statsmodels.tsa.arima.model import ARIMA\n\nnp.random.seed(42)\nplt.rcParams["figure.figsize"] = (10, 4)'
|
|
2
|
+
print('# Imports')
|
|
3
|
+
print(CODE)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "web-install-tsa-lab"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Import first..eleventh to print time-series lab code snippets"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
|
|
11
|
+
[tool.setuptools]
|
|
12
|
+
py-modules = ["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","imports","arima"]
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CODE = 'df = pd.DataFrame({\n "Date": ["2025-01-01", "2025-01-02", "2025-01-03",\n "2025-01-02", "2025-01-03", "2025-01-04"],\n "Sales": [120, 150, 180, 170, 160, 200]\n})\ndf["Date"] = pd.to_datetime(df["Date"])\n\nprint("Duplicate date rows:", df["Date"].duplicated().sum())\nconsolidated = df.groupby("Date")["Sales"].mean().sort_index()\nprint(consolidated)'
|
|
2
|
+
print('# Q2 Duplicate dates')
|
|
3
|
+
print(CODE)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CODE = '# Additive Model\nfit_add = ExponentialSmoothing(\n y_monthly, trend="add", seasonal="add", seasonal_periods=12,\n initialization_method="estimated"\n).fit()\n\n# Multiplicative Model\nfit_mul = ExponentialSmoothing(\n y_monthly, trend="add", seasonal="mul", seasonal_periods=12,\n initialization_method="estimated"\n).fit()'
|
|
2
|
+
print('# Q7 Holt-Winters additive and multiplicative')
|
|
3
|
+
print(CODE)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
CODE = 'candidate_orders = [(1, 0, 0), (2, 0, 0), (1, 0, 1)]\ncomparison = []\nfor order in candidate_orders:\n fit = ARIMA(stationary_series, order=order).fit()\n n = fit.nobs\n k = len(fit.params)\n aic = fit.aic\n aicc = aic + (2*k*(k+1))/(n-k-1) if n > k+1 else np.nan\n comparison.append({"order": order, "AICc": aicc})\n\ncomparison_df = pd.DataFrame(comparison).sort_values("AICc")\nprint(comparison_df)'
|
|
2
|
+
print('# Q10 AICc model selection')
|
|
3
|
+
print(CODE)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
arima.py
|
|
2
|
+
eighth.py
|
|
3
|
+
eleventh.py
|
|
4
|
+
fifth.py
|
|
5
|
+
first.py
|
|
6
|
+
fourth.py
|
|
7
|
+
imports.py
|
|
8
|
+
ninth.py
|
|
9
|
+
pyproject.toml
|
|
10
|
+
second.py
|
|
11
|
+
seventh.py
|
|
12
|
+
sixth.py
|
|
13
|
+
tenth.py
|
|
14
|
+
third.py
|
|
15
|
+
web_install_tsa_lab.egg-info/PKG-INFO
|
|
16
|
+
web_install_tsa_lab.egg-info/SOURCES.txt
|
|
17
|
+
web_install_tsa_lab.egg-info/dependency_links.txt
|
|
18
|
+
web_install_tsa_lab.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|