
Regression to the Mean Girls:Emily Riederer と選挙データのウェブスクレイピング
Regression to the Mean Girls | Election Data Web Scraping with Emily Riederer

Regression to the Mean Girls:Emily Riederer と選挙データのウェブスクレイピング
Casual Inference
要約
Capital One のデータサイエンティスト Emily Riederer が、各州の期日前投票データを集める副業的プロジェクトについて語った回。Texas のデータをきっかけに Playwright でスクレイピングを自動化し、州ごとの形式差に向き合った経験を紹介する。データの収集過程が分析に与えるバイアスや、EHR との共通点、分母が不明な場合の扱いも議論された。
この回のポイント
- ●Emily は 2022 年頃から市民向けデータ活動に関わり、Texas の期日前投票データを入口に各州のデータ収集へ広げた。Texas のデータは個人単位で日次更新と非常に詳細だが、取得には何段階もの画面操作が必要だった。
- ●Python の Playwright によるヘッドレスブラウジングで、クリック操作をスクリプト化した。決定論的な手法を好む一方、サイト変更で壊れやすく、保守負担が大きいと述べている。
- ●Lucy は決定論的なスクリプトを軸に、壊れた場合だけ AI エージェントが修正案を出す併用案を提案した。Emily はまだ試しておらず、手作りの良さも感じているという。
- ●データは誤っているのではなく収集過程を映したものだ、という見方が共有された。タイムスタンプの意味(投函日か受領日か)や、1 と null・1 と 0 の違いが分析結果を左右する例が挙がった。
- ●EHR(電子カルテ)や HIV コホートでのデータ調和の経験と、選挙データの州ごとの違いが重ねられた。分母(有権者全体など)が不明な場合の bounds(上下限)の限界と使い方も議論された。
- ●North Carolina の投票履歴は、現実の複雑さを持つモデリングの試験データとして重宝している。郡効果を捉えやすく、AUC が高くても目的次第では有用とは限らないと述べた。
章立て
メディアの話題と統計学の歴史
Rooster や Good Hang、ポッドキャストの話から、Fisher と Rothamsted の実験の歴史へ広がる雑談。
期日前投票データ収集の始まり
Texas のデータが詳細なのに取得しにくいという対比から、各州のデータ収集に広げた経緯を語る。
Playwright と決定論的スクレイピング
ヘッドレスブラウジングで操作を自動化した方法と、サイト変更に弱い問題、AI を併用する案を議論。
データ設計と EHR・コホートとの共通点
データエンジニアリングの視点や、EHR や HIV コホートでのデータ調和、ICD コードの順序の問題を話す。
収集過程とタイムスタンプ、分母の問題
データは収集過程の反映であるという考え方と、時刻の定義、分母が不明な場合の bounds の議論。
投票データの活用とモデリング
運動への活用と、North Carolina のデータを試験用モデリングに使う話。郡効果の扱いにも触れる。
fetch 度の自己評価
番組恒例の評価コーナーで、Emily は流行度では低めだが、手作りで理解が深まる価値を語った。
解説記事
Casual Inference 系列の番組 Regression to the Mean Girls に、Capital One でデータサイエンティストを務める Emily Riederer が登場した。ホストは Lucy D'Agostino McGowan と Sarah Lotspeich。テーマは、Emily が勤務外で続けてきた選挙データのスクレイピングという「寄り道」である。期日前投票データの集め方から、データの扱い方に関する一般的な教訓まで話が広がった。
各州の期日前投票データを集める
Emily は 2022 年頃から、データチームを持たない地方選挙の陣営などを支援する市民向けのデータ活動に関わってきたという。発端は Texas のデータだった。個人名レベルで、登録状況、投票済みか、対面か郵送か、投票用紙が送付されたかまでが日次で更新されていた。きわめて詳細で、その点では「アクセスしやすい」。一方で、CSV を 1 件ずつ得るために 4〜5 段階の画面を操作する必要があり、その点では「アクセスしにくい」。この矛盾が出発点になったと述べている。
Florida 大学の研究グループが、非常に精巧な期日前投票ダッシュボードを維持している例にも触れた。ただし彼らは州務長官に直接問い合わせるなどの手段も使っているはずで、自分は公開情報だけで集めているという違いを挙げた。
Playwright による自動化と保守の悩み
Texas では Python の Playwright を使い、ヘッドレスブラウジング(画面なしでブラウザを操作する手法)を採用した。CSS や JavaScript のタグでボタンの位置を指定し、クリックの手順をスクリプトにしたという。Emily は決定論的なやり方を支持する立場だ。ただしサイト側は更新を知らせてくれないので、HTML が変わると全体が壊れる。州ごとに PHP から JavaScript へ移行するなどの変更があり、GitHub に置いた教材も触るたびに大幅な修正が必要になると語った。
Lucy は、決定論的なスクリプトを基本にしつつ、壊れたときだけ AI エージェントがページを見て修正案を出し、再検証する併用案を示した。Emily は自分ではあまり試していないと述べた。手作りで進める楽しさも副業の魅力だという。
データ調和と「収集過程の反映」という視点
議論はデータエンジニアリングの発想に移った。Emily は、tidyverse のように整ったデータを前提とするツールの上流まで関わりたい気持ちがあったと語る。さらに、データサイエンティストもデータエンジニアの枠組みを借りれば効果的に動けると考えている。
Lucy と Sarah は、電子カルテ(EHR)で IT 部門、データウェアハウス、研究者と何層も経由する構造を例に挙げた。Sarah は博士課程で扱った多国籍 HIV コホートで、データ調和の手引きが整っていたおかげで行を単純に積み重ねられたと話した。州ごとに独自ルールで公開される選挙データにはそうした共通の取り決めがない、という対比である。Lucy は、ICD コードの検索結果の並び順が機関ごとに異なり、臨床医の選択に影響し得るのではないかと指摘した。
Emily は、「open account」「balance」といった語が、システムが違えば意味も違った職場での経験を紹介した。データ構造上の決定が分析上の決定になるという指摘もある。たとえば 1 と null か、1 と 0 かで、平均の意味が変わってしまう。統計学ではデータ生成過程を議論するが、システム間でデータが移動する過程にも同程度の誤差とバイアスがあるという見方だった。
この文脈で Emily は「データは間違っているのではなく、収集過程を映したものだ」とまとめた。投票日時のタイムスタンプが、郵送した日なのか受領された日なのかといった問題が一例である。Lucy も、EHR での曝露時点や検査日の定義が因果推論に直結すると応じた。
分母が分からないときの扱い
有権者全体ではなく登録済み有権者のデータしか手に入らない点は、EHR で特定の医療機関を受診した人しか見えない問題と似ているという。Lucy は COVID 期に ICU の死亡率 84% と報じられた例を挙げた。アウトカム未確定の患者を除いた割合であり、全員が死亡または生存と仮定して上下限を取ると 24〜98% に広がる。上下限が広すぎて役立たない場合の対処が議論になった。Emily は、結果の符号が変わる境界点を示すなど、何が不確実性を生んでいるかを絞り込むやり方が過小評価されていると述べた。
投票データの活用
用途には、投票率向上を目指す団体との運用的な連携がある。もう一つは、North Carolina の豊富な投票履歴を、手早く試せるモデリング用データとして使うことだ。シミュレーションデータや Kaggle よりも現実の複雑さを持つという。中間選挙と大統領選の違い、郡や属性の効果などがあり、目的によってはそうした効果をモデルに取り込みたくない場合もある。Charlotte での投票促進なら、Wake County より Charlotte の関与率が高いという情報は役に立たない。AUC が高くても有用とは限らないという指摘である。投票を増やす介入策については「分かればいいのだが」と答えた。
まとめ
本編の中心は、スクレイピングの技術より、データがどう作られ、どう届くかを理解する姿勢にある。サイト構造の変化に弱い自動化の保守、定義の違うタイムスタンプ、分母の欠落、といった課題は、日本の実務でも行政データや業務システムの統合で起こり得る。AI エージェントで収集を自動化できる時代にも、決定論的に手で組み立てて仕組みを理解することに価値がある、という Emily の姿勢は参考になる。
文字起こし(英語・自動生成)
This is Regression to the Mean Girls, where we chat with brilliant data people about their silliest side quests. We are mean as an average, but actually very nice. Come sit with us. I'm Lucy D'Agostino-McGowan. I'm Sarah Lotzich, and today we're really excited to be chatting with Emily Riederer, who is a data scientist currently working at Capital One, where she leads the development of specialty underwriting models and serves as a model risk officer for fraud models. Thanks for being here, Emily. Awesome. So happy to be here. Really, really excited to chat. Great. So we like to kick off with what we call a media minute. So just in any type of media, what are you enjoying right now? I just watched the season finale of Rooster which is the new show from the guy who did Scrubs and it has Steve Carell and a bunch of the old cast from Scrubs
it's like mostly academic which is fun it's based on like a like a fictional liberal arts school I really enjoyed it it was funny a little heartfelt I had some crossover with like Ted Lasso actors so that's what I've been tuning in I've been like interested in seeing that because I really do like Steve Carell I went on a deep dive about his wife the other day because she's also like so, do you know about her? Yeah, she's now. Well, she played the realtor in The Office, but he then did. She's like, she does cameos in a lot of his stuff. She's in Rooster. Was he on Good Hang recently? With Amy Poehler. It was Stephen Colbert that was talking about, because she always interviews someone to talk well behind their back at the beginning, and she did Stephen Colbert. It was hilarious. So when Stephen Colbert was on, his son was like playing drums in the background, like loudly, like the whole time. And you could just like hear it very loud. I just, like, love when we're, like, celebrities are just like us. Like, he could not control the environment that he was having to do this, like, podcast. And anyways, it made me go down this rabbit hole because it's just so interesting to think about, like, she, when they met, because they all met in Second City.
And, like, I think Steve Carell was, like, buddies with Stephen Colbert. The two of them were friends. But his wife, I think she was like famous first because when she was like well-known in that circle, I think. And then she got SNL, I think, before anybody else got anything that was. So it's like, I don't know. I just think it's interesting. What is it? She was in a main role in season 21. And then she was a guest in season 33 and 44. 1995, the year she and Steve got married. Yeah. so like and I don't think he was like well known at the time like I think she was kind of famous first it's just interesting because I feel like I don't know much about Nancy other than like yeah I think I knew maybe that she was on the office but and I like knew what she looked like because I've seen pictures of them together but I didn't know anything else okay Emily what are you enjoying and then I'll come back around to good hang gosh so I'm a I spend probably like insane amount of my life listening to podcasts and it's not unless I listen on them at double
speed so i'm probably like the only person in the world that has like is in chronic fear of running podcasts despite how many there are i'll say probably a couple that are like i've recently discovered that have been a lot of fun is like i feel like i use it a lot to just like stick my nose into kind of like areas that have like nothing to do with my can you be job or typical ways of thinking and one thing i've actually like really fallen in love with is one called like in the interim that is like from like very consultants just kind of like talking about oh yeah uncle child design for like mostly in the drug space but they've done some like fun and interesting stuff lately with like sports and like for me that's like like for you maybe that's like too close to your day job for me kind of like wildly different really cool to just like tend to hear how they think through that all sort of thing and then similarly another one that's been top of my list lately is the blenny's podcast which is kind of more for a totally different world product managers talking about management kind of like design you know like design users and lately kind
of like how they're thinking about AI so yeah like I feel like I'm always just trying to like cut a lot of different and interesting ideas from kind of like outside my little orbit yeah I love that I had just heard about in the interim for the first time I was at BU and someone mentioned asked me if I had listened to it and I hadn't heard it's Scott right he's yeah the one that runs it and yeah it's like there are different parts of like you see like different parts of the whole family kind of like coming through on different episodes spending on depending on like what kind of analysis they're talking about but yeah like it's like I think I love it because it is just so honest you know if I mean like talking about like the strengths and weaknesses and what's like the best practice versus what's actually as well as kind of I think the industry dynamics of like what your sponsors are optimizing for versus what you as a statistician are Yeah, it's like they hit on things from, like, so many different angles, which is also fun. Yeah, it's really awesome. Oh, there's a Lindsay buried, too. I didn't know it. I was just about to say a son buried. I don't know about – well, I know about – so I know three – because Don is the patriarch, and then I know Scott.
And I guess I maybe knew Nick. Is Nick Scott's son? Do you know? I feel like I should know this is Scott now. No, I don't know either. And I'm trying to figure out how Lindsay is in there. Statistics nepo babies. I was just talking to someone about this because I was at a conference last week where Andrew Mead was one of the speakers. Andrew, he runs the – it's the one that, like, Fisher was at, Rothenstead Research. Anyways, so he's the director of stat at Rothenstead Research. His dad also was a statistician. He did, like, Nelder and Mead as his dad, which is, like, if you use the opt-in function in R, that's, like, the default. But we were just, like, talking about – it was kind of – I don't know. I think that how, like, historically, for better or for worse, like, people fall in the same, you know, if your dad was a blacksmith and you were the eldest, then, like, you had to be a blacksmith. And this was, I think there are pluses and minuses to some of this stuff. Like, it's good now that there are lots of opportunities for people to do whatever their dreams are. And it's funny you mention Ronald Fisher, too, because I think even his, like, daughter was a statistician that then married, like, George Fox or someone.
Yes. So, like, original kind of, like. I know. And there was, like, Tukey's, what is it? There were, like, was it Ann's scumb and Tukey were brother-in-law. I feel like it's just sort of fun to think about the, like, interpersonal pieces of this. Because, like, especially in the old times when there weren't a ton of people that had this particular type of skill, there probably were a lot of overlap in, like, personal and professional. Yeah. Sort of, you know. You know, this is the HBO show that we need. I know. statistic succession yes okay i was just i i said i was so there's apparently a two volume series on like history of statistics that i i don't i need to look this up because at this conference that we were talking about this and one of the guys because there's so much you know there's a lot of history like andrew was sharing with me history just about this experiment center where fisher was fisher was the first statistician that was hired by it which by the way he was hired so the experiment Center started running experiments in like the mid-1800s, and Fisher, like the early 1900s,
I guess was when Fisher, so I'm like, what were they, what precisely was an experiment center doing without a statistician? Like, I'm just curious what exactly type of experiments, I mean, not to be like condescending, but like, I don't really understand what you were doing with your information. I guess they were collecting information, but like, how were you analyzing it if you didn't have anyone? So anyways, but he had this like very rich history because he just knows it because he's there you know what i mean and i feel like there's things that i i'm like there's gaps in my knowledge of sort of our field but it's not that old that i feel like we need to like sort of pass down better well that like that timing puts so much more context and i know there's a fisher quote about like if a statistician is brought in after the experiment already runs all they can do is like post-mortem on quiet ride and like yeah i mean you think of people i mean you think of that as just being like a pippy quote but like with the context of him coming in with like 100 years of data like we've all been there of just being like oh what was this like how did you plan this yes
exactly why don't we do some split plots yeah i i think it's so funny and the other thing that i thought was really interesting about ross and said research they have those same experiments they are still running they have these wheat experiments that started in the 1800s that they still are collected it out i'm like have we not figured it out yet though or is it just like for historical reasons that we're still collecting it but there's so many things that are changing so like weather patterns and you know there's things that influence the one that he was telling us about was looking at different I think it was like 16 different types of fertilizer and but like there are things that have have changed over that time that might influence what which of these answers you know it's like I think this is also a nice example of like clinical or trial-based research being a snapshot in time and that like the generalizability depends on that like it's only generalizable in that window and when things change so this is like cool longitudinal data to have literally like you know over like 150 years of data that they've collected on the same exact experiment okay i'm gonna loop us back i can just say i'll i'll keep my media minutes short i have
in addition to still enjoying the lonely island every minute that i can and increasing the number of songs that I know every lyric to. I also have been enjoying Good Hang with Amy Poehler and most recently listened to the episode with Billie Eilish, which was like very encouraging. I texted you, Sarah, about this, but I was like, Billie Eilish gets into loops just like me. She's just like us. She's just like us, yeah. She like talked about how she's watched The Office like upwards of 40 times or something because she just keeps watching like over and over and over again. And I'm like, yes, me too. We can consume that. Also me. Yes. So, okay. All right. Well, let's get into the real juice here. We are so excited to have you tell us about a potential rabbit hole that you have been down. So can you start by telling us about the context of your side quest? Yeah, absolutely. And I think I'm kind of cheating because I think my side quest is like a number of actually kind of like small interrelated side quests. And then we can kind of like zoom in on one. But since about 2022, I've gotten very involved in just like a number of different civic sort of data initiatives outside of work, supporting more directly different down ballot campaigns that often have like a lot of needs, a lot of data, but no data teams.
And then just off cycle besides that I think after crushing the bunk so to speak I think it really interested in like kind of what sort of data is available and how you collect and synthesize that So a couple of different data collection and data scraping side quests then that I've done is for kind of early vote data across a lot of different states, digging in, understanding how every different state has its own both legal obligations and norms in terms of, like, what data they're putting out there, looking at all the different, like, kind of formats and structures these come in, and trying to, like, build in the data pipelines to draw down the size and structures of that. That's awesome. Okay, first of all, can I ask you about where you, where do you even start? So you are interested in this question of early vote data. Where did you, did you pick a state? How did you even start approaching trying to answer it or figuring out where the resources are? Yeah, definitely. So it actually started with more need for one of the specific projects I was working on and kind of grew up from there. At that time, I was working on some information with Texas.
And I think it was surprising to me. I feel like I was just assumed like a lot of this data wasn't really just public or available just because I don't know why. But I found a couple of interesting things about Texas' data, which was both it was unusually expansive in terms of the granularity of data, files updating daily, down to individual named person level who was registered, who'd actually voted, was it in person, was it by mail, you know, was the ballot sent or not, which I think, coming from rural finance, which is similar to medicine, we care a lot about PII data. I was like, wow, did not see that coming. There was this, like, really interesting contrast between the data was incredibly accessible in so much that it was super highly granular, but it was also super inaccessible in so much as you had to click through four or five different levels of user interfaces to select the place he wanted to download an individual CSV. So I got down to this weird rabbit hole. How can this be both so accessible and so inaccessible?
What do I do about that in the short term? And I got really curious, how are other states doing this? The other sort of inspiration I had around the same time was there's actually an academic group at the University of Florida that maintains this really, really elaborate early voting dashboard that just has done this thing at the professional level to just this beautiful and immaculate extent. so like I knew it was kind of possible and I was just curious and sticking in and figuring out how oh that's awesome so the one at Florida what can you I'm assuming that you can't just pull their data out of it it's more like no yeah I think yeah I think they've like I mean made it kind of like a limited resource researchers and maybe even more of a proprietary tool the front end at least used to be built with iron work down so that was another thing that like kind of caught my eye and it was a lot of fun. And I think, like, they also use some different methods than probably what I've done in so much that they, like, directly, like, reach out to the Secretary of State to many states as needed to, like, you know, request or probably even FOIA where I need be some of the information,
whereas I'm just hooking around and seeing what I can get on the open internet. That's awesome. So, and I, okay, I have a couple of follow-up questions. My first question is, so for this Texas one, for example, were you able to, so were you able to then from that create a pipeline that did not require you to have to point and click or did you go through the pain of having to point and click and get all the data and then do something with it? Yeah so that was part of what was fun about both Texas and then expanding to other states is it was a forcing mechanism to expose you to like almost every different like form of script impossible. That one I ended up using something that was new to me at the time called Headless Browsing with a Python package called Playwright. And essentially that's very, very high tech in 2022. I guess for certain people designing like AI workflows now, they're just like, that's cute. You essentially can like write out as a script agent, so to speak, and tell it, hey, go to this website, click on these links. You know, by digging in and understanding a little bit about how the UI is structured, you can tell it through a kind of like CSS or JavaScript tag
of approximately how to find a button or where to click. So I was able to script out that workflow of navigating through DUIs and getting through the, like, links that it needed to double-click on. So, okay, wait, this has opened a whole new set of questions that I'm excited to ask you about because the first big – now, you mentioned people are doing this with AI, which I didn't know about, so I'm excited to hear about that. But I'm curious – so the way you did this in 2022, I assume, is, like, deterministic. Like, you had to – Yeah, which, frankly, I mean, I'm still the captain. I'm like, I can't address this a little more. Because I told them, like, no, like, in completely explicit terms, like, what you need to do. Yes. I'm, like, in this camp now where we need to get that. We need to get people to remember why we liked deterministic things because it's, like, most of what we were doing in coding was deterministic. And we liked that. We weren't trying to introduce extra error. We already had a lot of error. But one benefit to the kind of alternative approach could be that, you know, techs, they don't know that you're scraping this. And so they change the tag on one of their HTML things or they move a button or whatever and your whole thing breaks.
And then you have to like go in and figure out why it breaks and how often you're doing it. If you're scaling that to all 50 states, maybe that would be challenging. And so I'm curious whether, well, okay, you can go in any direction you want to go in. But one potential area that I would want to think about is like if there's ways to integrate both processes where you build your deterministic agent, but then you also have an AI-based kind of tool that is only for the backup. So should it break, the first implementation would be that this AI agent would then try to look at the page and figure out, like, is it really obvious what the fix is and propose this fix and then see if the deterministic thing keeps working. But otherwise, wouldn't just be, like, constantly in the AI mode? You know, are you seeing anything like that? Yeah. Yeah. No, and I'll admit, I haven't personally tried too much of that, just from the standpoint of, like, I think one of the joys of it being a side quest is that I'm old enough that I guess it just feels good to have something to eat bespoke. Yes, I totally, yes. But the need is definitely, or the statement you laid out of, like, what if something changes now that I've been doing this for a few cycles is also so very real.
Of a couple of years I've taught kind of like a training and tried to maintain GitHub based on some of this, drawing examples from different states. But every time I touch that thing, I'm like, I've got to change two thirds of this because someone moved from something that was in PHP. So I could use one set of, like, tools versus now it's in JavaScript. So I use like a totally different set of tools. You've been doing work in this space for as long as I think I have known. What motivated you initially? Like what was it that made you think about databases initially as sort of database construction? And then maybe what would be some like best practices that you would recommend people to think about when constructing databases? I think almost what we were saying with Fisher being disgruntled about the data collected at Dawson before he got there, I feel like kind of inevitably any data professional at some point end up like working with data that is like wildly not structured how they wish it were structured or then doesn't have like the grain or the information that they want.
And I always just got really curious with the ergonomics we can see in a lot of the tools that we know and use of like tidyvers. I feel like well-designed data wrangling tools work the best and presume the existence of well-behaved data. and I think about them just always had this urge to go a little bit further upstream in taking the data that well-behaved normalized structure. But then I think as I've learned more about the data engineering mindset, I've kind of realized there's so many ways that data scientists can just be more effective using the same frameworks that data engineers are using to optimize kind of databases at scale when building data within their own individual project. Sarah and I deal, we deal with the EHR a lot. And you mentioned this idea of sort of borrowing from data engineers and then having the data scientists familiar with the same, the language and also the same kind of principles to kind of construct this high data. And one thing that Sarah and I, so like, and I'm sure this is how it is, or maybe, I don't
know, I shouldn't be sure. I'm guessing this might be how it is in some circumstances for you. So I'd love your advice on it because what we note, like in our infrastructure, there's data, there's the data level, which is like the electronic health records. And then the people closest to that data level are actually IT, which are more maybe like a data engineer type person. I don't even know if that's exactly what they would be called, but they are the ones, you know, they're going to. So the EHR data epic turns EHR data into something that's like a SQL database. You know, so this is sort of like there's that connection, which first is that very first step. there's some abstraction from like what you actually literally typed into a medical record and what is getting put into these SQL databases. But those databases, then there's a data warehouse that we don't have access to most of the time as researchers. There's another layer that has access that is then extracting this information. And then we're taking kind of what we get from them and are doing something with it. I feel like there's something to be learned on all these sides.
And Sarah, maybe you can talk a little bit about what you've had experiences there too, because I think part of it is like there's some that we can learn from them, but there's also, I think, information that they can learn from the people downstream about what they're going to ultimately be doing with the data that might change how they would extract it. No, I think you laid it out really well, right? I think a lot of what this was reminding me too, Emily, as you described it, is like a lot of my dissertation work was with multinational observational HIV cohorts. And so we had individual HIV sites across, like, the Caribbean, Central and South America that collected their own, like, routine health data on paper charts. Then they would put it into an Excel spreadsheet and send it back to the Data Coordinating Center at Vanderbilt. And so over the course of, like, 15 years, this particular cohort had amassed, I think, a very impressive handbook, essentially, for data harmonization that didn't exist in the beginning, Where it's like, if you're going to take routinely collected data from six different countries, 12 different sites, whatever, we all need to agree on what this variable means and how it gets coded so that we could then fool it to answer questions at scale.
And I think that that I don want to say it like a thankless task but I feel like people hear that as like administrative strain and like it made as the little baby analyst who was brought on to their project it made it a dream because I could use data where no matter which country I pulled you can like deep higher bind rows stack all the data because they as a network had agreed that this is how this should be done. And so that was kind of what I was as you were describing the different states and bringing them together. I was like, oh, it's like when I combined like SISIS and CASMAT, except that we had like playbook basically that they had to follow and there just isn't that obligation when these states exist separately and essentially play by their own rules so that was super related to for me to what you were describing is like this idea of data harmonization which I've since learned means slightly different things to different people but to me that's pretty much what it means and then in terms of like what you laid out with the EHR Lucy I think that's also very similar where
At least to me, EPIC and that starting level is its own form of standardization, where it's like, if we all exist, then at the very least, the healthcare systems that all use EPIC start from the same place. But then there is immediately opportunity for different interpretations of the same task. Honestly, just human error when you write a particular join or the way that you sort something or the slightly different way that you filter or handle missing values. And, yeah, I think for me coming from like that, like the cohort I had worked with before started with paper charts because they were primarily in low and middle income countries and they didn't have reliable Internet. and so there was a lot of conversation at the time of like there's opportunity for error because they're busy and they take paper notes and then they have to enter them into excel and get it back and when i started working with the ehr i was like well where's the error gonna come from i like was i came in with like rose colored glasses and just thought if we're starting in the computer then
where does the error come from and i think that that flow that lucy outlined of like well the thing is like a clinician provides care they or it's like a tech or someone enters it into epic epic then splits it across a bunch of tables in their own databasing that then gets stored at an institutional level but then get individually kind of sliced and diced to curate these analytic data sets for research studies i think i largely just recapped what lucy said but it is something But it's very real. And it's, I think, maybe the best parallel beyond the fact of just, like, different interpretations of the same task. And it's a hard task. Like, if you bring IT onto a project I spent two years developing, and then suddenly they have to pull the data that we painstakingly came up with inclusion criteria for and all these weird derived variables. Like, I completely emphasize because you come on and the rest of us have been thinking about this forever. And then suddenly you have to pull the data in, like, two or three weeks. And it's just like, it's hard, I think, to get everyone up to speed at the same time.
But you can add on top of that the fact that even if you all use Epic, there's that other level where then if I want to combine data from our medical center and another medical center or even separate sites within our same medical center, you have immediately run into opportunity to lose harmonization. I learned recently that the International Classification of Disease Codes, like ICD codes, are a big part of the electronic health records data. They're fallible for sure because they exist for billing more than anything else, but people do like to use them to approximate diagnoses and things like that. Do you all know that every institution gets to decide what rank order the text matching should work? So if I type wild diabetes at one healthcare system versus another, the first ICD code that pops off when I type diabetes is like set. And in my mind, an opportunity to bias the way people respond. Like diabetes is probably a pretty clear cut one, but there are other ICD codes that are nested within hierarchies in a meaningful way.
And they're kind of ambiguous. And you can essentially bias clinicians who are fast and trying to do their job by the way you chose for them to see the options. Whereas, like, if I type the first word and pick the first one that pops up, maybe the second option was better. But the software, put that one at the top. Yeah, go to the first. And that would be such a fun study. Yeah, like, if that's different. Even within, like, the hospital at Wake is, like, part of a larger healthcare system now where we have a site in Charlotte. We have sites in the Midwest, and we could even compare, like, the coding and the standards, essentially, it's like the default between the Winston-Salem Hospital and the Charlotte Hospital, and that is also different. Does this translate to what you see, Emily, like, both in the, I guess, in this side quest, but also just in your regular kind of work? Oh, no, absolutely. I mean, I think truly my first time taking my teeth into all this was similarly being at a point in one of my companies where we were trying to integrate different systems that have been on different platforms historically and being like, oh, wow, an open account doesn't mean the same thing.
A statement does not mean the same thing. A transaction doesn't mean the same thing. A balance doesn't mean the same thing. And I think the two things that are just fascinating to me about that is data engineers are blind to data science. A lot of the data modeling decisions, meaning the structure of the database, actually become analytical decisions in ways you don't expect. You know, I mean, like the difference between if I have ones and nulls in a column versus ones and zeros in a column, somebody comes along and takes the mean, and you essentially just change the conditional probability of the population you're considering. I feel like in stats, we're really good about talking about the data generating process in the sense of like, this is the thing that happened in the real world. But there's also a kind of an equal amount of error and bias coming from like the physical bits moving data generating process from the different systems. Yeah, we need like one more layer. I think that's such a good point. If you think about drawing your identity mechanism for where the data actually came from, and then we need another layer for what the data that's filtering to my computer.
Because the other thing is like, as you just described, the ones and zeros versus ones and nulls, an analyst can handle that if it's documented. Like if they know that a zero, I mean, I guess they can't fully do it if there are, there could be real zeros. And so there's a mix of zeros and nulls, but the best you could do is bound your result. But at least you can know that there are bounds on your result, you know, if it's documented. But I think the other part that's so challenging is that some of those decisions feel innocuous to the layer above because they don't have the kind of full picture of what's going to happen downstream. Oh, yeah. I don't know how we solve that problem. I'll even give like a very recent example that was totally fine, but I was given a data set of encounters recently. And I was given six Excel spreadsheets entitled like encounters one who stick. And I went through and I was like, I noticed they were all the same columns. And I had to reply to be like, can I stack them?
Like, is it just that they were too long to be one Excel spreadsheet? you split them into six or are they organized in like a meaningful way um for whatever reason that was not part of the standard documentation i received i was just like flipping through six excel spreadsheets like how do you all relate to each other and the answer was yes and maybe they said that but i didn't find it clear enough they did say they have the same columns i was like okay but what do you what are your suggestions what do you think we should be doing what's your what do you think like as data people this is like what should we do next simply teach us help us fix it I was not told I had to, like, that this was a solution. You solved all the problems. I'm sorry. No, no, we can go back to the next question. No, no, no. We got too serious. I mean, at a serious note, I mean, I think there is just, like, to me it is really just feeling like you need to know about what the process is. And not just the choices people make. But also just, like, another separate repertoire I could take us down is when we talk about data quality. And I think students, we tend to teach them to look at your summary statistics. I don't know what hypothesis set is trying to validate.
I don't know what I expected to see here. And I feel like things even just understanding. Are upstream source tables updated? It's the same cadence to different cadences. Are there things being joined on versus unioned on? Understanding just the data flow above you, I think, can just really help people do hypothesis-driven quality analysis. Because, like, you know what types of common pain points would actually be. And honestly, too, I mean, I think there's like, I mean, sadly, like there's also no better interim workaround than just bringing your fingers enough on it to ask some of the right questions. Going back to the context of sort of this specific side quest that are mentioned with encounters, I think is another thing that can just be. Fundamentally distrust all timestamps. I guess it's another not solution, but the timing principle, the time something's recorded, very, very different than the time that's happened. And this even comes up a lot. Going back to the early vote data, when you're timestamped as having voted, is that based on, say, for somebody that voted by mail when they mailed the ballot or when the ballot was received?
And I think just generally always being aware of, like, how much your data is never wrong, but what your data is a reflection of is the process of collecting the data. And your reflection of that also happens to relate to something that happened in the real world. I love that. I think that I do, too. That timestamp one, too, is so relevant because I always give the very simple, you know, when I'm like, oh, causal inference is so easy just to adjust for everything pre-exposure. We could do it all the time. And then it's like, oh, but what is actually your definition of time of exposure in the EHR? Is it when the scan was taken or is it when the scan was read or is it when the result was given back to the patient? And for labs, it's the same where we usually use labs as, you know, these pre-exposure type variables. And is it the lab, is the lab taken on the same day that the exposure was assessed or was it taken two weeks ago, which would be what we would like for it to be? Or was it, you know, or was it actually read on like the date that I have? Because usually, again, dates, we don't always know exactly what they mean,
although you can usually get traced back to them if you can request enough information. But there's, like, multiple. And the other thing that happens is, like, if there's disagreement. So it passed through pathology and they said one thing, but then it got to, like, you know, whatever, the clinician that's interfacing with the patient and they said something different. So then the timestamp there also kind of can matter. And again, if you read the analyst five steps downstream, and you probably not even getting the timestamps You just getting like time since X thing column Yes Which is a date difference between two dates that fundamentally didn exist in the same time space continuum Yeah. I think it's a good takeaway in general. Like I like the idea that like your data aren't right. They maybe just are reflecting the collection process. And I think it's especially prudent for the settings like we're talking about that are called like, are you familiar with like secondary use data or like data that are being repurposed? So the EHR exists to support billing. generously it exists to support clinical care but technically speaking when it was first like first kind of started under George W. Bush in the late 90s and then really popularized
under like the Affordable Care Act with Barack Obama it was technically for billing and so you have to keep that in mind it's like even with the billing codes it's not maybe necessarily that that's exactly what that patient experienced sometimes maybe they thought they were doing them a favor they built it a little differently that happened to me at an eye doctor they built my eye appointment slightly differently because they thought they were helping me. But that was not my experience. And I could imagine the same is true, especially at a state level, where, like, each state, yes, is being, to their own degrees, transparent about these early voting data. But, like, what are they actually trying to show with it? Like, are they actually trying to show just, like, the lump sum? Here's how many people are registered to early vote. Are they trying to do it as, like, an engagement rate of, like, people who could have and didn't? And I feel like the collection, yes, but also what they're trying to show with the version you see kind of adds this lens that is also out in harmony.
Oh, yeah. And, too, I think in that context, another thing that I'm sure is probably really relatable to, like, your all fields, it's another situation where you never have actually the base population on which you'd prefer to do on Amfess. You know, I mean, in voting data especially, ideally, you'd always be thinking about things in terms of the voter-eligible population, not just through the best case, you can get registered voter data from different states. But that's obviously hiding out of the ball and introduces its own biases. People that are just showing up in this database have a high likelihood to vote because they're not going to go bother to register a week before the election and then not vote. But I think that's something that definitely comes up a lot across all fields is like, how do I make progress when I don't actually have the real denominator for anything that I want? Yeah, that's huge in the EHR because it's just the entire thing is conditioned on the idea that you could engage in care at this particular health care system in some capacity.
I feel like we could do so much more with bounding, although I don't know, because sometimes I say that initially and then I'm like, well, but then we give these big bounds that like then there's nothing can be actionable. But it feels like when you don't know your denominator, in theory, you could know the population. You could do something. I mean, EHR is a little harder than this because you don't necessarily know like potentially in the catchment area or something. You could have like a upper bound and a lower bound on these to sort of show like this is the range that it could be. But I mean, even as I'm saying that, like, I remember I sometimes show it for during COVID, there was a case where a hospital system up in New York published this information. They published this number that got like everybody very scared that 84 percent of people in the ICU were dying from COVID. And it was a denominator problem. If you actually looked at the numbers, the majority of the patients in their study were just still in the ICU. So the 84% were among people for whom they had an outcome for, but they were leaving out all the people who were there. So you could bound this result, you know, and if you bounded it basically to say, like, what if everybody who's still in the ICU does die?
That would be like the upper bound. Or what if nobody who's remaining dies? That would be lower bound. But like, I give this example, but the range then goes from 24% to 98%, which like is not a super helpful piece of information. So it's like sometimes we just need to like put some uncertainty bounds on this. But abounding sometimes is just like, yeah, we don't know. Isn't that a safer takeaway, though? Like, if abounds are that we don't know, maybe the answer is that we don't know. And you should not make a decision based on the other version. Right. I'm sympathetic to the idea that we have to make a decision. So it's like, and sometimes I think people are paralyzed under this, like, we're like, yeah, it's between 24 and 98, so good luck. And I think sometimes statisticians try to, like, throw those types of things, which I think is also not ideal. So I don't know. I don't know exactly what to say about it, but I think it's an area that is challenging because I think you also don't – obviously, you don't want to just be like, we're very certain it's 84. I feel like, yeah, the thing, though, that's kind of in between, that's a little bit underappreciated is almost more like within those, like, sensitivity bounds.
There are regions of the data having a break-even point of if thing X is true, the bound is positive or something. And then I feel like that gives people a much narrower, you still have to make an assumption and it's still transparent, but they can think about, do I think I'm closer to having outcomes for half these people or some different, you know, I mean, like, I think it, like, narrows this down. What is actually the thing that's driving the uncertainty to take a more educated data? What did you end up doing with this data? Can you tell us about what the kind of, or what types of things, because it sounds like you maybe did a couple of different things with it. Yeah, definitely. So I'd say a couple of different use cases. Some have been more operational in nature, which is more some of the groups I've been working with on more voter turnout efforts, activating and integrating the data with kind of campaign efforts. But probably the easier one to explain is, so North Carolina has a super, super rich past voter history update along with kind of turnout. That was definitely a bear to claim. It must change a lot. But that's actually become one of my go-to hangout on my desktop data sets of when I have.
a silly little modeling idea of something that's so much more representative of the complexity of real world data than fake data or simulated data or Kaggle, just for testing out different ideas. It's really fun if you just need like a generic modeling problem to try stuff. Something like voter turnout is really fun just because it has a lot of the same biases that you encounter in any space. Obviously, whether or not you can argue the last election is the most predictive, But then you have the cyclicality of, like, midterm and general elections, which have really different rates of engagement. And then so we have that as a two-year epicycle. Then we have senator or governor races at different cycles that, you know, I mean, the base rate of engagement is different. And then there's strong county effects, demographic effects, that depending on what you actually want to target or want to achieve with a model, Sometimes you want your model to capture those, but other times you kind of don't want your model to capture those. Because if I'm doing the voter turnout initiative in Charlotte, having a model that tells me, oh, I know all the Charlotte people are higher engagement than the people in Wake County.
It's not actually informative. Yeah. So you can get super high for all your generic modeling metrics, you know, like AUC or something. You can be like, oh, wow, I have a great model. It's almost like the opposite of generalization. It specializes wildly poorly. That's been kind of, I think, like both practically useful, but also a fun data set to kind of have as a go-to if I have. So I've had like different things I want to experiment with, grab and go data set to play with. This is awesome. Do you have, have you found something like an intervention that would be useful to increase? Sarah and I are in North Carolina. Could we, what could we do to increase voter engagement? Oh, gosh. That I wish I knew. That I wish I knew. Yeah, but don't we all wish we knew? But I do know I can somewhat effectively capture county effects in a predictive model by worm-stating and sheep-bounds. You know, none of the important problems. But fun. Sad question. That's it. I love it.
I feel like all of us, like, the longer we're in the field, it's like a decade ago, I think I would have been like, oh, but you have to, like, let the data speak. And now I'm just like, the data doesn't know what it's talking about either. This has been so fun, Emily. Thank you so much for coming on and talking with us. Okay. So the first thing, we have a thing called a segment. This is like Mean Girls related for rating how fetch you found your analysis, although you've done a series of analyses. So if you were to rate it on a scale of one to many fetches, how many fetches would you give your analysis? And we're not giving you any context here, which is like not useful for a quant person, But we're just – this was – we used to – so to give some context for where the segment came from, we were, like, trying to draw connections back to Mean Girls because, you know, I don't know. I think it's, like, a fun, yeah, old pop culture, pop culture reference. And initially when – Don't call it old. Don't call it old. I know. I know. I know. I think we're – I think you're a little bit younger than I am. I feel like I'm constantly aging myself in my interests.
But when we first conceived of it, we're like, oh, maybe we'll rank these based on how fat-free-five they are. We did them for each other. The first couple episodes we recorded, I did one and Sarah did one. And we did rank each other. And then afterwards we realized that there's no way. We're not going to do it. First of all, we can't make comparisons. And we're also never going to not give someone five fetches. I don't know. So we're like, we'll have them rank themselves. And this will be a fun. On the back end, we could do an analysis of the fetches. I don't know. I'm not really sure what we're doing with this information. But if you were to rank your analyses, and you can define fetches. This will be a measurement issue where you can define it however you want. because it could mean how fun it was to do it or how, you know, much information you think you've gleaned from it or some other metrics that you decide fetch means. Yeah. No, I mean, I think, so I guess I was thinking of it originally, like, going back to the Mean Girls context of, like, how popular is it in today's world? And I think from that perspective, I'd probably give it only, like, kind of, like, one or two fetches just from, like, the point of what we said of now you can probably, like, I'm sure you could somewhat autonomously point quad at some of these projects or websites and get a lot of it for free.
So, I mean, in some ways, I guess kind of like the still stepping through five or different screwing techniques, just manually collect this. Might not get at the popular girls like lunch table in this moment in time. But I think there's something just really fun about we started out from the beginning, that deterministic and handcrafted way of both being sure, A, you understand what you've got at the other end. and be just like understanding kind of the mechanics how to get there. Well, this was delightful. Thank you for sharing this with us. You go, Glenn Coco. We are regression to the mean girls. We're mean as an average, but actually really nice. Tune in next time.
番組の概要欄(原文)
<p>Follow <em>Regression to the Mean Girls</em> on [<a href="https://podcasts.apple.com/us/podcast/regression-to-the-mean-girls/id6807111816">Apple Podcasts</a>], [<a href="https://open.spotify.com/show/6L5PaIieWX4uNz06tCPcKp">Spotify</a>], or wherever you love to listen!</p><p><br></p><p><a href="https://www.emilyriederer.com/" target="_blank" rel="ugc noopener noreferrer">Emily Riederer</a><a href="http://hadley.nz/" target="_blank" rel="ugc noopener noreferrer"></a> (Capital One) joins <a href="https://www.sarahlotspeich.com/" target="_blank" rel="ugc noopener noreferrer">Sarah Lotspeich</a> and <a href="https://www.lucymcgowan.com/" target="_blank" rel="ugc noopener noreferrer">Lucy D'Agostino McGowan</a> with a data-driven side quest into scraping election data. </p><p><br></p><p>Check out the full process here: <a href="https://regressiontothemeangirls.com/" target="_blank" rel="ugc noopener noreferrer">regressiontothemeangirls.com</a></p><p>Follow along on instagram: </p><p><a href="https://www.instagram.com/regressiontothemeangirls" target="_blank" rel="ugc noopener noreferrer">@regressiontothemeangirls</a></p>
出典・この記事について
- 番組
- Casual Inference(Lucy D'Agostino McGowan and Ellie Murray)
- 元の回
- Regression to the Mean Girls | Election Data Web Scraping with Emily Riederer
- 配信日
- 要約作成日
- 公式サイト
- casualinfer.libsyn.com/website
この要約・解説記事は、元の音声を文字起こしした内容をもとに AI(Claude)が日本語で作成したものです。 固有名詞や数値に誤りを含む場合があるため、正確な内容は元の音声でご確認ください。制作方法について
関連エピソード

AIは建設現場の「本当の進捗」を見抜けるか? Buildots のアミール・バーマン氏に聞く
Making Data Simple

Regression to the Mean Girls:ドラマの「初キス」は視聴率(評価)を変えるのか? Ashley Mullan と考える
Casual Inference

Regression to the Mean Girls:野球データ解析とBART(Sameer Deshpandeと語る)
Casual Inference

Regression to the Mean Girls:『Dancing with the Stats』— 学部生が挑んだ生存時間解析
Casual Inference

Regression to the Mean Girls:混合効果モデルとLove Islandのキススコア(ゲスト:Hannah Barton)
Casual Inference

Regression to the Mean Girls:Roger Peng と「みんなのための因果推論」――偶然のビジネスマンになった寄り道
Casual Inference