evo-macro-cycle-correlation
SkillMonitoring & opsDeflates nominal series to real values using CPI, applies log transformation and Hodrick-Prescott filter to extract cyclical components, and computes Pearson correlation between two cyclical series.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the evo-macro-cycle-correlation skill
What this skill tells your AI
The instructions your AI receives, as published by openlair/openskill in tasks-evolved/econ-detrending-correlation/environment/skills/evo-macro-cycle-correlation/SKILL.md and read by ahel’s review.
Deflates nominal macroeconomic series, applies HP filter for cycle extraction, and computes Pearson correlation between cyclical components.
Key Functions
deflate_nominal_to_real(nominal, cpi)
Converts nominal to real values: Real_t = (Nominal_t / CPI_t) * 100
extract_hp_cycle(real_series, lamb=100)
Applies np.log() then HP filter (statsmodels hpfilter) to extract cyclical component.
- Uses natural log (np.log, NOT np.log10)
- hpfilter returns (cycle, trend) - parameter name is
lamb - lamb=100 for annual data (standard)
compute_cycle_pearson_correlation(cycle1, cycle2)
Computes Pearson r using scipy.stats.pearsonr (returns PearsonRResult.statistic)
run_full_pipeline(pce_file, pfi_file, cpi_file, ...)
Complete end-to-end pipeline: parse -> deflate -> HP filter -> correlate -> output. Depends on evo-macro-data-ingestion for data parsing.
Usage
import sys
sys.path.insert(0, '/app/environment/skills/evo-macro-cycle-correlation/scripts')
from utils import run_full_pipeline
correlation = run_full_pipeline(
pce_file='/root/ERP-2025-table10.xls',
pfi_file='/root/ERP-2025-table12.xls',
cpi_file='/root/CPI.xlsx',
start_year=1973,
end_year=2024,
hp_lambda=100,
output_file='/root/answer.txt'
)
Technical Details
Deflation
- Formula: Real = (Nominal / CPI) * 100
- CPI base period doesn't matter for HP cycle analysis (log differences cancel it)
HP Filter
- Import:
from statsmodels.tsa.filters.hp_filter import hpfilter - Signature:
hpfilter(x, lamb=1600)- use lamb=100 for annual data - Returns:
(cycle, trend)tuple - Input must have NO NaN values
Pearson Correlation
- scipy.stats.pearsonr returns PearsonRResult object (scipy 1.14.1)
- Access correlation via
.statisticattribute - Output formatted with f"{value:.5f}" for exactly 5 decimal places
Year Range
- Use pandas .loc[1973:2024] for inclusive filtering
- .loc is inclusive of both start and stop labels
Signals
- GitHub stars
- 89
- Forks
- 4
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
evo-macro-cycle-correlation- Source
- github.com/openlair/openskill