<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Isaac Land</title>
    <description>The latest articles on DEV Community by Isaac Land (@landisaac1).</description>
    <link>https://dev.to/landisaac1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4195271%2Fa19dce13-7ab3-47f9-aeca-1992c37c4838.png</url>
      <title>DEV Community: Isaac Land</title>
      <link>https://dev.to/landisaac1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/landisaac1"/>
    <language>en</language>
    <item>
      <title>IBM Updates Three Granite Speech Models</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Sat, 07 Nov 2026 12:05:47 +0000</pubDate>
      <link>https://dev.to/landisaac1/ibm-updates-three-granite-speech-models-5d2k</link>
      <guid>https://dev.to/landisaac1/ibm-updates-three-granite-speech-models-5d2k</guid>
      <description>&lt;h1&gt;
  
  
  IBM Updates Three Granite Speech Models
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnq51xozhb1krubc2eqcb.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnq51xozhb1krubc2eqcb.webp" alt="Close-up of a Shure MV7 microphone, launched in 2020 for podcast recording and live streaming" width="799" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Speech recognition models process speech picked up by microphones (illustrative photo). Photo: Panos Sakalakis; source: &lt;a href="https://commons.wikimedia.org/wiki/File:Shure_MV7_microphone.jpg" rel="noopener noreferrer"&gt;Wikimedia Commons&lt;/a&gt;; license: &lt;a href="https://creativecommons.org/licenses/by/2.0/" rel="noopener noreferrer"&gt;CC BY 2.0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On October 21, 2026, IBM published an update to its Granite Speech models on the Hugging Face blog. It added granite-speech-5.0-2b and updated two existing models, Turbo CTC and 4.1 2B Plus. All three are released under the Apache 2.0 license. On the Open ASR Leaderboard's English short-form audio benchmark, 5.0 2B has an average word error rate of 5.06%. By the leaderboard data, that places it 8th overall and 2nd among open-weight models, but the ranking mixes averages taken over different numbers of test sets.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Was Released and What Each Model Is For
&lt;/h2&gt;

&lt;p&gt;IBM's Granite speech team produced the release, and the blog byline includes researchers such as George Saon and Brian Kingsbury. The blog gives each of the three models a use case. 5.0 2B is for high-accuracy multilingual transcription and translation. Turbo CTC is for high-throughput and on-device transcription. 4.1 2B Plus is for multi-speaker recordings such as meetings and phone calls. The dates do not fully agree. The blog is dated October 21, but the 5.0 2B model card says October 20, and the discussion on the leaderboard PR shows the model was still not public on October 17. Which date counts as the official public release has yet to be verified.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Status in this release&lt;/th&gt;
&lt;th&gt;Parameter size&lt;/th&gt;
&lt;th&gt;Supported languages&lt;/th&gt;
&lt;th&gt;Main tasks&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;granite-speech-5.0-2b&lt;/td&gt;
&lt;td&gt;New release (model card date 2026-10-20)&lt;/td&gt;
&lt;td&gt;Named 2B; listed as 2.31B in leaderboard data&lt;/td&gt;
&lt;td&gt;Transcription: English, French, German, Spanish, Portuguese, Japanese; translation: between each of these languages and English, plus English-to-Italian and English-to-Chinese&lt;/td&gt;
&lt;td&gt;Speech recognition, speech translation, keyword biasing (up to 2000 words), punctuation and capitalization output on prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;granite-speech-5.0-470m-turboctc&lt;/td&gt;
&lt;td&gt;Multilingual update (2026-10-21; English version first released 2026-08-25)&lt;/td&gt;
&lt;td&gt;470 million&lt;/td&gt;
&lt;td&gt;English, French, German, Spanish, Portuguese, Italian, Japanese&lt;/td&gt;
&lt;td&gt;Speech recognition only; outputs punctuation and capitalization directly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;granite-speech-4.1-2b-plus&lt;/td&gt;
&lt;td&gt;Weight update (first released 2026-04-28, updated 2026-10-19)&lt;/td&gt;
&lt;td&gt;Named 2B; same architecture as 4.1 2B; exact parameter count yet to be verified&lt;/td&gt;
&lt;td&gt;English, French, German, Spanish, Portuguese&lt;/td&gt;
&lt;td&gt;Speech recognition, speaker-attributed transcription, word-level timestamps, keyword biasing; no punctuation or capitalization output&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The information in the table comes from the three official model cards, and all three models are licensed under Apache 2.0. Note that "Attribute" (speaker attribution) in the blog title refers to a capability of 4.1 2B Plus; the 5.0 2B model card does not list speaker labeling. 5.0 2B uses an intermediate checkpoint of granite-4.0-1b-base as its language model backbone. It was trained on about 390,000 hours of public audio, plus synthetic data created for Japanese recognition, keyword biasing, and translation. The model card recommends cutting long recordings into segments of about 2 minutes or less before transcription.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results Reported by IBM
&lt;/h2&gt;

&lt;p&gt;All figures in this section come from IBM's blog and model cards and are officially reported results. For 5.0 2B, the blog says its average word error rate (WER, lower is better) on the Open ASR Leaderboard's English short-form public test sets is 5.06%, which ranked 2nd among open-weight models as of October 21, 2026. For punctuation and capitalization, the blog says capitalization F1 ranges from 89.7 to 99.5. However, the model card table lists 5.0 2B's values as 90.16 to 99.51, and 89.71 is actually the score of the previous-generation 4.1 2B. Punctuation error rate went down on 7 of 9 test sets and rose slightly on CommonVoice English and French. Results for noisy and far-field conditions (the FFASR leaderboard), multilingual recognition, and speech translation appear only as charts in the model card. This article could not read the exact values, so they have yet to be verified.&lt;/p&gt;

&lt;p&gt;For Turbo CTC, the model card says the new multilingual version reaches an English average WER of 5.51%, better than the English-only version's 5.78%. It also notes that 5.51% is an unofficial result and that the leaderboard still lists the English-only version. The blog says the model reaches 19,870 RTFx on the leaderboard (processing speed as a multiple of the audio's real-time length), about 1.6 times the 12,600 it had at launch. In the leaderboard data read for this article, however, the entry is listed as 21,134.31. The two figures do not match, and the reason has yet to be verified.&lt;/p&gt;

&lt;p&gt;For 4.1 2B Plus, the blog compares the old and new versions (all figures are error rates, so lower is better):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Old version&lt;/th&gt;
&lt;th&gt;New version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Speaker attribution error rate WDER&lt;/td&gt;
&lt;td&gt;4.40&lt;/td&gt;
&lt;td&gt;4.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Error rate for transcription with speaker labels cpWER&lt;/td&gt;
&lt;td&gt;30.50&lt;/td&gt;
&lt;td&gt;28.48&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long-form audio WER&lt;/td&gt;
&lt;td&gt;13.53&lt;/td&gt;
&lt;td&gt;10.22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keyword WER with keyword biasing (20-word list)&lt;/td&gt;
&lt;td&gt;11.79&lt;/td&gt;
&lt;td&gt;6.48&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average timestamp shift AAS (all speech)&lt;/td&gt;
&lt;td&gt;210.86&lt;/td&gt;
&lt;td&gt;98.54&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The per-test breakdown in the model card shows the gains are not across the board. WDER got worse on FISHER (from 0.9 to 1.0) and CALLHOME English (from 2.2 to 3.0) but improved on AMI-SDM and GALE. On the leaderboard's revised English test sets, average WER rose from 6.01% to 6.10%. The model card does not explain how the blog's summary WDER values of 4.40 and 4.10 were calculated, so this has yet to be verified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where It Stands on the Open ASR Leaderboard
&lt;/h2&gt;

&lt;p&gt;The Open ASR Leaderboard is hosted under Hugging Face's hf-audio organization, and its result data are public in the open-asr-leaderboard-results dataset. On October 22, 2026, this article read english_short_latest.csv from that dataset. At the time, the latest commit was f3f9949, the one that added the 5.0 2B results. The English short-form leaderboard currently uses 9 public test sets: cleaned versions of AMI, Earnings22, Gigaspeech, and VoxPopuli; LibriSpeech clean and other; SPGISpeech; URGENT2024; and Voice Arena Monsoon (Indian English). The leaderboard does not state a formal methodology version number, so this has yet to be verified.&lt;/p&gt;

&lt;p&gt;This result does not rest on IBM's word alone. On October 14, IBM researcher gsaon opened PR #245 in the leaderboard's code repository and attached run logs from Hugging Face Jobs that showed an average WER of 5.06% across the 9 test sets. On October 19, repository collaborator Deep-unlearning said in a comment that they had run the public test sets independently on an H200 and got the same 5.06%. The PR was merged on October 21 and the result went live. However, the reproduction logs were not attached to the PR, and no results on the leaderboard's private test sets have been published. Both points have yet to be verified.&lt;/p&gt;

&lt;p&gt;When the CSV's average WER column is sorted from lowest to highest, 5.0 2B (5.06%) is 8th. Of the 7 entries above it, 6 are closed-source commercial services, and OtterAI speech-v3.1 (3.88%) is 1st. The only open-weight model among them is Microsoft's Phi-4-multimodal-instruct (5.02%, MIT license). Going by this column, the blog's claim of "2nd among open-weight models" matches the leaderboard data.&lt;/p&gt;

&lt;p&gt;The ranking does not compare like with like, however. This article recalculated each row from the per-test-set values in the CSV and found that the average column covers different numbers of test sets. For 5.0 2B it covers all 9. Phi-4-multimodal has no URGENT2024 result, so its average covers 8. For older entries such as the previous-generation 4.1 2B and Qwen3-ASR-1.7B-hf, the listed values match the average over 7 test sets, with the two LibriSpeech test sets left out. Averaged over the same 9 test sets, Qwen3-ASR-1.7B-hf scores 4.94%, lower than 5.0 2B's 5.06%. On the 8 test sets where Phi-4-multimodal has results, 5.0 2B averages 4.42%, lower than Phi-4-multimodal's 5.02%. In other words, with a consistent method 5.0 2B is still 2nd among open-weight models, but the model ahead of it is Qwen3-ASR-1.7B-hf. Its 8th place overall also depends on the method. These figures are this article's own calculations, not the leaderboard's official ranking. Why the leaderboard mixes different methods has yet to be verified.&lt;/p&gt;

