Noah Greifer's Avatar

Noah Greifer

@noahgreifer

Statistical consultant and programmer at Harvard IQSS. Author/maintainer of the #Rstats packages 'MatchIt', 'WeightIt', and 'cobalt' for causal inference, among many others | He/him ngreifer.github.io

3,862
Followers
189
Following
477
Posts
20.09.2023
Joined
Posts Following

Latest posts by Noah Greifer @noahgreifer

This is some beautiful documentation and cool package! What a nice tribute to Dr. Fox.

06.03.2026 23:06 πŸ‘ 3 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

bart2() accepts weights, but they aren’t sampling weights. If you can show me I’m wrong I would gladly change this! Thanks for the kind words about my work :) In the future please use github issues for this kind of question

05.03.2026 22:04 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
a cartoon character is looking out a window at krusty krabbs ALT: a cartoon character is looking out a window at krusty krabbs

But what if... I were to purchase propensity scores and disguise them as my own randomized trial? Delightfully devilish Seymour!

04.03.2026 21:23 πŸ‘ 9 πŸ” 0 πŸ’¬ 2 πŸ“Œ 0
Preview
a person is touching a cartoon character 's face while a snail is laying on the ground . ALT: a person is touching a cartoon character 's face while a snail is laying on the ground .

Counterfactuals! The causal effect of Omanyte vs. Kabuto! Great example :)

04.03.2026 21:21 πŸ‘ 8 πŸ” 0 πŸ’¬ 2 πŸ“Œ 0
Post image

We used a DAG here: doi.org/10.1037/edu0...

Unfortunately not that useful but we used it!

02.03.2026 14:14 πŸ‘ 6 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Well, all the cities are named after colors, but not just red and green colors. Lavander is purple, Saffron is yellow, Fuschia is pink, Pewter is gray, etc.

25.02.2026 16:30 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

It's so great to hear your perspective on this. Thank you for taking part in this discussion!

24.02.2026 19:43 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Because the relationship is nonlinear! A big benefit of the package is that it provides tools for testing and interpreting relationships that are not captured by a single regression coefficient. The outcome model can be arbitrarily complicated and the tools are still useful.

22.02.2026 12:47 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

I'm @ ing you because I disagree with this take. I'd love to hear what you don't like about them, other than "package authors aren't accommodating well enough".

20.02.2026 15:51 πŸ‘ 3 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

That's an even more complicated issue! Here, the treatment is static and scalar, but it can take on values on a continuum. For example, number of cigarettes smoked, medicine dosage, or particulate exposure levels. {adrftools} is model-agnostic; it uses g-computation to extract the ADRF.

19.02.2026 17:45 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Of course {marginaleffects} was the inspiration for {adrftools} and {adrftools} wouldn't be possible without using some {marginaleffects} functionality under the hood. But I do maintain that there is value added here. Of course, you should use whatever feels most productive for you.

19.02.2026 14:36 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

With that specificity come improvements to interface, performance, documentation, and functionality, but only for the tasks that {adrftools} was designed to do. Analyses that would take many lines of code and minutes to run in {marginaleffects} can be done in seconds in one line with {adrftools}.

19.02.2026 14:36 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Sure, in the same way you can just cook your own food instead of going to a restaurant. 😜

There is lots of functionality in {adrftools} not available in {marginaleffects}. {marginaleffects} is a general purpose tool, and {adrftools} is specific.

19.02.2026 14:36 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

I hope this test sees more use and is studied more deeply! Thanks for reading, and let me know if you have any questions about {adrftools} :)

8/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Subgroup ADRFs in two groups stratified by Male

Subgroup ADRFs in two groups stratified by Male

The ADRF contrast, the difference between the subgroup ADRFs. If there is no moderation, the contrast should be 0 everywhere.

The ADRF contrast, the difference between the subgroup ADRFs. If there is no moderation, the contrast should be 0 everywhere.

The omnibus test for 0 moderation.

The omnibus test for 0 moderation.

Some functions of the ADRF might have a fixed value under H0. For example, the difference between two subgroup ADRFs should be 0 everywhere if there is no moderation. In that case, we can replace the projection with the fixed value to test even more hypotheses:

7/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

The choice of projection is up to the user and doesn't have to be a flat line. For example, to test whether a linear model is sufficient to describe the ADRF, we can request a linear projection. If we reject H0, this implies the ADRF is nonlinear.

