diff --git a/binder/environment.yml b/binder/environment.yml index 006d6b0..7e39062 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -4,6 +4,7 @@ channels: dependencies: - python=3.9 - ipywidgets + - jupyter - jupyterlab - matplotlib - numpy @@ -13,8 +14,8 @@ dependencies: - lxml - requests - statsmodels + - pip - pip: - - pandas-datareader - - fredpy - - statsmodels - + - pandas-datareader + - fredpy + - statsmodels diff --git a/code/main/parse_GB_raw_data.py b/code/main/parse_GB_raw_data.py index 05481c0..43d74ef 100644 --- a/code/main/parse_GB_raw_data.py +++ b/code/main/parse_GB_raw_data.py @@ -1,5 +1,4 @@ import pandas as pd -import os # Load the Excel file excel_file = pd.ExcelFile('data/raw/GBweb_Row_Format.xlsx') @@ -81,10 +80,6 @@ for column in GB_df.columns[1:]: GB_df[column] = GB_df[column].apply(lambda x: f"{x:.{decimal}f}") -current_directory = os.path.dirname(os.path.abspath(__file__)) -file_path = "/../data/output/FRED.csv" -GB_df.to_csv(current_directory + file_path) - # Uncomment these final lines to get the output of your choice -#GB_df.to_csv('data/output/GB.csv') +GB_df.to_csv('data/output/GB.csv') # GB_df.to_excel('data/output/GB_parsed.xlsx', index=False) diff --git a/code/main/parse_SPF_raw_data.py b/code/main/parse_SPF_raw_data.py index dd2ed9d..53a96aa 100644 --- a/code/main/parse_SPF_raw_data.py +++ b/code/main/parse_SPF_raw_data.py @@ -1,5 +1,4 @@ import pandas as pd -import os # Load the Excel file with levels first excel_file = pd.ExcelFile('data/raw/meanLevel.xlsx') @@ -69,10 +68,6 @@ for column in results_df.columns[1:]: results_df[column] = results_df[column].apply(lambda x: f"{x:.{decimal}f}") -current_directory = os.path.dirname(os.path.abspath(__file__)) -file_path = "/../data/output/FRED.csv" -results_df.to_csv(current_directory + file_path) - # Uncomment these final lines to get the output of your choice -# results_df.to_csv('data/output/SPF.csv') +results_df.to_csv('data/output/SPF.csv') # SPF_df.to_excel('data/output/SPF_parsed.xlsx', index=False) \ No newline at end of file diff --git a/code/main/reproduce.py b/code/main/reproduce.py index dd4fb62..282b2e9 100755 --- a/code/main/reproduce.py +++ b/code/main/reproduce.py @@ -8,12 +8,12 @@ # List all files in the current directory files_to_run = [ - "/parse_GB_raw_data.py", - "/parse_SPF_raw_data.py", - "/scrape_FRED_data.py", - "/annual_forecasts.py", - "/compute_abs_error.py", - "/abse_reg.py" + "./code/main/parse_GB_raw_data.py", + "./code/main/parse_SPF_raw_data.py", + "./code/main/scrape_FRED_data.py", + "./code/main/annual_forecasts.py", + "./code/main/compute_abs_error.py", + "./code/main/abse_reg.py" ] # Measure the start time @@ -22,7 +22,7 @@ # Run each Python script in the directory for python_file in files_to_run: if python_file != "reproduce.py": # Exclude the launcher script itself - subprocess.run(["python", current_directory + python_file]) + subprocess.run(["python", python_file]) end_time = time.time() diff --git a/code/main/scrape_FRED_data.py b/code/main/scrape_FRED_data.py index f5ae697..59e41fa 100644 --- a/code/main/scrape_FRED_data.py +++ b/code/main/scrape_FRED_data.py @@ -2,7 +2,6 @@ import numpy as np import fredpy as fp import matplotlib.pyplot as plt -import os fp.api_key = "c735c085b4e162a17326871bc1d5c625" win = ['01-01-1982','12-01-2017'] @@ -30,10 +29,6 @@ for column in obs_df.columns[1:]: obs_df[column] = obs_df[column].apply(lambda x: f"{x:.{decimal}f}") -current_directory = os.path.dirname(os.path.abspath(__file__)) -file_path = "/../data/output/FRED.csv" -obs_df.to_csv(current_directory + file_path) - -#obs_df.to_csv('data/output/FRED.csv') +obs_df.to_csv('data/output/FRED.csv') # obs_df.to_excel('data/output/FRED_scraped.xlsx', index=False) \ No newline at end of file diff --git a/reproduce.sh b/reproduce.sh index ee3c900..4939b52 100755 --- a/reproduce.sh +++ b/reproduce.sh @@ -5,7 +5,7 @@ SCPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) cd "$SCPT_DIR" mamba env update -f binder/environment.yml -conda activate rs100_discussion +source activate rs100_discussion ipython *.ipynb diff --git a/results/abse_reg_1983.txt b/results/abse_reg_1983.txt index 949b4ff..eb0e465 100644 --- a/results/abse_reg_1983.txt +++ b/results/abse_reg_1983.txt @@ -5,7 +5,7 @@ Dep. Variable: GB_error_unemp R-squared: 0.013 Model: OLS Adj. R-squared: 0.006 Method: Least Squares F-statistic: 1.760 Date: Wed, 21 Feb 2024 Prob (F-statistic): 0.187 -Time: 08:35:09 Log-Likelihood: -118.32 +Time: 10:04:35 Log-Likelihood: -118.32 No. Observations: 144 AIC: 240.6 Df Residuals: 142 BIC: 246.6 Df Model: 1 @@ -25,7 +25,7 @@ Kurtosis: 15.518 Cond. No. 10.4 Notes: [1] Standard Errors are heteroscedasticity robust (HC3) Mean Squared Error for GB_error_unemp: 0.3028 -Durbin-Watson Statistic for GB_error_unemp: 0.4990387828073439 +Durbin-Watson Statistic for GB_error_unemp: 0.4990387828073438 Regression Summary for SPF_error_unemp: OLS Regression Results ============================================================================== @@ -33,7 +33,7 @@ Dep. Variable: SPF_error_unemp R-squared: 0.005 Model: OLS Adj. R-squared: -0.002 Method: Least Squares F-statistic: 0.6700 Date: Wed, 21 Feb 2024 Prob (F-statistic): 0.414 -Time: 08:35:09 Log-Likelihood: -125.71 +Time: 10:04:35 Log-Likelihood: -125.71 No. Observations: 144 AIC: 255.4 Df Residuals: 142 BIC: 261.4 Df Model: 1 @@ -53,7 +53,7 @@ Kurtosis: 13.710 Cond. No. 10.4 Notes: [1] Standard Errors are heteroscedasticity robust (HC3) Mean Squared Error for SPF_error_unemp: 0.3356 -Durbin-Watson Statistic for SPF_error_unemp: 0.380336402078763 +Durbin-Watson Statistic for SPF_error_unemp: 0.3803364020787631 Regression Summary for GB_error_cons: OLS Regression Results ============================================================================== @@ -61,7 +61,7 @@ Dep. Variable: GB_error_cons R-squared: 0.219 Model: OLS Adj. R-squared: 0.214 Method: Least Squares F-statistic: 30.02 Date: Wed, 21 Feb 2024 Prob (F-statistic): 1.89e-07 -Time: 08:35:10 Log-Likelihood: -166.53 +Time: 10:04:35 Log-Likelihood: -166.53 No. Observations: 144 AIC: 337.1 Df Residuals: 142 BIC: 343.0 Df Model: 1 @@ -89,7 +89,7 @@ Dep. Variable: SPF_error_cons R-squared: 0.133 Model: OLS Adj. R-squared: 0.127 Method: Least Squares F-statistic: 26.15 Date: Wed, 21 Feb 2024 Prob (F-statistic): 1.01e-06 -Time: 08:35:10 Log-Likelihood: -177.99 +Time: 10:04:35 Log-Likelihood: -177.99 No. Observations: 144 AIC: 360.0 Df Residuals: 142 BIC: 365.9 Df Model: 1