&lt;p&gt;Compared with the previous generation on the same 9 test sets, 4.1 2B has an average WER of 5.35% and 5.0 2B has 5.06%. WER went down on 8 of the 9 test sets; only LibriSpeech other rose slightly, from 2.19% to 2.21% (this article's calculation from the CSV). The two models are about equally fast, with RTFx of 546.84 and 544.52 in the CSV, respectively. IBM reported an RTFx of 570.17 for 5.0 2B in the PR log. Whether the gap from the leaderboard figure comes from different hardware has yet to be verified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft58m6n4tjlpvgmvh75j2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft58m6n4tjlpvgmvh75j2.webp" alt="Short-window reassigned spectrogram of the English word open, showing how formants and glottal pulses are spread over time and frequency" width="800" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Spectrogram of the English word "open" being spoken (illustrative image). According to the Granite Speech 5.0 2B model card, its speech encoder takes log-mel spectrogram features as input, which are the same kind of time-frequency representation. Author: Kelly Fitz; source: &lt;a href="https://commons.wikimedia.org/wiki/File:Short-window_reassigned_spectrogram_of_speech.png" rel="noopener noreferrer"&gt;Wikimedia Commons&lt;/a&gt;; license: &lt;a href="https://creativecommons.org/licenses/by-sa/3.0/" rel="noopener noreferrer"&gt;CC BY-SA 3.0&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;IBM Granite. &lt;a href="https://huggingface.co/blog/ibm-granite/granite-speech-5" rel="noopener noreferrer"&gt;Granite Speech 5.0: Transcribe, Translate, and Attribute more Accurately and Faster&lt;/a&gt;. Hugging Face Blog, 2026-10-21.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IBM Granite. &lt;a href="https://huggingface.co/ibm-granite/granite-speech-5.0-2b" rel="noopener noreferrer"&gt;ibm-granite/granite-speech-5.0-2b model card&lt;/a&gt;. Hugging Face, accessed 2026-10-22.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IBM Granite. &lt;a href="https://huggingface.co/ibm-granite/granite-speech-5.0-470m-turboctc" rel="noopener noreferrer"&gt;ibm-granite/granite-speech-5.0-470m-turboctc model card&lt;/a&gt;. Hugging Face, accessed 2026-10-22.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IBM Granite. &lt;a href="https://huggingface.co/ibm-granite/granite-speech-4.1-2b-plus" rel="noopener noreferrer"&gt;ibm-granite/granite-speech-4.1-2b-plus model card&lt;/a&gt;. Hugging Face, accessed 2026-10-22.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hugging Face hf-audio. &lt;a href="https://huggingface.co/datasets/hf-audio/open-asr-leaderboard-results/blob/main/english_short_latest.csv" rel="noopener noreferrer"&gt;open-asr-leaderboard-results: english_short_latest.csv&lt;/a&gt;. Commit f3f9949, read 2026-10-22.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;huggingface/open_asr_leaderboard. &lt;a href="https://github.com/huggingface/open_asr_leaderboard/pull/245" rel="noopener noreferrer"&gt;Add granite-speech-5.0-2b (PR #245)&lt;/a&gt;. GitHub, merged 2026-10-21.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://study.scholay.com" rel="noopener noreferrer"&gt;Smart Academy&lt;/a&gt; · Your own academy for the age of intelligence&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiled and published by &lt;a href="https://www.scholay.com/t/M4ZZW8KRE5" rel="noopener noreferrer"&gt;Scholay All-in-One Academic Platform&lt;/a&gt;. If this content infringes your rights, please let us know and it will be taken down.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also published on &lt;a href="https://enterscholar.com" rel="noopener noreferrer"&gt;EnterScholar&lt;/a&gt;, a community of scholars for the age of intelligence&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>models</category>
      <category>news</category>
    </item>
    <item>
      <title>Bootstrap: Understanding Sampling with Replacement Through Five Numbers</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Thu, 22 Oct 2026 06:46:57 +0000</pubDate>
      <link>https://dev.to/landisaac1/bootstrap-understanding-sampling-with-replacement-through-five-numbers-3mp4</link>
      <guid>https://dev.to/landisaac1/bootstrap-understanding-sampling-with-replacement-through-five-numbers-3mp4</guid>
      <description>&lt;h1&gt;
  
  
  Bootstrap: Understanding Sampling with Replacement Through Five Numbers
&lt;/h1&gt;

&lt;p&gt;How can we estimate how much a sample mean might vary when we have only one sample? The bootstrap treats the observed sample as a small empirical distribution that we can sample from repeatedly. Draw the same number of records, calculate a mean, and repeat. The spread of these means gives us information about uncertainty.&lt;/p&gt;

&lt;h2&gt;
  
  
  One resample from five numbers
&lt;/h2&gt;

&lt;p&gt;Take the teaching example 2, 3, 4, 4, 7. Its mean is 4. Each of the five records has its own position: the two 4s are separate records. Randomly select one of the five positions, leaving that position available for later draws. Draw five times to obtain one bootstrap sample.&lt;/p&gt;

&lt;p&gt;For example, one resample might be 2, 2, 4, 7, 7. The original 3 is absent, 2 and 7 each appear twice, and only one of the two records containing 4 is selected. A selected record stays in the pool and can be selected again. After five draws, the sample size is still 5. This resample has a mean of (2 + 2 + 4 + 7 + 7) / 5 = 4.4. The next resample may have a different combination and a different mean.&lt;/p&gt;

&lt;h2&gt;
  
  
  A statistic for each resample
&lt;/h2&gt;

&lt;p&gt;If the target is a mean, calculate a mean each time. If the target is the correlation between two measurements, resample complete records and then calculate the correlation. Resampling the two measurements independently would destroy the pairing that we want to study.&lt;/p&gt;

&lt;p&gt;A histogram of the repeated statistics can show where they concentrate, whether the distribution is skewed, and whether a few extreme results occur. Their standard deviation can estimate the bootstrap standard error. More resamples make the computation more stable; the original sample still contains only the observations we started with.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should we resample?
&lt;/h2&gt;

&lt;p&gt;The simplest ordinary bootstrap applies when records can be treated as independent and identically distributed observations. Seven diary entries from one person belong to the same person; students in the same classroom may also be correlated. The research design should determine whether to resample people, groups, or time blocks. A row in a spreadsheet is not automatically the right resampling unit.&lt;/p&gt;

&lt;p&gt;Software interfaces reflect this distinction. R's &lt;code&gt;boot&lt;/code&gt; function takes data, a statistic function, and a number of replications. In ordinary resampling, row indices are passed to the statistic function. Understanding what each index represents matters more than increasing the replication count first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Report the settings and the limitations
&lt;/h2&gt;

&lt;p&gt;Record the original sample size, target statistic, resampling unit, number of replications, and random seed, then report the results. If constructing a confidence interval, specify the percentile, BCa, or other method used. Different constructions should not all be described simply as a "bootstrap interval."&lt;/p&gt;

&lt;p&gt;The bootstrap recombines records that have already been observed. If a sample misses a group of people, repeated resampling cannot create those missing people. For targets that depend strongly on the tails, such as a maximum or a range, check whether the method is suitable. Start with how the sample was obtained and what you want to estimate, then decide how to resample.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.itl.nist.gov/div898/handbook/eda/section3/bootplot.htm" rel="noopener noreferrer"&gt;NIST: Bootstrap Plot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stat.ethz.ch/R-manual/R-devel/library/boot/html/boot.html" rel="noopener noreferrer"&gt;R boot: Bootstrap Resampling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Translated and adapted from &lt;a href="https://metho.scholay.com/news/draft-8768aba0-2e3c-46e1-a0d3-d6a74e113082/" rel="noopener noreferrer"&gt;the original Chinese article on Metho&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://metho.scholay.com/" rel="noopener noreferrer"&gt;Metho · Research Methods&lt;/a&gt; — Rituals can be copied. Understanding cannot be faked.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://enterscholar.com/t/-/415593" rel="noopener noreferrer"&gt;Discuss this article on EnterScholar&lt;/a&gt; — A scholarly community for the age of intelligence.&lt;/p&gt;

</description>
      <category>statistics</category>
      <category>datascience</category>
    </item>
    <item>
      <title>How Wald Inferred Vital Areas from Returning Aircraft</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Thu, 22 Oct 2026 03:19:40 +0000</pubDate>
      <link>https://dev.to/landisaac1/how-wald-inferred-vital-areas-from-returning-aircraft-1aaa</link>
      <guid>https://dev.to/landisaac1/how-wald-inferred-vital-areas-from-returning-aircraft-1aaa</guid>
      <description>&lt;h1&gt;
  
  
  How Wald Inferred Vital Areas from Returning Aircraft
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94jyl4caqe8zciyjomo2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94jyl4caqe8zciyjomo2.webp" alt="The nose of a B-17 bomber blown open by an anti-aircraft shell, its metal skin curled and torn, with the aircraft parked on the ground" width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the Wikimedia Commons description, this is a B-17 of the U.S. 398th Bomb Group whose nose was destroyed by flak during a bombing raid on Cologne, Germany, on October 15, 1944. The plane still made it back to base. Image: U.S. Air Force (National Museum of the U.S. Air Force), via Wikimedia Commons; license: public domain.&lt;/p&gt;

&lt;p&gt;In 1943, Abraham Wald of Columbia University's Statistical Research Group (SRG) wrote a set of memoranda on how to estimate, using only the bullet holes on returning aircraft, the probability that a plane would be shot down after being hit in each of its parts. The popular story reduces this to a one-line quip: “reinforce wherever there are no holes.” Checked against the original memoranda and Mangel and Samaniego's 1984 interpretation, the actual reasoning was more subtle, and many of the details in circulation cannot be verified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Columbia University's Statistical Research Group
&lt;/h2&gt;

&lt;p&gt;The Statistical Research Group (SRG) was established on July 1, 1942, at Columbia University in New York. It was funded by the Applied Mathematics Panel (AMP) of the National Defense Research Committee (NDRC), which sat under the U.S. Office of Scientific Research and Development (OSRD). W. Allen Wallis, the group's director of research, recorded several figures in a 1980 retrospective article. Over its lifetime the group had 18 principal members and a total of 78 staff. At most about 50 people were on duty at once, including about 30 young women who worked only on computation. During the war the group produced 572 reports, memoranda and letters. Its members included Friedman, Savage, Mosteller, Wolfowitz and others who later became leading figures.&lt;/p&gt;

&lt;p&gt;Wald was born in 1902 in Cluj, in present-day Romania. He worked on pure mathematics in Vienna in his early years and turned to mathematical statistics in the mid-thirties. Later, after losing his position in Austria because he was Jewish, he made his way to the United States. Wallis recalled that in the fall of 1939, when Wald had just begun teaching at Columbia, he and Wolfowitz often attended Wald's evening lectures. Wald was a part-time member of SRG and took part in its work for about 30 months in total. His best-known achievement there was sequential analysis, which originated at SRG in 1943. According to Wallis, the classification of sequential analysis as secret had a side effect: Wald's naturalization application was approved quickly, making him one of the few “enemy aliens” to obtain U.S. citizenship during the war.&lt;/p&gt;

&lt;p&gt;Aircraft vulnerability was one of the topics that grew out of SRG's air-warfare research. In SRG's final report, written in 1945, Wallis wrote that this problem led the group to devise a method of “judging vulnerability from the damage sustained by our own planes.” Mangel and Samaniego summarize the operational problem of the time this way: commanders had to decide which tactics to use and which parts of the aircraft to give extra protection, but added armor increases weight and reduces a plane's ability to carry out its mission. The real difficulty was that no one could see how the bullet holes were distributed on the planes that failed to return.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Reasoning and Numerical Example in the Memoranda
&lt;/h2&gt;

&lt;p&gt;Wald's work took the form of a set of technical memoranda under the overall title “A Method of Estimating Plane Vulnerability Based on Damage of Survivors.” According to the Defense Technical Information Center's entry, these are eight memoranda that SRG wrote in 1943 for the National Defense Research Committee. They were not published during the war and were reprinted only in July 1980, by the Center for Naval Analyses (CNA), as CRC 432. The first few parts do not distinguish among parts of the aircraft. Using only the number of sorties, the number of planes that returned, and the number of hits on each returning plane, they derive the probability that a plane is downed by the i-th hit, along with upper and lower bounds on that probability. Part Five divides the aircraft into several “equal-vulnerability regions” and estimates the vulnerability of each part. Part Six deals with sampling error and gives 95% and 99% confidence limits.&lt;/p&gt;

&lt;p&gt;The numerical example in Part Five shows the line of reasoning most clearly. Wald supposes that 400 planes fly a bombing mission and 359 return. Of the returning planes, 240 were not hit, while 68, 29, 12 and 10 planes took 1 to 4 hits respectively, for a total of 202 hits. He adopts simplifying assumptions, such as “every hit has the same probability of downing the plane, regardless of how many hits came before.” Under these assumptions he first solves for the probability that a plane survives a single hit, which comes to about 0.85. He then divides the aircraft into the engine, the fuselage, the fuel system and other parts. He assumes that the probability of a single hit landing on a given part equals that part's share of the projected area facing the direction of enemy attack: engine 26.9%, fuselage 34.6%, fuel system 15.4%, other parts 23.1%.&lt;/p&gt;

&lt;p&gt;The hits on the returning planes, however, did not follow these proportions. The engine accounted for only 19.3% of them (39 hits), the fuselage 38.6% (78), the fuel system 15.4% (31), and other parts 26.7% (54). If a part's share of hits on surviving planes is lower than the share it “should” receive based on its area, then more of the planes hit there failed to return. By Wald's formula, the probability of surviving a single hit on a given part equals 0.85 multiplied by “actual share ÷ expected share.” That gives about 0.61 for the engine, about 0.95 for the fuselage, 0.85 for the fuel system, and about 0.98 for other parts. On this basis the memorandum states that, for the data of this hypothetical example, the engine area is the most vulnerable and the fuselage is relatively less vulnerable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8skdphh5pvfz5q6nlsgy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8skdphh5pvfz5q6nlsgy.webp" alt="Grouped bar chart comparing, for the engine, fuselage, fuel system and other parts, the share of hits expected from area with the actual share on returning planes; the engine's actual share is clearly lower" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The hypothetical example in Part Five of Wald's memoranda. The engine's share of hits on returning planes is lower than the share its area would predict, and its estimated single-hit kill probability is the highest. Data from Wald's (1943) memoranda, CNA 1980 reprint; chart drawn with code for this article.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Survivorship Bias Means and What It Assumes
&lt;/h2&gt;

&lt;p&gt;This is what later came to be called survivorship bias: whether an object makes it into the sample depends on the very outcome we want to study. The returning planes are not a random sample of all the planes that flew. They are only the ones that “could still fly home after being hit.” If you count holes on them, the places with the most holes are often the places that can best withstand fire. In a short 1980 piece responding to readers' comments, Wallis put the point plainly. The military was inclined to add protection to the parts of returning planes that had been hit most often. Wald, however, had good reason to assume that hits in combat were spread roughly evenly over the whole aircraft. Hits on vital parts would therefore be underrepresented on the returning planes, because planes hit in those parts were less likely to come back and supply data.&lt;/p&gt;

&lt;p&gt;Still, “reinforce where there are no holes” is only shorthand, and it holds only under one condition: we must first know how hits would have been distributed if no planes had been shot down. In Part Five, Wald specifically points out that the damage on returning planes alone cannot be used to estimate both the hit distribution and the vulnerability of each part. He gives an example. Suppose all the holes on returning planes fall in Region One. That could mean Region Two simply cannot be hit, or it could mean that any plane hit in Region Two goes down. The data cannot tell the two explanations apart. He therefore required the hit distribution to be known in advance. It could be inferred from the dispersion of enemy fire, or measured in firing tests with “dummy bullets.” In the numerical example, the proportions of projected area serve in its place.&lt;/p&gt;

&lt;p&gt;In other words, Wald was not comparing “holes versus no holes.” He was comparing “how many fewer holes than expected.” In his example the engine still had 39 holes, just fewer than its area would predict. If a spot has few holes only because it is small and rarely hit, that is no reason to conclude that hits there are more deadly. In their 1984 article, Mangel and Samaniego re-examined these memoranda using modern statistical theory and discussed them within the framework of missing data and approximation methods. They concluded that Wald's treatment of these problems “was definitive.”&lt;/p&gt;

&lt;h2&gt;
  
  
  Exaggerations and Unsupported Details in Popular Versions
&lt;/h2&gt;

&lt;p&gt;The popular version goes roughly like this. Looking at the pattern of holes on returning bombers, the military was about to reinforce the heavily hit fuselage. Wald pointed out on the spot that the sparsely hit engines were what needed reinforcing, and his advice was adopted. In 2016, the mathematician Bill Casselman checked this story point by point in his column for the American Mathematical Society. When it is compared with the original sources, its claims fall into three categories.&lt;/p&gt;

&lt;p&gt;The documented parts: Wald did write a set of memoranda at SRG on inferring vulnerability from damage to surviving aircraft. Wallis's 1980 rejoinder did say that the military was inclined to reinforce the parts of returning planes that had been hit most often, and it stated that these methods were later used by the Navy and the Air Force. CNA's note to the reprint and Mangel and Samaniego's article both mention that the method was still used to analyze data from the Korean and Vietnam Wars.&lt;/p&gt;

&lt;p&gt;The exaggerated parts: the memoranda are rigorous and highly technical mathematical derivations, and Casselman notes that they make no recommendation about what the military should do. The claim that “the engine is the most vulnerable” comes from the hypothetical data in Part Five. The text says explicitly that this conclusion applies to “this hypothetical example” and is not a finding measured in any actual campaign. Telling the story as a flash of insight also leaves out the assumptions Wald made to solve the identification problem, as well as the separate treatment he gave to sampling error.&lt;/p&gt;

&lt;p&gt;The unsupported parts: no original record currently supports the conversations and meeting scenes between Wald and military officers, or the so-called “Wald's hand-drawn bullet-hole diagram” that circulates online. Casselman originally found that the only reliable material on this work was two brief passages in Wallis's retrospective article that do not mention Wald by name, plus the memoranda themselves. He later added Wallis's rejoinder in an addendum. The red-dotted airplane diagrams commonly seen online were all drawn by others later, and some even show a C-47 transport, a plane that rarely saw combat.&lt;/p&gt;

&lt;p&gt;Chance also played a part in the memoranda becoming public nearly forty years late. Casselman quotes Phil DePoy of the Center for Naval Analyses on how this happened. When Wallis was moving house, he came across a box of loose papers left over from when SRG shut down in 1946 and handed it to DePoy. DePoy kept only one packet from it, Wald's material, edited it lightly, and published it under Wald's name in July 1980. Wald himself had died in 1950 in a plane crash in the mountains of southern India, and he left no recollections of his own about this work.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Wald, A. (1980). &lt;em&gt;A Reprint of "A Method of Estimating Plane Vulnerability Based on Damage of Survivors" by Abraham Wald&lt;/em&gt; (CRC 432). Center for Naval Analyses. Original memoranda written in 1943. &lt;a href="https://www.cna.org/reports/1980/0204320000.pdf" rel="noopener noreferrer"&gt;https://www.cna.org/reports/1980/0204320000.pdf&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Defense Technical Information Center. Entry ADA091073. &lt;a href="https://apps.dtic.mil/sti/citations/ADA091073" rel="noopener noreferrer"&gt;https://apps.dtic.mil/sti/citations/ADA091073&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mangel, M., &amp;amp; Samaniego, F. J. (1984). Abraham Wald's Work on Aircraft Survivability. &lt;em&gt;Journal of the American Statistical Association&lt;/em&gt;, 79(386), 259–267. &lt;a href="https://doi.org/10.1080/01621459.1984.10478038" rel="noopener noreferrer"&gt;https://doi.org/10.1080/01621459.1984.10478038&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wallis, W. A. (1980). The Statistical Research Group, 1942–1945. &lt;em&gt;Journal of the American Statistical Association&lt;/em&gt;, 75(370), 320–330. &lt;a href="https://doi.org/10.1080/01621459.1980.10477469" rel="noopener noreferrer"&gt;https://doi.org/10.1080/01621459.1980.10477469&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wallis, W. A. (1980). The Statistical Research Group, 1942–1945: Rejoinder. &lt;em&gt;Journal of the American Statistical Association&lt;/em&gt;, 75(370), 334–335. &lt;a href="https://doi.org/10.1080/01621459.1980.10477472" rel="noopener noreferrer"&gt;https://doi.org/10.1080/01621459.1980.10477472&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Casselman, B. (2016, June). The Legend of Abraham Wald. &lt;em&gt;AMS Feature Column&lt;/em&gt;. &lt;a href="https://www.ams.org/publicoutreach/feature-column/fc-2016-06" rel="noopener noreferrer"&gt;https://www.ams.org/publicoutreach/feature-column/fc-2016-06&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://metho.scholay.com" rel="noopener noreferrer"&gt;Research Methods&lt;/a&gt; · Rituals can be imitated; understanding cannot be faked&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiled and published by &lt;a href="https://www.scholay.com/t/M4ZZW8KRE5" rel="noopener noreferrer"&gt;Scholay, a one-stop academic platform&lt;/a&gt;. If this infringes your rights, please let us know and it will be taken down.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also published on &lt;a href="https://enterscholar.com" rel="noopener noreferrer"&gt;EnterScholar&lt;/a&gt;, a community for scholars in the age of intelligence&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Originally published: &lt;a href="https://metho.scholay.com/en/news/draft-20cbe2fc-53ef-4c08-a6d7-3a4ead859548/" rel="noopener noreferrer"&gt;How Wald Inferred Vital Areas from Returning Aircraft&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://enterscholar.com/t/-/415785" rel="noopener noreferrer"&gt;Discuss on EntScholar (Chinese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Metho · Research Methods — Rituals can be copied. Understanding cannot be faked.&lt;/p&gt;

</description>
      <category>data</category>
      <category>learning</category>
      <category>science</category>
    </item>
    <item>
      <title>The 1884 Weight Experiment Randomized with Playing Cards</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Thu, 22 Oct 2026 02:59:45 +0000</pubDate>
      <link>https://dev.to/landisaac1/the-1884-weight-experiment-randomized-with-playing-cards-kmn</link>
      <guid>https://dev.to/landisaac1/the-1884-weight-experiment-randomized-with-playing-cards-kmn</guid>
      <description>&lt;h1&gt;
  
  
  The 1884 Weight Experiment Randomized with Playing Cards
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxasje79s4d5txrc2jxa8.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxasje79s4d5txrc2jxa8.webp" alt="Black-and-white portrait photograph of Charles Sanders Peirce taken in 1891; he has a thick beard and wears a dark formal suit" width="800" height="1124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Charles Sanders Peirce (1839–1914), photographed in 1891. Image: Napoleon Sarony; original held by the New York Public Library; source: Wikimedia Commons; license: public domain.&lt;/p&gt;

&lt;p&gt;In October 1884, Peirce and his student Jastrow reported a set of weight-perception experiments to the US National Academy of Sciences: the experimenter used the color of cards from a shuffled pack to decide whether the pressure would be “first increased, then decreased” or “first decreased, then increased,” while the subject made judgments from behind a screen. Even when the subjects believed they had no confidence at all, their judgments were still clearly better than guessing. The experiment is often regarded as one of the earliest to use an explicit randomization scheme, but what it randomized was the order of trials, not group assignment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Dispute over the Difference Threshold, and the Apparatus
&lt;/h2&gt;

&lt;p&gt;From the mid-19th century onward, the psychophysics of G. T. Fechner assumed the existence of a “difference threshold” (Unterschiedsschwelle): when the difference between two stimuli falls below a certain proportion, people can no longer tell them apart. Peirce, who had long studied observational error at the US Coast Survey, held that the errors made in comparing two sensations arise from a great many tiny chance disturbances along the path of nerve conduction and should follow the error curve (the normal distribution); in that case, there would be no threshold. The two views yield different testable predictions. If a threshold exists, then for differences below it, right and wrong judgments should each make up half in the long run. If the theory of errors holds, then no matter how small the difference, the proportion of correct answers should be above half, and that proportion can be calculated in advance from the theory of errors.&lt;/p&gt;

&lt;p&gt;According to Hacking's research, the experiments were carried out between 10 December 1883 and 7 April 1884. Jastrow, then Peirce's student at Johns Hopkins University, recalled in 1914 that the problem, the apparatus, the method and the way of arriving at the results were all supplied by Peirce, and that the apparatus was set up in his own room. Both men served as subjects, each making 150 judgments in a session lasting about two hours.&lt;/p&gt;

&lt;p&gt;The apparatus was adapted from a Fairbanks postal scale. One end of the beam carried a small block fitted with a rubber cap, which pressed up from below against a finger of the subject's left hand; with a 1-kilogram weight on the scale pan, the finger bore a pressure roughly equal to one quarter of that weight. A separate small pan holding the “difference weight” could be lowered on or lifted off by a fine rubber band, increasing or decreasing the pressure without any sound or vibration. The difference weights were 60, 30 and 15 parts per thousand of 1 kilogram; later on, Jastrow switched to 20, 10 and 5 parts per thousand. In each trial, the subject had to judge whether the pressure had “increased then decreased” or “decreased then increased,” and was not allowed to answer “can't tell.” At the same time, the subject reported confidence on a scale from 0 to 3: 0 meant no inclination at all, and 3 meant the strongest assurance one could have about a sensation of this kind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ordering by Playing Cards and Concealment by a Screen
&lt;/h2&gt;

&lt;p&gt;The order in each trial was determined by playing cards. Each set of 25 trials used a pack of 25 cards, 12 red and 13 black, or the reverse, so that for a given difference weight, the 50 trials of one session had exactly 25 red cards and 25 black. Before each set, the pack was shuffled thoroughly, and the experimenter used the colors of the cards, turned up one after another, to decide whether each trial would be increase-then-decrease or decrease-then-increase. After the subject answered, the experimenter laid the card face down or face up depending on whether the answer was right or wrong, and, according to the confidence level, set it so that the corner bearing 0 to 3 punched holes pointed in a fixed direction. This meant no separate notes were needed and the pace was not slowed; the results were recorded all together once a set was finished.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr2cc53hz90ovr0g1tv1e.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr2cc53hz90ovr0g1tv1e.webp" alt="A metal postal scale made by the Fairbanks company, with a pan for letters and parcels, in the collection of the Smithsonian National Postal Museum" width="799" height="674"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A postal scale made by the Fairbanks company, in the collection of the Smithsonian National Postal Museum (date of manufacture unverified). Peirce and Jastrow modified a postal scale of the same brand; this image is for reference only and is not the scale used in the experiment. Image: Smithsonian National Postal Museum; license: CC0 1.0.&lt;/p&gt;

&lt;p&gt;The reason given in the paper was that this prevented the subject from making any psychological guess about which change the experimenter “might be likely to choose.” The authors also wrote about a side effect of the random sequence: long runs of the same kind of change, occurring by chance, would confuse the subject. They believed, however, that if long runs were deliberately excluded and the subject knew this, the resulting disturbance would be even greater. Hacking points out that the problem of long runs remained contested later, when Fisher promoted randomization, and that Peirce's use of two small packs with opposite numbers of red and black cards had in effect already limited the imbalance between red and black within a session.&lt;/p&gt;

&lt;p&gt;As for concealment, a screen hid all of the experimenter's movements, and the paper states that they took ample precautions against “unconsciously received hints.” It should be noted that this blinded only the subject. The experimenter could see the card colors and knew exactly how to add or remove weight each time, so he was not blind. The role of randomization was to take “which order to choose” out of the experimenter's hands, so that even if he fell into some rhythm, consciously or unconsciously, it could not affect the sequence of stimuli. Hacking's summary of the experiment is exactly this: weights were presented to subjects who could not see the manipulation, and randomization was used to guard against unconscious suggestion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accuracy of Low-Confidence Judgments
&lt;/h2&gt;

&lt;p&gt;The paper compared the number of errors in each set with the expected value calculated from the theory of errors, and concluded that, as far as could conveniently be traced, the error counts all conformed to the probability curve, thereby “destroying every presumption in favor of a difference threshold.” Even more striking is the confidence record in footnote 4 of the original:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Subject and difference weights&lt;/th&gt;
&lt;th&gt;Trials&lt;/th&gt;
&lt;th&gt;Overall error rate&lt;/th&gt;
&lt;th&gt;Share with confidence recorded as 0&lt;/th&gt;
&lt;th&gt;Error rate at confidence 0&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Peirce, 15/30/60 parts per thousand&lt;/td&gt;
&lt;td&gt;1,125&lt;/td&gt;
&lt;td&gt;29%&lt;/td&gt;
&lt;td&gt;63%&lt;/td&gt;
&lt;td&gt;38%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jastrow, 15/30/60 parts per thousand&lt;/td&gt;
&lt;td&gt;1,975&lt;/td&gt;
&lt;td&gt;23%&lt;/td&gt;
&lt;td&gt;57%&lt;/td&gt;
&lt;td&gt;30%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jastrow, 5/10/20 parts per thousand&lt;/td&gt;
&lt;td&gt;1,675&lt;/td&gt;
&lt;td&gt;32%&lt;/td&gt;
&lt;td&gt;93%&lt;/td&gt;
&lt;td&gt;34%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is the most telling: when the difference weight was only 5 to 20 parts per thousand, Jastrow marked more than nine in ten of his judgments as “no inclination at all,” yet about two-thirds of those judgments were still correct. On this basis, the authors argued that confidence reflects a “secondary sensation” of the difference between the two sensations. This secondary sensation likewise has no threshold, but subjects often overlook it, so much so that confidence was still recorded as 0 even when the rate of correct answers reached three-fifths. They also found that average confidence roughly followed m = c log(p/(1−p)), where p is the probability of a correct answer. As cited by Hacking, Stigler considered this possibly the earliest attempt to elicit subjective probability experimentally.&lt;/p&gt;

&lt;p&gt;The final paragraph of the paper pushed the conclusion further: people may gain knowledge of other people's minds through faint sensations of which they are not conscious, and “women's insight” and certain “telepathic” phenomena might perhaps be explained in this way. This paragraph is the authors' speculation; the experiment itself did not test it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Relation to Fisher's Randomization, and Limitations
&lt;/h2&gt;

&lt;p&gt;Calling it “one of the earliest randomized experiments” rests mainly on research in the history of science. As cited by Hacking, Stigler wrote in 1978 that this was the first experiment he knew of to be conducted according to a “precise, mathematically sound randomization scheme.” Hacking sums up its design as three innovations: deliberate randomization, not allowing subjects to answer “can't tell,” and confidence ratings from 0 to 3. By way of contrast, in Fechner's earlier weight-lifting experiments, Fechner himself served as the subject and knew in advance which box was heavier. Hacking also notes that the French physiologist Charles Richet independently used random card drawing in telepathy tests at about the same time, so “earliest” should be understood as among the earliest known.&lt;/p&gt;

&lt;p&gt;The practice was not handed down all the way to Fisher. Hacking found that the later psychophysics literature almost never mentioned randomization again. Fullerton and Cattell's 1892 study says only that trials were conducted in an “irregular order”; when Jastrow later gave a systematic account of the method, he did not mention randomization either; and the debate over Peirce's method centered on “not allowing ‘can't tell’ answers.” Fisher first publicly argued for the central role of randomization in 1926 in “The Arrangement of Field Experiments,” and his 1935 &lt;em&gt;The Design of Experiments&lt;/em&gt; made it textbook material. His reasons belonged to his own system of statistical inference: randomization gives error estimation and significance testing an objective basis and can improve the efficiency of experiments. Hacking states explicitly that he does not believe early psychical research had any important “influence” on Fisher; he points out only that the concern about chance long runs in the “lady tasting tea” example of &lt;em&gt;The Design of Experiments&lt;/em&gt; had already been raised by Peirce.&lt;/p&gt;

&lt;p&gt;Judged by the standards of modern design, the experiment has several limitations. First, it randomized the order of trials within the same subject; it did not randomly assign subjects to treatment and control groups. Dehue 1997 argues that the random group design took shape gradually in educational psychology during the 20s of the 20th century, and that McCall appears to have been the first to propose forming groups at random. Second, there were only two subjects, who were the authors themselves, and the experimenter was not blind. Third, the balanced packs themselves left a clue: a footnote in the paper admits that Jastrow's observational errors in the last two stages were abnormally small, partly because he unconsciously kept track of how many times each of the two changes had appeared in a set and answered accordingly. Fourth, practice effects made Jastrow's errors fall steadily, so the authors could only divide his data into four stages and compare them separately; and in the early experiments of December 1883 and January 1884, the procedure had not yet been perfected. Finally, the paper describes its data analysis in less detail than its data collection. Its inference relied mainly on comparing error counts with the theoretical values of the error curve, and the role of randomization in inference was not explicitly argued in the way Fisher would later argue it.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Peirce, C. S., &amp;amp; Jastrow, J. (1885). On Small Differences of Sensation. &lt;em&gt;Memoirs of the National Academy of Sciences&lt;/em&gt;, 3(1), 73–83 (read 17 October 1884). &lt;a href="https://philpapers.org/archive/PEIOSD.pdf" rel="noopener noreferrer"&gt;PhilArchive scan&lt;/a&gt;; &lt;a href="https://psychclassics.yorku.ca/Peirce/small-diffs.htm" rel="noopener noreferrer"&gt;Full text at Classics in the History of Psychology&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hacking, I. (1988). Telepathy: Origins of Randomization in Experimental Design. &lt;em&gt;Isis&lt;/em&gt;, 79(3), 427–451. &lt;a href="https://doi.org/10.1086/354775" rel="noopener noreferrer"&gt;doi:10.1086/354775&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stigler, S. M. (1978). Mathematical Statistics in the Early States. &lt;em&gt;The Annals of Statistics&lt;/em&gt;, 6(2), 239–265. &lt;a href="https://doi.org/10.1214/aos/1176344123" rel="noopener noreferrer"&gt;doi:10.1214/aos/1176344123&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dehue, T. (1997). Deception, Efficiency, and Random Groups: Psychology and the Gradual Origination of the Random Group Design. &lt;em&gt;Isis&lt;/em&gt;, 88(4), 653–673. &lt;a href="https://doi.org/10.1086/383850" rel="noopener noreferrer"&gt;doi:10.1086/383850&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;The Collected Papers of Charles Sanders Peirce&lt;/em&gt;, Vol. 7, editors' notes (including Jastrow's 1914 recollection). &lt;a href="https://isidore.co/misc/Res%20pro%20Deo/Peirce/Done/7.html" rel="noopener noreferrer"&gt;Electronic edition&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://metho.scholay.com" rel="noopener noreferrer"&gt;Research Methods&lt;/a&gt; · Rituals can be imitated; understanding cannot be faked&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiled and published by &lt;a href="https://www.scholay.com/t/M4ZZW8KRE5" rel="noopener noreferrer"&gt;Scholay, the one-stop academic platform&lt;/a&gt;. If any content infringes your rights, please let us know and it will be taken down.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also published on &lt;a href="https://enterscholar.com" rel="noopener noreferrer"&gt;EnterScholar&lt;/a&gt;, a community for scholars in the age of intelligence&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Originally published: &lt;a href="https://metho.scholay.com/en/news/draft-c9b6bf8b-5528-45fa-a55e-09a2e3becf2b/" rel="noopener noreferrer"&gt;The 1884 Weight Experiment Randomized with Playing Cards&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://enterscholar.com/t/-/415787" rel="noopener noreferrer"&gt;Discuss on EntScholar (Chinese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Metho · Research Methods — Rituals can be copied. Understanding cannot be faked.&lt;/p&gt;

