Replication package for "Hydroelectric Generation and Wholesale Electricity Price Stabilization in Spain: Evidence from a Hydrological Instrument"

Published: 14 July 2026| Version 1 | DOI: 10.17632/65rcr8xwfv.1
Contributor:
Carlos Mario Gomez

Description

This dataset accompanies a study of how exogenous variation in water availability affects the wholesale electricity price in Spain. It contains 156 monthly observations for the Spanish peninsular power system from January 2012 to December 2024. The core hypothesis is that hydroelectric generation lowers wholesale prices through the merit order, but because reservoir operators respond dynamically to price signals, OLS estimates are biased. The dataset supports an instrumental-variables strategy in which the hydraulic producible — the electricity obtainable from observed precipitation, runoff and snowmelt, published by Red Eléctrica de España since 1920 — serves as a weather-driven, exogenous instrument for monthly hydroelectric generation. What the data show Wholesale prices range from 13.67 €/MWh (April 2024) to 283.30 €/MWh (March 2022, at the peak of the European energy crisis). Annual hydroelectric output varies by almost a factor of two, from 21,830 GWh in the drought year 2022 to 42,528 GWh in 2014. The producible tracks these fluctuations exogenously and predicts observed generation with a first-stage F-statistic of 87.5. The IV estimate is −0.665 €/MWh per GWh/day, 49 percent larger in absolute value than the OLS estimate, and robust across nine alternative specifications. The apparent amplification of the effect in dry years disappears once the 2021–22 gas crisis is excluded, indicating that the pass-through is stable across hydrological conditions once the gas-price regime is controlled. Data sources and construction Wholesale prices come from OMIE annual market reports. The hydraulic producible is from REE's historical monthly series. Hydroelectric, wind, solar and demand data combine REE's Informe del Sistema Eléctrico Español 2015 (2012–2015) with Ember Monthly Electricity Data (2016–2024). Natural gas TTF prices are from the IMF/FRED series PNGASEUUSDM converted to €/MWh. Monthly EUA prices for 2014–2024 are observed from public EU ETS data; 2012–2013 values are reconstructed from observed closing prices and cross-checked against Aleasoft and Agora Energiewende. Monthly mean temperature is from AEMET station data. Package contents Seven CSV data files, one Python replication script (replication.py), and a README with full documentation of sources, variable definitions, transformations and reconstruction procedures. Every table and figure in the paper is reproduced by running python code/replication.py from the package directory. A separate note in the README lists methodological caveats useful for reviewers, including the sensitivity of β(H) to alternative CO₂ series and the decomposition of the dry-year effect.

Files

Steps to reproduce

Environment setup The replication runs on Python 3.9 or higher. Install the following packages using pip or conda: pandas ≥ 1.5 numpy ≥ 1.23 statsmodels ≥ 0.14 openpyxl ≥ 3.0 Command: pip install pandas numpy statsmodels openpyxl We recommend a dedicated environment (venv or conda) to avoid version conflicts. Total installation time is typically 1–2 minutes. Package structure After downloading and extracting the ZIP archive, the folder replication_package/ contains: README.txt — full documentation code/replication.py — the single replication script data/ — seven CSV files with all input series (master dataset, gas TTF, CO₂ EUA, AEMET temperature, Ember generation, descriptive statistics) output/ — created automatically when the script runs; will contain the reproduced tables Reproduction command From inside the replication_package/ directory, run: python code/replication.py This single command reproduces all seven tables reported in the paper. Total runtime is approximately 15–30 seconds on a standard laptop. Tables are printed to standard output and simultaneously saved as CSV files in the output/ folder. What is reproduced The script produces: Table 1 — descriptive statistics for all variables Table 2 — main OLS and IV/2SLS estimates with Wu-Hausman and Wooldridge HAC endogeneity tests Table 3 — nine robustness tests (R1–R9), including HAC errors, temporal subsamples, alternative controls, temperature-augmented specification and placebo Table 4 — descriptive quantile regressions across five points of the price distribution Table 5 — subsample decomposition by water availability and gas-price regime (wet years, dry years, dry years excluding the 2021–22 gas crisis) Table 6 — counterfactual annual consumer savings relative to the 2022 dry reference year Table 7 — climate-change scenarios linking IPCC runoff projections to wholesale price impacts Expected key results IV estimate: β = −0.665 €/MWh per GWh/day (SE = 0.150, p < 0.001) First-stage F = 87.5 Wooldridge HAC-robust endogeneity test: χ² = 10.16, p = 0.001 CF1 accumulated savings 2012–2024: €34,140 million [16,490–51,791] Numerical values in the reproduced CSV files should match those reported in the paper to three decimal places. Minor differences at the fourth decimal may arise from small variations across statsmodels versions but do not affect any substantive conclusion. Troubleshooting If statsmodels fails to import with a _lazywhere error on Windows/Anaconda, upgrade both scipy and statsmodels together: conda install -c conda-forge scipy statsmodels. If running the script raises FileNotFoundError on a data file, verify that you are executing the command from the replication_package/ root, not from inside code/ or data/. On Windows, if you see Unicode encoding errors, run set PYTHONUTF8=1 before invoking the script.

Institutions

Categories

Energy Policy, Energy Economics of Transitional Economy

Licence