mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Econometrics Menu (#1403)
* Add Statistics Menu * Add Granger Causality test * Apply Black formatting * Add Cointegration Tests * Adjust plotting for Cointegration test * Add Significant parameter to Cointegration tests * Move regression functions to seperate .py files * Progress on Panel Data * A lot of progress for Panel Data * Make functions robust and improve documentation * Re-enable Breusch-Godfrey * Add modify functionality * Improve modify functionality * Add Breusch-Pagan heteroscedasticity test * Capitalize a word * Include documentatin for the Statistics Menu * Update _index.md * Update _index.md * Update _index.md * Fix export statements and add Example datasets * Update example with Longley's dataset * Update documentation with a legit source * Compare the results from each regression models based on the wage_panel dataset * Updated with all relevant types of regression tables * Update with all relevant regression types for Panel data * Update _index.md * Add change column type, improve OLS, add time and entity effects for FE * Update documentation and fix a small bug * Add in Statistics menu, replacing Custom menu * Remove custom menu * Add in documentation * Add in gst files * Cointegration can be used on any amount of columns * Add Tests * Make tests time invariant * Update Poetry and Requirements * Change name of Statistics menu to Econometrics menu * Rename scripts * Add type in Documentation * Change names from Statistics to Econometrics * Add graph * Update tests with rounding and naming * Make minor adjustments to fix the tests * Updating tests : allow extra args for capture * Apply recorder formatting * Adding some minor formatting * Fix error with MyPy * Attempt to fix MyPy annoyance * super small style things * Fix small bugs and add plot command to dwat * Small description mistake * Update documentation with missing argument * Update styling * Add error handling and add improve show functionality * Fix merge issue * Allow import from custom_imports Co-authored-by: Jeroen Bouma <jeroenbouma@MacBook-Pro-van-Jeroen.local> Co-authored-by: jmaslek <jmaslek11@gmail.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
from .stocks import stocks_api as stocks
|
||||
from .alternative import alt_api as alt
|
||||
from .cryptocurrency import crypto_api as crypto
|
||||
from .custom import custom_api as custom
|
||||
from .economy import economy_api as economy
|
||||
from .etf import etf_api as etf
|
||||
from .forex import forex_api as forex
|
||||
|
||||
0
gamestonk_terminal/econometrics/__init__.py
Normal file
0
gamestonk_terminal/econometrics/__init__.py
Normal file
1497
gamestonk_terminal/econometrics/econometrics_controller.py
Normal file
1497
gamestonk_terminal/econometrics/econometrics_controller.py
Normal file
File diff suppressed because it is too large
Load Diff
348
gamestonk_terminal/econometrics/econometrics_model.py
Normal file
348
gamestonk_terminal/econometrics/econometrics_model.py
Normal file
@@ -0,0 +1,348 @@
|
||||
"""Econometrics Model"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
# pylint: disable=eval-used
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import warnings
|
||||
from typing import Dict, Union, Any
|
||||
|
||||
import pandas as pd
|
||||
from pandas import DataFrame
|
||||
from scipy import stats
|
||||
import statsmodels.api as sm
|
||||
from statsmodels.tsa.stattools import adfuller, kpss, grangercausalitytests
|
||||
from linearmodels.datasets import wage_panel
|
||||
|
||||
from gamestonk_terminal.decorators import log_start_end
|
||||
from gamestonk_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def load(
|
||||
file: str,
|
||||
file_types: list,
|
||||
data_files: Dict[Any, Any],
|
||||
data_examples: Dict[Any, Any],
|
||||
) -> pd.DataFrame:
|
||||
"""Load custom file into dataframe.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
file: str
|
||||
Path to file
|
||||
file_types: list
|
||||
Supported file types
|
||||
data_files: dict
|
||||
Contains all available data files within the Export folder
|
||||
data_examples: dict
|
||||
Contains all available examples from Statsmodels
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame:
|
||||
Dataframe with custom data
|
||||
"""
|
||||
if file in data_examples:
|
||||
if file == "wage_panel":
|
||||
return wage_panel.load()
|
||||
return eval(f"sm.datasets.{file}.load_pandas().data")
|
||||
|
||||
if file in data_files:
|
||||
file = data_files[file]
|
||||
|
||||
if not Path(file).exists():
|
||||
console.print(f"[red]Can not find the file {file}[/red]\n")
|
||||
return pd.DataFrame()
|
||||
|
||||
file_type = Path(file).suffix
|
||||
|
||||
if file_type == ".xlsx":
|
||||
data = pd.read_excel(file)
|
||||
elif file_type == ".csv":
|
||||
data = pd.read_csv(file)
|
||||
else:
|
||||
return console.print(
|
||||
f"The file type {file_type} is not supported. Please choose one of the following: "
|
||||
f"{', '.join(file_types)}"
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_options(
|
||||
datasets: Dict[str, pd.DataFrame], dataset_name: str = None
|
||||
) -> Dict[Union[str, Any], DataFrame]:
|
||||
"""Obtain columns-dataset combinations from loaded in datasets that can be used in other commands
|
||||
|
||||
Parameters
|
||||
----------
|
||||
datasets: dict
|
||||
The available datasets.
|
||||
dataset_name: str
|
||||
The dataset you wish to show the options for.
|
||||
|
||||
Returns
|
||||
-------
|
||||
option_tables: dict
|
||||
A dictionary with a DataFrame for each option. With dataset_name set, only shows one options table.
|
||||
"""
|
||||
option_tables = {}
|
||||
|
||||
if dataset_name:
|
||||
columns = datasets[dataset_name].columns
|
||||
option_tables[dataset_name] = pd.DataFrame(
|
||||
{
|
||||
"dataset": [dataset_name] * len(columns),
|
||||
"column": columns,
|
||||
"option": [f"{column}-{dataset_name}" for column in columns],
|
||||
}
|
||||
)
|
||||
else:
|
||||
for dataset, data_values in datasets.items():
|
||||
columns = data_values.columns
|
||||
option_tables[dataset] = pd.DataFrame(
|
||||
{
|
||||
"dataset": [dataset] * len(columns),
|
||||
"column": columns,
|
||||
"option": [f"{column}-{dataset}" for column in columns],
|
||||
}
|
||||
)
|
||||
|
||||
return option_tables
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def clean(dataset: pd.DataFrame, fill: str, drop: str, limit: int) -> pd.DataFrame:
|
||||
"""Clean up NaNs from the dataset
|
||||
|
||||
Parameters
|
||||
----------
|
||||
dataset : pd.DataFrame
|
||||
The dataset you wish to clean
|
||||
fill : str
|
||||
The method of filling Nans
|
||||
drop : str
|
||||
The method of dropping NaNs
|
||||
limit : int
|
||||
The maximum limit you wish to apply that can be forward or backward filled
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame:
|
||||
Dataframe with cleaned up data
|
||||
"""
|
||||
if fill:
|
||||
if fill == "rfill":
|
||||
dataset = dataset.fillna(axis="index", value=0)
|
||||
if fill == "cfill":
|
||||
dataset = dataset.fillna(axis="columns", value=0)
|
||||
elif fill == "rbfill":
|
||||
dataset = dataset.fillna(axis="index", method="bfill", limit=limit)
|
||||
elif fill == "cbfill":
|
||||
dataset = dataset.fillna(axis="columns", method="bfill", limit=limit)
|
||||
elif fill == "rffill":
|
||||
dataset = dataset.fillna(axis="index", method="ffill", limit=limit)
|
||||
elif fill == "cffill":
|
||||
dataset = dataset.fillna(axis="columns", method="ffill", limit=limit)
|
||||
|
||||
if drop:
|
||||
if drop == "rdrop":
|
||||
dataset = dataset.dropna(how="any", axis="index")
|
||||
elif drop == "cdrop":
|
||||
dataset = dataset.dropna(how="any", axis="columns")
|
||||
|
||||
return dataset
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_normality(data: pd.Series) -> pd.DataFrame:
|
||||
"""
|
||||
Look at the distribution of returns and generate statistics on the relation to the normal curve.
|
||||
This function calculates skew and kurtosis (the third and fourth moments) and performs both
|
||||
a Jarque-Bera and Shapiro Wilk test to determine if data is normally distributed.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : pd.Series
|
||||
A series or column of a DataFrame to test normality for
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame
|
||||
Dataframe containing statistics of normality
|
||||
"""
|
||||
# Kurtosis: measures height and sharpness of the central peak relative to that of a standard bell curve
|
||||
k, kpval = stats.kurtosistest(data)
|
||||
|
||||
# Skewness: measure of the asymmetry of the probability distribution of a random variable about its mean
|
||||
s, spval = stats.skewtest(data)
|
||||
|
||||
# Jarque-Bera goodness of fit test on sample data: tests if the sample data has the skewness and kurtosis
|
||||
# matching a normal distribution
|
||||
jb, jbpval = stats.jarque_bera(data)
|
||||
|
||||
# The Shapiro-Wilk test: tests the null hypothesis that the data was drawn from a normal distribution.
|
||||
sh, shpval = stats.shapiro(data)
|
||||
|
||||
# Kolmogorov-Smirnov: the one-sample test compares the underlying distribution F(x) of a sample
|
||||
# against a given distribution G(x). Comparing to normal here.
|
||||
ks, kspval = stats.kstest(data, "norm")
|
||||
|
||||
l_statistic = [k, s, jb, sh, ks]
|
||||
l_pvalue = [kpval, spval, jbpval, shpval, kspval]
|
||||
|
||||
return pd.DataFrame(
|
||||
[l_statistic, l_pvalue],
|
||||
columns=[
|
||||
"Kurtosis",
|
||||
"Skewness",
|
||||
"Jarque-Bera",
|
||||
"Shapiro-Wilk",
|
||||
"Kolmogorov-Smirnov",
|
||||
],
|
||||
index=["Statistic", "p-value"],
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_root(df: pd.Series, fuller_reg: str, kpss_reg: str) -> pd.DataFrame:
|
||||
"""Calculate test statistics for unit roots
|
||||
|
||||
Parameters
|
||||
----------
|
||||
df : pd.Series
|
||||
Series or column of DataFrame of target variable
|
||||
fuller_reg : str
|
||||
Type of regression of ADF test
|
||||
kpss_reg : str
|
||||
Type of regression for KPSS test
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame
|
||||
Dataframe with results of ADF test and KPSS test
|
||||
"""
|
||||
# The Augmented Dickey-Fuller test: used to test for a unit root in a univariate process in the
|
||||
# presence of serial correlation.
|
||||
result = adfuller(df, regression=fuller_reg)
|
||||
cols = ["Test Statistic", "P-Value", "NLags", "Nobs", "ICBest"]
|
||||
vals = [result[0], result[1], result[2], result[3], result[5]]
|
||||
data = pd.DataFrame(data=vals, index=cols, columns=["ADF"])
|
||||
|
||||
# Kwiatkowski-Phillips-Schmidt-Shin test: test for level or trend stationarity
|
||||
# Note: this test seems to produce an Interpolation Error which says
|
||||
# The test statistic is outside the range of p-values available in the
|
||||
# look-up table. The actual p-value is greater than the p-value returned.
|
||||
# Wrap this in catch_warnings to prevent this
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
res2 = kpss(df, regression=kpss_reg, nlags="auto")
|
||||
|
||||
vals2 = [res2[0], res2[1], res2[2], 0, 0]
|
||||
data["KPSS"] = vals2
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_granger_causality(time_series_y, time_series_x, lags):
|
||||
"""Calculate granger tests
|
||||
|
||||
Parameters
|
||||
----------
|
||||
time_series_y : Series
|
||||
The series you want to test Granger Causality for.
|
||||
time_series_x : Series
|
||||
The series that you want to test whether it Granger-causes time_series_y
|
||||
lags : int
|
||||
The amoiunt of lags for the Granger test. By default, this is set to 3.
|
||||
"""
|
||||
granger_set = pd.concat([time_series_y, time_series_x], axis=1)
|
||||
|
||||
granger = grangercausalitytests(granger_set, [lags], verbose=False)
|
||||
|
||||
return granger
|
||||
|
||||
|
||||
def get_engle_granger_two_step_cointegration_test(y, x):
|
||||
"""Estimates long-run and short-run cointegration relationship for series y and x and apply
|
||||
the two-step Engle & Granger test for cointegration.
|
||||
|
||||
Uses a 2-step process to first estimate coefficients for the long-run relationship
|
||||
y_t = c + gamma * x_t + z_t
|
||||
|
||||
and then the short-term relationship,
|
||||
y_t - y_(t-1) = alpha * z_(t-1) + epsilon_t,
|
||||
|
||||
with z the found residuals of the first equation.
|
||||
|
||||
Then tests cointegration by Dickey-Fuller phi=1 vs phi < 1 in
|
||||
z_t = phi * z_(t-1) + eta_t
|
||||
|
||||
If this implies phi < 1, the z series is stationary is concluded to be
|
||||
stationary, and thus the series y and x are concluded to be cointegrated.
|
||||
|
||||
Parameters
|
||||
|
||||
Parameters
|
||||
----------
|
||||
y : pd.Series
|
||||
The first time series of the pair to analyse.
|
||||
|
||||
x : pd.Series
|
||||
The second time series of the pair to analyse.
|
||||
|
||||
Returns
|
||||
-------
|
||||
c : float
|
||||
The constant term in the long-run relationship y_t = c + gamma * x_t + z_t. This
|
||||
describes the static shift of y with respect to gamma * x.
|
||||
|
||||
gamma : float
|
||||
The gamma term in the long-run relationship y_t = c + gamma * x_t + z_t. This
|
||||
describes the ratio between the const-shifted y and x.
|
||||
|
||||
alpha : float
|
||||
The alpha term in the short-run relationship y_t - y_(t-1) = alpha * z_(t-1) + epsilon. This
|
||||
gives an indication of the strength of the error correction toward the long-run mean.
|
||||
|
||||
z : pd.Series
|
||||
Series of residuals z_t from the long-run relationship y_t = c + gamma * x_t + z_t, representing
|
||||
the value of the error correction term.
|
||||
|
||||
dfstat : float
|
||||
The Dickey Fuller test-statistic for phi = 1 vs phi < 1 in the second equation. A more
|
||||
negative value implies the existence of stronger cointegration.
|
||||
|
||||
pvalue : float
|
||||
The p-value corresponding to the Dickey Fuller test-statistic. A lower value implies
|
||||
stronger rejection of no-cointegration, thus stronger evidence of cointegration.
|
||||
|
||||
"""
|
||||
warnings.simplefilter(action="ignore", category=FutureWarning)
|
||||
long_run_ols = sm.OLS(y, sm.add_constant(x))
|
||||
warnings.simplefilter(action="default", category=FutureWarning)
|
||||
|
||||
long_run_ols_fit = long_run_ols.fit()
|
||||
|
||||
c, gamma = long_run_ols_fit.params
|
||||
z = long_run_ols_fit.resid
|
||||
|
||||
short_run_ols = sm.OLS(y.diff().iloc[1:], (z.shift().iloc[1:]))
|
||||
short_run_ols_fit = short_run_ols.fit()
|
||||
|
||||
alpha = short_run_ols_fit.params[0]
|
||||
|
||||
# NOTE: The p-value returned by the adfuller function assumes we do not estimate z first, but test
|
||||
# stationarity of an unestimated series directly. This assumption should have limited effect for high N, however.
|
||||
# Critical values taking this into account more accurately are provided in e.g. McKinnon (1990) and
|
||||
# Engle & Yoo (1987).
|
||||
|
||||
adfstat, pvalue, _, _, _ = adfuller(z, maxlag=1, autolag=None)
|
||||
|
||||
return c, gamma, alpha, z, adfstat, pvalue
|
||||
440
gamestonk_terminal/econometrics/econometrics_view.py
Normal file
440
gamestonk_terminal/econometrics/econometrics_view.py
Normal file
@@ -0,0 +1,440 @@
|
||||
"""Econometrics View"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import logging
|
||||
import os
|
||||
from itertools import combinations
|
||||
from typing import Dict, Any, Optional, List
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
from pandas.plotting import register_matplotlib_converters
|
||||
|
||||
from gamestonk_terminal.config_plot import PLOT_DPI
|
||||
from gamestonk_terminal.decorators import log_start_end
|
||||
from gamestonk_terminal.helper_funcs import (
|
||||
export_data,
|
||||
plot_autoscale,
|
||||
)
|
||||
from gamestonk_terminal.helper_funcs import (
|
||||
print_rich_table,
|
||||
)
|
||||
from gamestonk_terminal.rich_config import console
|
||||
from gamestonk_terminal.econometrics import econometrics_model
|
||||
from gamestonk_terminal.config_terminal import theme
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
register_matplotlib_converters()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def show_options(
|
||||
datasets: Dict[str, pd.DataFrame],
|
||||
dataset_name: str = None,
|
||||
export: str = "",
|
||||
):
|
||||
"""Plot custom data
|
||||
|
||||
Parameters
|
||||
----------
|
||||
datasets: dict
|
||||
The loaded in datasets
|
||||
dataset_name: str
|
||||
The name of the dataset you wish to show options for
|
||||
export: str
|
||||
Format to export image
|
||||
"""
|
||||
if not datasets:
|
||||
console.print(
|
||||
"Please load in a dataset by using the 'load' command before using this feature."
|
||||
)
|
||||
else:
|
||||
option_tables = econometrics_model.get_options(datasets, dataset_name)
|
||||
|
||||
for dataset, data_values in option_tables.items():
|
||||
print_rich_table(
|
||||
data_values,
|
||||
headers=list(data_values.columns),
|
||||
show_index=False,
|
||||
title=f"Options for {dataset}",
|
||||
)
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{dataset}_options",
|
||||
data_values.set_index("column"),
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_plot(
|
||||
data: pd.DataFrame,
|
||||
dataset: str,
|
||||
column: str,
|
||||
export: str = "",
|
||||
external_axes: Optional[List[plt.axes]] = None,
|
||||
):
|
||||
"""Plot data from a dataset
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data: pd.DataFrame
|
||||
Dataframe of custom data
|
||||
dataset: str
|
||||
Dataset name
|
||||
column: str
|
||||
Column for y data
|
||||
export: str
|
||||
Format to export image
|
||||
external_axes:Optional[List[plt.axes]]
|
||||
External axes to plot on
|
||||
"""
|
||||
if isinstance(data.index, pd.MultiIndex):
|
||||
console.print(
|
||||
"The index appears to be a multi-index. "
|
||||
"Therefore, it is not possible to plot the data."
|
||||
)
|
||||
else:
|
||||
if external_axes is None:
|
||||
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
else:
|
||||
ax = external_axes[0]
|
||||
|
||||
if isinstance(data, pd.Series):
|
||||
ax.plot(data)
|
||||
elif isinstance(data, pd.DataFrame):
|
||||
ax.plot(data[column])
|
||||
|
||||
ax.set_title(f"{column} data from dataset {dataset}")
|
||||
theme.style_primary_axis(ax)
|
||||
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{column}_{dataset}_plot",
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_norm(
|
||||
data: pd.Series,
|
||||
dataset: str,
|
||||
column: str,
|
||||
plot: bool = False,
|
||||
export: str = "",
|
||||
external_axes: Optional[List[plt.axes]] = None,
|
||||
):
|
||||
"""Determine the normality of a timeseries.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data: pd.Series
|
||||
Series of custom data
|
||||
dataset: str
|
||||
Dataset name
|
||||
column: str
|
||||
Column for y data
|
||||
plot : bool
|
||||
Whether you wish to plot a histogram
|
||||
export: str
|
||||
Format to export data.
|
||||
external_axes: Optional[List[plt.axes]]
|
||||
External axes to plot on
|
||||
"""
|
||||
if data.dtype not in [int, float]:
|
||||
console.print(
|
||||
f"The column type must be numeric. The {column}-{dataset} type is {data.dtype}. "
|
||||
f"Consider using the command 'type' to change this."
|
||||
)
|
||||
else:
|
||||
results = econometrics_model.get_normality(data)
|
||||
|
||||
print_rich_table(
|
||||
results,
|
||||
headers=list(results.columns),
|
||||
show_index=True,
|
||||
title=f"Normality Test [Column: {column} | Dataset: {dataset}]",
|
||||
)
|
||||
|
||||
if plot:
|
||||
if external_axes is None:
|
||||
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
else:
|
||||
ax = external_axes[0]
|
||||
|
||||
ax.hist(data, bins=100)
|
||||
|
||||
ax.set_title(f"Histogram of {column} data from dataset {dataset}")
|
||||
|
||||
theme.style_primary_axis(ax)
|
||||
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
if export:
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{column}_{dataset}_norm",
|
||||
results,
|
||||
)
|
||||
else:
|
||||
console.print()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_root(
|
||||
df: pd.Series,
|
||||
dataset_name: str,
|
||||
column_name: str,
|
||||
fuller_reg: str,
|
||||
kpss_reg: str,
|
||||
export: str = "",
|
||||
):
|
||||
"""Determine the normality of a timeseries.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
df : pd.Series
|
||||
Series of target variable
|
||||
dataset_name: str
|
||||
Name of the dataset
|
||||
column_name: str
|
||||
Name of the column
|
||||
fuller_reg : str
|
||||
Type of regression of ADF test
|
||||
kpss_reg : str
|
||||
Type of regression for KPSS test
|
||||
export: str
|
||||
Format to export data.
|
||||
"""
|
||||
if df.dtype not in [int, float]:
|
||||
console.print(
|
||||
f"The column type must be numeric. The {column_name}-{dataset_name} "
|
||||
f"type is {df.dtype}. Consider using the command 'type' to change this."
|
||||
)
|
||||
else:
|
||||
results = econometrics_model.get_root(df, fuller_reg, kpss_reg)
|
||||
|
||||
print_rich_table(
|
||||
results,
|
||||
headers=list(results.columns),
|
||||
show_index=True,
|
||||
title=f"Unitroot Test [Column: {column_name} | Dataset: {dataset_name}]",
|
||||
)
|
||||
|
||||
if export:
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{column_name}_{dataset_name}_root",
|
||||
results,
|
||||
)
|
||||
else:
|
||||
console.print()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_granger(
|
||||
time_series_y: pd.Series,
|
||||
time_series_x: pd.Series,
|
||||
lags: int = 3,
|
||||
confidence_level: float = 0.05,
|
||||
export: str = "",
|
||||
):
|
||||
"""Show granger tests
|
||||
|
||||
Parameters
|
||||
----------
|
||||
time_series_y : Series
|
||||
The series you want to test Granger Causality for.
|
||||
time_series_x : Series
|
||||
The series that you want to test whether it Granger-causes time_series_y
|
||||
lags : int
|
||||
The amount of lags for the Granger test. By default, this is set to 3.
|
||||
confidence_level: float
|
||||
The confidence level you wish to use. By default, this is set to 0.05.
|
||||
export : str
|
||||
Format to export data
|
||||
"""
|
||||
if time_series_y.dtype not in [int, float]:
|
||||
console.print(
|
||||
f"The time series {time_series_y.name} needs to be numeric but is type {time_series_y.dtype}. "
|
||||
f"Consider using the command 'type' to change this."
|
||||
)
|
||||
elif time_series_x.dtype not in [int, float]:
|
||||
console.print(
|
||||
f"The time series {time_series_x.name} needs to be numeric but is type {time_series_x.dtype}. "
|
||||
f"Consider using the command 'type' to change this."
|
||||
)
|
||||
else:
|
||||
granger = econometrics_model.get_granger_causality(
|
||||
time_series_y, time_series_x, lags
|
||||
)
|
||||
|
||||
for test in granger[lags][0]:
|
||||
# As ssr_chi2test and lrtest have one less value in the tuple, we fill
|
||||
# this value with a '-' to allow the conversion to a DataFrame
|
||||
if len(granger[lags][0][test]) != 4:
|
||||
pars = granger[lags][0][test]
|
||||
granger[lags][0][test] = (pars[0], pars[1], "-", pars[2])
|
||||
|
||||
granger_df = pd.DataFrame(
|
||||
granger[lags][0], index=["F-test", "P-value", "Count", "Lags"]
|
||||
).T
|
||||
|
||||
print_rich_table(
|
||||
granger_df,
|
||||
headers=list(granger_df.columns),
|
||||
show_index=True,
|
||||
title=f"Granger Causality Test [Y: {time_series_y.name} | X: {time_series_x.name} | Lags: {lags}]",
|
||||
)
|
||||
|
||||
result_ftest = round(granger[lags][0]["params_ftest"][1], 3)
|
||||
|
||||
if result_ftest > confidence_level:
|
||||
console.print(
|
||||
f"As the p-value of the F-test is {result_ftest}, we can not reject the null hypothesis at "
|
||||
f"the {confidence_level} confidence level."
|
||||
)
|
||||
else:
|
||||
console.print(
|
||||
f"As the p-value of the F-test is {result_ftest}, we can reject the null hypothesis at "
|
||||
f"the {confidence_level} confidence level and find the Series '{time_series_x.name}' "
|
||||
f"to Granger-cause the Series '{time_series_y.name}'"
|
||||
)
|
||||
|
||||
if export:
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{time_series_y.name}_{time_series_x.name}_granger",
|
||||
granger_df,
|
||||
)
|
||||
else:
|
||||
console.print()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_cointegration_test(
|
||||
datasets: Dict[pd.Series, Any],
|
||||
significant: bool = False,
|
||||
plot: bool = False,
|
||||
export: str = "",
|
||||
external_axes: Optional[List[plt.axes]] = None,
|
||||
):
|
||||
"""Estimates long-run and short-run cointegration relationship for series y and x and apply
|
||||
the two-step Engle & Granger test for cointegration.
|
||||
|
||||
Uses a 2-step process to first estimate coefficients for the long-run relationship
|
||||
y_t = c + gamma * x_t + z_t
|
||||
|
||||
and then the short-term relationship,
|
||||
y_t - y_(t-1) = alpha * z_(t-1) + epsilon_t,
|
||||
|
||||
with z the found residuals of the first equation.
|
||||
|
||||
Then tests co-integration with the Dickey-Fuller phi=1 vs phi < 1 in
|
||||
z_t = phi * z_(t-1) + eta_t
|
||||
|
||||
If this implies phi < 1, the z series is stationary is concluded to be
|
||||
stationary, and thus the series y and x are concluded to be cointegrated.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
datasets: Dict[pd.Series, Any]
|
||||
All time series to perform co-integration tests on.
|
||||
significant: float
|
||||
Show only companies that have p-values lower than this percentage
|
||||
plot: bool
|
||||
Whether you wish to plot the z-values of all pairs.
|
||||
export : str
|
||||
Format to export data
|
||||
external_axes:Optional[List[plt.axes]]
|
||||
External axes to plot on
|
||||
"""
|
||||
|
||||
pairs = list(combinations(datasets.keys(), 2))
|
||||
result: Dict[str, list] = dict()
|
||||
z_values: Dict[str, pd.Series] = dict()
|
||||
|
||||
for x, y in pairs:
|
||||
if sum(datasets[y].isnull()) > 0:
|
||||
console.print(
|
||||
f"The Series {y} has nan-values. Please consider dropping or filling these "
|
||||
f"values with 'clean'."
|
||||
)
|
||||
elif sum(datasets[x].isnull()) > 0:
|
||||
console.print(
|
||||
f"The Series {x} has nan-values. Please consider dropping or filling these "
|
||||
f"values with 'clean'."
|
||||
)
|
||||
elif not datasets[y].index.equals(datasets[x].index):
|
||||
console.print(f"The Series {y} and {x} do not have the same index.")
|
||||
else:
|
||||
(
|
||||
c,
|
||||
gamma,
|
||||
alpha,
|
||||
z,
|
||||
adfstat,
|
||||
pvalue,
|
||||
) = econometrics_model.get_engle_granger_two_step_cointegration_test(
|
||||
datasets[x], datasets[y]
|
||||
)
|
||||
result[f"{x}/{y}"] = [c, gamma, alpha, adfstat, pvalue]
|
||||
z_values[f"{x}/{y}"] = z
|
||||
|
||||
if result and z_values:
|
||||
df = pd.DataFrame.from_dict(
|
||||
result,
|
||||
orient="index",
|
||||
columns=["Constant", "Gamma", "Alpha", "Dickey-Fuller", "P Value"],
|
||||
)
|
||||
|
||||
if significant:
|
||||
console.print(
|
||||
f"Only showing pairs that are statistically significant ({significant} > p-value)."
|
||||
)
|
||||
df = df[significant > df["P Value"]]
|
||||
console.print()
|
||||
|
||||
print_rich_table(
|
||||
df,
|
||||
headers=list(df.columns),
|
||||
show_index=True,
|
||||
index_name="Pairs",
|
||||
title="Cointegration Tests",
|
||||
)
|
||||
|
||||
if plot:
|
||||
if external_axes is None:
|
||||
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
else:
|
||||
ax = external_axes[0]
|
||||
|
||||
for pair, values in z_values.items():
|
||||
ax.plot(values, label=pair)
|
||||
|
||||
ax.legend()
|
||||
ax.set_title("Error correction terms")
|
||||
|
||||
theme.style_primary_axis(ax)
|
||||
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
if export:
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"results_cointegration",
|
||||
df,
|
||||
)
|
||||
else:
|
||||
console.print()
|
||||
568
gamestonk_terminal/econometrics/regression_model.py
Normal file
568
gamestonk_terminal/econometrics/regression_model.py
Normal file
@@ -0,0 +1,568 @@
|
||||
"""Regression Model"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import os
|
||||
import warnings
|
||||
import logging
|
||||
from typing import List, Tuple, Dict, Any
|
||||
|
||||
import pandas as pd
|
||||
from linearmodels import PooledOLS
|
||||
from linearmodels.panel import (
|
||||
RandomEffects,
|
||||
BetweenOLS,
|
||||
PanelOLS,
|
||||
FirstDifferenceOLS,
|
||||
compare,
|
||||
)
|
||||
from pandas import DataFrame
|
||||
from statsmodels.api import add_constant
|
||||
import statsmodels.api as sm
|
||||
from statsmodels.stats.api import het_breuschpagan
|
||||
from statsmodels.stats.diagnostic import acorr_breusch_godfrey
|
||||
from statsmodels.stats.stattools import durbin_watson
|
||||
|
||||
from gamestonk_terminal.decorators import log_start_end
|
||||
from gamestonk_terminal.helper_funcs import export_data
|
||||
from gamestonk_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_regressions_results(
|
||||
regression_type: str,
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
entity_effects: bool = False,
|
||||
time_effects: bool = False,
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""Based on the regression type, this function decides what regression to run.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_type: str
|
||||
The type of regression you wish to execute.
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
entity_effects: bool
|
||||
Whether to apply Fixed Effects on entities.
|
||||
time_effects: bool
|
||||
Whether to apply Fixed Effects on time.
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the regression model.
|
||||
"""
|
||||
if regression_type == "OLS":
|
||||
return get_ols(regression_variables, data, datasets, False)
|
||||
if regression_type == "POLS":
|
||||
return get_pols(regression_variables, data, datasets)
|
||||
if regression_type == "RE":
|
||||
return get_re(regression_variables, data, datasets)
|
||||
if regression_type == "BOLS":
|
||||
return get_bols(regression_variables, data, datasets)
|
||||
if regression_type == "FE":
|
||||
return get_fe(
|
||||
regression_variables, data, datasets, entity_effects, time_effects
|
||||
)
|
||||
if regression_type == "FDOLS":
|
||||
return get_fdols(regression_variables, data, datasets)
|
||||
|
||||
return console.print(f"{regression_type} is not an option.")
|
||||
|
||||
|
||||
def get_regression_data(
|
||||
regression_variables: List[tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
regression_type: str = "",
|
||||
) -> Tuple[DataFrame, Any, List[Any]]:
|
||||
"""This function creates a DataFrame with the required regression data as
|
||||
well sets up the dependent and independent variables.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
regression_type: str
|
||||
The type of regression that is executed.
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the OLS model.
|
||||
"""
|
||||
|
||||
regression = {}
|
||||
independent_variables = []
|
||||
dependent_variable = None
|
||||
|
||||
for variable in regression_variables:
|
||||
column, dataset = datasets[variable].keys()
|
||||
regression[f"{column}_{dataset}"] = data[dataset][column]
|
||||
|
||||
if variable == regression_variables[0]:
|
||||
dependent_variable = f"{column}_{dataset}"
|
||||
elif variable in regression_variables[1:]:
|
||||
independent_variables.append(f"{column}_{dataset}")
|
||||
|
||||
regression_df = pd.DataFrame(regression)
|
||||
nan_values = regression_df.isnull().sum().sum()
|
||||
|
||||
if nan_values > 0:
|
||||
regression_df = regression_df.dropna(how="any", axis="index")
|
||||
|
||||
if regression_df.empty:
|
||||
console.print(
|
||||
f"The resulting DataFrame only consists of NaN values. This is usually due to an index "
|
||||
f"mismatch. Therefore, no {regression_type} regression can be performed. Consider revisiting your "
|
||||
"dataset(s) and adjust accordingly."
|
||||
)
|
||||
else:
|
||||
console.print(
|
||||
f"The resulting DataFrame has {nan_values} NaN values. This is usually due to "
|
||||
f"an index mismatch. Rows that contain NaNs are dropped to be able to perform the {regression_type} "
|
||||
f"regression. Consider revisiting your dataset(s) and adjust accordingly."
|
||||
)
|
||||
|
||||
return regression_df, dependent_variable, independent_variables
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_ols(
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
show_regression: bool = True,
|
||||
export: str = "",
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""Performs an OLS regression on timeseries data. [Source: Statsmodels]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
show_regression: bool
|
||||
Whether to show the regression results table.
|
||||
export: str
|
||||
Format to export data
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the OLS model.
|
||||
"""
|
||||
|
||||
regression_df, dependent_variable, independent_variables = get_regression_data(
|
||||
regression_variables, data, datasets, "OLS"
|
||||
)
|
||||
|
||||
if regression_df.empty:
|
||||
model = None
|
||||
else:
|
||||
with warnings.catch_warnings(record=True) as warning_messages:
|
||||
model = sm.OLS(
|
||||
regression_df[dependent_variable], regression_df[independent_variables]
|
||||
).fit()
|
||||
|
||||
if show_regression:
|
||||
console.print(model.summary())
|
||||
console.print("")
|
||||
if len(warning_messages) > 0:
|
||||
console.print("Warnings:")
|
||||
for warning in warning_messages:
|
||||
console.print(f"[red]{warning.message}[/red]".replace("\n", ""))
|
||||
|
||||
if export:
|
||||
results_as_html = model.summary().tables[1].as_html()
|
||||
df = pd.read_html(results_as_html, header=0, index_col=0)[0]
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{dependent_variable}_ols_regression",
|
||||
df,
|
||||
)
|
||||
else:
|
||||
console.print("")
|
||||
|
||||
return regression_df, dependent_variable, independent_variables, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_pols(
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""PooledOLS is just plain OLS that understands that various panel data structures.
|
||||
It is useful as a base model. [Source: LinearModels]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the Pooled OLS model.
|
||||
"""
|
||||
|
||||
regression_df, dependent_variable, independent_variables = get_regression_data(
|
||||
regression_variables, data, datasets, "POLS"
|
||||
)
|
||||
|
||||
if regression_df.empty:
|
||||
model = None
|
||||
else:
|
||||
with warnings.catch_warnings(record=True) as warning_messages:
|
||||
exogenous = add_constant(regression_df[independent_variables])
|
||||
model = PooledOLS(regression_df[dependent_variable], exogenous).fit()
|
||||
console.print(model)
|
||||
|
||||
if len(warning_messages) > 0:
|
||||
console.print("Warnings:")
|
||||
for warning in warning_messages:
|
||||
console.print(f"[red]{warning.message}[/red]".replace("\n", ""))
|
||||
|
||||
return regression_df, dependent_variable, independent_variables, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_re(
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""The random effects model is virtually identical to the pooled OLS model except that is accounts for the
|
||||
structure of the model and so is more efficient. Random effects uses a quasi-demeaning strategy which
|
||||
subtracts the time average of the within entity values to account for the common shock. [Source: LinearModels]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the RandomEffects model.
|
||||
"""
|
||||
|
||||
regression_df, dependent_variable, independent_variables = get_regression_data(
|
||||
regression_variables, data, datasets, "RE"
|
||||
)
|
||||
|
||||
if regression_df.empty:
|
||||
model = None
|
||||
else:
|
||||
with warnings.catch_warnings(record=True) as warning_messages:
|
||||
exogenous = add_constant(regression_df[independent_variables])
|
||||
model = RandomEffects(regression_df[dependent_variable], exogenous).fit()
|
||||
console.print(model)
|
||||
|
||||
if len(warning_messages) > 0:
|
||||
console.print("Warnings:")
|
||||
for warning in warning_messages:
|
||||
console.print(f"[red]{warning.message}[/red]".replace("\n", ""))
|
||||
|
||||
return regression_df, dependent_variable, independent_variables, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_bols(
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""The between estimator is an alternative, usually less efficient estimator, can can be used to
|
||||
estimate model parameters. It is particular simple since it first computes the time averages of
|
||||
y and x and then runs a simple regression using these averages. [Source: LinearModels]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the Between OLS model.
|
||||
"""
|
||||
|
||||
regression_df, dependent_variable, independent_variables = get_regression_data(
|
||||
regression_variables, data, datasets, "BOLS"
|
||||
)
|
||||
|
||||
if regression_df.empty:
|
||||
model = None
|
||||
else:
|
||||
with warnings.catch_warnings(record=True) as warning_messages:
|
||||
exogenous = add_constant(regression_df[independent_variables])
|
||||
model = BetweenOLS(regression_df[dependent_variable], exogenous).fit()
|
||||
console.print(model)
|
||||
|
||||
if len(warning_messages) > 0:
|
||||
console.print("Warnings:")
|
||||
for warning in warning_messages:
|
||||
console.print(f"[red]{warning.message}[/red]".replace("\n", ""))
|
||||
|
||||
return regression_df, dependent_variable, independent_variables, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_fe(
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
entity_effects: bool = False,
|
||||
time_effects: bool = False,
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""When effects are correlated with the regressors the RE and BE estimators are not consistent.
|
||||
The usual solution is to use Fixed Effects which are called entity_effects when applied to
|
||||
entities and time_effects when applied to the time dimension. [Source: LinearModels]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
entity_effects : bool
|
||||
Whether to include entity effects
|
||||
time_effects : bool
|
||||
Whether to include time effects
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the OLS model.
|
||||
"""
|
||||
|
||||
regression_df, dependent_variable, independent_variables = get_regression_data(
|
||||
regression_variables, data, datasets, "FE"
|
||||
)
|
||||
|
||||
if regression_df.empty:
|
||||
model = None
|
||||
else:
|
||||
with warnings.catch_warnings(record=True) as warning_messages:
|
||||
exogenous = add_constant(regression_df[independent_variables])
|
||||
model = PanelOLS(
|
||||
regression_df[dependent_variable],
|
||||
exogenous,
|
||||
entity_effects=entity_effects,
|
||||
time_effects=time_effects,
|
||||
).fit()
|
||||
console.print(model)
|
||||
|
||||
if len(warning_messages) > 0:
|
||||
console.print("Warnings:")
|
||||
for warning in warning_messages:
|
||||
console.print(f"[red]{warning.message}[/red]".replace("\n", ""))
|
||||
|
||||
return regression_df, dependent_variable, independent_variables, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_fdols(
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
) -> Tuple[DataFrame, Any, List[Any], Any]:
|
||||
"""First differencing is an alternative to using fixed effects when there might be correlation.
|
||||
When using first differences, time-invariant variables must be excluded. Additionally,
|
||||
only one linear time-trending variable can be included since this will look like a constant.
|
||||
This variable will soak up all time-trends in the data, and so interpretations of
|
||||
these variable can be challenging. [Source: LinearModels]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the OLS model.
|
||||
"""
|
||||
|
||||
regression_df, dependent_variable, independent_variables = get_regression_data(
|
||||
regression_variables, data, datasets, "FDOLS"
|
||||
)
|
||||
|
||||
if regression_df.empty:
|
||||
model = None
|
||||
else:
|
||||
with warnings.catch_warnings(record=True) as warning_messages:
|
||||
model = FirstDifferenceOLS(
|
||||
regression_df[dependent_variable], regression_df[independent_variables]
|
||||
).fit()
|
||||
console.print(model)
|
||||
|
||||
if len(warning_messages) > 0:
|
||||
console.print("Warnings:")
|
||||
for warning in warning_messages:
|
||||
console.print(f"[red]{warning.message}[/red]".replace("\n", ""))
|
||||
|
||||
return regression_df, dependent_variable, independent_variables, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_comparison(regressions, export: str = ""):
|
||||
"""Compare regression results between Panel Data regressions.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regressions : Dict
|
||||
Dictionary with regression results.
|
||||
export : str
|
||||
Format to export data
|
||||
|
||||
Returns
|
||||
-------
|
||||
Returns a PanelModelComparison which shows an overview of the different regression results.
|
||||
"""
|
||||
comparison = {}
|
||||
|
||||
for regression_type, data in regressions.items():
|
||||
if regression_type == "OLS":
|
||||
continue
|
||||
if data["model"]:
|
||||
comparison[regression_type] = data["model"]
|
||||
|
||||
if not comparison:
|
||||
# When the dictionary is empty, it means no Panel regression
|
||||
# estimates are available and thus the function will have no output
|
||||
return console.print(
|
||||
"No Panel regression estimates available. Please use the "
|
||||
"command 'panel' before using this command."
|
||||
)
|
||||
|
||||
comparison_result = compare(comparison)
|
||||
console.print(comparison_result)
|
||||
|
||||
if export:
|
||||
results_as_html = comparison_result.summary.tables[0].as_html()
|
||||
df = pd.read_html(results_as_html, header=0, index_col=0)[0]
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"regressions_compare",
|
||||
df,
|
||||
)
|
||||
|
||||
return comparison_result
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_dwat(residual: pd.DataFrame) -> pd.DataFrame:
|
||||
"""Calculate test statistics for Durbing Watson autocorrelation
|
||||
|
||||
Parameters
|
||||
----------
|
||||
residual : OLS Model
|
||||
Model containing residual values.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Test statistic of the Durbin Watson test.
|
||||
"""
|
||||
# Durbin Watson test: The test statistic is approximately equal to 2*(1-r) where r is the
|
||||
# sample autocorrelation of the residuals. Thus, for r == 0, indicating no serial correlation,
|
||||
# the test statistic equals 2. This statistic will always be between 0 and 4. The closer
|
||||
# to 0 the statistic, the more evidence for positive serial correlation. The closer to 4,
|
||||
# the more evidence for negative serial correlation.
|
||||
result = durbin_watson(residual)
|
||||
|
||||
return round(result, 2)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_bgod(model: pd.DataFrame, lags: int) -> tuple:
|
||||
"""Calculate test statistics for autocorrelation
|
||||
|
||||
Parameters
|
||||
----------
|
||||
model : OLS Model
|
||||
Model containing residual values.
|
||||
lags : int
|
||||
The amount of lags.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Test results from the Breusch-Godfrey Test
|
||||
"""
|
||||
|
||||
lm_stat, p_value, f_stat, fp_value = acorr_breusch_godfrey(model, nlags=lags)
|
||||
|
||||
return lm_stat, p_value, f_stat, fp_value
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_bpag(model: pd.DataFrame) -> tuple:
|
||||
"""Calculate test statistics for heteroscedasticity
|
||||
|
||||
Parameters
|
||||
----------
|
||||
model : OLS Model
|
||||
Model containing residual values.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Test results from the Breusch-Pagan Test
|
||||
"""
|
||||
|
||||
lm_stat, p_value, f_stat, fp_value = het_breuschpagan(model.resid, model.model.exog)
|
||||
|
||||
return lm_stat, p_value, f_stat, fp_value
|
||||
238
gamestonk_terminal/econometrics/regression_view.py
Normal file
238
gamestonk_terminal/econometrics/regression_view.py
Normal file
@@ -0,0 +1,238 @@
|
||||
"""Regression View"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from typing import Optional, List, Tuple, Dict, Any
|
||||
import os
|
||||
import logging
|
||||
import pandas as pd
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
from gamestonk_terminal.config_plot import PLOT_DPI
|
||||
from gamestonk_terminal.decorators import log_start_end
|
||||
from gamestonk_terminal.helper_funcs import plot_autoscale, export_data
|
||||
from gamestonk_terminal.rich_config import console
|
||||
from gamestonk_terminal.econometrics import regression_model
|
||||
from gamestonk_terminal.helper_funcs import (
|
||||
print_rich_table,
|
||||
)
|
||||
from gamestonk_terminal.config_terminal import theme
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_panel(
|
||||
regression_type: str,
|
||||
regression_variables: List[Tuple],
|
||||
data: Dict[str, pd.DataFrame],
|
||||
datasets: Dict[pd.DataFrame, Any],
|
||||
entity_effects: bool = False,
|
||||
time_effects: bool = False,
|
||||
export: str = "",
|
||||
):
|
||||
"""Based on the regression type, this function decides what regression to run.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
regression_type: str
|
||||
The type of regression you wish to execute.
|
||||
regression_variables : list
|
||||
The regressions variables entered where the first variable is
|
||||
the dependent variable.
|
||||
data : dict
|
||||
A dictionary containing the datasets.
|
||||
datasets: dict
|
||||
A dictionary containing the column and dataset names of
|
||||
each column/dataset combination.
|
||||
entity_effects: bool
|
||||
Whether to apply Fixed Effects on entities.
|
||||
time_effects: bool
|
||||
Whether to apply Fixed Effects on time.
|
||||
export : str
|
||||
Format to export data
|
||||
|
||||
Returns
|
||||
-------
|
||||
The dataset used, the dependent variable, the independent variable and
|
||||
the regression model.
|
||||
"""
|
||||
(
|
||||
regression_df,
|
||||
dependent,
|
||||
independent,
|
||||
model,
|
||||
) = regression_model.get_regressions_results(
|
||||
regression_type,
|
||||
regression_variables,
|
||||
data,
|
||||
datasets,
|
||||
entity_effects,
|
||||
time_effects,
|
||||
)
|
||||
|
||||
if export:
|
||||
results_as_html = model.summary.tables[1].as_html()
|
||||
df = pd.read_html(results_as_html, header=0, index_col=0)[0]
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{dependent}_{regression_type}_regression",
|
||||
df,
|
||||
)
|
||||
|
||||
return regression_df, dependent, independent, model
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_dwat(
|
||||
dependent_variable: pd.Series,
|
||||
residual: pd.DataFrame,
|
||||
plot: bool = False,
|
||||
export: str = "",
|
||||
external_axes: Optional[List[plt.axes]] = None,
|
||||
):
|
||||
"""Show Durbin-Watson autocorrelation tests
|
||||
|
||||
Parameters
|
||||
----------
|
||||
dependent_variable : pd.Series
|
||||
The dependent variable.
|
||||
residual : OLS Model
|
||||
The residual of an OLS model.
|
||||
plot : bool
|
||||
Whether to plot the residuals
|
||||
export : str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.axes]]
|
||||
External axes to plot on
|
||||
"""
|
||||
autocorrelation = regression_model.get_dwat(residual)
|
||||
|
||||
if 1.5 < autocorrelation < 2.5:
|
||||
console.print(
|
||||
f"The result {autocorrelation} is within the range 1.5 and 2.5 which therefore indicates "
|
||||
f"autocorrelation not to be problematic."
|
||||
)
|
||||
else:
|
||||
console.print(
|
||||
f"The result {autocorrelation} is outside the range 1.5 and 2.5 and therefore autocorrelation "
|
||||
f"can be problematic. Please consider lags of the dependent or independent variable."
|
||||
)
|
||||
|
||||
if plot:
|
||||
if external_axes is None:
|
||||
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
else:
|
||||
ax = external_axes[0]
|
||||
|
||||
ax.scatter(dependent_variable, residual)
|
||||
ax.axhline(y=0, color="r", linestyle="-")
|
||||
ax.set_ylabel("Residual")
|
||||
ax.set_xlabel(dependent_variable.name.capitalize())
|
||||
ax.set_title("Plot of Residuals")
|
||||
theme.style_primary_axis(ax)
|
||||
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"{dependent_variable.name}_dwat",
|
||||
autocorrelation,
|
||||
)
|
||||
|
||||
console.print()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_bgod(model: pd.DataFrame, lags: int, export: str = ""):
|
||||
"""Show Breusch-Godfrey autocorrelation test
|
||||
|
||||
Parameters
|
||||
----------
|
||||
model : OLS Model
|
||||
Model containing residual values.
|
||||
lags : int
|
||||
The amount of lags included.
|
||||
export : str
|
||||
Format to export data
|
||||
"""
|
||||
(
|
||||
lm_stat,
|
||||
p_value,
|
||||
f_stat,
|
||||
fp_value,
|
||||
) = regression_model.get_bgod(model, lags)
|
||||
|
||||
df = pd.DataFrame(
|
||||
[lm_stat, p_value, f_stat, fp_value],
|
||||
index=["LM-stat", "p-value", "f-stat", "fp-value"],
|
||||
)
|
||||
|
||||
print_rich_table(
|
||||
df,
|
||||
headers=list(["Breusch-Godfrey"]),
|
||||
show_index=True,
|
||||
title=f"Breusch-Godfrey autocorrelation test [Lags: {lags}]",
|
||||
)
|
||||
|
||||
if p_value > 0.05:
|
||||
console.print(
|
||||
f"The result {round(p_value, 2)} indicates the existence of autocorrelation. Consider re-estimating "
|
||||
f"with clustered standard errors and applying the Random Effects or Fixed Effects model."
|
||||
)
|
||||
else:
|
||||
console.print(
|
||||
f"The result {round(p_value, 2)} indicates no existence of autocorrelation."
|
||||
)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "results_bgod", df)
|
||||
|
||||
console.print()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_bpag(model: pd.DataFrame, export: str = ""):
|
||||
"""Show Breusch-Pagan heteroscedasticity test
|
||||
|
||||
Parameters
|
||||
----------
|
||||
model : OLS Model
|
||||
Model containing residual values.
|
||||
export : str
|
||||
Format to export data
|
||||
"""
|
||||
(
|
||||
lm_stat,
|
||||
p_value,
|
||||
f_stat,
|
||||
fp_value,
|
||||
) = regression_model.get_bpag(model)
|
||||
|
||||
df = pd.DataFrame(
|
||||
[lm_stat, p_value, f_stat, fp_value],
|
||||
index=["lm-stat", "p-value", "f-stat", "fp-value"],
|
||||
)
|
||||
|
||||
print_rich_table(
|
||||
df,
|
||||
headers=list(["Breusch-Pagan"]),
|
||||
show_index=True,
|
||||
title="Breusch-Pagan heteroscedasticity test",
|
||||
)
|
||||
|
||||
if p_value > 0.05:
|
||||
console.print(
|
||||
f"The result {round(p_value, 2)} indicates the existence of heteroscedasticity. Consider taking the log "
|
||||
f"or a rate for the dependent variable."
|
||||
)
|
||||
else:
|
||||
console.print(
|
||||
f"The result {round(p_value, 2)} indicates no existence of heteroscedasticity."
|
||||
)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "results_bpag", df)
|
||||
|
||||
console.print()
|
||||
129
poetry.lock
generated
vendored
129
poetry.lock
generated
vendored
@@ -158,6 +158,14 @@ python-versions = ">=3.7"
|
||||
[package.extras]
|
||||
tests = ["pytest", "pytest-asyncio", "mypy (>=0.800)"]
|
||||
|
||||
[[package]]
|
||||
name = "astor"
|
||||
version = "0.8.1"
|
||||
description = "Read/rewrite/write Python ASTs"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
|
||||
|
||||
[[package]]
|
||||
name = "astroid"
|
||||
version = "2.9.3"
|
||||
@@ -917,6 +925,29 @@ ufo = ["fs (>=2.2.0,<3)"]
|
||||
unicode = ["unicodedata2 (>=14.0.0)"]
|
||||
woff = ["zopfli (>=0.1.4)", "brotlicffi (>=0.8.0)", "brotli (>=1.0.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "formulaic"
|
||||
version = "0.2.4"
|
||||
description = "An implementation of Wilkinson formulas."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
astor = "*"
|
||||
interface-meta = ">=1.2"
|
||||
numpy = "*"
|
||||
pandas = "*"
|
||||
scipy = "*"
|
||||
wrapt = "*"
|
||||
|
||||
[package.extras]
|
||||
arrow = ["pyarrow"]
|
||||
benchmarks = ["patsy", "rpy2", "uncertainties"]
|
||||
calculus = ["sympy"]
|
||||
docs = ["mkdocs-material", "pymdown-extensions", "pygments"]
|
||||
test = ["flake8", "pytest", "pytest-cov"]
|
||||
|
||||
[[package]]
|
||||
name = "fred"
|
||||
version = "3.1"
|
||||
@@ -1160,6 +1191,14 @@ category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "interface-meta"
|
||||
version = "1.2.4"
|
||||
description = "InterfaceMeta"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.4"
|
||||
|
||||
[[package]]
|
||||
name = "investpy"
|
||||
version = "1.0.8"
|
||||
@@ -1595,6 +1634,26 @@ category = "main"
|
||||
optional = true
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "linearmodels"
|
||||
version = "4.25"
|
||||
description = "Linear Panel, Instrumental Variable, Asset Pricing, and System Regression models for Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
Cython = ">=0.29.21"
|
||||
formulaic = "*"
|
||||
mypy_extensions = ">=0.4"
|
||||
numpy = ">=1.16"
|
||||
pandas = ">=0.24"
|
||||
patsy = "*"
|
||||
property_cached = ">=1.6.3"
|
||||
pyhdfe = ">=0.1"
|
||||
scipy = ">=1.2"
|
||||
statsmodels = ">=0.11"
|
||||
|
||||
[[package]]
|
||||
name = "lxml"
|
||||
version = "4.8.0"
|
||||
@@ -2336,6 +2395,14 @@ python-versions = ">=3.6.2"
|
||||
[package.dependencies]
|
||||
wcwidth = "*"
|
||||
|
||||
[[package]]
|
||||
name = "property-cached"
|
||||
version = "1.6.4"
|
||||
description = "A decorator for caching properties in classes (forked from cached-property)."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">= 3.5"
|
||||
|
||||
[[package]]
|
||||
name = "protobuf"
|
||||
version = "3.19.4"
|
||||
@@ -2498,6 +2565,22 @@ category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
|
||||
[[package]]
|
||||
name = "pyhdfe"
|
||||
version = "0.1.0"
|
||||
description = "High dimensional fixed effect absorption with Python 3"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
numpy = ">=1.12.0"
|
||||
scipy = ">=1.0.0"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "ipython", "astunparse", "sphinx-rtd-theme", "nbsphinx", "jupyter-client"]
|
||||
tests = ["pytest", "pytest-xdist"]
|
||||
|
||||
[[package]]
|
||||
name = "pyimgur"
|
||||
version = "0.6.0"
|
||||
@@ -3999,7 +4082,6 @@ prediction = ["tensorflow"]
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8,<3.10"
|
||||
content-hash = "5627f70eca6b911461177c361ec7374f5f3576c96dbc9052887ab0c7749b4e5a"
|
||||
|
||||
[metadata.files]
|
||||
absl-py = [
|
||||
@@ -4143,6 +4225,10 @@ asgiref = [
|
||||
{file = "asgiref-3.5.0-py3-none-any.whl", hash = "sha256:88d59c13d634dcffe0510be048210188edd79aeccb6a6c9028cdad6f31d730a9"},
|
||||
{file = "asgiref-3.5.0.tar.gz", hash = "sha256:2f8abc20f7248433085eda803936d98992f1343ddb022065779f37c5da0181d0"},
|
||||
]
|
||||
astor = [
|
||||
{file = "astor-0.8.1-py2.py3-none-any.whl", hash = "sha256:070a54e890cefb5b3739d19f30f5a5ec840ffc9c50ffa7d23cc9fc1a38ebbfc5"},
|
||||
{file = "astor-0.8.1.tar.gz", hash = "sha256:6a6effda93f4e1ce9f618779b2dd1d9d84f1e32812c23a29b3fff6fd7f63fa5e"},
|
||||
]
|
||||
astroid = [
|
||||
{file = "astroid-2.9.3-py3-none-any.whl", hash = "sha256:506daabe5edffb7e696ad82483ad0228245a9742ed7d2d8c9cdb31537decf9f6"},
|
||||
{file = "astroid-2.9.3.tar.gz", hash = "sha256:1efdf4e867d4d8ba4a9f6cf9ce07cd182c4c41de77f23814feb27ca93ca9d877"},
|
||||
@@ -4591,6 +4677,10 @@ fonttools = [
|
||||
{file = "fonttools-4.29.1-py3-none-any.whl", hash = "sha256:1933415e0fbdf068815cb1baaa1f159e17830215f7e8624e5731122761627557"},
|
||||
{file = "fonttools-4.29.1.zip", hash = "sha256:2b18a172120e32128a80efee04cff487d5d140fe7d817deb648b2eee023a40e4"},
|
||||
]
|
||||
formulaic = [
|
||||
{file = "formulaic-0.2.4-py3-none-any.whl", hash = "sha256:775620d93f24f01b33a17aa2cf65a04112003c5112f12015368e4e4605a5013b"},
|
||||
{file = "formulaic-0.2.4.tar.gz", hash = "sha256:15b71ea8972fb451f80684203cddd49620fc9ed5c2e35f31e0874e9c41910d1a"},
|
||||
]
|
||||
fred = [
|
||||
{file = "fred-3.1.tar.gz", hash = "sha256:f31327d648917694b8d15d66ca4e82a082dbb88ca027bdcc9d56738cbc836a6a"},
|
||||
]
|
||||
@@ -4810,6 +4900,10 @@ iniconfig = [
|
||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
||||
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
||||
]
|
||||
interface-meta = [
|
||||
{file = "interface_meta-1.2.4-py2.py3-none-any.whl", hash = "sha256:8d11375064d51e73764a02b8225af87b1ed63c20c1df52d3867611a5e70a5fc0"},
|
||||
{file = "interface_meta-1.2.4.tar.gz", hash = "sha256:4c7725dd4b80f97b7eecfb26023e1a8a7cdbb6d6a7207a8e93f9d4bfef9ee566"},
|
||||
]
|
||||
investpy = [
|
||||
{file = "investpy-1.0.8.tar.gz", hash = "sha256:6a7632a94b484ee07cd54afd416bdc759cd905ba60c62dbb8a8d157229b267c6"},
|
||||
]
|
||||
@@ -5008,6 +5102,31 @@ libclang = [
|
||||
{file = "libclang-11.1.0-py2.py3-none-manylinux2014_aarch64.whl", hash = "sha256:39d07c8965a3c963fb2686496339b6dbacf42acbd32e4bc7361373a45e98cebe"},
|
||||
{file = "libclang-11.1.0-py2.py3-none-win_amd64.whl", hash = "sha256:8cb0082a30b9e1e615d7f4211b0c428b607a9bd1e43ddc6c0cabdd9ea5b244bf"},
|
||||
]
|
||||
linearmodels = [
|
||||
{file = "linearmodels-4.25-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e8d3b34c62357701b60d043356563c247096ad79b8b95ac9bbafb1820a455f48"},
|
||||
{file = "linearmodels-4.25-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b1b2e7e4e27b12e9d5ec4e2de41e9aeaa685405bc37beaff0f080a2ad3e24f61"},
|
||||
{file = "linearmodels-4.25-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6e107d3d97819cdc4bfe64c85870e0ed655f2e1bd04911e22127dee0e3fab8d2"},
|
||||
{file = "linearmodels-4.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:728d82fac702f65cc128742145b3702428b6aed5283450365ec5110f42e883dd"},
|
||||
{file = "linearmodels-4.25-cp310-cp310-win_amd64.whl", hash = "sha256:c0aec5de380c4daf0596bb3be647a8cc8d0081c06715465df7a87efced08014e"},
|
||||
{file = "linearmodels-4.25-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:db4c313127f3307a7c174ee12d9306fbc8dbb8a585b55234ebfa435fa5dd9ee9"},
|
||||
{file = "linearmodels-4.25-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:339f01a68e504db1cccb4be9d4167c38c92ea5700cd3eba03ad0352d869c15eb"},
|
||||
{file = "linearmodels-4.25-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f55f68eb675f863f80860526143451f516d9b77c580c0afb6c86f8bf7292da86"},
|
||||
{file = "linearmodels-4.25-cp37-cp37m-win32.whl", hash = "sha256:ab9cb6a6fcad05bc5e790341c321713232883a8757aab4c7ce038a0a1af55728"},
|
||||
{file = "linearmodels-4.25-cp37-cp37m-win_amd64.whl", hash = "sha256:f9fcb1eaaaf268ffcffbf4c2333bc9634d7a9ecf2ced0b5222bab6a8491d9fc6"},
|
||||
{file = "linearmodels-4.25-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:397201c401f1d21bbfa9b2f4c44694c2f8c557d69271c244f43ac2ec5c6f2376"},
|
||||
{file = "linearmodels-4.25-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e989cc12320e4cc599f3ceb83e8fa16e27af2584c3f76020bc56c20f76866839"},
|
||||
{file = "linearmodels-4.25-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c24f4aa2f44bf9e04606e15851b8874b2c8097f533c47bf11d6dab4954ecc6db"},
|
||||
{file = "linearmodels-4.25-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6843e0a8971d4d0539f22967ebf7dc9b381e55f087b6ee7bb32ad7ee728c91a7"},
|
||||
{file = "linearmodels-4.25-cp38-cp38-win32.whl", hash = "sha256:cced735e5c645902c3c2003826d75ff04dd5caa60096918e8f7f4fc0eb79ed31"},
|
||||
{file = "linearmodels-4.25-cp38-cp38-win_amd64.whl", hash = "sha256:4d5d401d1c2c9b8c2e8fd2dd8b064e513bf4cb0d6a30b9198f33f67163cbc7d8"},
|
||||
{file = "linearmodels-4.25-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3bd3ddc0753d29fcd26ff80d87957904f7d91c3f7d898c8839b13a226ee5fede"},
|
||||
{file = "linearmodels-4.25-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:11b3f66bdf17434b04be916f16ddb319bf8dae54b89b8c268cb37a8ad7b0f4ee"},
|
||||
{file = "linearmodels-4.25-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5a1b691e840189a2ed17796a806960166e30e86e6970c80e60fe10762456005"},
|
||||
{file = "linearmodels-4.25-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4abd59e3dda544807676d94ba1ea2ceba87624ab30491ea561430f31379229bc"},
|
||||
{file = "linearmodels-4.25-cp39-cp39-win32.whl", hash = "sha256:061f2970191fcee284f600d5cc84a556a411729494325af8c557047ab733ae46"},
|
||||
{file = "linearmodels-4.25-cp39-cp39-win_amd64.whl", hash = "sha256:19f8cb6237b61badb687a4a020527552a70e077cf1b303959c33faeb8cdde285"},
|
||||
{file = "linearmodels-4.25.tar.gz", hash = "sha256:a73e94195f486f74be6176809a515bb498b5371d8acb9e4ae6f0e59a7c28210a"},
|
||||
]
|
||||
lxml = [
|
||||
{file = "lxml-4.8.0-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:e1ab2fac607842ac36864e358c42feb0960ae62c34aa4caaf12ada0a1fb5d99b"},
|
||||
{file = "lxml-4.8.0-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:28d1af847786f68bec57961f31221125c29d6f52d9187c01cd34dc14e2b29430"},
|
||||
@@ -5541,6 +5660,10 @@ prompt-toolkit = [
|
||||
{file = "prompt_toolkit-3.0.28-py3-none-any.whl", hash = "sha256:30129d870dcb0b3b6a53efdc9d0a83ea96162ffd28ffe077e94215b233dc670c"},
|
||||
{file = "prompt_toolkit-3.0.28.tar.gz", hash = "sha256:9f1cd16b1e86c2968f2519d7fb31dd9d669916f515612c269d14e9ed52b51650"},
|
||||
]
|
||||
property-cached = [
|
||||
{file = "property-cached-1.6.4.zip", hash = "sha256:3e9c4ef1ed3653909147510481d7df62a3cfb483461a6986a6f1dcd09b2ebb73"},
|
||||
{file = "property_cached-1.6.4-py2.py3-none-any.whl", hash = "sha256:135fc059ec969c1646424a0db15e7fbe1b5f8c36c0006d0b3c91ba568c11e7d8"},
|
||||
]
|
||||
protobuf = [
|
||||
{file = "protobuf-3.19.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f51d5a9f137f7a2cec2d326a74b6e3fc79d635d69ffe1b036d39fc7d75430d37"},
|
||||
{file = "protobuf-3.19.4-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:09297b7972da685ce269ec52af761743714996b4381c085205914c41fcab59fb"},
|
||||
@@ -5679,6 +5802,10 @@ pygments = [
|
||||
{file = "Pygments-2.11.2-py3-none-any.whl", hash = "sha256:44238f1b60a76d78fc8ca0528ee429702aae011c265fe6a8dd8b63049ae41c65"},
|
||||
{file = "Pygments-2.11.2.tar.gz", hash = "sha256:4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a"},
|
||||
]
|
||||
pyhdfe = [
|
||||
{file = "pyhdfe-0.1.0-py3-none-any.whl", hash = "sha256:21c6f7d9f464929ce5acfce54d46684c4449a5bbe14d2986237ecb30a723b9ee"},
|
||||
{file = "pyhdfe-0.1.0.tar.gz", hash = "sha256:820a40722d70e94cec1dcd140d6c480f02578fee96660b722a2e722c2222e377"},
|
||||
]
|
||||
pyimgur = [
|
||||
{file = "pyimgur-0.6.0-py2-none-any.whl", hash = "sha256:ad22deea062fe8e7412d0bdfc70cbf305a828c6390096d3523ed3d7dbeb2bdff"},
|
||||
{file = "pyimgur-0.6.0.tar.gz", hash = "sha256:f776ca7f14663bd9ac14a1380db62c87ed32231d159d2d167ad1cb817dcb9144"},
|
||||
|
||||
1
pyproject.toml
vendored
1
pyproject.toml
vendored
@@ -87,6 +87,7 @@ PyNaCl = {version = "^1.5.0", optional = true}
|
||||
ascii-magic = "^1.6"
|
||||
squarify = "^0.4.3"
|
||||
finnhub-python = "^2.4.10"
|
||||
linearmodels = "^4.25"
|
||||
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
58
requirements-full.txt
vendored
58
requirements-full.txt
vendored
@@ -7,33 +7,34 @@ ansiwrap==0.8.4; python_version >= "3.6"
|
||||
anyio==3.5.0; python_full_version >= "3.6.2" and python_version >= "3.7"
|
||||
appdirs==1.4.4; python_full_version >= "3.6.2" and python_version >= "3.8"
|
||||
appnope==0.1.2; platform_system == "Darwin" and python_version >= "3.8" and sys_platform == "darwin"
|
||||
argon2-cffi-bindings==21.2.0; python_version >= "3.6"
|
||||
argon2-cffi-bindings==21.2.0; python_version >= "3.7"
|
||||
argon2-cffi==21.3.0; python_version >= "3.7"
|
||||
ascii-magic==1.6; python_version >= "3.5"
|
||||
astor==0.8.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
|
||||
astroid==2.9.3; python_full_version >= "3.6.2"
|
||||
asttokens==2.0.5; python_version >= "3.8"
|
||||
astunparse==1.6.3
|
||||
async-timeout==4.0.2; python_version >= "3.6"
|
||||
atomicwrites==1.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
|
||||
attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_full_version >= "3.5.0" and python_version >= "3.7" and python_version < "4.0"
|
||||
attrs==21.4.0; python_full_version >= "3.7.0" and python_version >= "3.7" and python_version < "4.0"
|
||||
babel==2.9.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
|
||||
backcall==0.2.0; python_version >= "3.8"
|
||||
backports.zoneinfo==0.2.1; python_version < "3.9" and python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
|
||||
bandit==1.7.2; python_version >= "3.7"
|
||||
beartype==0.7.1; python_version >= "3.8" and python_version < "4.0" and python_full_version >= "3.6.0"
|
||||
beautifulsoup4==4.10.0; python_full_version > "3.0.0" and python_version >= "3.5"
|
||||
beautifulsoup4==4.10.0; python_full_version > "3.0.0" and python_version >= "3.7"
|
||||
black==21.7b0; python_full_version >= "3.6.2"
|
||||
bleach==4.1.0; python_version >= "3.7"
|
||||
bs4==0.0.1
|
||||
bt==0.2.9; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0")
|
||||
cachetools==5.0.0; python_version >= "3.7" and python_version < "4.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
|
||||
certifi==2021.10.8; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0"
|
||||
cffi==1.15.0; implementation_name == "pypy" and python_version >= "3.6"
|
||||
certifi==2021.10.8; python_full_version >= "3.7.1" and python_version >= "3.8" and python_version < "4.0" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
cffi==1.15.0; implementation_name == "pypy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
cfgv==3.3.1; python_full_version >= "3.6.1"
|
||||
charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
charset-normalizer==2.0.12; python_full_version >= "3.7.1" and python_version >= "3.8" and python_version < "4.0" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
click==8.0.4; python_version >= "3.8" and python_full_version >= "3.6.2"
|
||||
codespell==2.1.0; python_version >= "3.5"
|
||||
colorama==0.4.4; python_full_version >= "3.6.2" and python_full_version < "4.0.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and (python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.5.0") and sys_platform == "win32" and (python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0") and (python_version >= "3.7" and python_full_version < "3.0.0" and platform_system == "Windows" or platform_system == "Windows" and python_version >= "3.7" and python_full_version >= "3.5.0") and (python_version >= "2.7" and python_full_version < "3.0.0" and platform_system == "Windows" or python_full_version >= "3.5.0" and platform_system == "Windows") and (python_version >= "3.6" and python_full_version < "3.0.0" and platform_system == "Windows" or platform_system == "Windows" and python_version >= "3.6" and python_full_version >= "3.5.0") and (python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.5.0")
|
||||
colorama==0.4.4; python_full_version >= "3.6.2" and python_full_version < "4.0.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and (python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.5.0") and sys_platform == "win32" and (python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0") and (python_version >= "3.7" and python_full_version < "3.0.0" and platform_system == "Windows" or platform_system == "Windows" and python_version >= "3.7" and python_full_version >= "3.5.0") and (python_version >= "3.6" and python_full_version < "3.0.0" and platform_system == "Windows" or python_full_version >= "3.5.0" and platform_system == "Windows" and python_version >= "3.6") and platform_system == "Windows" and python_version >= "3.6" and (python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.5.0")
|
||||
commonmark==0.9.1; python_full_version >= "3.6.2" and python_full_version < "4.0.0"
|
||||
convertdate==2.4.0; python_version >= "3.7" and python_version < "4"
|
||||
coverage==6.3.2; python_version >= "3.7"
|
||||
@@ -54,7 +55,7 @@ distlib==0.3.4; python_full_version >= "3.6.1"
|
||||
dnspython==2.2.0; python_version >= "3.6" and python_version < "4.0"
|
||||
docutils==0.16; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
|
||||
ecos==2.0.10; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
entrypoints==0.4; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
entrypoints==0.4; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
et-xmlfile==1.1.0; python_version >= "3.6"
|
||||
exchange-calendars==3.6; python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
executing==0.8.2; python_version >= "3.8"
|
||||
@@ -68,6 +69,7 @@ finvizfinance==0.9.10; python_version >= "3.5"
|
||||
flake8==3.9.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
|
||||
flatbuffers==2.0
|
||||
fonttools==4.29.1; python_version >= "3.7"
|
||||
formulaic==0.2.4; python_version >= "3.7"
|
||||
fred==3.1
|
||||
fredapi==0.4.3
|
||||
frozendict==2.3.0; python_version >= "3.6"
|
||||
@@ -85,27 +87,28 @@ h5py==3.6.0; python_version >= "3.7"
|
||||
hijri-converter==2.2.3; python_version >= "3.6"
|
||||
holidays==0.11.3.1; python_version >= "3.6"
|
||||
identify==2.4.11; python_version >= "3.7" and python_full_version >= "3.6.1"
|
||||
idna==3.3; python_full_version >= "3.6.2" and python_version >= "3.7"
|
||||
idna==3.3; python_full_version >= "3.7.1" and python_version >= "3.8" and python_version < "4.0" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
imagesize==1.3.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
|
||||
importlib-metadata==4.11.1; python_version < "3.10" and python_version >= "3.7"
|
||||
inflection==0.5.1; python_version >= "3.6"
|
||||
iniconfig==1.1.1; python_version >= "3.7"
|
||||
interface-meta==1.2.4; python_version >= "3.7"
|
||||
investpy==1.0.8; python_version >= "3.7"
|
||||
ipykernel==6.9.1; python_version >= "3.7"
|
||||
ipympl==0.8.8
|
||||
ipython-genutils==0.2.0; python_version >= "3.7"
|
||||
ipython-genutils==0.2.0; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
ipython==8.0.1; python_version >= "3.8"
|
||||
ipywidgets==7.6.5
|
||||
iso8601==0.1.16
|
||||
isort==5.10.1; python_full_version >= "3.6.2" and python_version < "4.0"
|
||||
jedi==0.18.1; python_version >= "3.8"
|
||||
jinja2==3.0.3; python_version >= "3.7"
|
||||
joblib==1.1.0; python_version >= "3.7"
|
||||
json5==0.9.6; python_version >= "3.6"
|
||||
joblib==1.1.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
json5==0.9.6; python_version >= "3.7"
|
||||
jsonschema==3.2.0
|
||||
jupyter-client==7.1.2; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
jupyter-console==6.4.0; python_version >= "3.6"
|
||||
jupyter-core==4.9.2; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
jupyter-core==4.9.2; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
jupyter-server==1.13.5; python_version >= "3.7"
|
||||
jupyter==1.0.0
|
||||
jupyterlab-pygments==0.1.2; python_version >= "3.7"
|
||||
@@ -118,6 +121,7 @@ kiwisolver==1.3.2; python_version >= "3.7"
|
||||
korean-lunar-calendar==0.2.1; python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
lazy-object-proxy==1.7.1; python_version >= "3.6" and python_full_version >= "3.6.2"
|
||||
libclang==11.1.0
|
||||
linearmodels==4.25; python_version >= "3.7"
|
||||
lxml==4.8.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
m2r2==0.2.8; python_version >= "3.7"
|
||||
markdown-it-py==1.1.0; python_version >= "3.6" and python_version < "4.0"
|
||||
@@ -173,20 +177,22 @@ prawcore==2.3.0; python_version >= "3.6" and python_version < "4.0"
|
||||
pre-commit==2.17.0; python_full_version >= "3.6.1"
|
||||
prometheus-client==0.13.1; python_version >= "3.7"
|
||||
prompt-toolkit==3.0.28; python_full_version >= "3.6.2"
|
||||
property-cached==1.6.4; python_version >= "3.7"
|
||||
protobuf==3.19.4; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
psaw==0.0.12; python_version >= "3"
|
||||
ptyprocess==0.7.0; os_name != "nt" and python_version >= "3.8" and sys_platform != "win32"
|
||||
pure-eval==0.2.2; python_version >= "3.8"
|
||||
py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" and implementation_name == "pypy" or python_full_version >= "3.5.0" and python_version >= "3.7" and implementation_name == "pypy"
|
||||
py==1.11.0; python_full_version >= "3.7.0" and python_version >= "3.7" and implementation_name == "pypy"
|
||||
pyally==1.1.2
|
||||
pyasn1-modules==0.2.8; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
pyasn1==0.4.8; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") or python_full_version >= "3.6.0" and python_version >= "3.6" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
|
||||
pycodestyle==2.7.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
|
||||
pycoingecko==2.2.0
|
||||
pycparser==2.21; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
pycparser==2.21; implementation_name == "pypy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
pyex==0.5.0
|
||||
pyflakes==2.3.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
|
||||
pygments==2.11.2; python_version >= "3.5"
|
||||
pyhdfe==0.1.0; python_version >= "3.7"
|
||||
pylint==2.12.2; python_full_version >= "3.6.2"
|
||||
pyluach==1.4.0; python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
pymeeus==0.5.11; python_version >= "3.7" and python_version < "4"
|
||||
@@ -204,16 +210,16 @@ pytest-recording==0.12.0; python_version >= "3.5"
|
||||
pytest==6.2.5; python_version >= "3.6"
|
||||
python-binance==1.0.15
|
||||
python-coinmarketcap==0.2
|
||||
python-dateutil==2.8.2; python_full_version >= "3.7.1" and python_version >= "3.7" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5")
|
||||
python-dateutil==2.8.2; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5")
|
||||
python-dotenv==0.19.2; python_version >= "3.5"
|
||||
pytrends==4.8.0
|
||||
pytz-deprecation-shim==0.1.0.post0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
pytz==2021.3; python_full_version >= "3.7.1" and python_version >= "3.7" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7")
|
||||
pytz==2021.3; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7")
|
||||
pyupgrade==2.31.0; python_full_version >= "3.6.1"
|
||||
pywin32==303; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.6"
|
||||
pywin32==303; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
pywinpty==1.1.6; os_name == "nt" and python_version >= "3.7"
|
||||
pyyaml==6.0; python_version >= "3.7" and python_full_version >= "3.6.1"
|
||||
pyzmq==22.3.0; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
pyzmq==22.3.0; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
qdldl==0.1.5.post0; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
qtconsole==5.2.2; python_version >= "3.6"
|
||||
qtpy==2.0.1; python_version >= "3.6"
|
||||
@@ -227,7 +233,7 @@ rich==10.16.2; python_full_version >= "3.6.2" and python_full_version < "4.0.0"
|
||||
robin-stocks==2.1.0; python_version >= "3"
|
||||
rsa==4.8; python_version >= "3.6" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
|
||||
scikit-learn==1.0.2; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
scipy==1.8.0; python_version >= "3.8" and python_version < "3.11" and python_full_version >= "3.6.1" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
|
||||
scipy==1.8.0; python_version >= "3.8" and python_version < "3.11" and python_full_version >= "3.6.1" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
screeninfo==0.6.7
|
||||
scs==3.2.0; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
seaborn==0.11.2; python_version >= "3.6"
|
||||
@@ -235,7 +241,7 @@ selenium==3.141.0
|
||||
send2trash==1.8.0; python_version >= "3.7"
|
||||
sentiment-investor==2.1.0; python_version >= "3.8" and python_version < "4.0"
|
||||
setuptools-scm==6.4.2; python_version >= "3.7"
|
||||
six==1.16.0; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") and (python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8")
|
||||
six==1.16.0; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") and (python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8")
|
||||
smmap==5.0.0; python_version >= "3.7"
|
||||
sniffio==1.2.0; python_full_version >= "3.6.2" and python_version >= "3.7"
|
||||
snowballstemmer==2.2.0; python_version >= "3.7"
|
||||
@@ -268,12 +274,12 @@ testpath==0.5.0; python_version >= "3.7"
|
||||
textwrap3==0.9.2; python_version >= "3.6"
|
||||
tf-estimator-nightly==2.8.0.dev2021122109
|
||||
thepassiveinvestor==1.0.10
|
||||
threadpoolctl==3.1.0; python_version >= "3.7"
|
||||
threadpoolctl==3.1.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
tokenize-rt==4.2.1; python_full_version >= "3.6.1"
|
||||
toml==0.10.2; python_full_version >= "3.6.2" and python_version >= "3.6" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7")
|
||||
tomli==1.2.3; python_version >= "3.8" and python_full_version >= "3.6.2"
|
||||
toolz==0.11.2; python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
tornado==6.1; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
tornado==6.1; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
tqdm==4.62.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
tradingview-ta==3.2.10; python_version >= "3.6"
|
||||
traitlets==5.1.1; python_full_version >= "3.7.0" and python_version >= "3.8"
|
||||
@@ -289,20 +295,20 @@ tzlocal==4.1; python_version >= "3.6"
|
||||
ujson==5.1.0; python_version >= "3.7"
|
||||
unidecode==1.3.3; python_version >= "3.7"
|
||||
update-checker==0.18.0; python_version >= "3.6" and python_version < "4.0"
|
||||
urllib3==1.26.8; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
|
||||
urllib3==1.26.8; python_full_version >= "3.7.1" and python_version < "4" and python_version >= "3.8" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
user-agent==0.1.10
|
||||
vadersentiment==3.3.2
|
||||
valinvest==0.0.2; python_version >= "3.6"
|
||||
vcrpy==4.1.1; python_version >= "3.5"
|
||||
virtualenv==20.13.1; python_full_version >= "3.6.1"
|
||||
voila==0.3.2; python_version >= "3.7"
|
||||
wcwidth==0.2.5; python_full_version >= "3.6.2" and python_version >= "3.6"
|
||||
wcwidth==0.2.5; python_full_version >= "3.6.2" and python_version >= "3.8"
|
||||
webencodings==0.5.1; python_version >= "3.7"
|
||||
websocket-client==1.2.3; python_version >= "3.8" and python_version < "4.0"
|
||||
websockets==9.1; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
werkzeug==2.0.3; python_version >= "3.6"
|
||||
widgetsnbextension==3.5.2
|
||||
wrapt==1.13.3; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5")
|
||||
wrapt==1.13.3; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7")
|
||||
yarl==1.7.2; python_version >= "3.6"
|
||||
yfinance==0.1.70
|
||||
zipp==3.7.0; python_version < "3.10" and python_version >= "3.7"
|
||||
|
||||
58
requirements.txt
vendored
58
requirements.txt
vendored
@@ -6,26 +6,27 @@ ansiwrap==0.8.4; python_version >= "3.6"
|
||||
anyio==3.5.0; python_full_version >= "3.6.2" and python_version >= "3.7"
|
||||
appdirs==1.4.4; python_full_version >= "3.6.2" and python_version >= "3.8"
|
||||
appnope==0.1.2; platform_system == "Darwin" and python_version >= "3.8" and sys_platform == "darwin"
|
||||
argon2-cffi-bindings==21.2.0; python_version >= "3.6"
|
||||
argon2-cffi-bindings==21.2.0; python_version >= "3.7"
|
||||
argon2-cffi==21.3.0; python_version >= "3.7"
|
||||
ascii-magic==1.6; python_version >= "3.5"
|
||||
astor==0.8.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
|
||||
asttokens==2.0.5; python_version >= "3.8"
|
||||
async-timeout==4.0.2; python_version >= "3.6"
|
||||
attrs==21.4.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
attrs==21.4.0; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
babel==2.9.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
|
||||
backcall==0.2.0; python_version >= "3.8"
|
||||
backports.zoneinfo==0.2.1; python_version < "3.9" and python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
|
||||
beartype==0.7.1; python_version >= "3.8" and python_version < "4.0" and python_full_version >= "3.6.0"
|
||||
beautifulsoup4==4.10.0; python_full_version > "3.0.0" and python_version >= "3.5"
|
||||
beautifulsoup4==4.10.0; python_full_version > "3.0.0" and python_version >= "3.7"
|
||||
black==21.7b0; python_full_version >= "3.6.2"
|
||||
bleach==4.1.0; python_version >= "3.7"
|
||||
bs4==0.0.1
|
||||
bt==0.2.9; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0")
|
||||
certifi==2021.10.8; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0"
|
||||
cffi==1.15.0; implementation_name == "pypy" and python_version >= "3.6"
|
||||
charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
certifi==2021.10.8; python_full_version >= "3.7.1" and python_version >= "3.8" and python_version < "4.0" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
cffi==1.15.0; implementation_name == "pypy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
charset-normalizer==2.0.12; python_full_version >= "3.7.1" and python_version >= "3.8" and python_version < "4.0" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
click==8.0.4; python_version >= "3.8" and python_full_version >= "3.6.2"
|
||||
colorama==0.4.4; python_full_version >= "3.6.2" and python_full_version < "4.0.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and (python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0") and (python_version >= "2.7" and python_full_version < "3.0.0" and platform_system == "Windows" or python_full_version >= "3.5.0" and platform_system == "Windows") and (python_version >= "3.6" and python_full_version < "3.0.0" and platform_system == "Windows" or platform_system == "Windows" and python_version >= "3.6" and python_full_version >= "3.5.0") and (python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.5.0")
|
||||
colorama==0.4.4; python_full_version >= "3.6.2" and python_full_version < "4.0.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and (python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0") and (python_version >= "3.6" and python_full_version < "3.0.0" and platform_system == "Windows" or python_full_version >= "3.5.0" and platform_system == "Windows" and python_version >= "3.6") and platform_system == "Windows" and python_version >= "3.6" and (python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.5.0")
|
||||
commonmark==0.9.1; python_full_version >= "3.6.2" and python_full_version < "4.0.0"
|
||||
convertdate==2.4.0; python_version >= "3.7" and python_version < "4"
|
||||
cryptography==36.0.1; python_version >= "3.6"
|
||||
@@ -44,7 +45,7 @@ detecta==0.0.5; python_version >= "3.6"
|
||||
dnspython==2.2.0; python_version >= "3.6" and python_version < "4.0"
|
||||
docutils==0.16; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
|
||||
ecos==2.0.10; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
entrypoints==0.4; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
entrypoints==0.4; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
et-xmlfile==1.1.0; python_version >= "3.6"
|
||||
executing==0.8.2; python_version >= "3.8"
|
||||
fear-greed-index==0.1.4; python_version >= "3.7"
|
||||
@@ -54,6 +55,7 @@ finnhub-python==2.4.10
|
||||
finviz==1.4.3
|
||||
finvizfinance==0.9.10; python_version >= "3.5"
|
||||
fonttools==4.29.1; python_version >= "3.7"
|
||||
formulaic==0.2.4; python_version >= "3.7"
|
||||
fred==3.1
|
||||
fredapi==0.4.3
|
||||
frozendict==2.3.0; python_version >= "3.6"
|
||||
@@ -65,24 +67,25 @@ gitpython==3.1.27; python_version >= "3.7"
|
||||
grpcio==1.44.0; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
hijri-converter==2.2.3; python_version >= "3.6"
|
||||
holidays==0.11.3.1; python_version >= "3.6"
|
||||
idna==3.3; python_full_version >= "3.6.2" and python_version >= "3.7"
|
||||
idna==3.3; python_full_version >= "3.7.1" and python_version >= "3.8" and python_version < "4.0" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
imagesize==1.3.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
|
||||
inflection==0.5.1; python_version >= "3.6"
|
||||
interface-meta==1.2.4; python_version >= "3.7"
|
||||
investpy==1.0.8; python_version >= "3.7"
|
||||
ipykernel==6.9.1; python_version >= "3.7"
|
||||
ipympl==0.8.8
|
||||
ipython-genutils==0.2.0; python_version >= "3.7"
|
||||
ipython-genutils==0.2.0; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
ipython==8.0.1; python_version >= "3.8"
|
||||
ipywidgets==7.6.5
|
||||
iso8601==0.1.16
|
||||
jedi==0.18.1; python_version >= "3.8"
|
||||
jinja2==3.0.3; python_version >= "3.7"
|
||||
joblib==1.1.0; python_version >= "3.7"
|
||||
json5==0.9.6; python_version >= "3.6"
|
||||
joblib==1.1.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
json5==0.9.6; python_version >= "3.7"
|
||||
jsonschema==3.2.0
|
||||
jupyter-client==7.1.2; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
jupyter-console==6.4.0; python_version >= "3.6"
|
||||
jupyter-core==4.9.2; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
jupyter-core==4.9.2; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
jupyter-server==1.13.5; python_version >= "3.7"
|
||||
jupyter==1.0.0
|
||||
jupyterlab-pygments==0.1.2; python_version >= "3.7"
|
||||
@@ -91,6 +94,7 @@ jupyterlab-widgets==1.0.2; python_version >= "3.6"
|
||||
jupyterlab==3.2.9; python_version >= "3.6"
|
||||
kiwisolver==1.3.2; python_version >= "3.7"
|
||||
korean-lunar-calendar==0.2.1; python_version >= "3.6"
|
||||
linearmodels==4.25; python_version >= "3.7"
|
||||
lxml==4.8.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
m2r2==0.2.8; python_version >= "3.7"
|
||||
markupsafe==2.1.0; python_version >= "3.7"
|
||||
@@ -133,16 +137,18 @@ praw==7.5.0; python_version >= "3.6" and python_version < "4.0"
|
||||
prawcore==2.3.0; python_version >= "3.6" and python_version < "4.0"
|
||||
prometheus-client==0.13.1; python_version >= "3.7"
|
||||
prompt-toolkit==3.0.28; python_full_version >= "3.6.2"
|
||||
property-cached==1.6.4; python_version >= "3.7"
|
||||
protobuf==3.19.4; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and python_version >= "3.5"
|
||||
psaw==0.0.12; python_version >= "3"
|
||||
ptyprocess==0.7.0; os_name != "nt" and python_version >= "3.8" and sys_platform != "win32"
|
||||
pure-eval==0.2.2; python_version >= "3.8"
|
||||
py==1.11.0; python_version >= "3.6" and python_full_version < "3.0.0" and implementation_name == "pypy" or implementation_name == "pypy" and python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
py==1.11.0; implementation_name == "pypy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
pyally==1.1.2
|
||||
pycoingecko==2.2.0
|
||||
pycparser==2.21; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
pycparser==2.21; implementation_name == "pypy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
pyex==0.5.0
|
||||
pygments==2.11.2; python_version >= "3.5"
|
||||
pyhdfe==0.1.0; python_version >= "3.7"
|
||||
pymeeus==0.5.11; python_version >= "3.7" and python_version < "4"
|
||||
pymongo==3.11.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
|
||||
pyobjc-core==8.2; python_version >= "3.6" and sys_platform == "darwin"
|
||||
@@ -154,15 +160,15 @@ pyprind==2.11.3; python_version >= "2.7" and python_full_version < "3.0.0" or py
|
||||
pyrsistent==0.18.1; python_version >= "3.7"
|
||||
python-binance==1.0.15
|
||||
python-coinmarketcap==0.2
|
||||
python-dateutil==2.8.2; python_full_version >= "3.7.1" and python_version >= "3.7" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5")
|
||||
python-dateutil==2.8.2; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5")
|
||||
python-dotenv==0.19.2; python_version >= "3.5"
|
||||
pytrends==4.8.0
|
||||
pytz-deprecation-shim==0.1.0.post0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
pytz==2021.3; python_full_version >= "3.7.1" and python_version >= "3.7" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7")
|
||||
pywin32==303; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.6"
|
||||
pytz==2021.3; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7")
|
||||
pywin32==303; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.7" and python_full_version >= "3.7.0"
|
||||
pywinpty==1.1.6; os_name == "nt" and python_version >= "3.7"
|
||||
pyyaml==6.0; python_version >= "3.6"
|
||||
pyzmq==22.3.0; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
pyzmq==22.3.0; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
qdldl==0.1.5.post0; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
qtconsole==5.2.2; python_version >= "3.6"
|
||||
qtpy==2.0.1; python_version >= "3.6"
|
||||
@@ -175,7 +181,7 @@ requests==2.27.1; (python_version >= "2.7" and python_full_version < "3.0.0") or
|
||||
rich==10.16.2; python_full_version >= "3.6.2" and python_full_version < "4.0.0"
|
||||
robin-stocks==2.1.0; python_version >= "3"
|
||||
scikit-learn==1.0.2; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
scipy==1.8.0; python_version >= "3.8" and python_version < "3.11" and python_full_version >= "3.6.1" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
|
||||
scipy==1.8.0; python_version >= "3.8" and python_version < "3.11" and python_full_version >= "3.6.1" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
screeninfo==0.6.7
|
||||
scs==3.2.0; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
|
||||
seaborn==0.11.2; python_version >= "3.6"
|
||||
@@ -183,7 +189,7 @@ selenium==3.141.0
|
||||
send2trash==1.8.0; python_version >= "3.7"
|
||||
sentiment-investor==2.1.0; python_version >= "3.8" and python_version < "4.0"
|
||||
setuptools-scm==6.4.2; python_version >= "3.7"
|
||||
six==1.16.0; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8")
|
||||
six==1.16.0; python_full_version >= "3.7.1" and python_version >= "3.7" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8")
|
||||
smmap==5.0.0; python_version >= "3.7"
|
||||
sniffio==1.2.0; python_full_version >= "3.6.2" and python_version >= "3.7"
|
||||
snowballstemmer==2.2.0; python_version >= "3.7"
|
||||
@@ -208,9 +214,9 @@ terminado==0.13.1; python_version >= "3.7"
|
||||
testpath==0.5.0; python_version >= "3.7"
|
||||
textwrap3==0.9.2; python_version >= "3.6"
|
||||
thepassiveinvestor==1.0.10
|
||||
threadpoolctl==3.1.0; python_version >= "3.7"
|
||||
threadpoolctl==3.1.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
|
||||
tomli==1.2.3; python_version >= "3.8" and python_full_version >= "3.6.2"
|
||||
tornado==6.1; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
tornado==6.1; python_full_version >= "3.7.0" and python_version >= "3.7"
|
||||
tqdm==4.62.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
tradingview-ta==3.2.10; python_version >= "3.6"
|
||||
traitlets==5.1.1; python_full_version >= "3.7.0" and python_version >= "3.8"
|
||||
@@ -220,17 +226,17 @@ tzlocal==4.1; python_version >= "3.6"
|
||||
ujson==5.1.0; python_version >= "3.7"
|
||||
unidecode==1.3.3; python_version >= "3.7"
|
||||
update-checker==0.18.0; python_version >= "3.6" and python_version < "4.0"
|
||||
urllib3==1.26.8; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
|
||||
urllib3==1.26.8; python_full_version >= "3.7.1" and python_version < "4" and python_version >= "3.8" and python_full_version < "4.0.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7")
|
||||
user-agent==0.1.10
|
||||
vadersentiment==3.3.2
|
||||
valinvest==0.0.2; python_version >= "3.6"
|
||||
voila==0.3.2; python_version >= "3.7"
|
||||
wcwidth==0.2.5; python_full_version >= "3.6.2" and python_version >= "3.6"
|
||||
wcwidth==0.2.5; python_full_version >= "3.6.2" and python_version >= "3.8"
|
||||
webencodings==0.5.1; python_version >= "3.7"
|
||||
websocket-client==1.2.3; python_version >= "3.8" and python_version < "4.0"
|
||||
websockets==9.1; python_full_version >= "3.6.1" and python_version >= "3.7"
|
||||
widgetsnbextension==3.5.2
|
||||
wrapt==1.13.3; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
|
||||
wrapt==1.13.3; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7")
|
||||
yarl==1.7.2; python_version >= "3.6"
|
||||
yfinance==0.1.70
|
||||
zope.interface==5.4.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
|
||||
|
||||
30
scripts/test_econometrics_panel.gst
vendored
Normal file
30
scripts/test_econometrics_panel.gst
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
econometrics
|
||||
load wage_panel wp
|
||||
options
|
||||
options wp
|
||||
show wp
|
||||
index wp nr year
|
||||
clean wp -f cfill
|
||||
clean wp -d rdrop
|
||||
type
|
||||
type year-wp category
|
||||
desc wp
|
||||
modify -a dummy_married_educ-wp married-wp * educ-wp
|
||||
modify -d married-wp
|
||||
load wage_panel wp2
|
||||
index wp2 nr year
|
||||
modify -c wp married-wp2
|
||||
modify -r wp married_wp2 married
|
||||
remove wp2
|
||||
panel lwage-wp black-wp hisp-wp exper-wp expersq-wp married-wp educ-wp union-wp year-wp
|
||||
panel lwage-wp black-wp hisp-wp exper-wp married-wp educ-wp union-wp -t bols
|
||||
panel lwage-wp black-wp hisp-wp exper-wp expersq-wp married-wp educ-wp union-wp year-wp -t re
|
||||
panel lwage-wp expersq-wp union-wp married-wp year-wp -t fe
|
||||
panel lwage-wp expersq-wp union-wp married-wp year-wp -t fe -ee
|
||||
panel lwage-wp expersq-wp union-wp married-wp -t fe -te
|
||||
panel lwage-wp expersq-wp union-wp married-wp -t fe -te -ee
|
||||
panel lwage-wp exper-wp expersq-wp union-wp married-wp -t fdols
|
||||
dwat -p
|
||||
bgod
|
||||
granger married-wp educ-wp
|
||||
coint black-wp hisp-wp exper-wp expersq-wp married-wp educ-wp union-wp
|
||||
26
scripts/test_econometrics_ts.gst
vendored
Normal file
26
scripts/test_econometrics_ts.gst
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
econometrics
|
||||
load longley ll
|
||||
load longley ll2
|
||||
options
|
||||
options ll
|
||||
show ll
|
||||
index ll year
|
||||
plot pop-ll
|
||||
clean ll -f cfill
|
||||
clean ll -d rdrop
|
||||
type
|
||||
type year-ll category
|
||||
desc ll
|
||||
modify -a emp_ratio-ll totemp-ll div pop-ll
|
||||
modify -d totemp-ll
|
||||
index ll2 year
|
||||
modify -c ll totemp-ll2
|
||||
modify -r ll totemp_ll2 totemp
|
||||
remove ll2
|
||||
ols totemp-ll gnpdefl-ll gnp-ll unemp-ll armed-ll pop-ll year-ll
|
||||
norm totemp-ll
|
||||
root unemp-ll
|
||||
dwat -p
|
||||
bgod
|
||||
granger gnp-ll pop-ll
|
||||
coint totemp-ll gnpdefl-ll gnp-ll unemp-ll armed-ll pop-ll year-ll
|
||||
14
terminal.py
14
terminal.py
@@ -61,7 +61,7 @@ class TerminalController(BaseController):
|
||||
"jupyter",
|
||||
"funds",
|
||||
"alternative",
|
||||
"custom",
|
||||
"econometrics",
|
||||
]
|
||||
|
||||
PATH = "/"
|
||||
@@ -122,7 +122,7 @@ class TerminalController(BaseController):
|
||||
> alternative
|
||||
> portfolio
|
||||
> jupyter
|
||||
> custom[/menu]
|
||||
> econometrics[/menu]
|
||||
""",
|
||||
menu="Home",
|
||||
)
|
||||
@@ -199,13 +199,13 @@ class TerminalController(BaseController):
|
||||
|
||||
self.queue = self.load_class(AlternativeDataController, self.queue)
|
||||
|
||||
def call_custom(self, _):
|
||||
"""Process custom command"""
|
||||
from gamestonk_terminal.custom.custom_controller import (
|
||||
CustomDataController,
|
||||
def call_econometrics(self, _):
|
||||
"""Process econometrics command"""
|
||||
from gamestonk_terminal.econometrics.econometrics_controller import (
|
||||
EconometricsController,
|
||||
)
|
||||
|
||||
self.queue = CustomDataController(self.queue).menu()
|
||||
self.queue = EconometricsController(self.queue).menu()
|
||||
|
||||
def call_portfolio(self, _):
|
||||
"""Process portfolio command"""
|
||||
|
||||
32
tests/FIXTURES.md
vendored
32
tests/FIXTURES.md
vendored
@@ -351,4 +351,34 @@ def test_function(recorder):
|
||||
|
||||
recorder.record_mode = "rewrite"
|
||||
recorder.capture(some_text)
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
**EXTRA ARGUMENTS - PD.TO_CSV**
|
||||
If you capture a DataFrame it will be exported as a CSV using the function `pandas.DataFrame.to_csv`.
|
||||
|
||||
This function contains arguments that can be useful to the test builder.
|
||||
|
||||
Everything you pass as extra `kwargs` to the `capture` function will be passed to this `to_csv` function.
|
||||
|
||||
Example :
|
||||
```python
|
||||
import random
|
||||
|
||||
def test_function(recorder):
|
||||
table_of_floats = pd.DataFrame(
|
||||
np.random.uniform(low=1, high=10, size=(5,)),
|
||||
columns=["numbers"],
|
||||
)
|
||||
|
||||
recorder.capture(table_of_floats, float_format="%.2f")
|
||||
# This will truncate the numbers
|
||||
```
|
||||
|
||||
|
||||
**EXTRA ARGUMENTS - JSON.DUMPS**
|
||||
If you capture a TUPLE, LIST, DICT... it will be exported as a json using the function `json.dumps`.
|
||||
|
||||
This function contains arguments that can be useful to the test builder.
|
||||
|
||||
Everything you pass as extra `kwargs` to the `capture` function will be passed to this `dumps` function.
|
||||
|
||||
@@ -33,7 +33,7 @@ EXTENSIONS_MATCHING: Dict[str, List[Type]] = {
|
||||
|
||||
class Record:
|
||||
@staticmethod
|
||||
def extract_string(data: Any) -> str:
|
||||
def extract_string(data: Any, **kwargs) -> str:
|
||||
if isinstance(data, tuple(EXTENSIONS_MATCHING["txt"])):
|
||||
string_value = data
|
||||
elif isinstance(data, tuple(EXTENSIONS_MATCHING["csv"])):
|
||||
@@ -41,9 +41,10 @@ class Record:
|
||||
encoding="utf-8",
|
||||
line_terminator="\n",
|
||||
# date_format="%Y-%m-%d %H:%M:%S",
|
||||
**kwargs,
|
||||
)
|
||||
elif isinstance(data, tuple(EXTENSIONS_MATCHING["json"])):
|
||||
string_value = json.dumps(data)
|
||||
string_value = json.dumps(data, **kwargs)
|
||||
else:
|
||||
raise AttributeError(f"Unsupported type : {type(data)}")
|
||||
|
||||
@@ -99,8 +100,9 @@ class Record:
|
||||
captured: Any,
|
||||
record_path: str,
|
||||
strip: bool = False,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
self.__captured = self.extract_string(data=captured)
|
||||
self.__captured = self.extract_string(data=captured, **kwargs)
|
||||
self.__record_path = record_path
|
||||
self.__strip = strip
|
||||
|
||||
@@ -201,7 +203,7 @@ class Recorder:
|
||||
|
||||
self.__record_list: List[Record] = list()
|
||||
|
||||
def capture(self, captured: Any, strip: bool = False):
|
||||
def capture(self, captured: Any, strip: bool = False, **kwargs):
|
||||
record_list = self.__record_list
|
||||
record_path = self.__path_template.build_path_by_data(
|
||||
data=captured,
|
||||
@@ -211,6 +213,7 @@ class Recorder:
|
||||
captured=captured,
|
||||
record_path=record_path,
|
||||
strip=strip,
|
||||
**kwargs,
|
||||
)
|
||||
self.__record_list.append(record)
|
||||
|
||||
|
||||
0
tests/gamestonk_terminal/econometrics/__init__.py
Normal file
0
tests/gamestonk_terminal/econometrics/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,17 @@
|
||||
,TOTEMP,GNPDEFL,GNP,UNEMP,ARMED,POP,YEAR
|
||||
0,60323.0,83.0,234289.0,2356.0,1590.0,107608.0,1947.0
|
||||
1,61122.0,88.5,259426.0,2325.0,1456.0,108632.0,1948.0
|
||||
2,60171.0,88.2,258054.0,3682.0,1616.0,109773.0,1949.0
|
||||
3,61187.0,89.5,284599.0,3351.0,1650.0,110929.0,1950.0
|
||||
4,63221.0,96.2,328975.0,2099.0,3099.0,112075.0,1951.0
|
||||
5,63639.0,98.1,346999.0,1932.0,3594.0,113270.0,1952.0
|
||||
6,64989.0,99.0,365385.0,1870.0,3547.0,115094.0,1953.0
|
||||
7,63761.0,100.0,363112.0,3578.0,3350.0,116219.0,1954.0
|
||||
8,66019.0,101.2,397469.0,2904.0,3048.0,117388.0,1955.0
|
||||
9,67857.0,104.6,419180.0,2822.0,2857.0,118734.0,1956.0
|
||||
10,68169.0,108.4,442769.0,2936.0,2798.0,120445.0,1957.0
|
||||
11,66513.0,110.8,444546.0,4681.0,2637.0,121950.0,1958.0
|
||||
12,68655.0,112.6,482704.0,3813.0,2552.0,123366.0,1959.0
|
||||
13,69564.0,114.2,502601.0,3931.0,2514.0,125368.0,1960.0
|
||||
14,69331.0,115.7,518173.0,4806.0,2572.0,127852.0,1961.0
|
||||
15,70551.0,116.9,554894.0,4007.0,2827.0,130081.0,1962.0
|
||||
|
@@ -0,0 +1,6 @@
|
||||
,0
|
||||
0,-0.00313
|
||||
1,0.15451
|
||||
2,-1.28840
|
||||
3,-13.12366
|
||||
4,0.00000
|
||||
|
@@ -0,0 +1,108 @@
|
||||
,0
|
||||
0,-0.01283
|
||||
1,0.00917
|
||||
2,0.01449
|
||||
3,0.00596
|
||||
4,-0.01234
|
||||
5,0.00481
|
||||
6,0.02672
|
||||
7,-0.01485
|
||||
8,-0.00099
|
||||
9,0.01034
|
||||
10,0.03060
|
||||
11,-0.02100
|
||||
12,-0.00427
|
||||
13,-0.00161
|
||||
14,0.02876
|
||||
15,-0.02854
|
||||
16,-0.00238
|
||||
17,0.00869
|
||||
18,0.01547
|
||||
19,-0.02213
|
||||
20,0.00424
|
||||
21,0.00426
|
||||
22,0.02932
|
||||
23,-0.02129
|
||||
24,0.00387
|
||||
25,0.01130
|
||||
26,0.01862
|
||||
27,-0.02491
|
||||
28,-0.00573
|
||||
29,0.01672
|
||||
30,0.02227
|
||||
31,-0.02483
|
||||
32,0.00340
|
||||
33,0.00545
|
||||
34,0.02028
|
||||
35,-0.03373
|
||||
36,-0.00358
|
||||
37,0.00377
|
||||
38,0.02833
|
||||
39,-0.03186
|
||||
40,-0.00728
|
||||
41,0.01109
|
||||
42,0.02348
|
||||
43,-0.02848
|
||||
44,-0.01272
|
||||
45,0.00943
|
||||
46,0.02485
|
||||
47,-0.03530
|
||||
48,-0.01459
|
||||
49,0.00446
|
||||
50,0.02974
|
||||
51,-0.03797
|
||||
52,-0.01030
|
||||
53,0.01047
|
||||
54,0.03057
|
||||
55,-0.02662
|
||||
56,-0.00524
|
||||
57,0.00674
|
||||
58,0.02832
|
||||
59,-0.02757
|
||||
60,-0.00740
|
||||
61,-0.00472
|
||||
62,0.03075
|
||||
63,-0.03078
|
||||
64,-0.00522
|
||||
65,-0.00209
|
||||
66,0.03187
|
||||
67,-0.02883
|
||||
68,-0.00838
|
||||
69,0.00197
|
||||
70,0.02843
|
||||
71,-0.02701
|
||||
72,-0.00881
|
||||
73,-0.00406
|
||||
74,0.01668
|
||||
75,-0.02424
|
||||
76,0.00649
|
||||
77,0.00400
|
||||
78,0.03269
|
||||
79,-0.02232
|
||||
80,-0.00058
|
||||
81,0.00837
|
||||
82,0.02220
|
||||
83,-0.01751
|
||||
84,0.00024
|
||||
85,-0.00162
|
||||
86,0.02554
|
||||
87,-0.02182
|
||||
88,-0.00673
|
||||
89,-0.00024
|
||||
90,0.02046
|
||||
91,-0.02622
|
||||
92,-0.00227
|
||||
93,0.00359
|
||||
94,0.01922
|
||||
95,-0.02435
|
||||
96,-0.01189
|
||||
97,0.00044
|
||||
98,0.01961
|
||||
99,-0.02050
|
||||
100,-0.01209
|
||||
101,-0.00087
|
||||
102,0.01949
|
||||
103,-0.01878
|
||||
104,-0.00618
|
||||
105,-0.00073
|
||||
106,0.02118
|
||||
|
@@ -0,0 +1,3 @@
|
||||
,Kurtosis,Skewness,Jarque-Bera,Shapiro-Wilk,Kolmogorov-Smirnov
|
||||
Statistic,1.47991,6.17020,52.21623,0.90912,0.97114
|
||||
p-value,0.13890,0.00000,0.00000,0.00000,0.00000
|
||||
|
@@ -0,0 +1,3 @@
|
||||
,Kurtosis,Skewness,Jarque-Bera,Shapiro-Wilk,Kolmogorov-Smirnov
|
||||
Statistic,3.80111,4.03782,60.66372,0.91086,0.78828
|
||||
p-value,0.00014,0.00005,0.00000,0.00000,0.00000
|
||||
|
@@ -0,0 +1,3 @@
|
||||
,Kurtosis,Skewness,Jarque-Bera,Shapiro-Wilk,Kolmogorov-Smirnov
|
||||
Statistic,3.55614,4.17188,68.87032,0.88711,1.00000
|
||||
p-value,0.00038,0.00003,0.00000,0.00004,0.00000
|
||||
|
6
tests/gamestonk_terminal/econometrics/csv/test_econometrics_model/test_get_root[df0-c-c].csv
vendored
Normal file
6
tests/gamestonk_terminal/econometrics/csv/test_econometrics_model/test_get_root[df0-c-c].csv
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
,ADF,KPSS
|
||||
Test Statistic,-2.83778,0.66987
|
||||
P-Value,0.05308,0.01628
|
||||
NLags,8.00000,7.00000
|
||||
Nobs,300.00000,0.00000
|
||||
ICBest,2430.50034,0.00000
|
||||
|
@@ -0,0 +1,6 @@
|
||||
,ADF,KPSS
|
||||
Test Statistic,-2.83778,0.11583
|
||||
P-Value,0.05308,0.10000
|
||||
NLags,8.00000,7.00000
|
||||
Nobs,300.00000,0.00000
|
||||
ICBest,2430.50034,0.00000
|
||||
|
@@ -0,0 +1,6 @@
|
||||
,ADF,KPSS
|
||||
Test Statistic,-2.92437,0.66987
|
||||
P-Value,0.15447,0.01628
|
||||
NLags,8.00000,7.00000
|
||||
Nobs,300.00000,0.00000
|
||||
ICBest,2431.97673,0.00000
|
||||
|
@@ -0,0 +1,6 @@
|
||||
,ADF,KPSS
|
||||
Test Statistic,-3.00490,0.66987
|
||||
P-Value,0.29285,0.01628
|
||||
NLags,8.00000,7.00000
|
||||
Nobs,300.00000,0.00000
|
||||
ICBest,2432.53846,0.00000
|
||||
|
@@ -0,0 +1,6 @@
|
||||
,ADF,KPSS
|
||||
Test Statistic,-0.75222,0.66987
|
||||
P-Value,0.39061,0.01628
|
||||
NLags,8.00000,7.00000
|
||||
Nobs,300.00000,0.00000
|
||||
ICBest,2436.91406,0.00000
|
||||
|
@@ -0,0 +1,310 @@
|
||||
,YEAR,SUNACTIVITY
|
||||
0,1700.0,5.0
|
||||
1,1701.0,11.0
|
||||
2,1702.0,16.0
|
||||
3,1703.0,23.0
|
||||
4,1704.0,36.0
|
||||
5,1705.0,58.0
|
||||
6,1706.0,29.0
|
||||
7,1707.0,20.0
|
||||
8,1708.0,10.0
|
||||
9,1709.0,8.0
|
||||
10,1710.0,3.0
|
||||
11,1711.0,0.0
|
||||
12,1712.0,0.0
|
||||
13,1713.0,2.0
|
||||
14,1714.0,11.0
|
||||
15,1715.0,27.0
|
||||
16,1716.0,47.0
|
||||
17,1717.0,63.0
|
||||
18,1718.0,60.0
|
||||
19,1719.0,39.0
|
||||
20,1720.0,28.0
|
||||
21,1721.0,26.0
|
||||
22,1722.0,22.0
|
||||
23,1723.0,11.0
|
||||
24,1724.0,21.0
|
||||
25,1725.0,40.0
|
||||
26,1726.0,78.0
|
||||
27,1727.0,122.0
|
||||
28,1728.0,103.0
|
||||
29,1729.0,73.0
|
||||
30,1730.0,47.0
|
||||
31,1731.0,35.0
|
||||
32,1732.0,11.0
|
||||
33,1733.0,5.0
|
||||
34,1734.0,16.0
|
||||
35,1735.0,34.0
|
||||
36,1736.0,70.0
|
||||
37,1737.0,81.0
|
||||
38,1738.0,111.0
|
||||
39,1739.0,101.0
|
||||
40,1740.0,73.0
|
||||
41,1741.0,40.0
|
||||
42,1742.0,20.0
|
||||
43,1743.0,16.0
|
||||
44,1744.0,5.0
|
||||
45,1745.0,11.0
|
||||
46,1746.0,22.0
|
||||
47,1747.0,40.0
|
||||
48,1748.0,60.0
|
||||
49,1749.0,80.9
|
||||
50,1750.0,83.4
|
||||
51,1751.0,47.7
|
||||
52,1752.0,47.8
|
||||
53,1753.0,30.7
|
||||
54,1754.0,12.2
|
||||
55,1755.0,9.6
|
||||
56,1756.0,10.2
|
||||
57,1757.0,32.4
|
||||
58,1758.0,47.6
|
||||
59,1759.0,54.0
|
||||
60,1760.0,62.9
|
||||
61,1761.0,85.9
|
||||
62,1762.0,61.2
|
||||
63,1763.0,45.1
|
||||
64,1764.0,36.4
|
||||
65,1765.0,20.9
|
||||
66,1766.0,11.4
|
||||
67,1767.0,37.8
|
||||
68,1768.0,69.8
|
||||
69,1769.0,106.1
|
||||
70,1770.0,100.8
|
||||
71,1771.0,81.6
|
||||
72,1772.0,66.5
|
||||
73,1773.0,34.8
|
||||
74,1774.0,30.6
|
||||
75,1775.0,7.0
|
||||
76,1776.0,19.8
|
||||
77,1777.0,92.5
|
||||
78,1778.0,154.4
|
||||
79,1779.0,125.9
|
||||
80,1780.0,84.8
|
||||
81,1781.0,68.1
|
||||
82,1782.0,38.5
|
||||
83,1783.0,22.8
|
||||
84,1784.0,10.2
|
||||
85,1785.0,24.1
|
||||
86,1786.0,82.9
|
||||
87,1787.0,132.0
|
||||
88,1788.0,130.9
|
||||
89,1789.0,118.1
|
||||
90,1790.0,89.9
|
||||
91,1791.0,66.6
|
||||
92,1792.0,60.0
|
||||
93,1793.0,46.9
|
||||
94,1794.0,41.0
|
||||
95,1795.0,21.3
|
||||
96,1796.0,16.0
|
||||
97,1797.0,6.4
|
||||
98,1798.0,4.1
|
||||
99,1799.0,6.8
|
||||
100,1800.0,14.5
|
||||
101,1801.0,34.0
|
||||
102,1802.0,45.0
|
||||
103,1803.0,43.1
|
||||
104,1804.0,47.5
|
||||
105,1805.0,42.2
|
||||
106,1806.0,28.1
|
||||
107,1807.0,10.1
|
||||
108,1808.0,8.1
|
||||
109,1809.0,2.5
|
||||
110,1810.0,0.0
|
||||
111,1811.0,1.4
|
||||
112,1812.0,5.0
|
||||
113,1813.0,12.2
|
||||
114,1814.0,13.9
|
||||
115,1815.0,35.4
|
||||
116,1816.0,45.8
|
||||
117,1817.0,41.1
|
||||
118,1818.0,30.1
|
||||
119,1819.0,23.9
|
||||
120,1820.0,15.6
|
||||
121,1821.0,6.6
|
||||
122,1822.0,4.0
|
||||
123,1823.0,1.8
|
||||
124,1824.0,8.5
|
||||
125,1825.0,16.6
|
||||
126,1826.0,36.3
|
||||
127,1827.0,49.6
|
||||
128,1828.0,64.2
|
||||
129,1829.0,67.0
|
||||
130,1830.0,70.9
|
||||
131,1831.0,47.8
|
||||
132,1832.0,27.5
|
||||
133,1833.0,8.5
|
||||
134,1834.0,13.2
|
||||
135,1835.0,56.9
|
||||
136,1836.0,121.5
|
||||
137,1837.0,138.3
|
||||
138,1838.0,103.2
|
||||
139,1839.0,85.7
|
||||
140,1840.0,64.6
|
||||
141,1841.0,36.7
|
||||
142,1842.0,24.2
|
||||
143,1843.0,10.7
|
||||
144,1844.0,15.0
|
||||
145,1845.0,40.1
|
||||
146,1846.0,61.5
|
||||
147,1847.0,98.5
|
||||
148,1848.0,124.7
|
||||
149,1849.0,96.3
|
||||
150,1850.0,66.6
|
||||
151,1851.0,64.5
|
||||
152,1852.0,54.1
|
||||
153,1853.0,39.0
|
||||
154,1854.0,20.6
|
||||
155,1855.0,6.7
|
||||
156,1856.0,4.3
|
||||
157,1857.0,22.7
|
||||
158,1858.0,54.8
|
||||
159,1859.0,93.8
|
||||
160,1860.0,95.8
|
||||
161,1861.0,77.2
|
||||
162,1862.0,59.1
|
||||
163,1863.0,44.0
|
||||
164,1864.0,47.0
|
||||
165,1865.0,30.5
|
||||
166,1866.0,16.3
|
||||
167,1867.0,7.3
|
||||
168,1868.0,37.6
|
||||
169,1869.0,74.0
|
||||
170,1870.0,139.0
|
||||
171,1871.0,111.2
|
||||
172,1872.0,101.6
|
||||
173,1873.0,66.2
|
||||
174,1874.0,44.7
|
||||
175,1875.0,17.0
|
||||
176,1876.0,11.3
|
||||
177,1877.0,12.4
|
||||
178,1878.0,3.4
|
||||
179,1879.0,6.0
|
||||
180,1880.0,32.3
|
||||
181,1881.0,54.3
|
||||
182,1882.0,59.7
|
||||
183,1883.0,63.7
|
||||
184,1884.0,63.5
|
||||
185,1885.0,52.2
|
||||
186,1886.0,25.4
|
||||
187,1887.0,13.1
|
||||
188,1888.0,6.8
|
||||
189,1889.0,6.3
|
||||
190,1890.0,7.1
|
||||
191,1891.0,35.6
|
||||
192,1892.0,73.0
|
||||
193,1893.0,85.1
|
||||
194,1894.0,78.0
|
||||
195,1895.0,64.0
|
||||
196,1896.0,41.8
|
||||
197,1897.0,26.2
|
||||
198,1898.0,26.7
|
||||
199,1899.0,12.1
|
||||
200,1900.0,9.5
|
||||
201,1901.0,2.7
|
||||
202,1902.0,5.0
|
||||
203,1903.0,24.4
|
||||
204,1904.0,42.0
|
||||
205,1905.0,63.5
|
||||
206,1906.0,53.8
|
||||
207,1907.0,62.0
|
||||
208,1908.0,48.5
|
||||
209,1909.0,43.9
|
||||
210,1910.0,18.6
|
||||
211,1911.0,5.7
|
||||
212,1912.0,3.6
|
||||
213,1913.0,1.4
|
||||
214,1914.0,9.6
|
||||
215,1915.0,47.4
|
||||
216,1916.0,57.1
|
||||
217,1917.0,103.9
|
||||
218,1918.0,80.6
|
||||
219,1919.0,63.6
|
||||
220,1920.0,37.6
|
||||
221,1921.0,26.1
|
||||
222,1922.0,14.2
|
||||
223,1923.0,5.8
|
||||
224,1924.0,16.7
|
||||
225,1925.0,44.3
|
||||
226,1926.0,63.9
|
||||
227,1927.0,69.0
|
||||
228,1928.0,77.8
|
||||
229,1929.0,64.9
|
||||
230,1930.0,35.7
|
||||
231,1931.0,21.2
|
||||
232,1932.0,11.1
|
||||
233,1933.0,5.7
|
||||
234,1934.0,8.7
|
||||
235,1935.0,36.1
|
||||
236,1936.0,79.7
|
||||
237,1937.0,114.4
|
||||
238,1938.0,109.6
|
||||
239,1939.0,88.8
|
||||
240,1940.0,67.8
|
||||
241,1941.0,47.5
|
||||
242,1942.0,30.6
|
||||
243,1943.0,16.3
|
||||
244,1944.0,9.6
|
||||
245,1945.0,33.2
|
||||
246,1946.0,92.6
|
||||
247,1947.0,151.6
|
||||
248,1948.0,136.3
|
||||
249,1949.0,134.7
|
||||
250,1950.0,83.9
|
||||
251,1951.0,69.4
|
||||
252,1952.0,31.5
|
||||
253,1953.0,13.9
|
||||
254,1954.0,4.4
|
||||
255,1955.0,38.0
|
||||
256,1956.0,141.7
|
||||
257,1957.0,190.2
|
||||
258,1958.0,184.8
|
||||
259,1959.0,159.0
|
||||
260,1960.0,112.3
|
||||
261,1961.0,53.9
|
||||
262,1962.0,37.6
|
||||
263,1963.0,27.9
|
||||
264,1964.0,10.2
|
||||
265,1965.0,15.1
|
||||
266,1966.0,47.0
|
||||
267,1967.0,93.8
|
||||
268,1968.0,105.9
|
||||
269,1969.0,105.5
|
||||
270,1970.0,104.5
|
||||
271,1971.0,66.6
|
||||
272,1972.0,68.9
|
||||
273,1973.0,38.0
|
||||
274,1974.0,34.5
|
||||
275,1975.0,15.5
|
||||
276,1976.0,12.6
|
||||
277,1977.0,27.5
|
||||
278,1978.0,92.5
|
||||
279,1979.0,155.4
|
||||
280,1980.0,154.6
|
||||
281,1981.0,140.4
|
||||
282,1982.0,115.9
|
||||
283,1983.0,66.6
|
||||
284,1984.0,45.9
|
||||
285,1985.0,17.9
|
||||
286,1986.0,13.4
|
||||
287,1987.0,29.4
|
||||
288,1988.0,100.2
|
||||
289,1989.0,157.6
|
||||
290,1990.0,142.6
|
||||
291,1991.0,145.7
|
||||
292,1992.0,94.3
|
||||
293,1993.0,54.6
|
||||
294,1994.0,29.9
|
||||
295,1995.0,17.5
|
||||
296,1996.0,8.6
|
||||
297,1997.0,21.5
|
||||
298,1998.0,64.3
|
||||
299,1999.0,93.3
|
||||
300,2000.0,119.6
|
||||
301,2001.0,111.0
|
||||
302,2002.0,104.0
|
||||
303,2003.0,63.7
|
||||
304,2004.0,40.4
|
||||
305,2005.0,29.8
|
||||
306,2006.0,15.2
|
||||
307,2007.0,7.5
|
||||
308,2008.0,2.9
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
,dataset,column,option
|
||||
0,heart,survival,survival-heart
|
||||
1,heart,censors,censors-heart
|
||||
2,heart,age,age-heart
|
||||
|
@@ -0,0 +1,4 @@
|
||||
,dataset,column,option
|
||||
0,heart,survival,survival-heart
|
||||
1,heart,censors,censors-heart
|
||||
2,heart,age,age-heart
|
||||
|
@@ -0,0 +1,15 @@
|
||||
,dataset,column,option
|
||||
0,macrodata,year,year-macrodata
|
||||
1,macrodata,quarter,quarter-macrodata
|
||||
2,macrodata,realgdp,realgdp-macrodata
|
||||
3,macrodata,realcons,realcons-macrodata
|
||||
4,macrodata,realinv,realinv-macrodata
|
||||
5,macrodata,realgovt,realgovt-macrodata
|
||||
6,macrodata,realdpi,realdpi-macrodata
|
||||
7,macrodata,cpi,cpi-macrodata
|
||||
8,macrodata,m1,m1-macrodata
|
||||
9,macrodata,tbilrate,tbilrate-macrodata
|
||||
10,macrodata,unemp,unemp-macrodata
|
||||
11,macrodata,pop,pop-macrodata
|
||||
12,macrodata,infl,infl-macrodata
|
||||
13,macrodata,realint,realint-macrodata
|
||||
|
@@ -0,0 +1,5 @@
|
||||
,0
|
||||
0,12.30369
|
||||
1,0.00641
|
||||
2,3.85222
|
||||
3,0.05032
|
||||
|
@@ -0,0 +1,5 @@
|
||||
,0
|
||||
0,15.52753
|
||||
1,0.00008
|
||||
2,0.20175
|
||||
3,0.66071
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,const,married_wage_panel,lwage_wage_panel,hisp_wage_panel,black_wage_panel
|
||||
parameter,9.50097,-0.21638,1.53397,-0.93806,-0.19418
|
||||
|
@@ -0,0 +1,5 @@
|
||||
,0
|
||||
0,8.34753
|
||||
1,0.00386
|
||||
2,7.63580
|
||||
3,0.00572
|
||||
|
@@ -0,0 +1,5 @@
|
||||
,0
|
||||
0,5.65587
|
||||
1,
|
||||
2,8.20157
|
||||
3,0.01183
|
||||
|
@@ -0,0 +1,5 @@
|
||||
,RE,FE
|
||||
const,0.14530,0.16091
|
||||
lwage_wage_panel,0.19126,0.18194
|
||||
hisp_wage_panel,-0.00687,-0.00737
|
||||
black_wage_panel,-0.17866,-0.18008
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,married_wage_panel
|
||||
parameter,0.08226
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,const,married_wage_panel,lwage_wage_panel,hisp_wage_panel,black_wage_panel
|
||||
parameter,10.65398,-0.13342,0.82259,-0.97489,-0.28511
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,GNP_longley,ARMED_longley,POP_longley
|
||||
0,-0.00605,0.68417,0.56098
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,GNP_longley,ARMED_longley,POP_longley
|
||||
0,-0.00605,0.68417,0.56098
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,const,married_wage_panel,lwage_wage_panel,hisp_wage_panel,black_wage_panel
|
||||
parameter,10.65398,-0.13342,0.82259,-0.97489,-0.28511
|
||||
|
@@ -0,0 +1,2 @@
|
||||
,const,lwage_wage_panel,hisp_wage_panel,black_wage_panel
|
||||
parameter,0.14530,0.19126,-0.00687,-0.17866
|
||||
|
@@ -0,0 +1,20 @@
|
||||
,0
|
||||
0," TOTEMP_longley GNP_longley ARMED_longley POP_longley
|
||||
0 60323.0 234289.0 1590.0 107608.0
|
||||
1 61122.0 259426.0 1456.0 108632.0
|
||||
2 60171.0 258054.0 1616.0 109773.0
|
||||
3 61187.0 284599.0 1650.0 110929.0
|
||||
4 63221.0 328975.0 3099.0 112075.0
|
||||
5 63639.0 346999.0 3594.0 113270.0
|
||||
6 64989.0 365385.0 3547.0 115094.0
|
||||
7 63761.0 363112.0 3350.0 116219.0
|
||||
8 66019.0 397469.0 3048.0 117388.0
|
||||
9 67857.0 419180.0 2857.0 118734.0
|
||||
10 68169.0 442769.0 2798.0 120445.0
|
||||
11 66513.0 444546.0 2637.0 121950.0
|
||||
12 68655.0 482704.0 2552.0 123366.0
|
||||
13 69564.0 502601.0 2514.0 125368.0
|
||||
14 69331.0 518173.0 2572.0 127852.0
|
||||
15 70551.0 554894.0 2827.0 130081.0"
|
||||
1,TOTEMP_longley
|
||||
2,['GNP_longley' 'ARMED_longley' 'POP_longley']
|
||||
|
@@ -0,0 +1 @@
|
||||
1.8
|
||||
@@ -0,0 +1 @@
|
||||
0.08
|
||||
325
tests/gamestonk_terminal/econometrics/test_econometrics_model.py
Normal file
325
tests/gamestonk_terminal/econometrics/test_econometrics_model.py
Normal file
@@ -0,0 +1,325 @@
|
||||
# IMPORTATION STANDARD
|
||||
import pandas as pd
|
||||
|
||||
# IMPORTATION THIRDPARTY
|
||||
import pytest
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from gamestonk_terminal.econometrics import econometrics_model
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"file, file_types, data_files, data_examples",
|
||||
[
|
||||
("wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}),
|
||||
("sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}),
|
||||
],
|
||||
)
|
||||
def test_load(recorder, file, file_types, data_files, data_examples):
|
||||
result = econometrics_model.load(
|
||||
file=file,
|
||||
file_types=file_types,
|
||||
data_files=data_files,
|
||||
data_examples=data_examples,
|
||||
)
|
||||
|
||||
recorder.capture(result)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"datasets, dataset_name",
|
||||
[
|
||||
(
|
||||
{
|
||||
"heart": econometrics_model.load(
|
||||
"heart", ["csv", "xlsx"], {}, {"heart": "heart"}
|
||||
)
|
||||
},
|
||||
"heart",
|
||||
),
|
||||
(
|
||||
{
|
||||
"heart": econometrics_model.load(
|
||||
"heart", ["csv", "xlsx"], {}, {"heart": "heart"}
|
||||
),
|
||||
"macrodata": econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
),
|
||||
},
|
||||
None,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_options(recorder, datasets, dataset_name):
|
||||
result = econometrics_model.get_options(
|
||||
datasets=datasets, dataset_name=dataset_name
|
||||
)
|
||||
|
||||
recorder.capture_list(result.values())
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"dataset, fill, drop, limit",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"rfill",
|
||||
None,
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"cfill",
|
||||
None,
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"rbfill",
|
||||
None,
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"cbfill",
|
||||
None,
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"rffill",
|
||||
None,
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"cffill",
|
||||
None,
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
None,
|
||||
"rdrop",
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
None,
|
||||
"cdrop",
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"rfill",
|
||||
"rdrop",
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"rfill",
|
||||
"cdrop",
|
||||
5,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
"rfill",
|
||||
None,
|
||||
10,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
),
|
||||
None,
|
||||
"rdrop",
|
||||
10,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_clean(recorder, dataset, fill, drop, limit):
|
||||
result = econometrics_model.clean(
|
||||
dataset=dataset, fill=fill, drop=drop, limit=limit
|
||||
)
|
||||
|
||||
recorder.capture(result)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"data",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"]
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["infl"]
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"elnino", ["csv", "xlsx"], {}, {"elnino": "elnino"}
|
||||
)["JAN"]
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_normality(recorder, data):
|
||||
result = econometrics_model.get_normality(data=data)
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"df, fuller_reg, kpss_reg",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"c",
|
||||
"c",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"c",
|
||||
"ct",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"ct",
|
||||
"c",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"ctt",
|
||||
"c",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"nc",
|
||||
"c",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_root(recorder, df, fuller_reg, kpss_reg):
|
||||
result = econometrics_model.get_root(
|
||||
df=df, fuller_reg=fuller_reg, kpss_reg=kpss_reg
|
||||
)
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"time_series_y, time_series_x, lags",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realgdp"],
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["pop"],
|
||||
3,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realgovt"],
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realinv"],
|
||||
2,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realdpi"],
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["cpi"],
|
||||
1,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_granger_causality(recorder, time_series_y, time_series_x, lags):
|
||||
result = econometrics_model.get_granger_causality(
|
||||
time_series_y=time_series_y, time_series_x=time_series_x, lags=lags
|
||||
)
|
||||
|
||||
# The first item is taken since the second item contains Statsmodels
|
||||
# objects (which change their identifier on every iteration)
|
||||
recorder.capture_list(result[lags][0])
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"y, x",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"interest_inflation",
|
||||
["csv", "xlsx"],
|
||||
{},
|
||||
{"interest_inflation": "interest_inflation"},
|
||||
)["Dp"],
|
||||
econometrics_model.load(
|
||||
"interest_inflation",
|
||||
["csv", "xlsx"],
|
||||
{},
|
||||
{"interest_inflation": "interest_inflation"},
|
||||
)["R"],
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_engle_granger_two_step_cointegration_test(recorder, y, x):
|
||||
(
|
||||
c,
|
||||
gamma,
|
||||
alpha,
|
||||
z,
|
||||
adfstat,
|
||||
pvalue,
|
||||
) = econometrics_model.get_engle_granger_two_step_cointegration_test(y=y, x=x)
|
||||
|
||||
result = pd.DataFrame([c, gamma, alpha, adfstat, pvalue])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
recorder.capture(z, float_format="%.5f")
|
||||
219
tests/gamestonk_terminal/econometrics/test_econometrics_view.py
Normal file
219
tests/gamestonk_terminal/econometrics/test_econometrics_view.py
Normal file
@@ -0,0 +1,219 @@
|
||||
# IMPORTATION THIRDPARTY
|
||||
import pytest
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from gamestonk_terminal.econometrics import econometrics_model, econometrics_view
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"datasets, dataset_name",
|
||||
[
|
||||
(
|
||||
{
|
||||
"heart": econometrics_model.load(
|
||||
"heart", ["csv", "xlsx"], {}, {"heart": "heart"}
|
||||
),
|
||||
"macrodata": econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
),
|
||||
},
|
||||
None,
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_show_options(datasets, dataset_name):
|
||||
econometrics_view.show_options(datasets=datasets, dataset_name=dataset_name)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"data, dataset, column, plot",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"Sunset",
|
||||
"Sunactivity",
|
||||
False,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["infl"],
|
||||
"Macrodata",
|
||||
"Inflation",
|
||||
False,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"elnino", ["csv", "xlsx"], {}, {"elnino": "elnino"}
|
||||
)["JAN"],
|
||||
"El Nino",
|
||||
"January",
|
||||
False,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_display_norm(data, dataset, column, plot):
|
||||
econometrics_view.display_norm(data=data, dataset=dataset, column=column, plot=plot)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"df, dataset_name, column_name, fuller_reg, kpss_reg",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"Sunspot",
|
||||
"Sunactivity",
|
||||
"c",
|
||||
"c",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"Sunspot",
|
||||
"Sunactivity",
|
||||
"c",
|
||||
"ct",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"Sunspot",
|
||||
"Sunactivity",
|
||||
"ct",
|
||||
"c",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"Sunspot",
|
||||
"Sunactivity",
|
||||
"ctt",
|
||||
"c",
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"sunspots", ["csv", "xlsx"], {}, {"sunspots": "sunspots"}
|
||||
)["SUNACTIVITY"],
|
||||
"Sunspot",
|
||||
"Sunactivity",
|
||||
"nc",
|
||||
"c",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_display_root(df, dataset_name, column_name, fuller_reg, kpss_reg):
|
||||
econometrics_view.display_root(
|
||||
df=df,
|
||||
dataset_name=dataset_name,
|
||||
column_name=column_name,
|
||||
fuller_reg=fuller_reg,
|
||||
kpss_reg=kpss_reg,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"time_series_y, time_series_x, lags, confidence_level",
|
||||
[
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realgdp"],
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["pop"],
|
||||
3,
|
||||
0.05,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realgovt"],
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realinv"],
|
||||
2,
|
||||
0.10,
|
||||
),
|
||||
(
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["realdpi"],
|
||||
econometrics_model.load(
|
||||
"macrodata", ["csv", "xlsx"], {}, {"macrodata": "macrodata"}
|
||||
)["cpi"],
|
||||
1,
|
||||
0.01,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_display_granger(time_series_y, time_series_x, lags, confidence_level):
|
||||
econometrics_view.display_granger(
|
||||
time_series_y=time_series_y,
|
||||
time_series_x=time_series_x,
|
||||
lags=lags,
|
||||
confidence_level=confidence_level,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"datasets, significant, plot",
|
||||
[
|
||||
(
|
||||
{
|
||||
"y": econometrics_model.load(
|
||||
"interest_inflation",
|
||||
["csv", "xlsx"],
|
||||
{},
|
||||
{"interest_inflation": "interest_inflation"},
|
||||
)["Dp"],
|
||||
"x": econometrics_model.load(
|
||||
"interest_inflation",
|
||||
["csv", "xlsx"],
|
||||
{},
|
||||
{"interest_inflation": "interest_inflation"},
|
||||
)["R"],
|
||||
},
|
||||
True,
|
||||
False,
|
||||
),
|
||||
(
|
||||
{
|
||||
"y": econometrics_model.load(
|
||||
"interest_inflation",
|
||||
["csv", "xlsx"],
|
||||
{},
|
||||
{"interest_inflation": "interest_inflation"},
|
||||
)["Dp"],
|
||||
"x": econometrics_model.load(
|
||||
"interest_inflation",
|
||||
["csv", "xlsx"],
|
||||
{},
|
||||
{"interest_inflation": "interest_inflation"},
|
||||
)["R"],
|
||||
},
|
||||
False,
|
||||
False,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_engle_granger_two_step_cointegration_test(datasets, significant, plot):
|
||||
econometrics_view.display_cointegration_test(
|
||||
datasets=datasets, significant=significant, plot=plot
|
||||
)
|
||||
477
tests/gamestonk_terminal/econometrics/test_regression_model.py
Normal file
477
tests/gamestonk_terminal/econometrics/test_regression_model.py
Normal file
@@ -0,0 +1,477 @@
|
||||
# IMPORTATION STANDARD
|
||||
import pandas as pd
|
||||
|
||||
# IMPORTATION THIRDPARTY
|
||||
import pytest
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from gamestonk_terminal.econometrics import regression_model, econometrics_model
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
["TOTEMP-longley", "GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_regression_data(recorder, regression_variables, data, datasets):
|
||||
(
|
||||
regression_df,
|
||||
dependent_variable,
|
||||
independent_variables,
|
||||
) = regression_model.get_regression_data(
|
||||
regression_variables=regression_variables, data=data, datasets=datasets
|
||||
)
|
||||
|
||||
recorder.capture(
|
||||
pd.DataFrame([regression_df, dependent_variable, independent_variables])
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets, show_regression",
|
||||
[
|
||||
(
|
||||
["TOTEMP-longley", "GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
["TOTEMP-longley", "GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
False,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_ols(recorder, regression_variables, data, datasets, show_regression):
|
||||
_, _, _, model = regression_model.get_ols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
show_regression=show_regression,
|
||||
)
|
||||
|
||||
result = pd.DataFrame([model.params])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
[
|
||||
"educ-wage_panel",
|
||||
"married-wage_panel",
|
||||
"lwage-wage_panel",
|
||||
"hisp-wage_panel",
|
||||
"black-wage_panel",
|
||||
],
|
||||
{
|
||||
"wage_panel": econometrics_model.load(
|
||||
"wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}
|
||||
).set_index(["nr", "year"])
|
||||
},
|
||||
{
|
||||
"educ-wage_panel": {"educ": None, "wage_panel": None},
|
||||
"married-wage_panel": {"married": None, "wage_panel": None},
|
||||
"lwage-wage_panel": {"lwage": None, "wage_panel": None},
|
||||
"hisp-wage_panel": {"hisp": None, "wage_panel": None},
|
||||
"black-wage_panel": {"black": None, "wage_panel": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_pols(recorder, regression_variables, data, datasets):
|
||||
_, _, _, model = regression_model.get_pols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
result = pd.DataFrame([model.params])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
[
|
||||
"married-wage_panel",
|
||||
"lwage-wage_panel",
|
||||
"hisp-wage_panel",
|
||||
"black-wage_panel",
|
||||
],
|
||||
{
|
||||
"wage_panel": econometrics_model.load(
|
||||
"wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}
|
||||
).set_index(["nr", "year"])
|
||||
},
|
||||
{
|
||||
"educ-wage_panel": {"educ": None, "wage_panel": None},
|
||||
"married-wage_panel": {"married": None, "wage_panel": None},
|
||||
"lwage-wage_panel": {"lwage": None, "wage_panel": None},
|
||||
"hisp-wage_panel": {"hisp": None, "wage_panel": None},
|
||||
"black-wage_panel": {"black": None, "wage_panel": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_re(recorder, regression_variables, data, datasets):
|
||||
_, _, _, model = regression_model.get_re(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
result = pd.DataFrame([model.params])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
[
|
||||
"educ-wage_panel",
|
||||
"married-wage_panel",
|
||||
"lwage-wage_panel",
|
||||
"hisp-wage_panel",
|
||||
"black-wage_panel",
|
||||
],
|
||||
{
|
||||
"wage_panel": econometrics_model.load(
|
||||
"wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}
|
||||
).set_index(["nr", "year"])
|
||||
},
|
||||
{
|
||||
"educ-wage_panel": {"educ": None, "wage_panel": None},
|
||||
"married-wage_panel": {"married": None, "wage_panel": None},
|
||||
"lwage-wage_panel": {"lwage": None, "wage_panel": None},
|
||||
"hisp-wage_panel": {"hisp": None, "wage_panel": None},
|
||||
"black-wage_panel": {"black": None, "wage_panel": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_bols(recorder, regression_variables, data, datasets):
|
||||
_, _, _, model = regression_model.get_bols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
result = pd.DataFrame([model.params])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
[
|
||||
"educ-wage_panel",
|
||||
"married-wage_panel",
|
||||
"lwage-wage_panel",
|
||||
"hisp-wage_panel",
|
||||
"black-wage_panel",
|
||||
],
|
||||
{
|
||||
"wage_panel": econometrics_model.load(
|
||||
"wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}
|
||||
).set_index(["nr", "year"])
|
||||
},
|
||||
{
|
||||
"educ-wage_panel": {"educ": None, "wage_panel": None},
|
||||
"married-wage_panel": {"married": None, "wage_panel": None},
|
||||
"lwage-wage_panel": {"lwage": None, "wage_panel": None},
|
||||
"hisp-wage_panel": {"hisp": None, "wage_panel": None},
|
||||
"black-wage_panel": {"black": None, "wage_panel": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_fe(recorder, regression_variables, data, datasets):
|
||||
_, _, _, model = regression_model.get_fe(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
result = pd.DataFrame([model.params])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
["lwage-wage_panel", "married-wage_panel"],
|
||||
{
|
||||
"wage_panel": econometrics_model.load(
|
||||
"wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}
|
||||
).set_index(["nr", "year"])
|
||||
},
|
||||
{
|
||||
"married-wage_panel": {"married": None, "wage_panel": None},
|
||||
"lwage-wage_panel": {"lwage": None, "wage_panel": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_fdols(recorder, regression_variables, data, datasets):
|
||||
_, _, _, model = regression_model.get_fdols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
result = pd.DataFrame([model.params])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets",
|
||||
[
|
||||
(
|
||||
[
|
||||
"married-wage_panel",
|
||||
"lwage-wage_panel",
|
||||
"hisp-wage_panel",
|
||||
"black-wage_panel",
|
||||
],
|
||||
{
|
||||
"wage_panel": econometrics_model.load(
|
||||
"wage_panel", ["csv", "xlsx"], {}, {"wage_panel": "wage_panel"}
|
||||
).set_index(["nr", "year"])
|
||||
},
|
||||
{
|
||||
"educ-wage_panel": {"educ": None, "wage_panel": None},
|
||||
"married-wage_panel": {"married": None, "wage_panel": None},
|
||||
"lwage-wage_panel": {"lwage": None, "wage_panel": None},
|
||||
"hisp-wage_panel": {"hisp": None, "wage_panel": None},
|
||||
"black-wage_panel": {"black": None, "wage_panel": None},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_get_comparison(recorder, regression_variables, data, datasets):
|
||||
regressions = {"RE": {}, "FE": {}}
|
||||
|
||||
_, _, _, regressions["RE"]["model"] = regression_model.get_re(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
_, _, _, regressions["FE"]["model"] = regression_model.get_fe(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
)
|
||||
|
||||
comparison_result = regression_model.get_comparison(regressions)
|
||||
|
||||
recorder.capture(comparison_result.params, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets, show_regression",
|
||||
[
|
||||
(
|
||||
["TOTEMP-longley", "GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
["GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_dwat(recorder, regression_variables, data, datasets, show_regression):
|
||||
_, _, _, model = regression_model.get_ols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
show_regression=show_regression,
|
||||
)
|
||||
|
||||
result = regression_model.get_dwat(model.resid).round(5)
|
||||
|
||||
recorder.capture(result)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets, show_regression, lags",
|
||||
[
|
||||
(
|
||||
["ARMED-longley", "GNP-longley", "TOTEMP-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
3,
|
||||
),
|
||||
(
|
||||
["GNP-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
1,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_bgod(
|
||||
recorder, regression_variables, data, datasets, show_regression, lags
|
||||
):
|
||||
_, _, _, model = regression_model.get_ols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
show_regression=show_regression,
|
||||
)
|
||||
|
||||
lm_stat, p_value, f_stat, fp_value = regression_model.get_bgod(model, lags)
|
||||
|
||||
result = pd.DataFrame([lm_stat, p_value, f_stat, fp_value])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets, show_regression",
|
||||
[
|
||||
(
|
||||
["GNP-longley", "TOTEMP-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
["POP-longley", "GNP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
True,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_bpag(recorder, regression_variables, data, datasets, show_regression):
|
||||
_, _, _, model = regression_model.get_ols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
show_regression=show_regression,
|
||||
)
|
||||
|
||||
lm_stat, p_value, f_stat, fp_value = regression_model.get_bpag(model)
|
||||
|
||||
result = pd.DataFrame([lm_stat, p_value, f_stat, fp_value])
|
||||
|
||||
recorder.capture(result, float_format="%.5f")
|
||||
107
tests/gamestonk_terminal/econometrics/test_regression_view.py
Normal file
107
tests/gamestonk_terminal/econometrics/test_regression_view.py
Normal file
@@ -0,0 +1,107 @@
|
||||
# IMPORTATION THIRDPARTY
|
||||
import pytest
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from gamestonk_terminal.econometrics import (
|
||||
regression_model,
|
||||
econometrics_model,
|
||||
regression_view,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets, show_regression, lags",
|
||||
[
|
||||
(
|
||||
["TOTEMP-longley", "GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
False,
|
||||
1,
|
||||
),
|
||||
(
|
||||
["TOTEMP-longley", "GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
False,
|
||||
2,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_display_bgod(regression_variables, data, datasets, show_regression, lags):
|
||||
_, _, _, model = regression_model.get_ols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
show_regression=show_regression,
|
||||
)
|
||||
|
||||
regression_view.display_bgod(model=model, lags=lags)
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.record_stdout
|
||||
@pytest.mark.parametrize(
|
||||
"regression_variables, data, datasets, show_regression",
|
||||
[
|
||||
(
|
||||
["TOTEMP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
False,
|
||||
),
|
||||
(
|
||||
["GNP-longley", "ARMED-longley", "POP-longley"],
|
||||
{
|
||||
"longley": econometrics_model.load(
|
||||
"longley", ["csv", "xlsx"], {}, {"longley": "longley"}
|
||||
)
|
||||
},
|
||||
{
|
||||
"TOTEMP-longley": {"TOTEMP": None, "longley": None},
|
||||
"GNP-longley": {"GNP": None, "longley": None},
|
||||
"ARMED-longley": {"ARMED": None, "longley": None},
|
||||
"POP-longley": {"POP": None, "longley": None},
|
||||
},
|
||||
False,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_display_bpag(regression_variables, data, datasets, show_regression):
|
||||
_, _, _, model = regression_model.get_ols(
|
||||
regression_variables=regression_variables,
|
||||
data=data,
|
||||
datasets=datasets,
|
||||
show_regression=show_regression,
|
||||
)
|
||||
|
||||
regression_view.display_bpag(model=model)
|
||||
@@ -0,0 +1 @@
|
||||
ssr_ftest
|
||||
@@ -0,0 +1 @@
|
||||
ssr_chi2test
|
||||
@@ -0,0 +1 @@
|
||||
lrtest
|
||||
@@ -0,0 +1 @@
|
||||
params_ftest
|
||||
@@ -0,0 +1 @@
|
||||
ssr_ftest
|
||||
@@ -0,0 +1 @@
|
||||
ssr_chi2test
|
||||
@@ -0,0 +1 @@
|
||||
lrtest
|
||||
@@ -0,0 +1 @@
|
||||
params_ftest
|
||||
@@ -0,0 +1 @@
|
||||
ssr_ftest
|
||||
@@ -0,0 +1 @@
|
||||
ssr_chi2test
|
||||
@@ -0,0 +1 @@
|
||||
lrtest
|
||||
@@ -0,0 +1 @@
|
||||
params_ftest
|
||||
@@ -0,0 +1,7 @@
|
||||
F-test P-value Count Lags
|
||||
ssr_ftest 2.669911 0.048815 193.0 3.0
|
||||
ssr_chi2test 8.300242 0.040198 - 3
|
||||
lrtest 8.132629 0.043349 - 3
|
||||
params_ftest 2.669911 0.048815 193.0 3.0
|
||||
As the p-value of the F-test is 0.049, we can reject the null hypothesis at the 0.05 confidence level and find the Series 'pop' to Granger-cause the Series 'realgdp'
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
F-test P-value Count Lags
|
||||
ssr_ftest 3.265591 0.040261 196.0 2.0
|
||||
ssr_chi2test 6.697793 0.035123 - 2
|
||||
lrtest 6.588619 0.037094 - 2
|
||||
params_ftest 3.265591 0.040261 196.0 2.0
|
||||
As the p-value of the F-test is 0.04, we can reject the null hypothesis at the 0.1 confidence level and find the Series 'realinv' to Granger-cause the Series 'realgovt'
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
F-test P-value Count Lags
|
||||
ssr_ftest 1.012638 0.315494 199.0 1.0
|
||||
ssr_chi2test 1.027904 0.310651 - 1
|
||||
lrtest 1.025298 0.311266 - 1
|
||||
params_ftest 1.012638 0.315494 199.0 1.0
|
||||
As the p-value of the F-test is 0.315, we can not reject the null hypothesis at the 0.01 confidence level.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Kurtosis Skewness Jarque-Bera Shapiro-Wilk Kolmogorov-Smirnov
|
||||
Statistic 1.479908 6.170200e+00 5.221623e+01 9.091216e-01 0.971137
|
||||
p-value 0.138898 6.820348e-10 4.585554e-12 1.052443e-12 0.000000
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Kurtosis Skewness Jarque-Bera Shapiro-Wilk Kolmogorov-Smirnov
|
||||
Statistic 3.801112 4.037817 6.066372e+01 9.108574e-01 7.882806e-01
|
||||
p-value 0.000144 0.000054 6.716849e-14 1.060935e-09 6.730586e-135
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Kurtosis Skewness Jarque-Bera Shapiro-Wilk Kolmogorov-Smirnov
|
||||
Statistic 3.556139 4.171875 6.887032e+01 0.887108 1.0
|
||||
p-value 0.000376 0.000030 1.110223e-15 0.000040 0.0
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
ADF KPSS
|
||||
Test Statistic -2.837781 0.669866
|
||||
P-Value 0.053076 0.016285
|
||||
NLags 8.000000 7.000000
|
||||
Nobs 300.000000 0.000000
|
||||
ICBest 2430.500342 0.000000
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
ADF KPSS
|
||||
Test Statistic -2.837781 0.115831
|
||||
P-Value 0.053076 0.100000
|
||||
NLags 8.000000 7.000000
|
||||
Nobs 300.000000 0.000000
|
||||
ICBest 2430.500342 0.000000
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
ADF KPSS
|
||||
Test Statistic -2.924375 0.669866
|
||||
P-Value 0.154465 0.016285
|
||||
NLags 8.000000 7.000000
|
||||
Nobs 300.000000 0.000000
|
||||
ICBest 2431.976734 0.000000
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
ADF KPSS
|
||||
Test Statistic -3.004904 0.669866
|
||||
P-Value 0.292850 0.016285
|
||||
NLags 8.000000 7.000000
|
||||
Nobs 300.000000 0.000000
|
||||
ICBest 2432.538460 0.000000
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
ADF KPSS
|
||||
Test Statistic -0.752220 0.669866
|
||||
P-Value 0.390609 0.016285
|
||||
NLags 8.000000 7.000000
|
||||
Nobs 300.000000 0.000000
|
||||
ICBest 2436.914059 0.000000
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Only showing pairs that are statistically significant (True > p-value).
|
||||
|
||||
Constant Gamma Alpha Dickey-Fuller P Value
|
||||
y/x -0.003126 0.154512 -1.2884 -13.123662 1.544757e-24
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Constant Gamma Alpha Dickey-Fuller P Value
|
||||
y/x -0.003126 0.154512 -1.2884 -13.123662 1.544757e-24
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
dataset column option
|
||||
0 heart survival survival-heart
|
||||
1 heart censors censors-heart
|
||||
2 heart age age-heart
|
||||
dataset column option
|
||||
0 macrodata year year-macrodata
|
||||
1 macrodata quarter quarter-macrodata
|
||||
2 macrodata realgdp realgdp-macrodata
|
||||
3 macrodata realcons realcons-macrodata
|
||||
4 macrodata realinv realinv-macrodata
|
||||
5 macrodata realgovt realgovt-macrodata
|
||||
6 macrodata realdpi realdpi-macrodata
|
||||
7 macrodata cpi cpi-macrodata
|
||||
8 macrodata m1 m1-macrodata
|
||||
9 macrodata tbilrate tbilrate-macrodata
|
||||
10 macrodata unemp unemp-macrodata
|
||||
11 macrodata pop pop-macrodata
|
||||
12 macrodata infl infl-macrodata
|
||||
13 macrodata realint realint-macrodata
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
0
|
||||
LM-stat 12.591323
|
||||
p-value 0.000388
|
||||
f-stat 0.688985
|
||||
fp-value 0.424158
|
||||
The result 0.0 indicates no existence of autocorrelation.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
0
|
||||
LM-stat 13.283202
|
||||
p-value 0.001305
|
||||
f-stat 1.666265
|
||||
fp-value 0.237376
|
||||
The result 0.0 indicates no existence of autocorrelation.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
0
|
||||
lm-stat 8.266655
|
||||
p-value 0.004038
|
||||
f-stat 7.482736
|
||||
fp-value 0.006162
|
||||
The result 0.0 indicates no existence of heteroscedasticity.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
0
|
||||
lm-stat 11.318704
|
||||
p-value 0.000767
|
||||
f-stat 16.924998
|
||||
fp-value 0.000184
|
||||
The result 0.0 indicates no existence of heteroscedasticity.
|
||||
|
||||
24
website/content/custom/_index.md
vendored
24
website/content/custom/_index.md
vendored
@@ -1,24 +0,0 @@
|
||||
---
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
{{< toc-tree >}}
|
||||
|
||||
# Loading in custom data
|
||||
|
||||
There is a directory in root, labeled `custom_imports`. Here there is a sample
|
||||
csv file titled `test.csv` that is __randomly__ generated data for visualization purposes.
|
||||
|
||||
When loading in the data, we recommend working with time series. The prediction techniques menu
|
||||
will plot against time data, so not using that may result in undesired outputs.
|
||||
|
||||
## How to load in a time variable
|
||||
|
||||
Note in the sample csv, the first row has the following form `Date,ColNorm,Col2,ColNorm3,ColB`.
|
||||
The process for loading data into Gamestonk Terminal is that the code loops through all input columns and looks through
|
||||
for one column that is either `Date`,`Time` or `Timestamp` (not case-sensitive).
|
||||
If one of these are found, then the dataframe sets this column to be the index.
|
||||
|
||||
If onc of these columns are not found, then the index will just be integers from 0 to the length of your data.
|
||||
|
||||
Once again: __the prediction menu is designed for data with a datetime index__.
|
||||
28
website/content/custom/info/_index.md
vendored
28
website/content/custom/info/_index.md
vendored
@@ -1,28 +0,0 @@
|
||||
```
|
||||
usage: info [-h]
|
||||
```
|
||||
Show information of custom data.
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
-h, --help show this help message (default: False)
|
||||
```
|
||||
|
||||
Sample Output:
|
||||
```python
|
||||
<class 'pandas.core.frame.DataFrame'>
|
||||
DatetimeIndex: 732 entries, 2020-01-01 to 2022-01-01
|
||||
Data columns (total 4 columns):
|
||||
# Column Non-Null Count Dtype
|
||||
--- ------ -------------- -----
|
||||
0 colnorm 732 non-null float64
|
||||
1 col2 732 non-null float64
|
||||
2 colnorm3 732 non-null float64
|
||||
3 colb 732 non-null float64
|
||||
dtypes: float64(4)
|
||||
memory usage: 28.6 KB
|
||||
None
|
||||
```
|
||||
|
||||
This tells us the loaded dataframe, (which there is one saved as a default template as test.csv)
|
||||
has 4 columns that are all floats (numeric). The index is a date time range from the start of 2020 to the start of 2022.
|
||||
11
website/content/custom/load/_index.md
vendored
11
website/content/custom/load/_index.md
vendored
@@ -1,11 +0,0 @@
|
||||
```
|
||||
usage: load [-f {test.csv}] [-h]
|
||||
```
|
||||
Load custom data set into a dataframe
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
-f {test.csv}, --file {test.csv}
|
||||
File to load in. (default: test.csv)
|
||||
-h, --help show this help message (default: False)
|
||||
```
|
||||
23
website/content/custom/plot/_index.md
vendored
23
website/content/custom/plot/_index.md
vendored
@@ -1,23 +0,0 @@
|
||||
```
|
||||
usage: plot [-y {colnorm,col2,colnorm3,colb}] [-x {colnorm,col2,colnorm3,colb}] [-k {line,scatter,bar,barh,hist,box,kde,area,pie,hexbin}] [-h] [--export {png,jpg,pdf,svg}]
|
||||
```
|
||||
Plot 2 columns of loaded data.
|
||||
|
||||
```
|
||||
optional arguments:
|
||||
-y {colnorm,col2,colnorm3,colb}
|
||||
Variable to plot along y (default: None)
|
||||
-x {colnorm,col2,colnorm3,colb}, --vs {colnorm,col2,colnorm3,colb}
|
||||
Variable along x axis (default: )
|
||||
-k {line,scatter,bar,barh,hist,box,kde,area,pie,hexbin}, --kind {line,scatter,bar,barh,hist,box,kde,area,pie,hexbin}
|
||||
Type of plot for data (default: scatter)
|
||||
-h, --help show this help message (default: False)
|
||||
--export {png,jpg,pdf,svg}
|
||||
Export figure into png, jpg, pdf, svg (default: )
|
||||
```
|
||||
|
||||
Note that when no "-x/--vs" is supplied, the x axis will be the dataframe index. The -x and -y defaults will be the
|
||||
columns present in your data. In this scenario, the columns loaded are `colnorm,col2,colnorm3,colb` .
|
||||
|
||||
The different kinds of plots can be seen in the `kind` kwarg of the
|
||||
[pandas plot function](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.html)
|
||||
24
website/content/custom/show/_index.md
vendored
24
website/content/custom/show/_index.md
vendored
@@ -1,24 +0,0 @@
|
||||
```
|
||||
usage: show [-s SORTCOL [SORTCOL ...]] [-a] [-h] [-l LIMIT]
|
||||
```
|
||||
Show loaded dataframe
|
||||
```
|
||||
optional arguments:
|
||||
-s SORTCOL [SORTCOL ...], --sortcol SORTCOL [SORTCOL ...]
|
||||
-a, --ascend
|
||||
-h, --help show this help message (default: False)
|
||||
-l LIMIT, --limit LIMIT
|
||||
Number of entries to show in data. (default: 5)
|
||||
```
|
||||
|
||||
Sample Output:
|
||||
```
|
||||
2022 Jan 18, 17:53 (✨) /custom/ $ show -l 3
|
||||
colnorm col2 colnorm3 colb
|
||||
date
|
||||
2020-01-01 0.999953 1.012313 1.008667 0.001203
|
||||
2020-01-02 0.983850 1.023421 1.004225 0.004517
|
||||
2020-01-03 1.002692 1.019749 1.006244 0.007035
|
||||
```
|
||||
|
||||
This shows the top 3 rows of my custom dataframe. This should primarily be used as a method of debugging that the load worked.
|
||||
11
website/content/econometrics/_index.md
vendored
Normal file
11
website/content/econometrics/_index.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
The Econometrics menu's purpose is to provide the user the ability to perform statistical research on custom datasets.
|
||||
The menu allows the user to load in his/her own dataset(s), modify the data by (for example) adding columns or setting
|
||||
indices, apply statistical tests (e.g. Breusch-Godfrey autocorrelation tests) as well as OLS regressions and Panel
|
||||
regressions (e.g. Random Effects and Fixed Effects)
|
||||
|
||||
{{< toc-tree >}}
|
||||
|
||||
63
website/content/econometrics/bgod/_index.md
vendored
Normal file
63
website/content/econometrics/bgod/_index.md
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
```
|
||||
usage: bgod [-l LAGS] [-h] [--export {csv,json,xlsx}]
|
||||
```
|
||||
|
||||
Show Breusch-Pagan heteroscedasticity test results.
|
||||
|
||||
In statistics, heteroskedasticity (or heteroscedasticity) happens when the standard deviations of a predicted variable, monitored over different values of an independent variable or as related to prior time periods, are non-constant. With heteroskedasticity, the tell-tale sign upon visual inspection of the residual errors is that they will tend to fan out over time. [Source: Investopedia]
|
||||
```
|
||||
optional arguments:
|
||||
-l LAGS, --lags LAGS The lags for the Breusch-Godfrey test (default: 3)
|
||||
-h, --help show this help message (default: False)
|
||||
--export {csv,json,xlsx}
|
||||
Export raw data into csv, json, xlsx (default: )
|
||||
```
|
||||
|
||||
Example:
|
||||
```
|
||||
2022 Feb 24, 06:00 (✨) /econometrics/ $ ols adj_close-msft adj_close-aapl adj_close-googl adj_close-tsla
|
||||
OLS Regression Results
|
||||
==============================================================================
|
||||
Dep. Variable: adj_close_msft R-squared: 0.977
|
||||
Model: OLS Adj. R-squared: 0.977
|
||||
Method: Least Squares F-statistic: 1.068e+04
|
||||
Date: Thu, 24 Feb 2022 Prob (F-statistic): 0.00
|
||||
Time: 12:01:09 Log-Likelihood: -2830.6
|
||||
No. Observations: 759 AIC: 5669.
|
||||
Df Residuals: 755 BIC: 5688.
|
||||
Df Model: 3
|
||||
Covariance Type: nonrobust
|
||||
===================================================================================
|
||||
coef std err t P>|t| [0.025 0.975]
|
||||
-----------------------------------------------------------------------------------
|
||||
Intercept 27.7984 2.166 12.832 0.000 23.546 32.051
|
||||
adj_close_aapl 0.8662 0.034 25.503 0.000 0.800 0.933
|
||||
adj_close_googl 0.0508 0.002 30.374 0.000 0.048 0.054
|
||||
adj_close_tsla -0.0007 0.004 -0.181 0.856 -0.009 0.007
|
||||
==============================================================================
|
||||
Omnibus: 41.445 Durbin-Watson: 0.044
|
||||
Prob(Omnibus): 0.000 Jarque-Bera (JB): 47.398
|
||||
Skew: 0.612 Prob(JB): 5.10e-11
|
||||
Kurtosis: 2.995 Cond. No. 1.16e+04
|
||||
==============================================================================
|
||||
|
||||
Notes:
|
||||
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
|
||||
[2] The condition number is large, 1.16e+04. This might indicate that there are
|
||||
strong multicollinearity or other numerical problems.
|
||||
|
||||
2022 Feb 24, 06:01 (✨) /econometrics/ $ bgod
|
||||
Breusch-Godfrey autocorrelation test [Lags: 3]
|
||||
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
|
||||
┃ ┃ Breusch-Godfrey ┃
|
||||
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
|
||||
│ LM-stat │ 723.75 │
|
||||
├──────────┼─────────────────┤
|
||||
│ p-value │ 0.00 │
|
||||
├──────────┼─────────────────┤
|
||||
│ f-stat │ 5147.20 │
|
||||
├──────────┼─────────────────┤
|
||||
│ fp-value │ 0.00 │
|
||||
└──────────┴─────────────────┘
|
||||
The result 0.0 indicates no existence of autocorrelation.
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user