</description>
      <category>data</category>
      <category>psychology</category>
      <category>science</category>
    </item>
    <item>
      <title>How Data Journalists Spotted Fabricated Polls</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Thu, 22 Oct 2026 02:59:06 +0000</pubDate>
      <link>https://dev.to/landisaac1/how-data-journalists-spotted-fabricated-polls-3ab9</link>
      <guid>https://dev.to/landisaac1/how-data-journalists-spotted-fabricated-polls-3ab9</guid>
      <description>&lt;h1&gt;
  
  
  How Data Journalists Spotted Fabricated Polls
&lt;/h1&gt;

&lt;p&gt;On October 20, 2026, Wedgewood Polls, an emerging American polling outfit, admitted on the social platform X that the vast majority of the polls it had published had no real survey data behind them. The admission was prompted by an investigation by the election-data site FiftyPlusOne: after obtaining its raw data, reporters found the sample was abnormally “clean,” and the respondent IDs and transaction IDs did not follow the patterns of the survey platform it claimed to use. This article reviews what happened, how the data were checked and how polling aggregators screen pollsters, and lists items readers can check for themselves.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhez380l01a74d644sqxm.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhez380l01a74d644sqxm.webp" alt="A sign reading “Vote Here” stands outside the polling place at Woodbury City Hall, Minnesota, on U.S. Election Day 2020" width="800" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The “Vote Here” sign outside the polling place at Woodbury City Hall, Minnesota, on U.S. Election Day, November 3, 2020. Photo: Tony Webster. Source: Wikimedia Commons. License: CC BY 2.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happened with Wedgewood
&lt;/h2&gt;

