Spatial DML and GWR on US wind turbines

Last updated: 2026-11-30

Open the web app. Read the plain-language explainer. Read the ERGIS oil well documentation for the original study and the method.

1. Overview

This study uses the method of the ERGIS oil well study on public US wind data. The question is: how much does the capacity factor of a new wind plant change for each 100 MW of older turbines nearby?

A plant is one EIA wind power plant: a group of turbines that reports generation together. The capacity factor (CF) of a plant is its generation divided by its capacity × 8,760 hours. An older turbine upwind slows the wind for the turbines behind it. This loss is a wake. Dense areas also share transmission lines. Thus the effect also contains curtailment: generation that the grid operator stops.

The study uses Double Machine Learning (DML) to remove confounding. The ERGIS documentation, section 2.3, gives the method. The study adds a GWR step that examines whether the effect changes with location.

The study has three parts:

2. Architecture

USGS USWTDBEIA-923 fetch(), load()data/wind/ build()Y, D, X, blocks run(), run_rings()from dml.py local_gwr()placebo() consoleGeoJSON Y = log capacity factor, D = older turbine capacity in 100 MW, X = confounders
Figure 1. Data flow in wind.py. The DML estimators are the functions of dml.py.

2.1 Steps

  1. fetch() downloads the USGS turbine database and the EIA-923 files for 2011 to 2024 one time. It keeps uswtdb.csv, gen.csv and VERSION in data/wind/.
  2. load() reads the onshore turbines and makes one row for each plant. A plant needs a known size and year for each turbine. Turbines with no recorded size get the mean size of turbines built within 2 years.
  3. build() selects the study plants and makes Y, D and X.
  4. run() and run_rings() from dml.py calculate the naive, PLR, IRM and ring estimates. wind.py gives them its own printed labels.
  5. local_gwr() fits a local regression at each plant on the PLR residuals. placebo() examines how many plants it marks by chance.

2.2 Variables

VariableDefinition
Study plantAn onshore plant whose turbines all came online in one year (one phase), from 2010 to 2023, with a CF for the next full year.
Outcome YNatural logarithm of the CF in the first full calendar year after the online year. CF values outside 0.05 to 0.70, and years from a repowering on, are removed.
Treatment DCapacity of turbines from an earlier project year within 10 km of each turbine of the plant, averaged over the turbines of the plant, in units of 100 MW.
Confounders XLongitude, latitude, online year, turbine count, hub height, rotor diameter, specific power, manufacturer code, log MW, and two resource values.
Resource valuesMean log CF, and number, of plant-years of other plants within 50 km, only in years before the study plant came online.
BlockA 100 km grid square (248 blocks). The folds and the clustered standard errors use the blocks.

2.3 GWR

Geographically weighted regression (GWR) fits one weighted regression at each location. Near points get large weights. local_gwr() uses these rules:

2.4 Web app

The web app is one HTML page with plain JavaScript and no build step. It uses the ArcGIS Maps SDK for JavaScript 5.2 from the CDN (<arcgis-map> component).

The app has three views. The URL hash selects the view: #/map, #/results and #/about. The map stays loaded below the other views.

3. Requirements

ItemRequirementVersion used for the results
Operating systemmacOS (the only system tested)Darwin 27.2.0, Apple silicon
uvInstalled and on the path0.13.10
Python3.12 or 3.13 (pyproject.toml)3.13.7
Python packagesduckdb with the excel extension, numpy, scikit-learn, scipyduckdb 2.0.1, numpy 2.5.5, scikit-learn 1.9.1, scipy 1.18.1
Wind dataInternet access for the first run. The script downloads approximately 300 MB and keeps 15 MB.USWTDB v9.1 (uswtdb_V9_1_20260928.csv), EIA-923 2011–2024 downloaded 2026-11-30
Web appA browser with WebGL and internet access to js.arcgis.comArcGIS Maps SDK for JavaScript 5.2 (latest release 5.2.9)

The study does not need the ERGIS database.

4. Installation

  1. Open a terminal.
  2. Go to the project folder.
    cd double-machine-learning
  3. Install the packages.
    uv sync
  4. Run the self-test. The first run downloads the wind data into data/wind/.
    uv run wind.py --selftest
    The last line shows selftest ok.

5. Configuration

5.1 Command-line options

