Business Cycle Correlation Skill
This skill extracts nominal PCE and PFI from ERP Excel tables, deflates them using a CPI index, applies the Hodrick-Prescott filter on log-transformed real series, and computes the Pearson correlation of the cyclical components.
Workflow
- Parse ERP .xls tables to extract annual totals (column 1)
- For years with only quarterly data, average available quarters
- Deflate nominal series using CPI (real = nominal / CPI)
- Take natural logarithm of real series
- Apply HP filter with specified lambda (100 for annual data)
- Compute Pearson correlation of cyclical components
- Write rounded result to output file
Usage Example
pythonimport sys sys.path.insert(0, '/app/environment/skills/evo-business-cycle/scripts') from utils import run_business_cycle_correlation, validate_result # Run end-to-end corr = run_business_cycle_correlation( pce_filepath='/root/ERP-2025-table10.xls', pfi_filepath='/root/ERP-2025-table12.xls', cpi_filepath='/root/CPI.xlsx', output_filepath='/root/answer.txt', start_year=1973, end_year=2024, hp_lambda=100, decimals=5 ) # Validate validate_result('/root/answer.txt')
Key Functions
extract_erp_annual_data(filepath, data_start_row, col_index)- Parse annual rows from ERP tablesextract_erp_quarterly_for_year(filepath, target_year, data_start_row, col_index)- Get quarterly values for a specific yearload_cpi(filepath)- Load CPI data from xlsxdeflate_series(nominal_dict, cpi_dict)- Convert nominal to real valueshp_filter(series_values, lamb)- Apply HP filter, returns (cycle, trend)compute_correlation(series1, series2)- Pearson correlationrun_business_cycle_correlation(...)- End-to-end entry pointvalidate_result(output_filepath)- Validate output file