&lt;p&gt;According to Newsweek and The Guardian, Wedgewood Polls appeared in June 2026, describing itself as an independent election pollster. One of its earlier polls, on Louisiana’s Republican Senate primary, showed John Fleming leading Julia Letlow by 4 percentage points, while in the actual result on June 27 Letlow won by nearly 14 percentage points. On July 10, Washington Monthly columnist Bill Scher pointed out that the new outfit’s first poll had been wildly wrong.&lt;/p&gt;

&lt;p&gt;On August 20, Straight Arrow News reported on its background: its website was built on Google Sites and listed no staff names, phone number or location; the site was registered on June 26, and its only social media account, on X, was also created in June. Wedgewood described itself as a two-person team that had not yet incorporated as a company. It declined to reveal who its members were on the grounds that one of them had been harassed online, and it also refused video calls. At the time, The New York Times’ polling database already included its results, but with the note “this pollster does not meet our criteria for select pollsters.”&lt;/p&gt;

&lt;p&gt;In mid-October, Wedgewood released a Mississippi Senate poll: conducted October 12 to 14 among 511 likely voters, it showed incumbent Republican Senator Cindy Hyde-Smith leading Democrat Scott Colom by only 52% to 48%. According to Magnolia Tribune, Colom’s campaign promptly cited the poll in a press release. FiftyPlusOne’s Mary Radcliffe, G. Elliott Morris and Cooper Burton had received multiple tips about Wedgewood before, but this time the tip came with evidence, so they asked Wedgewood for the poll’s raw data. On October 20, FiftyPlusOne sent its findings to Wedgewood for comment. Rather than answer the questions, Wedgewood posted a statement on X admitting that the vast majority of its polls were not backed by real data. It called this a “social experiment” to expose gaps in how media outlets and aggregators vet pollsters, and said that only one crowdfunded Nebraska poll was real. For now, both the “social experiment” motive and the claim that the Nebraska poll was real rest only on Wedgewood’s own account.&lt;/p&gt;

&lt;p&gt;Afterward, The New York Times removed all of Wedgewood’s polls from its poll tracker, Decision Desk HQ deleted 17 of them from its race lists and averages, Silver Bulletin announced a permanent ban, and Newsweek retracted 3 articles and corrected other coverage. Michigan State Senator Mallory McMorrow said that a Wedgewood poll in late June showing her support falling into single digits dried up her campaign donations and hurt her volunteers’ morale; she withdrew from the Senate primary on July 5. This account of the poll’s impact is her own.&lt;/p&gt;

&lt;h2&gt;
  
  
  FiftyPlusOne’s Data Check
&lt;/h2&gt;