OptionTypeDefaultEffect
--radius-kmnumber, km10The largest distance between a turbine of the study plant and an older turbine.
--ringsnumbers, km5 10 20 40Outer edges of the distance rings. They must be positive and in increasing order.
--yearstwo integers2010 2023First and last online year of the study plants. The outcome is the next calendar year.
--geojsonpathnoneIf set, the script writes the GWR effect of each plant to this GeoJSON file.
--neighboursintegernone (cross-validation)Sets the GWR bandwidth to this neighbour count. 0 is one global slope. The value must be less than the number of plants.
--geojson-forcedinteger and pathnoneAlso writes a second GeoJSON with the GWR fit forced to K neighbours. It uses the DML and ring estimates of the same run.
--placebointeger50Number of shuffle placebo repetitions. 0 stops the placebo.
--selftestflagoffRuns the self-test: five hand-made plants, then the real plant positions with synthetic outcomes.

5.2 Constants in wind.py

NameValueEffect
GEN_YEARS2011 to 2024EIA-923 years to download. Files before 2011 are .xls, which DuckDB cannot read.
PER100 MWUnit of D.
RESOURCE_KM50 kmSearch distance for the resource values.
BLOCK_KM100 kmBlock size for the folds, the clustered standard errors and the GWR cross-validation.
NEIGHBOURS25, 50, 100, 200, 400, 0Neighbour counts that the cross-validation compares. 0 is one global slope.
LABELSdictionaryPrinted labels for run() and run_rings(). dml.py has its own LABELS for wells.

6. Usage

6.1 Calculate the estimates

  1. Run the wind script with the default settings.
    uv run wind.py
  2. Examine the first line. It shows the data version from data/wind/VERSION.
  3. Examine the output. With the data of 2026-11-30, the output is:
    data: uswtdb_V9_1_20260928.csv; EIA-923 2011-2024 downloaded 2026-11-30
    US onshore wind: log capacity factor in the first full year, older turbine capacity within 10 km of each of the plant's turbines, online 2010-2023
    mean capacity factor 0.366
    plants 781  blocks 248  mean 100 MW of older turbines 0.69  share with older turbines 0.56
    effect on log(outcome):
    naive OLS, per 100 MW older turbines -0.0086  se 0.0026  95% CI [-0.0137, -0.0034]
    DML PLR, per 100 MW older turbines -0.0012  se 0.0039  95% CI [-0.0088, +0.0064]  out-of-fold R2: Y 0.48, D 0.04
    naive difference, older turbines nearby vs none +0.0239  se 0.0252  95% CI [-0.0255, +0.0732]
    DML IRM (ATE), older turbines nearby vs none +0.0014  se 0.0215  95% CI [-0.0408, +0.0435]  propensities clipped: 0.0%
    rings, mean 100 MW of older turbines: 0–5 km 0.20, 5–10 km 0.49, 10–20 km 0.92, 20–40 km 2.05
    naive OLS, per 100 MW older turbines 0–5 km +0.0030  se 0.0294  95% CI [-0.0547, +0.0607]
    DML PLR, per 100 MW older turbines 0–5 km +0.0288  se 0.0308  95% CI [-0.0315, +0.0891]  out-of-fold R2 D 0.06
    naive OLS, per 100 MW older turbines 5–10 km -0.0228  se 0.0173  95% CI [-0.0567, +0.0111]
    DML PLR, per 100 MW older turbines 5–10 km -0.0217  se 0.0171  95% CI [-0.0552, +0.0118]  out-of-fold R2 D 0.02
    naive OLS, per 100 MW older turbines 10–20 km +0.0116  se 0.0070  95% CI [-0.0022, +0.0253]
    DML PLR, per 100 MW older turbines 10–20 km +0.0117  se 0.0087  95% CI [-0.0054, +0.0288]  out-of-fold R2 D 0.29
    naive OLS, per 100 MW older turbines 20–40 km +0.0079  se 0.0066  95% CI [-0.0050, +0.0209]
    DML PLR, per 100 MW older turbines 20–40 km -0.0031  se 0.0051  95% CI [-0.0132, +0.0069]  out-of-fold R2 D 0.40
    GWR on the PLR residuals (per 100 MW older capacity):
      block-CV MSE by neighbours: 25 0.07962, 50 0.05716, 100 0.05277, 200 0.05226, 400 0.05200, global 0.05171
      chosen global (median bandwidth inf km), effective parameters 2.0, adjusted |t| > 1.96 (unadjusted 1.96)
      local slopes: median -0.0014, 10-90% [-0.0014, -0.0014]
      plants that differ from the overall -0.0014: adjusted 0.0%, unadjusted 0.0%
      shuffle placebo (50x): flagged adjusted 0.0%, unadjusted 0.0%
      calibrated |t| > 1.96: plants that differ 0.0%; fresh shuffles (50x) flag 0.0%