6/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
Nonparametric Tests of the Causal Null With Nondiscrete Exposures In many scientific studies, it is of interest to determine whether an exposure has a causal effect on an outcome. In observational studies, this is a challenging task due to the presence of confoun...

This test is similar in spirit to that developed in Westling (2022) doi.org/10.1080/0162...

In {adrftools}, the p-value can be computed using simulation, exact methods, or fast approximations, which @tslumley.bsky.social has written about on his blog (notstatschat.rbind.io/2024/09/13/t...).

5/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
Generalized chi-squared distribution - Wikipedia

This statistic can be approximated as a Riemann sum, which makes it the sum of correlated Gaussian variables, which, under the null hypothesis that the ADRF is equal to its flat projection, are centered around 0. Such a sum has a "generalized χ² distribution", for which the CDF can be computed.

4/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

This naturally leads to the following test statistic, which corresponds to the L2 norm of the deviation of the ADRF from its projection:

3/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Similarly, lets say we have a projection of the ADRF, e.g., a flat line. This is also a Gaussian Process, and so is the difference between the ADRF and the projection at each point. If the ADRF is flat, there should be no difference between the ADRF and the flat projection.

2/8

18.02.2026 21:42 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Some more details on the omnibus test for whether the ADRF is flat, as I mention in this test. We have an estimate for the ADRF at each treatment value `a`, and jointly they have a multivariate normal distribution. This makes the ADRF estimate a Gaussian Process.

1/8

18.02.2026 21:42 πŸ‘ 3 πŸ” 2 πŸ’¬ 1 πŸ“Œ 0

I would also say it exposes you to a lot of areas of statistics, including inference, machine learning, optimization, regression modeling, survey analysis, missing data, econometrics. etc. I don't think I would have been exposed to those if I had followed a traditional psychometrics path.

18.02.2026 21:09 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

For me it was the sense that causal inference was used heavily in applied fields, and I was concerned with my work being used to make the world better. These days I've kind of lost that dream and now just like it because I find it interesting.

18.02.2026 21:09 πŸ‘ 3 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

Yes, a JN plot is for studying interactions; this is a plot of the ADRF itself (closer to what you'd get with marginaleffects::plot_predictions()). I don't agree with JN methodology, so nothing like it is implemented, but you can validly ask when the confidence band excludes a certain value.

18.02.2026 17:13 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

My hope is that by using this new tool for studying continuous treatments, we reduce the tendency to dichotomize treatments and extract as much information as we can from our data in a valid way. If you end up using {adrftools} in your work I'd love to know!

10/10

18.02.2026 16:05 πŸ‘ 10 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Estimating, Visualizing, and Testing Average Dose-Response Functions Facilitates estimating, visualizing, and testing average dose-response functions (ADRFs) for characterizing the causal effect of a continuous (i.e., non-discrete) treatment or exposure. Includes suppo...

{adrftools} does a lot more, including producing different estimands, subset estimates, contrasts, and tests, and supports a large variety of models including Bayesian models (e.g., BART), relying on @vincentab.bsky.social's {marginaleffects} under the hood.

See its capabilities here:

9/10

18.02.2026 16:05 πŸ‘ 5 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

The projection model coefficients can also be interpreted directly to provide a quantitative summary of the ADRF. This methodology was described in Neugebauer and van der Laan (2007) but seemingly never made it into applied work.

8/10

18.02.2026 16:05 πŸ‘ 3 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

Though a picture is worth a thousand estimates, often it can be helpful to project the ADRF onto a simpler function to facilitate interpretation. {adrftools} lets you do this with your chosen projection model without committing to a specific functional form for the outcome model.

7/10

18.02.2026 16:05 πŸ‘ 3 πŸ” 0 πŸ’¬ 2 πŸ“Œ 0
Omnibus test for whether the ADRF is flat.

Omnibus test for whether the ADRF is flat.

I developed a new test for whether the ADRF is flat. If H0 is rejected, we can claim there is an effect of the treatment on the outcome. This test can be used with any model because it doesn't test any parameters in the model; it tests the difference between the ADRF itself and a flat line:

6/10

18.02.2026 16:05 πŸ‘ 5 πŸ” 0 πŸ’¬ 1 πŸ“Œ 1

We can use `plot()` on the ADRF object to generate a plot of the ADRF. By default, the plot uses simultaneous confidence bands, as described in @pausalz.bsky.social's paper in the post below. It also uses the corrected g-computation variance estimator described by Hansen & Overgaard (2024).

5/10

18.02.2026 16:05 πŸ‘ 5 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0