&lt;p&gt;According to FiftyPlusOne’s report (as quoted on Gelman’s blog), the reporters’ first impression on obtaining the raw data was that it was “surprisingly clean.” The unweighted sample was 67% white and 31% Black, already quite close to reasonable estimates for Mississippi (about 60% and 37%); the poll’s design effect was only 1.18. The design effect measures “how hard” the weighting has to work to make the sample representative: the more skewed the sample, the more spread out the weights must be, the higher the design effect, and the smaller the effective sample size. For example, if a sample has far too few young people, the few young respondents must be given very large weights, which amounts to letting a handful of people speak for a large group. By the usual conversion, 511 respondents with a design effect of 1.18 amount to an effective sample of about 433, a very small loss for an online survey.&lt;/p&gt;

&lt;p&gt;A low design effect does not by itself mean fabrication. If quotas are set during recruitment, requiring the platform to return respondents from each group in proportion to the population, the raw sample can also be very close to the population. FiftyPlusOne therefore asked Wedgewood whether it had used quotas, because as far as they understood, quotas seemed to be the only way to control sample composition on Pollfish while a survey is in the field. Wedgewood said it had not, which made the unusually low design effect harder to explain. But the reporters also stated that this was still not enough to prove the data were made up.&lt;/p&gt;

&lt;p&gt;The decisive evidence came from IDs automatically generated by the survey platform. Wedgewood said the poll had been conducted through the online survey platform Pollfish, so FiftyPlusOne paid out of its own pocket to replicate the Mississippi survey on Pollfish as closely as possible and obtain real data for comparison. In the real data, about half of the respondent IDs were plain strings of digits (e.g., “1234567890”) and half had a hyphen prefix (e.g., “-1234567890”); the transaction IDs tracked the time respondents submitted the questionnaire almost perfectly (in the report’s words, “almost 1:1 correlated”). The reporters confirmed with Pollfish that this was exactly the expected behavior of these two columns, and checked data from another organization that had used the platform, finding the same patterns. The data Wedgewood provided matched neither pattern, nor the platform’s description of these two columns.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg8jcpx8h73ugbtdilsdn.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg8jcpx8h73ugbtdilsdn.webp" alt="Several sets of scatter plots labeled with correlation coefficients; in the first row, from 1 to -1, the points go from lying on a straight line to a patternless cloud and back to a slanted line" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example scatter plots for different correlation coefficients: at the far left of the first row the correlation is 1 and the points fall on a straight line; in the middle it is 0 and the points form a patternless cloud. According to the report, the relationship between transaction IDs and submission times in real Pollfish data is close to the former. This is a generic illustration, not data from FiftyPlusOne or Wedgewood. Image: DenisBoigelot (original uploader Imagecreator). Source: Wikimedia Commons. License: CC0.&lt;/p&gt;

&lt;p&gt;It is a bit like checking a receipt: a forger can make the amount and items look very convincing, but is unlikely to think of imitating the fixed format of the cash register’s serial numbers or the way they increase over time. FiftyPlusOne stated that the ID patterns were only two of the “many factors” that raised its suspicions. The rest is in the paywalled part of the original article, which the author of this article was unable to read. In the freely available part, the report does not mention statistical tests such as checking the distribution of final digits.&lt;/p&gt;

&lt;p&gt;Before this data check, FiftyPlusOne says it had already checked Wedgewood’s identity: Wedgewood provided two names, one of whom was independently confirmed to have worked in polling, and the reporters also read the methodology description on its website closely. In its statement, Wedgewood accused FiftyPlusOne, The New York Times and other aggregators of failing to vet properly; FiftyPlusOne says this claim is false. Silver Bulletin also says Wedgewood had previously answered questions from several aggregators about its identity, methods and funding, which is why it was included. Judging by the outcome, vetting based on self-reported materials was circumvented, and what ultimately worked was checking at the level of raw data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aggregators’ Screening Rules and the Blog Commentary
&lt;/h2&gt;

&lt;p&gt;Polling aggregators usually do not audit raw data poll by poll; instead they decide whether to include a pollster, and how much weight to give it, based on the pollster’s characteristics. The explanation on The New York Times’ polling page says that pollsters that meet at least two of the following three criteria and conduct surveys for nonpartisan sponsors are classified as “select pollsters”: an accurate track record in recent elections; membership in professional polling organizations; and use of probability sampling. These factors affect each poll’s weight in the average. Wedgewood did not meet this standard, so although it was included, its polls always carried the “does not meet the criteria” notice.&lt;/p&gt;

&lt;p&gt;Silver Bulletin’s explanation says its averages distinguish between registered voters and likely voters, adjust for each pollster’s systematic lean (house effect), and give more weight to more reliable polls; most of its election polls are drawn from The New York Times’ database. Rules like these rely mainly on pollsters’ self-reported information and track records. A new pollster has no track record yet and can fabricate its self-reported information, so this kind of screening can only do so much. FiftyPlusOne also warns in its report that AI tools make it increasingly easy to generate websites, PDFs and tables, so fakers can make their materials look as polished as those of legitimate research organizations.&lt;/p&gt;

&lt;p&gt;On his blog, Gelman praised this as a successful application of data-journalism methods and offered two personal comments. First, Wedgewood said it was an “experiment” only on the very day it was exposed, which he considers “a bit suspicious.” Second, he reiterated a view he first put forward in 2004: there are too many polls in the United States, even counting only legitimate ones. The sheer number of polls wastes respondents’ time and also makes people less willing to take part in surveys that serve the public good, such as public health surveys. Polls and “horse-race” election coverage that cares only about who is ahead feed each other: polls supply headlines for such coverage, and such coverage spawns more polls. Fake polls mixed in only make things worse. These are Gelman’s views, not conclusions of the investigation itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Items Readers Can Check
&lt;/h2&gt;

&lt;p&gt;The American Association for Public Opinion Research (AAPOR) Transparency Initiative lists the elements that should be disclosed when survey results are published; the initiative only requires disclosure and does not judge methodological quality. In light of this episode, when readers come across an unfamiliar poll, they can check the following items one by one. Note that these are only screening clues: meeting all of them does not prove the data are real. Wedgewood itself passed some vetting.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Who conducted it and who paid&lt;/strong&gt;: whether the sponsor and the organization that carried out the survey are named; whether it was commissioned by a candidate, party or advocacy group.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whether the organization can be verified&lt;/strong&gt;: whether there are verifiable names of those in charge, an address and a phone number; when the website and social media accounts were created; whether it belongs to professional polling organizations or the AAPOR Transparency Initiative.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Track record&lt;/strong&gt;: how far the organization’s past polls were from actual election results. Wedgewood’s earlier Louisiana poll even got the leader wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sampling method&lt;/strong&gt;: whether it used probability sampling or an opt-in online sample; which platform, list or panel the sample came from.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Questionnaire, timing and population&lt;/strong&gt;: whether the exact question wording, interview dates, target population (all adults, registered voters or likely voters) and sample size are published.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weighting and error&lt;/strong&gt;: whether it explains which variables were used for weighting; whether the margin of error accounts for the design effect. Under AAPOR’s requirements, a nonprobability sample that does not describe the model used should not report a measure of precision, and should instead explain why none is provided.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data quality control&lt;/strong&gt;: whether it describes measures such as attention checks, removing respondents who answer too quickly, and preventing duplicate responses, and whether AI was used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whether the results and timing are too convenient&lt;/strong&gt;: whether the results happen to play into hot topics in public discussion, and whether the release timing is suspiciously convenient; when the raw data are available, whether the sample is abnormally “clean.” Clues like these only signal that further checking is needed; they are not, on their own, evidence of fabrication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Generally only journalists and aggregators can check raw data, and only if they can obtain the data and have comparable real data as a reference. In this case, FiftyPlusOne ran its own survey on the same platform and compared the suspect data against the “fingerprint” of real data. For ordinary readers, the more practical course is to pay attention to how aggregators label pollsters and to treat polls of unclear origin with only a single result with caution.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Andrew Gelman. &lt;a href="https://statmodeling.stat.columbia.edu/2026/10/20/legit-political-reporters-use-data-journalism-techniques-to-catch-fake-pollsters-at-wedgewood-polls/" rel="noopener noreferrer"&gt;Real political reporters use data journalism techniques to catch fakers at “Wedgewood Polls”&lt;/a&gt;. Statistical Modeling, Causal Inference, and Social Science, 2026-10-20.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mary Radcliffe, G. Elliott Morris, Cooper Burton. &lt;a href="https://blog.fiftyplusone.news/p/fiftyplusone-just-caught-a-pollster" rel="noopener noreferrer"&gt;FiftyPlusOne just caught a pollster faking data — and they copped to it&lt;/a&gt;. FiftyPlusOne, 2026-10-20.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lucy Campbell. &lt;a href="https://www.theguardian.com/us-news/2026/oct/21/polling-fabricated-data-social-experiment" rel="noopener noreferrer"&gt;Pollster admits to fabricating data for ‘social experiment’ to expose flaws of industry&lt;/a&gt;. The Guardian, 2026-10-21.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Newsweek Editors. &lt;a href="https://www.newsweek.com/fake-polling-firm-duped-media-in-social-experiment-12599153" rel="noopener noreferrer"&gt;Fake Polling Firm Duped Media in ‘Social Experiment’&lt;/a&gt;. Newsweek, 2026-10-21.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Azi Paybarah. &lt;a href="https://san.com/cc/pollsters-weather-storm-of-fake-data-secret-sponsorships-with-some-afraid-to-give-names/" rel="noopener noreferrer"&gt;Pollsters weather storm of fake data, secret sponsorships, with some afraid to give names&lt;/a&gt;. Straight Arrow News, 2026-08-20.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Frank Corder. &lt;a href="https://magnoliatribune.com/2026/10/20/poll-pushed-by-colom-claiming-senate-race-with-hyde-smith-is-tied-was-fake-fabricated/" rel="noopener noreferrer"&gt;Poll pushed by Colom claiming Senate race with Hyde-Smith is “tied” was fake, fabricated&lt;/a&gt;. Magnolia Tribune, 2026-10-20.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nate Silver, Eli McKown-Dawson. &lt;a href="https://www.natesilver.net/p/nate-silver-2026-midterm-election-polls-model" rel="noopener noreferrer"&gt;2026 Midterm Election Forecast: Senate &amp;amp; House&lt;/a&gt;. Silver Bulletin, updated 2026-10-21.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The New York Times. &lt;a href="https://www.nytimes.com/interactive/polls/donald-trump-approval-rating-polls.html" rel="noopener noreferrer"&gt;President Trump Approval Rating: Latest Polls (About our polling averages)&lt;/a&gt;. Publication date not stated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;American Association for Public Opinion Research. &lt;a href="https://aapor.org/standards-and-ethics/transparency-initiative/" rel="noopener noreferrer"&gt;Transparency Initiative&lt;/a&gt;. Accessed 2026-10-22.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://metho.scholay.com" rel="noopener noreferrer"&gt;Research Methods&lt;/a&gt; · Rituals can be imitated; understanding cannot be faked&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiled and published by &lt;a href="https://www.scholay.com/t/M4ZZW8KRE5" rel="noopener noreferrer"&gt;Scholay, the all-in-one academic platform&lt;/a&gt;. If any content infringes your rights, please let us know and it will be taken down.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also published on &lt;a href="https://enterscholar.com" rel="noopener noreferrer"&gt;EnterScholar&lt;/a&gt;, a community for scholars in the age of AI&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Originally published: &lt;a href="https://metho.scholay.com/en/news/draft-946e4c85-e2d7-4f9e-942e-c401c1757775/" rel="noopener noreferrer"&gt;How Data Journalists Spotted Fabricated Polls&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://enterscholar.com/t/-/415789" rel="noopener noreferrer"&gt;Discuss on EntScholar (Chinese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Metho · Research Methods — Rituals can be copied. Understanding cannot be faked.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>data</category>
      <category>news</category>
    </item>
    <item>
      <title>Regression discontinuity designs break in six common ways</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Wed, 21 Oct 2026 11:33:56 +0000</pubDate>
      <link>https://dev.to/landisaac1/regression-discontinuity-designs-break-in-six-common-ways-3kjd</link>
      <guid>https://dev.to/landisaac1/regression-discontinuity-designs-break-in-six-common-ways-3kjd</guid>
      <description>&lt;p&gt;Regression discontinuity (RD) is one of the most credible designs for causal inference from observational data. When a rule assigns treatment based on whether a score crosses a cutoff (a scholarship for test scores above 80, a programme for towns under a population threshold, a policy on one side of a border), people just above and just below the cutoff should be comparable. Any jump in outcomes at the cutoff can then be attributed to the treatment.&lt;/p&gt;