One run took 26 seconds on the test computer, with the data already downloaded (one measurement, 50 placebo repetitions). Two runs gave the same output.

The lines from effect on log(outcome) to the last ring have the same meaning as in the ERGIS documentation, section 6.2. "Per 100 MW older turbines" replaces "per parent". "Older turbines nearby vs none" replaces "child vs parent".

GWR lineMeaning
block-CV MSE by neighboursCross-validation error for each neighbour count. The smallest value selects the bandwidth.
chosenSelected neighbour count, median bandwidth in km, ENP and the adjusted critical |t|.
local slopesMedian and 10th to 90th percentile of the local effects.
plants that differ from the overallShare of plants whose local effect differs from the overall effect, with the adjusted and the usual 1.96 limit.
shuffle placeboThe same share after the residuals are moved to random plants. It shows the share that occurs by chance.

Caution: the USGS link always gives the newest release, and EIA revises recent years. If you remove data/wind/, the next run can download different data and show different numbers.

Other wind runs:

uv run wind.py --radius-km 5
uv run wind.py --neighbours 100
uv run wind.py --years 2015 2023
uv run wind.py --geojson data/wind/wind.geojson

6.2 Make the app data

  1. Write the plants with the GWR fit that cross-validation selects, and the forced local fit.
    uv run wind.py --geojson docs/wind-app/data/wind-cv.geojson --geojson-forced 100 docs/wind-app/data/wind-k100.geojson
    The run also writes the plants with a GWR fit forced to 100 neighbours. It uses the same DML estimate. Two lines show: wrote docs/wind-app/data/wind-cv.geojson: 781 plants and wrote docs/wind-app/data/wind-k100.geojson: 781 plants.

6.3 Open the web app

  1. Start a local web server.
    python3 -m http.server -d docs 8000
  2. Open http://localhost:8000/wind-app/ in a browser. The online copy is wind-app/ on this site.
  3. Select a value in the Color plants by list: capacity factor, older capacity within 10 km, or local effect.
  4. Select a fit in the GWR fit list. Selected by cross-validation shows the global slope. Forced local, k = 100 shows a local surface.
  5. Click a plant. A popup shows the name, state, online year, capacity, CF, older capacity and the local effect.
  6. Click Results to see the estimates, the rings, the cross-validation curve and the placebo.
  7. To stop the web server, press Ctrl+C in the terminal.

Caution: with the forced local fit, the colors show differences that cross-validation did not select. No plant differs from the overall effect with the adjusted α.

7. Results

7.1 Main estimates

All values use USWTDB v9.1 and EIA-923 2011–2024, 781 study plants and 248 blocks. Effects are on log CF for each 100 MW of older turbine capacity within 10 km. Measured on 2026-11-30, after the code audit fixes.

EstimateEffectStandard error95% interval
Naive OLS−0.00860.0026−0.0137 to −0.0034
DML PLR−0.0012 (−0.12%)0.0039−0.0088 to +0.0064
Naive difference, older turbines nearby vs none+0.02390.0252−0.0255 to +0.0732
DML IRM, older turbines nearby vs none+0.00140.0215−0.0408 to +0.0435

Mean CF is 0.366. The out-of-fold R² is 0.48 for Y and 0.04 for D. The confounders barely predict D. The IRM clipped no propensities. The DML PLR value is the median of 10 cross-fitting splits, with the better of gradient boosting and additive splines for each prediction. Before 2026-11-30, with gradient boosting only and one split, it was −0.0071 (0.0029), and its interval excluded zero.

7.2 Sensitivity

No variant shows a robust loss. Plants online 2015–2023 give −0.0072 (standard error 0.0031), but +0.0064 without the top 1% of D. Without the far West (longitude < −114.5°) the estimate is +0.0240 (0.0154). The earlier negative estimate depended on 8 plants at Tehachapi, California, with 1,433 to 2,542 MW of older turbines nearby, and on the lower capacity factors of the far West. The rings (0–5, 5–10, 10–20, 20–40 km) show no decrease with distance. The full report, section 5, gives all nine variants.

7.3 GWR

The block cross-validation selects one global slope. At a forced k = 100, no plant differs from the overall effect with the adjusted α. In the shuffle placebo, the analytic critical t marks 6.1% of plants by chance at k = 100. The run therefore calibrates the critical t from the placebo (4.23 at k = 100); a second placebo with new shuffles then marks 0.2%. The full report, section 6, gives the cross-validation errors and the placebo for each type of standard error.

