<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>JAX on Volundarhus</title><link>http://www.volundarhus.com/tags/jax/</link><description>Recent content in JAX on Volundarhus</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 31 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://www.volundarhus.com/tags/jax/index.xml" rel="self" type="application/rss+xml"/><item><title>pymargins: A Ground-Up Redesign of Marginal Effects for Python</title><link>http://www.volundarhus.com/posts/pymargins_package/</link><pubDate>Sun, 31 May 2026 00:00:00 +0000</pubDate><guid>http://www.volundarhus.com/posts/pymargins_package/</guid><description>&lt;p&gt;A while back I wrote about &lt;a href="http://www.volundarhus.com/posts/smmargins/" &gt;marginal effects for StatsModels&lt;/a&gt;&#10;and then &lt;a href="http://www.volundarhus.com/posts/smmargins_package/" &gt;released that work as &lt;strong&gt;smmargins&lt;/strong&gt;&lt;/a&gt;,&#10;a package that brought Stata-style &lt;code&gt;margins&lt;/code&gt; to the StatsModels&#10;ecosystem. This post is about its successor, &lt;strong&gt;pymargins&lt;/strong&gt;, which is&#10;not a new version of smmargins but a complete, ground-up redesign.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pip install pymargins&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="where-this-came-from"&gt;&#10; Where this came from&#10; &lt;a class="heading-link" href="#where-this-came-from"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;smmargins started as research code. I was doing population-study work&#10;at UCSF, and the recurring need was to turn fitted models into&#10;quantities people could actually act on: a risk difference in&#10;percentage points, an adjusted prediction at a representative patient&#10;profile, a subgroup average marginal effect. StatsModels'&#10;&lt;code&gt;get_margeff()&lt;/code&gt; covered a sliver of that, so I kept accreting helpers&#10;until the helpers were the size of a package. smmargins was me carving&#10;the useful parts out of that research code and giving them a public&#10;API.&lt;/p&gt;</description></item></channel></rss>