&lt;p&gt;But a jump in a plot is not the same thing as a credible effect. This post goes through the mistakes that most often undermine RD analyses and the tools that help avoid them.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick refresher
&lt;/h2&gt;

&lt;p&gt;The variable that determines treatment is the &lt;strong&gt;running variable&lt;/strong&gt; (also called the forcing variable or score). RD comes in two forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sharp RD&lt;/strong&gt;: treatment switches on completely at the cutoff.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fuzzy RD&lt;/strong&gt;: crossing the cutoff only changes the &lt;em&gt;probability&lt;/em&gt; of treatment. The effect is estimated as the jump in the outcome divided by the jump in treatment take-up, which is essentially an instrumental-variables estimate at the cutoff. It needs a non-zero first stage, an exclusion restriction, and monotonicity, and it identifies a local effect for compliers near the cutoff.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key identifying assumption is not that the observed outcome is smooth. It is that the &lt;em&gt;potential outcomes&lt;/em&gt;, meaning what would happen with and without treatment, change smoothly through the cutoff. Lee and Lemieux (2010) give an accessible treatment, and the design itself goes back to Thistlethwaite and Campbell (1960).&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 1: fitting high-order global polynomials
&lt;/h2&gt;

&lt;p&gt;A common older practice was to fit a 4th-, 5th-, or 6th-degree polynomial to the whole range of the running variable on each side and read off the gap at the cutoff. Gelman and Imbens (2019), in the &lt;em&gt;Journal of Business &amp;amp; Economic Statistics&lt;/em&gt;, argue strongly against this, for three reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Global polynomials put surprisingly large and erratic weight on observations far from the cutoff.&lt;/li&gt;
&lt;li&gt;Estimates are sensitive to the polynomial order.&lt;/li&gt;
&lt;li&gt;Confidence intervals tend to be too narrow, so real coverage falls short of the nominal level.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Better:&lt;/strong&gt; use local linear (or local quadratic) regression within a bandwidth around the cutoff, with a triangular kernel that gives more weight to points near the threshold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 2: choosing the bandwidth by eye (or by result)
&lt;/h2&gt;

&lt;p&gt;How much data on either side of the cutoff should you use? A narrow window reduces bias but increases variance. A wide window does the opposite. Trying several bandwidths and reporting the one with the cleanest result is a garden of forking paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Better:&lt;/strong&gt; use a data-driven, MSE-optimal bandwidth selector and report it up front. Then show sensitivity to, say, half and double that bandwidth as a robustness check, not as a menu to choose from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 3: conventional confidence intervals with an optimal bandwidth
&lt;/h2&gt;

&lt;p&gt;Here is a subtle one. MSE-optimal bandwidths are, by construction, wide enough that some bias remains. Conventional confidence intervals ignore that bias, so they under-cover. Calonico, Cattaneo and Titiunik (2014), in &lt;em&gt;Econometrica&lt;/em&gt;, proposed &lt;strong&gt;robust bias-corrected&lt;/strong&gt; confidence intervals that account for this. They are now standard, and implemented in the &lt;code&gt;rdrobust&lt;/code&gt; package for R, Stata, and Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rdrobust&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rdrobust&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="c1"&gt;# local linear, MSE-optimal bandwidth&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="c1"&gt;# report the robust bias-corrected CI&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;rdplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="c1"&gt;# binned scatter with local fits&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Report the point estimate together with the robust confidence interval, not the conventional one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 4: not checking for manipulation of the running variable
&lt;/h2&gt;

&lt;p&gt;If people can precisely control their score (retaking a test until they pass, or misreporting income to stay under a threshold), those just above the cutoff are no longer comparable to those just below. A tell-tale sign is bunching: a spike in the density of the running variable on one side.&lt;/p&gt;

&lt;p&gt;McCrary (2008) introduced the standard density test. A more recent local-polynomial version is available in the &lt;code&gt;rddensity&lt;/code&gt; package. A histogram of the running variable with fine bins is a cheap first look that every RD paper should show.&lt;/p&gt;

&lt;p&gt;Note the asymmetry. A clean density test does not prove the absence of sorting, but clear bunching is a serious warning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 5: skipping covariate balance checks
&lt;/h2&gt;

&lt;p&gt;If the design works, pre-treatment characteristics should not jump at the cutoff. Run the same RD estimator with baseline covariates (age, prior outcomes, demographics) as the outcome. A significant jump in a variable the treatment could not have affected suggests sorting or a second policy that shares the same cutoff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 6: over-extrapolating the result
&lt;/h2&gt;

&lt;p&gt;An RD estimate is a &lt;strong&gt;local&lt;/strong&gt; effect at the cutoff. A scholarship's effect on students scoring exactly 80 says little about students scoring 50. Reporting it as "the effect of scholarships" stretches the design beyond what it identifies. Be explicit about the population the estimate applies to.&lt;/p&gt;

&lt;h2&gt;
  
  
  A cautionary case: the Huai River heating study
&lt;/h2&gt;

&lt;p&gt;China historically provided free winter heating north of the Huai River and not south of it, which creates a geographic discontinuity. Chen, Ebenstein, Greenstone and Li (2013), in &lt;em&gt;PNAS&lt;/em&gt;, used this border to estimate the effect of air pollution on life expectancy. The paper drew wide attention, and also methodological criticism, notably from Andrew Gelman, centring on the use of a global cubic polynomial in distance from the river and how sensitive the estimate was to that choice. A follow-up study, Ebenstein, Fan, Greenstone, He and Zhou (2017), also in &lt;em&gt;PNAS&lt;/em&gt;, revisited the question with more data and different specifications.&lt;/p&gt;

&lt;p&gt;Whatever your view of the substantive result, the episode is a useful teaching case. It shows why specification choices in RD (polynomial order, bandwidth, what counts as "near" the cutoff) need to be justified and stress-tested rather than picked once.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical RD checklist
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Confirm the assignment rule exists independently of the outcome data. Don't go hunting for a kink first and call it a policy cutoff afterwards.&lt;/li&gt;
&lt;li&gt;Plot the raw data with &lt;code&gt;rdplot&lt;/code&gt; or a binned scatter.&lt;/li&gt;
&lt;li&gt;Check the density of the running variable for bunching.&lt;/li&gt;
&lt;li&gt;Check covariate balance at the cutoff.&lt;/li&gt;
&lt;li&gt;Estimate with local linear regression, an MSE-optimal bandwidth, and robust bias-corrected CIs.&lt;/li&gt;
&lt;li&gt;Show sensitivity to bandwidth and kernel; avoid high-order global polynomials.&lt;/li&gt;
&lt;li&gt;For fuzzy RD, report the first stage.&lt;/li&gt;
&lt;li&gt;Run placebo cutoffs where no effect should exist.&lt;/li&gt;
&lt;li&gt;State clearly that the estimate is local.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I wrote a longer version of this discussion, with more on the Huai River debate, in &lt;a href="https://metho.scholay.com/news/draft-5b12c767-147a-4c17-a896-ae42dc0cca1d/" rel="noopener noreferrer"&gt;this article on common regression discontinuity mistakes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Calonico, S., Cattaneo, M. D., &amp;amp; Titiunik, R. (2014). Robust nonparametric confidence intervals for regression-discontinuity designs. &lt;em&gt;Econometrica&lt;/em&gt;, 82(6), 2295–2326.&lt;/li&gt;
&lt;li&gt;Chen, Y., Ebenstein, A., Greenstone, M., &amp;amp; Li, H. (2013). Evidence on the impact of sustained exposure to air pollution on life expectancy from China's Huai River policy. &lt;em&gt;PNAS&lt;/em&gt;, 110(32), 12936–12941.&lt;/li&gt;
&lt;li&gt;Ebenstein, A., Fan, M., Greenstone, M., He, G., &amp;amp; Zhou, M. (2017). New evidence on the impact of sustained exposure to air pollution on life expectancy from China's Huai River Policy. &lt;em&gt;PNAS&lt;/em&gt;, 114(39), 10384–10389.&lt;/li&gt;
&lt;li&gt;Gelman, A., &amp;amp; Imbens, G. (2019). Why high-order polynomials should not be used in regression discontinuity designs. &lt;em&gt;Journal of Business &amp;amp; Economic Statistics&lt;/em&gt;, 37(3), 447–456.&lt;/li&gt;
&lt;li&gt;Lee, D. S., &amp;amp; Lemieux, T. (2010). Regression discontinuity designs in economics. &lt;em&gt;Journal of Economic Literature&lt;/em&gt;, 48(2), 281–355.&lt;/li&gt;
&lt;li&gt;McCrary, J. (2008). Manipulation of the running variable in the regression discontinuity design: A density test. &lt;em&gt;Journal of Econometrics&lt;/em&gt;, 142(2), 698–714.&lt;/li&gt;
&lt;li&gt;Thistlethwaite, D. L., &amp;amp; Campbell, D. T. (1960). Regression-discontinuity analysis: An alternative to the ex post facto test. &lt;em&gt;Journal of Educational Psychology&lt;/em&gt;, 51(6), 309–317.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datascience</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>EEG classifiers can score well by recognising the person</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Wed, 21 Oct 2026 02:00:22 +0000</pubDate>
      <link>https://dev.to/landisaac1/eeg-classifiers-can-score-well-by-recognising-the-person-2clm</link>
      <guid>https://dev.to/landisaac1/eeg-classifiers-can-score-well-by-recognising-the-person-2clm</guid>
      <description>&lt;p&gt;Many EEG machine-learning papers report accuracies that look too good. One common reason has nothing to do with the brain signal you care about: the model has learned to recognise &lt;em&gt;who&lt;/em&gt; a recording came from. If the same person's data sit in both the training and the test set, the test score answers an easier question than the one the paper claims to answer. This post walks through how that happens, what a recent small replication found, and how to set up the split so your number means what you think it means.&lt;/p&gt;

&lt;h2&gt;
  
  
  How windowing creates the problem
&lt;/h2&gt;

&lt;p&gt;A typical EEG pipeline cuts each recording into many short windows (say, 4 seconds each), extracts features per window, and treats each window as a sample. A study with 36 participants can easily end up with a couple of thousand windows. That looks like plenty of data.&lt;/p&gt;

&lt;p&gt;The trap is the next step. If you shuffle all the windows and do a random 80/20 split, windows from the same person land on both sides. Consecutive windows from one recording are highly similar, and so are different recordings from the same head. A flexible classifier can then learn person-specific boundaries ("for this participant, the alpha power shifts like &lt;em&gt;this&lt;/em&gt; between rest and task") that do not carry over to anyone new.&lt;/p&gt;

&lt;p&gt;The randomisation unit decides what you are estimating:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Window-level split&lt;/strong&gt;: how well the model classifies new windows from people it has probably already seen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subject-level split&lt;/strong&gt;: how well the model transfers to people it has never seen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Neither is wrong in itself. The problem is reporting the first and claiming the second.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a minimal replication showed
&lt;/h2&gt;

&lt;p&gt;In October 2026, Renish Joshi published a deliberately simple replication in &lt;em&gt;Towards Data Science&lt;/em&gt;. He used the public EEGMAT dataset on PhysioNet (EEG during mental arithmetic): 36 healthy students, each with a resting recording and a serial-subtraction recording, sampled at 500 Hz with 10/20 electrode placement (Zyma et al., 2019).&lt;/p&gt;

&lt;p&gt;The pipeline was kept fixed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;19 scalp channels, 1–40 Hz band-pass filter, non-overlapping 4-second windows (2,134 windows in total).&lt;/li&gt;
&lt;li&gt;Welch power spectra, relative power in theta, alpha, beta and low-gamma bands, giving 76 features per window.&lt;/li&gt;
&lt;li&gt;Three classifiers: class-weighted logistic regression, an RBF-kernel SVM, and a 300-tree class-weighted random forest. Scaling sat inside a scikit-learn pipeline, so it was fit on training data only.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only the evaluation changed. The window-level protocol used 10 stratified random 80/20 splits. The subject-level protocol used 6-fold &lt;code&gt;GroupKFold&lt;/code&gt; with participant ID as the group, so no test participant contributed a single training window.&lt;/p&gt;

&lt;p&gt;Balanced accuracy dropped for every model:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Classifier&lt;/th&gt;
&lt;th&gt;Random windows&lt;/th&gt;
&lt;th&gt;Held-out subjects&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Logistic regression&lt;/td&gt;
&lt;td&gt;0.770&lt;/td&gt;
&lt;td&gt;0.648&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RBF SVM&lt;/td&gt;
&lt;td&gt;0.864&lt;/td&gt;
&lt;td&gt;0.602&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Random forest&lt;/td&gt;
&lt;td&gt;0.664&lt;/td&gt;
&lt;td&gt;0.532&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;ROC-AUC moved the same way. Because a linear model, a kernel method and a tree ensemble all showed the pattern, it is hard to blame one model family.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do the features know who you are?
&lt;/h2&gt;