7.4 Self-test

The self-test checks build() on five hand-made plants, then recovers a synthetic east–west surface on the real plant positions. DML removes 66% of the naive bias in the self-test design. The full report, section 7, gives each check and its limit.

Caution: with approximately 780 plants, DML removes only 34% of the bias under the strongest synthetic confounding tested (18% to 24% with gradient boosting only; a Gaussian process reaches 37%). The target was 50%. The self-test limits were set after the first scan.

8. Troubleshooting

SymptomCauseFix
wind.py: layout changed assertionEIA moved the columns of Page 1 in a year file.Examine row 6 of the file. Change the columns A, O, CR in fetch().
wind.py: download stops with a timeoutThe server did not answer in 60 seconds.Run the script again. It keeps the downloaded files and continues.
wind.py: a turbine size is still unknownA new USWTDB release has a turbine with no size and no turbine of known size within 2 years.Examine the turbine in uswtdb.csv. Extend the window in load().
--rings must be positive and strictly increasingThe ring edges are not in increasing order.Give the edges in increasing order, for example 5 10 20 40.
--neighbours must be 0 (global) or 1 to …The neighbour count is not less than the number of plants.Use a smaller value.
wind.pyThe wind script: download, plant data, GWR, self-test. It imports the estimators from dml.py.
The web app shows Could not load the dataThe GeoJSON files are not in docs/wind-app/data/, or the page was opened as a file.Make the app data (section 6.2). Use the web server (section 6.3).
The web app shows no mapThere is no access to js.arcgis.com.Examine the internet connection.

9. Limitations and next steps

9.1 Limitations

9.2 Next steps

10. Reference

10.1 Files

PathContents
wind.pyThe wind script: download, plant data, GWR, app data, self-test. It imports the estimators from dml.py.
dml.pyThe DML estimators: plr(), irm(), slope(), run(), run_rings().
data/wind/Downloaded data: uswtdb.csv, gen.csv, VERSION. Not in git.
docs/wind-app/The web app and its data.
WIND.mdThe full wind report.
DATASETS.mdPublic datasets to test the method.
docs/wind.htmlThis page.

10.2 Functions in wind.py

FunctionInputOutput
fetch()NoneDownloads the data one time into data/wind/
load()NoneTurbines, plants and CF for each plant-year, as dictionaries of arrays
build(turb, plants, cf, radius_km, years)Output of load(). radius_km can be a list of ring edges.Y, D, X, block numbers, longitude and latitude, row numbers of the study plants in the plant table
bandwidth(dkm, k)Distance matrix in km, neighbour countDistance to the k-th nearest plant for each plant. k = 0 gives infinity.
gwr(u, v, dkm, h, exclude)Residuals, distances, bandwidths, pairs to leave outLocal slope, HC3 standard error, hat diagonal, fitted values
local_gwr(u, v, ll, groups, alpha, k)PLR residuals, positions, blocksDictionary: k, bandwidths, cross-validation errors, local effects, standard errors, ENP, critical |t|, overall effect
placebo(u, v, g, reps, seed)Residuals and the output of local_gwr()Share of plants marked, with the adjusted α and with 1.96
write_geojson(path, ll, y, d, study, plants, g, meta)Positions, Y, D, row numbers of the study plants, the plant table, output of local_gwr(), resultsThe app data file
selftest()NonePrints the results. Stops with an error if a check fails.

10.3 App data format

Each file is a GeoJSON FeatureCollection in longitude and latitude. Each feature is one study plant.

PropertyTypeMeaning
plantintegerEIA plant id.
name, statetextUSWTDB project name and state, the most frequent value over the turbines of the plant.
yearintegerOnline year.
mwnumber, MWPlant capacity.
cfnumber, 0 to 1Capacity factor in the first full year.
older_mwnumber, MWD × 100: older capacity within 10 km, averaged over the turbines of the plant.
effect_pct, lo_pct, hi_pctnumber, percentLocal GWR effect on CF for each 100 MW and its 95% interval.
differs0 or 11 if the local effect differs from the overall effect with the adjusted α.

The top-level member meta holds the data version, the run settings, the overall DML effect (theta, se, effect_pct, lo_pct, hi_pct), the rings, and gwr: neighbour count, selected_by (cv or forced), median bandwidth in km (null for the global fit), the cross-validation errors, ENP, the critical |t| and the placebo shares.

10.4 Sources