{marginaleffects} for
#RStats
recently won the 2023-24 Statistical Software Award from the Society for Political Methodology.
It's a massive honor, because I have used and benefited a ton from software by literally all past winners.
A feelings 🧵 1/5
𝚖𝚊𝚛𝚐𝚒𝚗𝚊𝚕𝚎𝚏𝚏𝚎𝚌𝚝𝚜 0.9.0 is a BIG📦release! Simple yet powerful tools to help you interpret the results of over 70 classes of models in
#RStats
(LM, GLM, GAM, discrete choice, mixed-effects, bayesian, etc.) 🧵 on some cool new stuff.
🚨 I'm excited to release the 𝚝𝚒𝚗𝚢𝚝𝚊𝚋𝚕𝚎 📦 for
#RStats
! Convert R dataframes to beautiful tables in HTML, LaTeX, PDF, Quarto, Markdown, etc. Easy to learn; minimalist interface; concise syntax; ultra-customizable tables; and zero dependency. 🧵
The {marginaleffects} 📦 book is now online! 25 chapters on post-estimation analyses and interpretation with
#Rstats
. The 📖 is full of tutorials, case studies, tips, and technical notes. Please check it out and let us know how we can improve this resource
🚨 modelsummary 2.0.0 📦 for
#RStats
is out now!
Draw beautiful and customizable tables for your descriptive statistics, regression models, correlations, balance, etc.
Save your tables to HTML, Word, LaTeX, PNG, Typst, and more.
Short 🧵 for v2
It's official. I'm writing the
#marginaleffects
book!
The provisional title is “Model to Meaning: How to Interpret and Communicate Statistical Results in R and Python”
Please reply with better titles, artwork ideas, content suggestions... What do you want to read?
#Rstats
Check out the website re-design. 30 free chapters of tutorials and case studies on how to interpret your statistical models in R and Python. Now with cute illustrations!
{modelsummary} is your 1-stop shop for regression tables, coef plots, corr tables, and descriptive statistics in
#RStats
. Version 1.4.0 includes a few new features, including a persistent way to switch between gt, kableExtra, flextable, DT...
{tinytable} is now available on CRAN! It's a dead simple and 0-dep📦to create beautiful tables in R. Check out the GIF below for a peek at the new "tiny plots" feature. In addition to TeX, PDF, MD, and HTML, we now support Word and PNG. Tutorials here:
New
#Rstats
tutorial: How to Interpret Interactions, Polynomials, and Splines with {marginaleffects}
I'd love to get feeback on this one. It's the first draft of what could become one of the "recipe" chapters in the book.
{marginaleffects} 0.14.0 for
#RStats
offers more reliable estimation of std errors and lots of cool features. Everyone should upgrade now. BTW, we just got a fancy new domain: While you're there check out the revamped bilingual (R/Python) Get Started page
Grant McDermott just released a new version of his 𝚙𝚕𝚘𝚝𝟸 package for
#RStats
. It's an ultra-lightweight package that makes it easier to draw facets, area plots, ribbons, legends, and more using Base R plotting functions. Very cool stuff:
Rohan is spot on. I've been coding every day for 15+ years and still make tons of elementary mistakes. I bet coding errors are nearly as important as the garden of forking paths in explaining why published findings are often wrong.
🚨 This fall, I'll be teaching an online short course titled "Interpreting and Communicating Statistical Results with R". It's about using the estimates produced by complex statistical models to deliver clear and meaningful insights. 1/3
𝚖𝚘𝚍𝚎𝚕𝚜𝚞𝚖𝚖𝚊𝚛𝚢 1.3.0 for
#RStats
adds:
1) Show groups of models in "panels"; a style of table popular in
#EconTwitter
#PoliSciTwitter
2) Powerful new way to control rounding (eg signif digits).
Plus, the 📦 can summarize all your descriptive stats or models.
🔗⬇️
I'm 𝒕𝒉𝒓𝒊𝒍𝒍𝒆𝒅 to be speaking at
#useR2024
next week.
How to Interpret Statistical Results with the marginaleffects 📦 for
#RStats
Here’s a pre-recorded video on Youtube in case you can’t make it
Let me know if you're in Salzburg and want to chat!
🚀 {marginaleffects} 0.16.0: A unified interface to interpret results from 100+ statistical and machine learning models in
#RStats
! Predictions, slopes, differences, ratios & much more! See our new vignettes on Matching, Inverse Probability Weighting & ML:
New tutorial: "MrP with {marginaleffects}." A super easy way to adjust non-representative data using Multilevel Regression and Poststratification in
#RStats
. Let me know what you think!
Violets Are Blue. OLS is too.
`violets` is a package for
#RStats
to re-estimate all your fancy statistical models using simple OLS.
[annual post courtesy with h/t to
@abhworthington
and
@researchremora
]
{countrycode} 1.5.0 for
#RStats
is branching out! The 📦now ships with new dictionaries (crosswalks) to convert American State names and abbreviations, Swiss Cantons, and more. You can also create your own dictionaries and submit them to the Github repo.
New vignette:
Conjoint Experiments with `marginaleffects` for
#RStats
See how you can easily compute marginal means, AMCEs, or AFCPs. Learn tricks to conduct subgroup analyses or run complex hypothesis tests on (combinations of) those quantities.
How to interpret differences between smooths in GAM models?
A really nice pair of answers by
@ucfagls
and
@nj_clark
. Sometimes, I'm still amazed when I see experts fixing strangers' problems for free on the internet like this!
I just read a great book!
Telling (true) Stories with Data requires more than fancy statistical models and big data. With a series of fascinating case studies,
@RohanAlexander
teaches us how to ask good questions, acquire data, estimate models, and communicate our results 1/2
The {softbib} 📦
#RStats
scans a project folder, detects the software used, and magically creates software bibliographies: Word, PDF, Rmd and BibTeX.
Complements our new free article which argues that researchers should acknowledge the contributions of software devs to science
Now online!
Software Citations in Political Science
@VincentAB
and I document the under citation of software in political science, suggesting it disincentivizes the creation and maintenance of public goods.
Thrilled to teach my
@StatHorizons
course "Interpreting and Communicating Statistical Results with R," from June 18-21.
Last edition was a blast, thanks to amazing participants. I'm super excited to meet the new group!
Questions? Let me know!
#RStats
*marginaleffects* for
#Python
can compute predictions, slopes, and comparisons (diff, ratio, etc.) for many statsmodels. It can run hyp & equiv tests as well.
This is a dangerous *alpha* release. Send feedback & bugs:
#stats
#econtwitter
#datascience
🚨
#RStats
📦 developers!
`altdoc` is an easy way to create highly customizable websites for your documentation.
It's an alternative to `pkgdown`, with support for Quarto and several other frameworks: MkDocs, Docsify, Docute. Expand 🧵 for examples.
🚨 Job Alert! 🚨
Assistant Professor of Political Science, Université de Montréal
Data Science or Causal Inference.
Great job, fantastic city, ultra-nice colleagues!
DM or email me with any questions (ex: about French teaching req)
Please apply!
Another journal says bibliographies will no longer count against word limit. A perfect opportunity to cite the software you use!
In
#RStats
, `softbib()` scans your scripts and auto-creates software bibliographies in docx, Rmd, bib and pdf. Check it out:
📣📣📣
Two announcements from PSRM regarding word limits on submissions.
The standard length limit for original articles is 9,000 words. The new editorial team has decided that going forward bibliographic entries will NOT count toward a manuscript’s word total.
Violets are blue, OLS is too. The {violets} package for
#RStats
re-estimates fancy statistical models using simple OLS. This annual valentine is courtesy of
@abhworthington
. Logo by
@researchremora
Just released a port of my `countrycode` package for
#python
. Convert between 40+ different kinds of country codes, to 600+ name variants, and has regex to translate English, French, German, and Italian names. Please try it and let me know if what breaks.
With {marginaleffects} you can compute and plot predictions, slopes (dy/dx), marginal means, and comparisons (contrasts, risk ratios, log odds, etc.). That's a lot, but don't worry: I 💘 documentation. Check out the new "Get Started" page and the 25+ vignettes and case studies.
We all need to start publishing **full pipelines** of code, including all cleaning steps; not just the code to fit models and draw plots using a "pre-cleaned" dataset. I've personally been very bad at this, and will make a major effort in that direction for future projects.
Could any
#RStats
Machine Learning person test something for me? The upcoming `marginaleffects` 📦 will support `tidymodels` and `mlr3`. I would really appreciate it if you could try the development version and let me know if you run into issues. Vignette:
Hey
#RStats
people! I would 𝒓𝒆𝒂𝒍𝒍𝒚 appreciate some feedback (interface or code) on a new feature I'm working on for {marginaleffects}: Prediction intervals using conformal inference. This could be a killer feature, but I need people to kick the tires
I want to implement joint hypotheses tests in {marginaleffects} for
#RStats
. My goal is to allow joint tests on model coefficients and for everything else the package estimates: contrasts, slopes, predictions, etc. What features do you need? Is this user interface OK?
I've been asked to consult on small data analysis projects. I'm a boring salaried worker and have never done this. How should I think about compensation? Surely it depends on the type of project and on my qualifications. But what factors and what range should I consider?
Soooo, I wrote both `modelsummary` (last year) and the first iteration of `summary_col` (10 years ago). I guess this means I suck a bit less than I used to? 😅
Question to
#EconTwitter
and other Econometrics/Python users:
What workflow do you have to output publication-level tables with regression coefficients?
Something along the lines of
#Modelsummary
from
@VincentAB
in R would be awesome.
I use "summary_col" but it sucks
"Where Should Multinationals Pay Taxes?" is out!
Pre-print for those in
#TaxTwitter
#PoliSciTwitter
and
#EconTwitter
who can't cross the paywall:
It was a great privilege to work and learn from my friend
@ablais_udem
. Hope you like the paper!
Where do people *actually* think multinationals should pay their taxes?
Most people dislike the current regime, instead favouring taxation based on market/destination principles.
Great to see this important paper from
@VincentAB
and
@ablais_
out:
New notebook for
#PoliSciTwitter
and
#RStats
: Notes on Hainmueller, Mummolo & Xu: How Much Should we Trust Estimates from Multiplicative Interaction Models?
I'm super happy to see this paper online, and tremendously proud of my student Simon St-Georges, who led this interesting and policy relevant project. Thanks to
@ablais_
and
@realMarcoMA
, the best co-authors I could hope for.
Not everyone seems to know this cool (but trivial) trick: It's an easy way to adjust for covariates in an experiment, following the advice in Lin (2013). See screenshot below or details at the link:
@stats_samir
A trivial tip: The Lin strategy does not require centering; it only facilitates interpretation. Taking the slope of the uncentered model is equivalent. In this example, it's basically a wash, but the 2nd approach may be more convenient when there are lots of covariates:
Text analysis question: I have 100k strings, each only a few sentences long. I want to know which strings relate to topic X, and how "central" that topic is. What is the best/latest/cool way to that now? Should I give GPT some reference material and pay $$$$ for API calls?
I really look forward to teaching this class! It'll be full of
#RStats
and
#marginaleffects
. I'd love to see you there! Please let me know if you're on the fence and have questions.
Join
@VincentAB
for Interpreting & Communicating Statistical Results with
#Rstats
on Nov. 16-18 to leverage the power of statistical models to deliver clear & compelling insights w/ confidence. Learn to illustrate your findings & create reproducible reports to convey results.
This DataViz nerd had a very good day: saw a Draft of Florence Nightingale’s Causes of Mortality in the Army in the East
Also: Gutenberg bible, Shakespeare 1st folio, Magna Carta, Da Vinci notebooks, Michelangelo Love notes, Monty Python scripts. British Library “Treasures” = 🤩
The
#RStats
community is pretty great. Out of the blue,
@EtienneBacher
tweaked my code and made several key {marginaleffects} calls 2-5x faster. Thanks! Also, check out the improved support and vignettes for plots and multiple imputation:
Thanks to
@strengejacke
for his tireless work on {insight},
@noahgreifer
for code and comments,
@PhDemetri
for memes, and everyone who debated terminology with me on here. Please direct complaints about all the underscores in function names to
@mattansb
and
@mjskay
Some journals in political science have been assessing the computational reproducibility of results for a while. It is expensive, but not prohibitively so. See for example the guidelines from the American Journal of Political Science:
@xuyiqing
FWIW, my understanding is that {lfe} is no longer developed, and is only receiving critical bugfixes by a team of volunteers who do not have the time to do much on it. {fixest} is probably the best choice for most users going forward.
3 things:
1) My new
#RStats
package `tinysnapshot` is out!
2) Thanks to Mark for his awesome `tinytest` and `validate` 📦
3) Thanks to the CRAN team who gave me super helpful pointers for this (and other) pkg releases
#rstats
package 1.2.3 'validate' is on CRAN now
- Fixes and other small improvements
Cheers to the CRAN team for their relentless efforts to maintain a high standard of quality!
OMFG it exists (photo from a colleague in the UK). I apologize in advance, but this account is going to be (even more) insufferable for the next month.
The `hypotheses` function can now run null hypothesis, non-superiority/inferiority, or equivalence tests on a ton of quantities of interest: raw coefficients, contrasts, predictions for different individuals, the sum of two predictions, the mean of three slopes, etc.
Confidence intervals can now be computed using the delta method (default), bootstrap, or simulation-based inference. Note that the resampling code is still experimental; I would **really** appreciate any feedback or feature requests.
⏰There's still time to sign up for my class next week! We'll learn a simple and powerful framework to interpret and communicate complex statistical results. I'm super excited about this course; it's going to be a ton of fun! Please let me know if you have any questions
Join
@VincentAB
for Interpreting & Communicating Statistical Results with
#Rstats
on Nov. 16-18 to leverage the power of statistical models to deliver clear & compelling insights w/ confidence. Learn to illustrate your findings & create reproducible reports to convey results.
This was a fun project and a special treat to work with such great colleagues! Special thanks to the excellent Marco Mendoza Aviña (
@realMarcoMA
) who deserves a ton of credit for this one.
NEW PAPER🚨: delighted to announce that new paper by M Mendoza,
@VincentAB
,
@ablais_
, A Harell and I has been accepted for publication by
@PolStudiesRev
!
The paper focus on outgroup bias and public attitudes do tax fraud. Short 🧵:
via
@OSFramework
My
#RStats
📦can compute the slope(s) of a bunch of models (dY/dX).
#EconTwitter
calls this "marginal effect" in the sense of "tiny change."
#EpiTwitter
and others hear "marginal" and think "average." Should I rename the function? Assume I can keep backward compatibility forever.
@JoshGoodman_BU
@PaulvonHippel
It's a neat observation, but **please** do not publish this in an academic journal. Instead, let's teach people to do this right; with modern software, it's not that hard. "Rules of thumb" with strong distributional assumptions have ruined too many analyses already. 1/2
New blog up!
This is the second in my series on how to make causal inferences from randomized experiments, using various model types from the GLM.
In this post, we introduce the potential outcomes framework for causal inference, with
#marginaleffects
.
Plotting functions also get simpler names: `plot_predictions`, `plot_comparisons`, `plot_slopes`. These functions are more powerful than ever, making it easy to display simple predictions, ultra-customized risk ratios, or decorated plots like this one:
@S_Stantcheva
This looks like a very interesting paper, thanks for sharing! I’ll just note that there are literally dozens of published articles in political science, using survey experiments and exploring these exact questions. 1/2
There are many resources about statistical modeling, but far fewer about what happens *after* we fit our models. I've spent a lot of time thinking about post-estimation workflow and building tools to make analysts' lives a bit easier. I'm excited to share what I've learned. 2/3
@michal_ovadek
Not sure this will qualify as one-stop shop. My theory: There are lots of books on modelling, but once parameters are estimated, many analysts don't know what to do with them. I want to teach people to interpret and communicate their results clearly. A "post-estimation" workflow
@jimhester_
The R6 syntax is nice because it preserves near exact parallelism with the Python API, so that can help multilingual teams. But
@EtienneBacher
has also started some work on a `dplyr`-style wrapper:
@amypond_ps
@KrzPelc
Thanks so much for hosting the talk! I had a ton of fun and got very useful feedback. And thanks for the Invader portrait. I feel cooler by association ;)
@andrewheiss
This looks awesome! Can't wait to read it carefully. FYI, you can compute utility/share by using `hypotheses()`, which allows us to run tests on arbitrary functions of a model's coefficients. Ex:
I love teaching and look forward to learning about your needs, challenges, and interests. Check out the website for a breakdown of the course, and don't hesitate to reach out to me if you have any questions. Thanks to
@StatHorizons
for inviting me! 3/3
Everything you've ever wondered about the international tax regime! Check out new work from
@VincentAB
and
@__lisalechner__
that explores how boilerplate legal language has allowed OECD countries to govern the taxation of multinational corporations.
Function names are now more consistent. Get conditional (unit-level) estimates with `predictions`, `comparisons`, or `slopes`. Get marginal (average) estimates by adding a prefix: `avg_predictions`, `avg_comparisons`, `avg_slopes`. Old names are kept for backward compatibility.
I promise: all of this is very easy to use! Check out the detailed tutorial on the package website. And leave a note or a bug report while you're at it ;)
We're unbelievably excited to open registration for the Montreal Replication Games.
We are looking for researchers interested in a one-day replication challenge at UQAM. In-person or virtual. We give coauthorship to a meta-paper to all participants!
#econtwitter
#polsci