&lt;p&gt;A score drop alone doesn't explain the mechanism, so Joshi ran a second test: use the same 76 spectral features to predict &lt;em&gt;which of the 36 participants&lt;/em&gt; a window came from. Chance is about 2.8%. The identity classifier reached 95.6%. On a class-balanced subset (15 rest and 15 task windows per person, 1,080 windows), it still reached 94.0%, with 99.5% top-3 accuracy.&lt;/p&gt;

&lt;p&gt;He is careful about what this shows. It does not prove the task classifier used identity as its decision rule. It shows the features carry a lot of person-specific information, which is enough to make overlapping splits optimistic. The window-versus-subject gap also persisted on the balanced subset, so class imbalance alone doesn't explain it.&lt;/p&gt;

&lt;p&gt;The averages also hide a wide spread. Per-participant balanced accuracy for the subject-level logistic regression ranged from 0.289 to 0.956, and 5 of 36 participants scored below chance.&lt;/p&gt;

&lt;h2&gt;
  
  
  This isn't a one-off
&lt;/h2&gt;

&lt;p&gt;The replication follows Brookshire et al. (2024) in &lt;em&gt;Frontiers in Neuroscience&lt;/em&gt;, who reran two published convolutional networks. For Alzheimer's disease versus subjective cognitive decline, test accuracy was 99.8% with segment-level splits and 53.0% with subject-level splits, where the confidence interval included chance. For seizure detection on the Siena Scalp EEG database, accuracy fell from 79.1% to 65.1%. In a non-exhaustive review of 63 deep-learning EEG papers on disease identification, they found only 17 (27.0%) that clearly avoided this leakage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the split correctly
&lt;/h2&gt;

&lt;p&gt;The rule is simple to state: &lt;strong&gt;match the split to the generalisation claim.&lt;/strong&gt; If you claim the model works on new people, no data from a test person may reach training, and that includes anything learned from data along the way.&lt;/p&gt;

&lt;p&gt;In scikit-learn, that means grouped cross-validation, with every learned step inside the pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GroupKFold&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cross_val_score&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.pipeline&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;make_pipeline&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StandardScaler&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LogisticRegression&lt;/span&gt;

&lt;span class="c1"&gt;# X: (n_windows, n_features), y: labels, groups: participant ID per window
&lt;/span&gt;&lt;span class="n"&gt;pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;make_pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;class_weight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;balanced&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_iter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;cv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GroupKFold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n_splits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cross_val_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;scoring&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;balanced_accuracy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;std&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few things to check beyond the outer split:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tuning&lt;/strong&gt;: if you tune hyperparameters, do it with an inner grouped split inside the training participants only (nested CV), not on the outer test folds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature selection, PCA, ICA, normalisation&lt;/strong&gt;: anything fit on data belongs inside the pipeline so it only sees training participants.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Report per-subject results&lt;/strong&gt;: show the spread across held-out people, not just the mean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run the identity check&lt;/strong&gt;: if your features can name the participant, window-level results are likely to be inflated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Window-level evaluation is still fine when the question really is "new sessions from people already enrolled", for example a personalised model that only ever serves the users it was trained on. Just say so.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits worth keeping in mind
&lt;/h2&gt;

&lt;p&gt;Joshi's study is one 36-person dataset with hand-crafted spectral features. The two protocols also differ in resampling structure (10 random splits versus 6 grouped folds), so the gap is descriptive, not a formal causal estimate of leakage. Where the person-specific signal comes from (physiology, electrode placement, session effects or residual artefacts) isn't resolved. And as of mid-October 2026, the article page did not link a public code repository, so the numbers can't yet be rerun independently. Brookshire et al. did publish code in their supplementary material, and EEGMAT is freely downloadable.&lt;/p&gt;

&lt;p&gt;I first wrote up this case in Chinese, with the figures from Brookshire et al., on &lt;a href="https://metho.scholay.com/news/draft-d767e6ec-62a9-4728-b0b9-2f97559a2b4e/" rel="noopener noreferrer"&gt;Scholay's research-methods section&lt;/a&gt;. The same logic applies to any data with repeated samples per person: patients, users, sensors, or schools.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Brookshire, G., Kasper, J., Blauch, N. M., Wu, Y. C., Glatt, R., Merrill, D. A., Gerrol, S., Yoder, K. J., Quirk, C., &amp;amp; Lucero, C. (2024). Data leakage in deep learning studies of translational EEG. &lt;em&gt;Frontiers in Neuroscience&lt;/em&gt;, 18, 1373515. &lt;a href="https://doi.org/10.3389/fnins.2024.1373515" rel="noopener noreferrer"&gt;https://doi.org/10.3389/fnins.2024.1373515&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Joshi, R. (2026, October 17). When EEG models see the same people in training and testing. &lt;em&gt;Towards Data Science&lt;/em&gt;. &lt;a href="https://towardsdatascience.com/when-eeg-models-see-the-same-people-in-training-and-testing/" rel="noopener noreferrer"&gt;https://towardsdatascience.com/when-eeg-models-see-the-same-people-in-training-and-testing/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Zyma, I., Seleznov, I., Popov, A., Chernykh, M., &amp;amp; Shpenkov, O. (2018). EEG during mental arithmetic tasks (version 1.0.0). &lt;em&gt;PhysioNet&lt;/em&gt;. &lt;a href="https://doi.org/10.13026/C2JQ1P" rel="noopener noreferrer"&gt;https://doi.org/10.13026/C2JQ1P&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Zyma, I., Tukaev, S., Seleznov, I., Kiyono, K., Popov, A., Chernykh, M., &amp;amp; Shpenkov, O. (2019). Electroencephalograms during mental arithmetic task performance. &lt;em&gt;Data&lt;/em&gt;, 4(1), 14. &lt;a href="https://doi.org/10.3390/data4010014" rel="noopener noreferrer"&gt;https://doi.org/10.3390/data4010014&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;scikit-learn developers. Cross-validation: evaluating estimator performance (section on cross-validation iterators for grouped data). &lt;a href="https://scikit-learn.org/stable/modules/cross_validation.html" rel="noopener noreferrer"&gt;https://scikit-learn.org/stable/modules/cross_validation.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Cross-validation fails when data leaks between folds</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Tue, 20 Oct 2026 12:44:31 +0000</pubDate>
      <link>https://dev.to/landisaac1/cross-validation-fails-when-data-leaks-between-folds-6f9</link>
      <guid>https://dev.to/landisaac1/cross-validation-fails-when-data-leaks-between-folds-6f9</guid>
      <description>&lt;p&gt;A model that scores well on the data it was trained on has shown that it can memorise. Cross-validation is the standard way to estimate how it will do on data it has never seen. It only works if one rule holds, though: no information from the validation data may reach the model-building process by any route. Break that rule, which is easy to do without noticing, and your estimate turns optimistic. This post covers k-fold and leave-one-out cross-validation and the leakage patterns that most often break them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just score on the training set?
&lt;/h2&gt;

&lt;p&gt;The scikit-learn user guide gives the extreme case: a model that simply repeats the labels of samples it has already seen gets a perfect training score and is useless on new data. That is overfitting in its purest form.&lt;/p&gt;

&lt;p&gt;The obvious fix is a held-out test set. With small datasets, though, holding data out shrinks the training set further, and the score depends heavily on which rows happened to land in the test split. Cross-validation reuses the data more efficiently and gives a more stable estimate.&lt;/p&gt;

&lt;p&gt;The idea is old. Stone (1974), in the &lt;em&gt;Journal of the Royal Statistical Society, Series B&lt;/em&gt;, used cross-validation for both choosing a prediction method and assessing it. &lt;em&gt;The Elements of Statistical Learning&lt;/em&gt; (Hastie, Tibshirani &amp;amp; Friedman, chapter 7) keeps those two jobs separate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model selection&lt;/strong&gt;: using CV to pick a model or tune hyperparameters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model assessment&lt;/strong&gt;: using CV to report the final model's error on new data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mixing the two in a single CV loop is one of the leakage sources covered below.&lt;/p&gt;

&lt;h2&gt;
  
  
  k-fold and leave-one-out
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;k-fold CV&lt;/strong&gt; randomly splits the data into &lt;em&gt;k&lt;/em&gt; roughly equal folds. In each round, one fold is held out for validation and the model is trained on the other &lt;em&gt;k − 1&lt;/em&gt;. Average the &lt;em&gt;k&lt;/em&gt; validation scores and you have the CV estimate. Every observation is used for validation exactly once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leave-one-out CV (LOOCV)&lt;/strong&gt; is the special case &lt;em&gt;k = n&lt;/em&gt;: each round holds out a single observation.&lt;/p&gt;

&lt;p&gt;Choosing &lt;em&gt;k&lt;/em&gt; is a bias–variance trade-off. ESL notes that LOOCV is approximately unbiased for expected prediction error, but its &lt;em&gt;n&lt;/em&gt; training sets are almost identical, so the estimate can have high variance. It can also be expensive. Five- or ten-fold CV is the common default and usually a sensible compromise.&lt;/p&gt;

&lt;p&gt;In scikit-learn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;cross_val_score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;KFold&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LogisticRegression&lt;/span&gt;

&lt;span class="n"&gt;cv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;KFold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n_splits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shuffle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cross_val_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_iter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;std&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Leakage pattern 1: preprocessing before splitting
&lt;/h2&gt;

&lt;p&gt;This is the classic mistake. You standardise features, impute missing values, or run feature selection on the &lt;em&gt;whole&lt;/em&gt; dataset, and only then run cross-validation. Every validation fold has now influenced the means, the imputation values, or the selected features.&lt;/p&gt;

&lt;p&gt;Feature selection is the worst offender. ESL section 7.10.2, "The Wrong and Right Way to Do Cross-validation", describes screening thousands of predictors for those most correlated with the label and then cross-validating a classifier on the survivors. Even when labels are pure noise, this procedure can report error rates far below chance. Ambroise and McLachlan (2002) documented the same selection bias in gene-expression studies.&lt;/p&gt;

&lt;p&gt;The fix is to put every data-dependent step inside the CV loop. In scikit-learn, that is what &lt;code&gt;Pipeline&lt;/code&gt; is for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.pipeline&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;make_pipeline&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StandardScaler&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.feature_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SelectKBest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_classif&lt;/span&gt;

&lt;span class="n"&gt;pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;make_pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nc"&gt;SelectKBest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f_classif&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_iter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cross_val_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# scaler and selector refit per fold
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Leakage pattern 2: tuning and reporting on the same folds
&lt;/h2&gt;

&lt;p&gt;If you try 50 hyperparameter settings and report the best CV score, that score is biased upwards: you picked the winner partly because it got lucky on those folds. Varma and Simon (2006) showed how large this bias can be in small-sample settings.&lt;/p&gt;

&lt;p&gt;The remedy is &lt;strong&gt;nested cross-validation&lt;/strong&gt;. An inner loop tunes hyperparameters and an outer loop estimates the performance of the whole tuning procedure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GridSearchCV&lt;/span&gt;

&lt;span class="n"&gt;inner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;KFold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shuffle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;outer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;KFold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shuffle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GridSearchCV&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;logisticregression__C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]},&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;nested_scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cross_val_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;outer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Leakage pattern 3: grouped data split row by row
&lt;/h2&gt;

&lt;p&gt;When several rows come from the same unit (multiple scans per patient, many EEG windows per subject, several photos of the same object), a random row-level split puts the same unit in both training and validation. The model can learn to recognise the &lt;em&gt;individual&lt;/em&gt; rather than the pattern you care about. The score then reflects identity matching, not generalisation to new people.&lt;/p&gt;

&lt;p&gt;Split by group instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GroupKFold&lt;/span&gt;

&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cross_val_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subject_ids&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;GroupKFold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n_splits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A useful sanity check: if the group-wise score falls sharply compared with the row-wise score, your earlier number was mostly measuring leakage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leakage pattern 4: time
&lt;/h2&gt;

&lt;p&gt;For time series, a random split lets the model train on the future and predict the past. Features built with rolling windows or "future-aware" aggregates make this worse. Use forward-chaining splits such as &lt;code&gt;TimeSeriesSplit&lt;/code&gt;, which only ever validate on data that comes after the training window, and add a gap between them if features look back over several periods.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leakage pattern 5: features that encode the target
&lt;/h2&gt;

