Portfolio project · Energy economics
How solar reshaped the Texas power grid, and how well its demand can be forecast
Seven years of hourly data from ERCOT, the Texas grid operator, analyzed with SQL (DuckDB) and Python: demand, generation by fuel, prices, weather, and a day-ahead forecast scored against ERCOT's own on equal terms.
- 4.5×growth in the average evening ramp in net load (demand minus wind and solar), from 3.1 GW in 2019 to 13.8 GW in 2025
- 26%growth in ERCOT load from 2019 to 2025 at identical weather, about 3.9% a year
- 3.05%average error of my day-ahead forecast on 2024 to 2025 using only what was known at 9:30 am the day before, against 2.38% for ERCOT's 9:30 am posting and 8.53% for a same-hour-last-week baseline
- $36spring evening price premium over midday in 2025, per MWh, up from $2.50 in 2019
- −1.6 ptsdrop in gas's share of fossil generation when the gas price doubles (95% confidence interval 0.5 to 2.6), a link that looks weaker than in 2019
Electricity demand follows temperature
Hourly load on the Texas grid is U-shaped in temperature. It is lowest around 16 °C, when people need little heating or cooling, and climbs fastest in summer heat. The hours below −9 °C on the left of the chart are Winter Storm Uri, when load was shed by rolling outages rather than measured as true demand.
Open the interactive version → (large, about 1.4 MB)
Demand is growing, and weather isn't the reason
ERCOT's annual peak rose about 15% from 2019 to 2023 and then held nearly flat, with 2024's 85.5 GW only just above 2023. To find out whether that is growth or just hotter summers, I fit log hourly load on temperature (separately for each hour of the day), the calendar, and a year effect. The year effect is the change in load at identical weather.
- The growth is structural. At identical weather, load in 2025 was 26% higher than in 2019, almost exactly the raw 27%.
- Milder summers hid it. Summer-afternoon load at identical weather grew 18%, more than the raw peak (+12% by 2025), because the summers of 2024 and 2025 were milder than 2023.
- The fastest growth is in West Texas. From 2020 to 2023 the Far West zone (the Permian Basin oil field) grew 58% and the North zone 46%, against about 10 to 11% for the Dallas and Houston zones. That pattern is consistent with oil-field electrification and large new industrial loads such as crypto mining and data centers, though this data cannot separate them.
The duck curve has arrived in Texas
Solar output peaks at midday, when it pushes net load (demand minus wind and solar) down, then falls away just as people come home. Spring midday net load sank to about 21 GW in 2025, and the average daily maximum three-hour evening ramp grew from 3.1 GW in 2019 to 13.8 GW in 2025. The single steepest ramp rose from 13.4 GW to 30.1 GW. Solar's share of midday generation (11 am to 3 pm) went from 2.5% to 32.9%.
Over the same period total generation grew 27% (383 to 488 TWh). Coal fell from 20.4% to 13.0% of annual generation, gas stayed the largest source (41 to 47%), and wind plateaued near 24%.
Winter Storm Uri
Served demand peaked at 69.2 GW in the hour ending 8 pm on February 14, 2021. Over the next 54 hours generation fell 38.7% (68.0 to 41.7 GW): gas down 15.6 GW, wind 4.8 GW, coal 4.6 GW, and nuclear 1.4 GW. EIA reports served demand, so it fell in step, to about 43 GW.
ERCOT's own day-ahead forecast ran up to 28.9 GW above served demand, peaking at 76.8 GW, and 1,568 GWh above it over February 15 to 18. That gap is an upper bound on load shed, because it also includes forecast error and conservation.
Does the gas price move the generation mix?
Gas and coal compete for the load left after wind, solar, and nuclear, so I measure the gas share of fossil generation (gas divided by gas plus coal) by day. Uri is excluded, because its price spike came with forced outages, not economic dispatch.
Controlling for net load, month, and year, doubling the Henry Hub price cuts gas's share of fossil generation by 1.6 points (95% confidence interval 0.5 to 2.6, from a 72% average). Adding weather controls, a coal capacity proxy, or limiting the sample to mild days gives 1.6 to 2.1 points.
The link looks weaker than it was: 8.7 points per doubling in 2019 and 0.9 to 2.9 points since 2022, although the 2023 and 2024 estimates are each too noisy to tell from zero.
Why it faded: what this data can and can't say
The natural story is that coal retirements left less room to switch. I tested it with two proxies built from earlier days' coal output, and it only partly holds up:
- Lost capacity doesn't explain it. Peak coal output fell from about 12.6 GW to 10.3 GW, but price sensitivity doesn't vary with that measure (p = 0.62).
- Spare coal matters, but it hasn't trended down. Each extra GW of recent spare coal output adds about 2.0 points of switching per doubling (p < 0.001). Spare output was 3.6 GW in 2019 and 3.0 GW in 2025, with 4.1 GW in 2024.
- The fade survives both controls. Sensitivity still weakens by about 0.85 points per doubling each year (p = 0.005).
So I treat this as a description, not a causal estimate. Cold snaps and heat waves move gas prices, demand, and plant availability together, and Henry Hub is a national price, not what Texas plants pay. A Texas hub price and actual plant availability would be the next step; I did not find a free daily series for either.
Forecasting demand a day ahead
ERCOT posts its forecast at 9:30 am the day before delivery, so I built mine under the same rule. Load is known only through hour ending 9 am the day before, and weather comes from archived forecasts, using the newest model run already published at 9:30 am. My first version used actual temperatures and the previous day's full load. It scored 2.52%, but that comparison was not like for like, so it now appears only as a reference.
The model is gradient boosting that predicts the ratio of load to a baseline, the average of the same hour over the last 14 fully known non-holiday days. Its inputs are the calendar, forecast temperature, the previous morning's load, and recent weather. I trained on 2019 to 2023 and tested on 2024 to 2025. Inputs were compared by cross-validation across 2022 and 2023, and settings were tuned on 2023, which cut cross-validated error from 3.17% to 2.99%.
| Forecast | RMSE (MWh) | MAPE (%) |
|---|---|---|
| Baseline: same hour last week | 6,482 | 8.53 |
| Mine, 9:30 am information only | 2,238 | 3.05 |
| ERCOT 9:30 am posting | 1,810 | 2.38 |
| Reference: mine with hindsight on weather and load | 1,971 | 2.52 |
Test set: 17,489 hours scored by every forecast. ERCOT's forecast as filed with EIA scored 2.31% on the same hours; I compare against the API posting because its 9:30 am timing is documented.
How it compares with ERCOT
ERCOT wins clearly. My forecast beat its posting on 30% of days, and it trailed in both years (3.14% vs. 2.24% in 2024, 2.95% vs. 2.53% in 2025) and in every season. It removes about two-thirds of the baseline's error, which is the fair claim. Hindsight was worth about half a point: the same project scored 2.52% with it and 3.05% without.
The two forecasts also lean opposite ways. Mine under-forecasts by about 300 MWh on average, and ERCOT's over-forecasts by about 410 MWh.
Peak hours
Grid operators care more about the summer peak than about 3 am, so I scored those hours separately.
| Measure | Mine | ERCOT |
|---|---|---|
| Error, summer 4 to 8 pm | 3.05% | 2.39% |
| Error on the size of each day's peak | 2.98% | 2.46% |
| Days the peak hour was called exactly | 37% | 59% |
What drives the model
I shuffled each group of inputs on the test set to see how much accuracy falls.
- Weather dominates. Statewide forecast temperature (2.27 points) and recent weather (1.90) matter most, then the temperature over the baseline days (1.20), which tells the model what the baseline already reflects.
- The previous morning's load is the best load signal (1.14), ahead of day of week (0.79).
- Correlated inputs split the credit, so a low score for a city means it adds little beyond the others, not that it is irrelevant.
Recent weather is in the model because buildings hold heat and cold, so a hot night raises the next day's load. The evidence is uneven. Adding rolling temperature and the overnight low cut 2022 validation error from 3.65% to 3.34%, and left 2023 about the same (3.15% to 3.17%).
Holidays: a fix that didn't work
My model's first version anchored on yesterday's load, so the day after a holiday anchored on holiday-level demand. The baseline now skips holidays, but that did not help: error on holidays stayed at about 4.0%, and error in the two days after them was 3.47% with the fix against 3.39% without it. ERCOT scored 2.9% on both. A simpler fix, anchoring on a single day a week earlier, made holiday-period error worse in validation. With about ten holidays a year, this remains the model's clearest weak spot.
The ten biggest misses
| Date | Mine | ERCOT | Context |
|---|---|---|---|
| 2024-07-08 | 19.3% | 16.3% | Hurricane Beryl landfall near Houston; about 2.2 million customers lost power |
| 2024-01-15 | 14.1% | 4.8% | MLK Day, freezing; temperature forecast ran 6.8 °C warm |
| 2024-05-17 | 10.2% | 10.2% | Day after the Houston derecho |
| 2024-01-14 | 9.8% | 6.0% | Freezing; temperature forecast ran 7.0 °C warm |
| 2024-05-28 | 9.7% | 9.0% | Day after Memorial Day |
| 2024-07-09 | 9.1% | 9.7% | Beryl outages continuing |
| 2024-01-29 | 9.1% | 1.2% | No clear driver in the data |
| 2024-05-16 | 8.2% | 5.6% | Houston derecho |
| 2024-11-01 | 8.0% | 2.9% | No clear driver in the data |
| 2024-06-05 | 7.9% | 8.7% | No clear driver in the data; ERCOT missed too |
Mean absolute percentage error for the day. Temperature misses come from the data; Beryl and the derecho are labeled by hand. January 14 and 15 fall in the three weeks where the weather forecast comes from a backup model.
- Storms hit both forecasts. Outages take load off the grid, which no weather-to-demand model expects. ERCOT missed those days too.
- Cold snaps are where a weather forecast error costs most. On January 14 and 15, 2024, the temperature forecast was about 7 °C too warm and the model under-forecast by 6 to 10 GW.
Two bugs I found and fixed
Load levels as inputs. My first version also fed yesterday's and last week's load levels in as inputs. In 2019 to 2023 the model learned that unusually high-load days tend to be followed by drops. In 2024 and 2025, load is high every day because of growth, so it kept predicting drops that never came and under-forecast by about 1,000 MWh. Removing those inputs cut test error from 2.94% to 2.52%. I chose the change on the 2023 validation year, not the test set. I found it while testing whether commuters switching on heating and AC at 6 pm explained that hour's errors: it did not, and a correction for it made 6 pm slightly worse.
Row order in the gas regression. Newey-West standard errors assume rows are in time order, and my query didn't guarantee it. Sorting by date widened the confidence interval from 0.8 to 2.3 points to 0.5 to 2.6.
What this means for the industry
ERCOT's public day-ahead prices put numbers on the physical changes above.
- Evening flexibility is worth more. The spring evening premium over midday rose from $2.50 per MWh in 2019 to $35.70 in 2025. Across all seasons, the median gap between each day's two highest and two lowest hours rose from $28 to $46, a rough gross margin for a two-hour battery before losses. That favors batteries and fast-ramping gas, though more batteries would likely narrow the gap.
- West Texas has become a transmission question. The West hub averaged $1 to $5 per MWh below the North hub through 2022, and has run slightly above it since. West was at least $5 above North in 0.2% of hours in 2019 and 28.2% in 2025. That fits load growing faster than the wires serving it, the same region where zonal load grew 58%, though prices alone can't prove the cause.
- Uri's scale is hard to overstate. From February 14 to 19, 2021, day-ahead prices averaged about $6,500 per MWh of served demand, against $22 in the three weeks before. That values six days at $47 billion, more than 2.5 times all of 2019 ($18 billion). This is market value, not what customers paid, since hedges, real-time settlement, and later financing change the final bill.
Data and methods
Data
- Demand, generation, and forecast: EIA Open Data API (hourly ERCOT demand, ERCOT's own day-ahead forecast as filed on Form EIA-930, generation by fuel, and load by weather zone), 2019 to 2025: 61,368 hours.
- ERCOT's forecast, direct: ERCOT public API, 7-day load forecast by model and weather zone, 2024 to 2025, keeping the 9:30 am posting the day before each delivery day.
- Gas price: daily Henry Hub spot price from EIA.
- Weather: hourly temperature for eight Texas cities (Dallas, Houston, Midland, San Antonio, Austin, Corpus Christi, Tyler, Lubbock) from Open-Meteo, weighted by each city's weather zone's share of 2019 to 2023 load.
- Weather forecasts: archived GFS forecasts from Open-Meteo's Previous Runs API, from March 2021. Each delivery hour uses the 24-hour-old value if that run was out by 9:30 am, otherwise the 48-hour-old value.
- Prices: hourly day-ahead settlement prices at ERCOT's hubs, 2019 to 2025 (ERCOT report NP4-180-ER).
Pipeline
SQL files in DuckDB build a star schema (calendar and fuel dimensions, fact tables for load, generation, weather, forecast, and gas price) and a wide hourly modeling table with window-function features: a 7-day rolling average, hourly ramps, and lags. Python (pandas, scikit-learn, statsmodels) runs the models, regressions, and charts in Plotly. All timestamps are stored in UTC and converted to Central time only for calendar fields; EIA hourly values are hour-ending.
Data quality
The quality checks found one missing demand hour (the daylight-saving fall-back hour in 2021, interpolated and flagged), 122 hours on five days in 2019 to 2020 where gas generation was misfiled as "Other" (added back to gas and flagged), and no duplicate or negative values. The full table is in the repository README.
Limitations
- Weather forecast gaps: GFS's archive is missing December 30, 2023 to January 19, 2024, so those weeks use JMA, a less accurate model. Before March 2021, training rows use observed temperature plus a fixed offset.
- Timing assumptions: load through 9 am is treated as available by 9:30 am, and a model run as available four hours after it starts.
- No humidity: the archive has no dew point or humidity forecasts. Observed dew point would have cut validation error by about 0.15 points, but using it would bring back hindsight.
- Test set handling: notebook runs scored the test set before the last changes (adding recent weather, turning off early stopping), but I did not read those results until the design was final.
- ERCOT-wide demand only: eight cities stand in for statewide weather, and the North zone has no city.
- Served demand: during load shed, EIA demand understates true demand, so Uri is left out of model training.