&lt;p&gt;Kaufman, Rosset, Perlich and Stitelman (2012) describe leakage as including information that would not be legitimately available at prediction time. Typical examples are an ID field that correlates with outcome because of how records were created, a "date of treatment" column when predicting diagnosis, or a field that is filled in only after the event you are predicting. No splitting scheme protects you from this. You have to ask, for each feature, "would I actually have this value at the moment of prediction?"&lt;/p&gt;

&lt;h2&gt;
  
  
  It is not just a Kaggle problem
&lt;/h2&gt;

&lt;p&gt;Kapoor and Narayanan (2023), in &lt;em&gt;Patterns&lt;/em&gt;, surveyed published research that used machine learning across many scientific fields. They found leakage to be a widespread cause of overstated results, and proposed "model info sheets" so authors could document how they had ruled it out. If you are using ML in a research setting, it is worth reading their taxonomy before submitting anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Every step that learns from data (scaling, imputation, encoding, feature selection, resampling such as SMOTE) sits inside the CV loop.&lt;/li&gt;
&lt;li&gt;Hyperparameter tuning happens in an inner loop, and the reported score comes from an outer loop or a truly untouched test set.&lt;/li&gt;
&lt;li&gt;If rows share a subject, site, or source, split by group.&lt;/li&gt;
&lt;li&gt;If time matters, validate only on the future.&lt;/li&gt;
&lt;li&gt;Each feature is available at prediction time.&lt;/li&gt;
&lt;li&gt;The test set is used once, at the end.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a broader look at how validation choices affect what a study can claim, I keep notes on research-method topics like this one on &lt;a href="https://scholay.com" rel="noopener noreferrer"&gt;Scholay&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ambroise, C., &amp;amp; McLachlan, G. J. (2002). Selection bias in gene extraction on the basis of microarray gene-expression data. &lt;em&gt;PNAS&lt;/em&gt;, 99(10), 6562–6566.&lt;/li&gt;
&lt;li&gt;Hastie, T., Tibshirani, R., &amp;amp; Friedman, J. (2009). &lt;em&gt;The Elements of Statistical Learning&lt;/em&gt; (2nd ed.), chapter 7. Springer.&lt;/li&gt;
&lt;li&gt;Kapoor, S., &amp;amp; Narayanan, A. (2023). Leakage and the reproducibility crisis in machine-learning-based science. &lt;em&gt;Patterns&lt;/em&gt;, 4(9).&lt;/li&gt;
&lt;li&gt;Kaufman, S., Rosset, S., Perlich, C., &amp;amp; Stitelman, O. (2012). Leakage in data mining: Formulation, detection, and avoidance. &lt;em&gt;ACM Transactions on Knowledge Discovery from Data&lt;/em&gt;, 6(4).&lt;/li&gt;
&lt;li&gt;Stone, M. (1974). Cross-validatory choice and assessment of statistical predictions. &lt;em&gt;Journal of the Royal Statistical Society: Series B&lt;/em&gt;, 36(2), 111–147.&lt;/li&gt;
&lt;li&gt;Varma, S., &amp;amp; Simon, R. (2006). Bias in error estimation when using cross-validation for model selection. &lt;em&gt;BMC Bioinformatics&lt;/em&gt;, 7, 91.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Nested data needs a multilevel model</title>
      <dc:creator>Isaac Land</dc:creator>
      <pubDate>Tue, 20 Oct 2026 12:43:16 +0000</pubDate>
      <link>https://dev.to/landisaac1/nested-data-needs-a-multilevel-model-1c01</link>
      <guid>https://dev.to/landisaac1/nested-data-needs-a-multilevel-model-1c01</guid>
      <description>&lt;p&gt;When your data come in groups (students inside classrooms, patients inside hospitals, repeated measurements inside the same person), ordinary regression quietly assumes something false: that every row is independent. This post walks through why that matters, how a multilevel (mixed-effects) model fixes it, and how to fit one in R with &lt;code&gt;lme4&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: rows that know each other
&lt;/h2&gt;

&lt;p&gt;Imagine 3,000 students spread across 100 classrooms. Students in the same classroom share a teacher, a timetable, and often a neighbourhood. Their test scores will be more alike than scores drawn at random from the whole population.&lt;/p&gt;

&lt;p&gt;Ordinary least squares (OLS) does not know that. It treats 3,000 rows as 3,000 independent pieces of information. In reality, part of the information is duplicated within each classroom, so OLS standard errors come out too small, confidence intervals too narrow, and p-values too optimistic. Classroom-level predictors such as "teacher has a master's degree" are hit hardest, because there are really only 100 independent units for that variable, not 3,000.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring the similarity: the intraclass correlation
&lt;/h2&gt;

&lt;p&gt;The standard way to quantify "how alike are members of the same group" is the &lt;strong&gt;intraclass correlation (ICC)&lt;/strong&gt;. Start with an empty (intercept-only) multilevel model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y_ij = γ00 + u_j + e_ij
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;u_j&lt;/code&gt; is classroom &lt;em&gt;j&lt;/em&gt;'s deviation from the grand mean, with variance τ²&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;e_ij&lt;/code&gt; is student &lt;em&gt;i&lt;/em&gt;'s deviation from their classroom mean, with variance σ²&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ICC = τ² / (τ² + σ²)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is the share of total variance that lies &lt;em&gt;between&lt;/em&gt; groups, and it also equals the expected correlation between two observations from the same group.&lt;/p&gt;

&lt;h2&gt;
  
  
  From ICC to the design effect
&lt;/h2&gt;

&lt;p&gt;Survey statisticians have long used the &lt;strong&gt;design effect&lt;/strong&gt; to translate the ICC into lost precision. Following Kish (1965), for groups of average size &lt;em&gt;m&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deff ≈ 1 + (m − 1) × ICC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A purely hypothetical illustration: 100 classrooms of 30 students and an ICC of 0.2 give &lt;code&gt;deff = 1 + 29 × 0.2 = 6.8&lt;/code&gt;. The effective sample size is about 3000 / 6.8 ≈ 441, and naive standard errors would be roughly 1/√6.8 ≈ 0.38 of what they should be. Even a modest ICC of 0.05 gives a design effect of 2.45 with classes of 30. Small ICCs matter when groups are large.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three ways to handle groups
&lt;/h2&gt;

&lt;p&gt;Gelman and Hill (2007) frame the choice as three options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Complete pooling.&lt;/strong&gt; Ignore groups and fit one regression. Simple, but it erases between-group variation (which is often the very thing you care about) and gives overconfident standard errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No pooling.&lt;/strong&gt; Fit each group separately, or add a dummy variable per group. Small groups get noisy estimates, and group dummies are perfectly collinear with any group-level predictor, so you cannot estimate the effect of, say, school type at the same time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partial pooling (multilevel model).&lt;/strong&gt; Each group gets its own parameters, but those parameters are drawn from a common distribution. Groups with little data are "shrunk" towards the overall mean; groups with lots of data mostly keep their own estimates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Partial pooling is the core idea. It is a data-driven compromise between "all groups are the same" and "all groups are unrelated".&lt;/p&gt;

&lt;h2&gt;
  
  
  Random intercepts and random slopes
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;random-intercept&lt;/strong&gt; model lets each group have its own baseline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y_ij = γ00 + γ10 x_ij + u0j + e_ij
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;random-slope&lt;/strong&gt; model also lets the effect of a predictor vary by group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y_ij = γ00 + (γ10 + u1j) x_ij + u0j + e_ij
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, the link between hours of homework and test scores might be steeper in some classrooms than in others. The variance of &lt;code&gt;u1j&lt;/code&gt; tells you how much that slope varies, and the covariance between &lt;code&gt;u0j&lt;/code&gt; and &lt;code&gt;u1j&lt;/code&gt; tells you whether high-baseline groups also have steeper slopes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fitting it in R with lme4
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;lme4&lt;/code&gt; package (Bates, Mächler, Bolker &amp;amp; Walker, 2015) is the workhorse for this in R. It ships with the &lt;code&gt;sleepstudy&lt;/code&gt; dataset: reaction times for 18 participants measured over 10 days of sleep restriction, so measurements are nested in people.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lme4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c1"&gt;# Complete pooling: one line for everyone&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;m_ols&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Reaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Days&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sleepstudy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c1"&gt;# Random intercept per participant&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;m_ri&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lmer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Reaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Days&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Subject&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sleepstudy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c1"&gt;# Random intercept and random slope for Days&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;m_rs&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lmer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Reaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Days&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Days&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Subject&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sleepstudy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m_rs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things worth comparing yourself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The standard error of &lt;code&gt;Days&lt;/code&gt; in &lt;code&gt;m_ols&lt;/code&gt; versus &lt;code&gt;m_rs&lt;/code&gt;. The OLS version treats 180 rows as independent.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;Subject&lt;/code&gt; variance components in &lt;code&gt;summary(m_ri)&lt;/code&gt;. Plug them into the ICC formula above.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;coef(m_rs)$Subject&lt;/code&gt; against per-subject &lt;code&gt;lm()&lt;/code&gt; fits. You will see shrinkage: participants with extreme individual slopes are pulled towards the average.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;lmer()&lt;/code&gt; uses REML (restricted maximum likelihood) by default, which gives less biased variance estimates than plain ML. If you compare models that differ in their &lt;em&gt;fixed&lt;/em&gt; effects with a likelihood-ratio test, refit with &lt;code&gt;REML = FALSE&lt;/code&gt; first. &lt;code&gt;anova()&lt;/code&gt; in lme4 does this automatically for &lt;code&gt;merMod&lt;/code&gt; objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Too few groups.&lt;/strong&gt; Variance components are estimated from the number of groups, not the number of rows. Maas and Hox (2005) found that with very few groups the standard errors of the group-level variances were noticeably biased. Five schools with 1,000 students each is a weak basis for a random effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ignoring the design and just clustering standard errors.&lt;/strong&gt; Cluster-robust standard errors can fix inference for fixed effects, which is a reasonable choice in some settings. But they do not give you estimates of between-group variation, group-specific predictions, or random slopes. Pick the tool that answers your question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding random slopes for everything.&lt;/strong&gt; Models with many random slopes and correlations often fail to converge or produce singular fits (&lt;code&gt;isSingular()&lt;/code&gt; returns &lt;code&gt;TRUE&lt;/code&gt;). Start from a theoretically motivated structure and simplify when the data cannot support it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forgetting centring.&lt;/strong&gt; With a random slope on &lt;code&gt;x&lt;/code&gt;, the intercept variance depends on where &lt;code&gt;x = 0&lt;/code&gt;. Centring predictors, either at the grand mean or within each group, changes what the intercept means. Within-group centring also separates within-group and between-group effects, which are often different things entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treating the ICC as a test of whether you "need" a multilevel model.&lt;/strong&gt; A small ICC can still produce a large design effect when groups are big, and the grouping is part of the design whatever the ICC turns out to be.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to reach for a multilevel model
&lt;/h2&gt;

&lt;p&gt;Use one when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;observations are grouped, and the grouping comes from how the data were collected (sampling, randomisation, or repeated measurement);&lt;/li&gt;
&lt;li&gt;you care about variation between groups, or about predictors measured at the group level;&lt;/li&gt;
&lt;li&gt;some groups are small and you want stable estimates for them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want a longer, education-focused walk-through of the same ideas, including a worked example with classroom data, the &lt;a href="https://metho.scholay.com/news/draft-59e3ef4b-bca5-4afb-a202-8fc22a646d2d/" rel="noopener noreferrer"&gt;original article on nested data and multilevel models&lt;/a&gt; goes into more detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Bates, D., Mächler, M., Bolker, B., &amp;amp; Walker, S. (2015). Fitting linear mixed-effects models using lme4. &lt;em&gt;Journal of Statistical Software&lt;/em&gt;, 67(1), 1–48.&lt;/li&gt;
&lt;li&gt;Gelman, A., &amp;amp; Hill, J. (2007). &lt;em&gt;Data Analysis Using Regression and Multilevel/Hierarchical Models&lt;/em&gt;. Cambridge University Press.&lt;/li&gt;
&lt;li&gt;Kish, L. (1965). &lt;em&gt;Survey Sampling&lt;/em&gt;. Wiley.&lt;/li&gt;
&lt;li&gt;Maas, C. J. M., &amp;amp; Hox, J. J. (2005). Sufficient sample sizes for multilevel modeling. &lt;em&gt;Methodology&lt;/em&gt;, 1(3), 86–92.&lt;/li&gt;
&lt;li&gt;Raudenbush, S. W., &amp;amp; Bryk, A. S. (2002). &lt;em&gt;Hierarchical Linear Models: Applications and Data Analysis Methods&lt;/em&gt; (2nd ed.). Sage.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datascience</category>
      <category>tutorial</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
