Skip to contents

What are Item-Level Heterogeneous Treatment Effects?

When STEM education researchers test an educational intervention, they often ask, “Does a new curriculum work?” For example, does a new engineering curriculum improve students’ problem-solving skills, or a new biology curriculum improve factual recall?

Traditionally, researchers compare total test scores or unweighted mean scores between treatment and control groups. Under certain assumptions, these test-level treatment effects provide a reasonable proxy of whether the curriculum impacted the underlying ability or construct the assessment is intended to measure (referred to as impact; see Halpin, P. F., & Gilbert, J. B., n.d.). However, this assumes that differences among assessment items reflect differences in how they measure the same underlying ability, rather than item-specific effects of the curriculum itself. Some items may be more sensitive to the curriculum, while others may show little effect, or even effects in the opposite direction. These differences are called Item-Level Heterogeneous Treatment Effects (IL-HTE). When IL-HTE is present, the validity of using aggregate test-level effects (hereafter, “naïve treatment effects”) as proxies for impact is threatened and should be further evaluated (Halpin, P. F., & Gilbert, J. B., n.d.). This will be discussed in more detail later on.

Imagine a biology educator introduces a new inquiry-based laboratory curriculum. At the end of the semester, students complete a 20-item biology assessment. The average test scores may show that students in the new curriculum performed better than those in the previous. However, looking at the total scores obscures what happened within individual questions. Perhaps the new curriculum greatly improved performance on items requiring scientific reasoning, but had only a small effect on factual recall questions, and even lower performance on questions requiring memorization of foundational biological pathways. In that case, the effect of the curriculum was not uniform across items: some items benefited substantially, bringing the average up, but others did not. IL-HTE describes this variation in the effect of the curriculum across individual items.

IL-HTE analysis of the 20-item biology assessment may produce a plot like Figure 1. In the plot, the individual points and error bars show the item-level effects of the curriculum for each question on the assessment. The horizontal dashed line represents an overall estimate of the treatment effect that is robust to these item-level differences (the “robust treatment effect”), which reduces the influence of items whose treatment effects differ significantly from the majority of the assessment. Items requiring scientific reasoning are highlighted in red, and we can see that each of them has item-level effects significantly higher than the robust treatment effect (i.e., they are above the dashed line and their error bars do not cross over the line).

ILHTE
ILHTE

In the following, we will describe how to use the robustDIF package to assess the degree of IL-HTE present in an educational intervention study, whether it affects conclusions about the effectiveness of the curriculum being studied, and what the potential issues are when IL-HTE is ignored.

Technical details: Isn’t this just DIF?

Education researchers have long recognized a related issue in educational measurement called Differential Item Functioning (DIF). DIF occurs when students from different demographic groups (i.e., different genders or ethnicities) have the same underlying academic ability, but nevertheless have different probabilities of answering an item correctly due to the characteristics of the item itself.

For example, imagine a mathematics assessment on fractions. If several of the assessment items are word problems, English-language-learning students may have more difficulty understanding and answering the items correctly, regardless of their ability to calculate fractions. When such item-specific effects are unrelated to the target construct being measured (i.e., mathematics ability), they are thought of as construct-irrelevant DIF, interpreted as measurement bias, and a seen as a threat to test fairness (Joint Committee for Educational and Psychological Testing, 2014).

IL-HTE analysis is conceptually similar, but instead of comparing demographic groups, it compares how specific items function between treatment and control groups. Additionally, many of the same considerations for analyzing DIF carry over to IL-HTE analysis, such as the distinction between construct-relevant and construct-irrelevant DIF (Markus and Borsboom, 2025, chap. 3).

Importance of IL-HTE in Education-based Research

Detecting IL-HTE is important to determine how well treatment effects measured using unweighted means of assessment items reflect improvements in underlying ability. If educators only look at total test scores, they may overlook the fact that improvements in mean outcomes were driven by only a handful of items while most of the test shows little change. Understanding which items responded most to the intervention helps educators determine how and why a curriculum worked, not simply whether it improved overall scores.

Before continuing, it is important to explain there are different types of IL-HTE. Some IL-HTE is construct-relevant, which means the variation in item-level effects may be scientifically interesting in themselves. In our hypothetical biology assessment example, suppose questions regarding scientific reasoning consistently showed larger treatment effects compared to factual recall or memorization. This might reveal that the assessment is multidimensional (i.e., is capturing separate facets of biological expertise), constituting a source of construct-relevant IL-HTE. Documenting sources of construct-relevant IL-HTE is useful for refining educational theory (Gilbert et al., 2024b; Kim et al., 2023), and neglecting to report this type of IL-HTE would constitute a threat to construct validity because it may indicate that the curriculum changed how students respond to certain questions.

IL-HTE may be construct-irrelevant if the source of variation in item-level effects is not due to something meaningful to the treatment. For example, if the new biology curriculum included lab work with questions identical to the scientific reasoning items on the assessment, whereas the old curriculum did not, then students in the treatment group had prior exposure to exam materials. This would constitute construct-irrelevant IL-HTE and a threat to internal validity. Whether IL-HTE is construct-relevant or construct-irrelevant, when only a few items with strong positive effects drive the test-level treatment effect, then the treatment may not generalize to assessments without those items. This is particularly concerning because improvements to underlying ability (i.e., impact) must generalize to other assessments measuring the same underlying ability.

Finally, the strength and direction of the item-level effects will influence how they relate to the test-level treatment effect. Returning to our biology curriculum example, when each of the scientific reasoning items (Items 1 through 5) are significantly larger than the robust treatment effect (as in Figure 1), the naive treatment effect would be upwardly biased. We can see the effect of this from a diagnostic test comparing a naive, IRT-based test-level estimate (analogous to using the unweighted mean of test items) to a robust estimate that down-weights items that exhibit significant IL-HTE (Table 1).

## Table 1: Non-ignorable IL-HTE
##   naive.est  naive.se   rdif.est  rdif.se    delta   delta.se   z.test
## 1 0.4404281 0.1029667 0.09289712 0.106527 0.347531 0.05942556 5.848172
##          p.val
## 1 4.980015e-09

The naive estimate was equal to 0.44, the robust estimate equal to 0.09, and the difference (0.34) was significant at z = 5.8, p < 0.001. Here, we would conclude that the treatment effect based on unweighted means is not a suitable proxy for impact. This means the naive treatment effect would represent a threat to construct validity, insofar as the effect is specific to the scientific reasoning domain rather than biology expertise overall, as well as a threat to external validity, as the size of the effect may not generalize to assessments without those five items.

However, if the pattern of IL-HTE follows that in Figure 2, where the item-level effects are more balanced (i.e., some positive and some negative), then their effects average out. From this plot, we can see Item 1 is significantly higher than the robust estimate, but Item 3 is significantly lower and Items 2, 4 and 5 do not significantly differ (i.e., their error bars cross the red line). From the diagnostic test on such items, we would see a non-significant Wald test, indicating the naive treatment effect estimate based on unweighted means is a suitable proxy for impact (Table 2).

ILHTE2
ILHTE2
## Table 2: Ignorable IL-HTE
##   naive.est  naive.se   rdif.est   rdif.se      delta   delta.se    z.test
## 1 0.1027919 0.1037291 0.07641707 0.1079588 0.02637488 0.04765341 0.5534731
##       p.val
## 1 0.5799395

Naturally, there may not be any significant item-level effects, producing a plot like Figure 3. From this plot, we can see that while there is some variation item-by-item, none of the items significantly differ from the robust treatment effect. In this scenario, the naive treatment effect is equivalent to impact, and a diagnostic test on such items would result in a non-significant Wald test.

ILHTE3 We will next turn to an applied analysis example using real data from a math curriculum intervention. The following will demonstrate how to use the robustDIF package to identify if IL-HTE is present and determine whether it affects conclusions drawn from using naive test-level treatment effects.

Effect of an Adaptive Game-Based Math Learning App on Students’ Learning

In a recent block randomized control trial, Bang, Li, and Flynn (2022) investigated whether using My Math Academy, a personalized adaptive learning app, could improve math achievement and learning engagement in K-1 students (n=505 treatment, n=481 control). My Math Academy supplemented school curricula with game-based activities, performance dashboards for teachers, and offline additional learning activities.

Blocking on school and grade, teachers were cluster randomized to treatment (21 classrooms) or control (20 classrooms). Treatment teachers were tasked with using My Math Academy for at least 60 minutes per week. Control teachers implemented whatever math curricula the district used. The intervention took place between February and June 2019. In total, 41 classrooms from 11 elementary schools participated.

Math achievement was measured at pre-test and post-test using 38 multiple-choice items selected from the Certica assessment item bank. Items were selected if they aligned with Common Core State Standards for K-2 and targeted specific My Math Academy learning objectives. Students had 30-45 minutes to complete the assessment. Responses were coded as 0 (incorrect) or 1 (correct) for the analyses.

Bang and colleagues (2022) estimated a simple treatment effect by computing the difference between mean un-weighted post-test total scores:

TreatmentEffect=TotalScore¯treat−TotalScore¯control TreatmentEffect = \overline{\text{TotalScore}}_{\text{treat}} - \overline{\text{TotalScore}}_{\text{control}}=20.97−20.08=0.89= 20.97 - 20.08 = 0.89 Dividing by the pooled standard deviation gives a measure of effect size (d):

d=TEsdp=0.898.09=0.11 d = \frac{TE}{sd_p} = \frac{0.89}{8.09} = 0.11

These findings indicate students using My Math Academy had greater math achievement scores than students who did not, but the difference is relatively small. The following analysis will examine whether this effect size is robust to item-level sources of variability that may not generalize to other measures of Math achievement (i.e., tests that have different questions).

Step 1: Fit IRT model to data

To begin the procedure, we will need to fit an IRT model to the data. The robustDIF package can handle several models, and so the exact choice of models is left up to the researcher and guided by theory. This example uses a 2PL model. All data used in this example is available from the Item Response Warehouse (https://itemresponsewarehouse.org/) and can be downloaded using the following code:

library(irw) # You may need to first install the package with `devtools::install_github("itemresponsewarehouse/Rpkg")`

# On first use, you will need to log in with a Redivis account (a platform for academic data sharing). See instructions for this on the IRW website.

# Pull the selected data-set
irw.data <- irw_fetch("gilbert_meta_23") 

# Pivot to wide format
wide <- irw_long2resp(irw.data)

# Add cluster ID and treatment ID to wide data
data <- left_join(wide, irw.data[,c(1,2,7)], by="id",multiple="first")

After retrieving the data, the following code utilizes mirt to fit a one-factor, multiple-group (treatment vs control) 2PL model to the data. We need to specify SE=TRUE within the function so that robustDIF can access the parameter covariance matrix later.

library(mirt) # You may need to install the package first with install.packages("mirt")

# Subset data to just test items
items <- data[,-c(1,40,41)]

# Calculate 1-factor 2-PL models, using treatment to split groups and specifying SE=TRUE for the covariance matrix.
mirt.dat <- multipleGroup(items,
                      model = 1,
                      group= as.factor(data$treat),
                      itemtype = "2PL",
                      SE=TRUE)
Technical details: What is a 2PL IRT model?

A “Two-Parameter Logistic” (2PL) model is an item response theory model that estimates both how challenging an item is (item difficulty) and how well an item distinguishes between individuals with different levels of underlying ability (item discrimination). It can be used when item responses are binary (e.g., correct/incorrect) and when researchers have reason to believe items differ in both difficulty and discrimination. You can get a sense of these two parameters by investigating the item response functions (IRFs) of the model using plot():

# Plot the IRFs
plot(mirt.dat, type = "trace", facet = F)
IRF
IRF

Each curve on the plot represents how the probability of a particular response to an item changes as a person’s level of underlying ability increases. The x-axis is level of latent ability θ\theta and the y-axis is the probability of answering an item correctly. The horizontal position of each s-shaped curve reflects how difficult an item is: curves further to the right represent more difficult items, where individuals need higher levels of θ\theta to have a high probability of answering correctly.

The steepness of the curve represents the item’s discrimination: items with steeper curves more effectively distinguish between individuals with slightly lower and slightly higher levels of θ\theta, whereas flatter curves provide less information about the differences between individuals.

When comparing between groups, we are essentially looking for similarities and differences between the response functions in the treatment (1) and control (0) groups. If the response functions look near identical, we may not expect much IL-HTE.

Step 2: Is the overall treatment effect robust to item-level variability?

Children using My Math Academy may be exposed to certain types of questions more frequently than those in the control group. For example, My Math Academy includes games that use base-ten blocks for addition and subtraction, whereas some control curricula may not. If the post-test assessment includes base-ten block items, then score differences between groups on those items could reflect differential exposure rather than true differences in underlying math ability.

Differential exposure would constitute construct-irrelevant IL-HTE and would cast doubt on using total scores, which include base-ten block questions, as a way of demonstrating that the treatment improved math ability.

Additionally, if IL-HTE is present, the generalizability of the treatment effect might be questioned. If the treatment effect is driven by only a subset of test questions, then tests with different questions may not show the same magnitude of effect.

We will turn next to demonstrating how to test for IL-HTE.

The get_model_parms() function from robustDIF can be used to extract item-level estimates from the mirt object. After, robustness to item-level variability can be investigated using the rdif() function. Users supply a significance level by setting alpha (here, .05) and testing for DIF on slope (discrimination), intercept (difficulty), or both with fun.

Here, we choose d_fun1 to test whether the treatment effect computed using the un-weighted mean of items and scaled to the control group is robust to item-level sources of variation.

# Extract cluster indicator variables (classroom/teacher id)
group_vars <- data$cluster_id

# Save model parameters
parms <- get_model_parms(mirt.dat, cluster = group_vars)

# Investigate DIF
mod <- rdif(mle = parms, fun = "d_fun1", alpha = .05)
# Print estimate
print(mod)
## Est: 0.1041982     SE: 0.2798387

The print() function provides the robust treatment effect estimate (0.10) and standard error (0.28) estimated using iteratively reweighted least squares with Tukey’s bisquare.

The delta_test() function provides both a naive effect estimate (one that aggregates over all test items) and a robust estimate that adjusts for item-level variation.

##   naive.est naive.se  rdif.est   rdif.se     delta   delta.se z.test      p.val
## 1 0.2449639 0.307209 0.1041982 0.2798387 0.1407657 0.06516024 2.1603 0.03074946

The naive effect estimate is 0.24, SE = 0.31. The robust effect estimate that adjusts for item-level variation is 0.10, SE = 0.28. This significant difference (p < 0.05) implies that the treatment effect on the total score was driven by only a subset of items with relatively large effects. These items will be investigated next.

Technical details: How does robustDIF approach scaling and clustering?

When fitting 2PL IRT models, the latent trait θ\theta (representing children’s underlying “math ability”) needs to be scaled (i.e., we restrain it to have a mean of zero and variance of one). This can be problematic when testing differences between groups (tests of DIF), because if we arbitrarily scale θ\theta in both groups, we give their θ\theta the same mean and variance. In other words, we end up removing any differences and will show zero impact. The robustDIF procedure tackles this problem by instead using robust statistics to estimate scaling parameters and flag items for DIF.

A second issue here is the clustering of observations: students within the same classroom may have similar characteristics (e.g., have similar capabilities, backgrounds, etc.). This leads to partial redundancies in their scores which should be accounted for. The robustDIF package can handle this by specifying a cluster variable (e.g., classroom id’s) in the get_model_parms() function.

Step 3: Which items show differential treatment effects?

Using summary will provide deltas (the estimated scaling parameter subtracted from the item-level scaling function value) and p-valuesfor each item. Significant p-values indicate that, at the chosen alpha, the item was flagged for DIF. Those items are down-weighted to zero during estimation of the scaling parameter.

# Print summary
summary(mod)
## Robust Scaling and Differential Item Functioning.
## 
## Data: 38 items 
## Estimation ended after  13  iterations
## Single solution found
## 
## Est: 0.104    SE: 0.2798 
## 
## Results from Wald Tests of DIF:
##                  delta         se      z.test       p.val
## item1_d1   0.115633003 0.19682025  0.58750563 0.556864172
## item2_d1  -0.066612378 0.18127570 -0.36746446 0.713272597
## item3_d1  -0.190324096 0.16870574 -1.12814241 0.259259781
## item4_d1   0.020063711 0.23962197  0.08373068 0.933270562
## item5_d1   0.055510667 0.16768000  0.33105121 0.740605807
## item6_d1  -0.021597174 0.21032340 -0.10268555 0.918212541
## item7_d1  -0.084641477 0.17648935 -0.47958405 0.631523192
## item8_d1   0.108560507 0.14782891  0.73436589 0.462725771
## item9_d1  -0.006712899 0.15449566 -0.04345041 0.965342495
## item10_d1 -0.275029789 0.11388624 -2.41495183 0.015737291
## item11_d1 -0.063338260 0.17209726 -0.36803758 0.712845211
## item12_d1  0.222371903 0.36177041  0.61467687 0.538768138
## item13_d1 -0.092438955 0.10352617 -0.89290427 0.371908439
## item14_d1 -0.032820851 0.08948296 -0.36678326 0.713780694
## item15_d1  0.092338815 0.13099809  0.70488672 0.480880735
## item16_d1 -0.159438851 0.12119595 -1.31554602 0.188326462
## item17_d1 -0.210254838 0.16900943 -1.24404204 0.213484089
## item18_d1  0.489239880 0.82998800  0.58945416 0.555556652
## item19_d1  0.055374051 0.17508307  0.31627302 0.751795291
## item20_d1 -0.009162725 0.13975430 -0.06556310 0.947725668
## item21_d1  0.192334938 0.31953693  0.60191771 0.547228913
## item22_d1  0.156423564 0.19457760  0.80391354 0.421446908
## item23_d1  0.165641941 0.13784953  1.20161411 0.229513074
## item24_d1 -0.084950693 0.30150778 -0.28175291 0.778132982
## item25_d1  0.465575917 0.28297684  1.64527926 0.099912235
## item26_d1  1.109023313 0.75694377  1.46513302 0.142884629
## item27_d1  0.678945204 0.28757927  2.36089760 0.018230764
## item28_d1  0.194769667 0.16581094  1.17464905 0.240135152
## item29_d1  0.303730038 0.12956905  2.34415578 0.019070204
## item30_d1  0.824750765 0.42354780  1.94724365 0.051505531
## item31_d1  0.578251407 0.19174741  3.01569344 0.002563923
## item32_d1 -0.288450618 0.17646126 -1.63463990 0.102124557
## item33_d1  0.047250317 0.35604143  0.13271016 0.894422604
## item34_d1  0.176916512 0.20866159  0.84786335 0.396514080
## item35_d1  0.053548904 0.14845794  0.36070085 0.718323092
## item36_d1 -0.168924579 0.25620832 -0.65932510 0.509687027
## item37_d1  1.329555051 0.83878924  1.58508835 0.112946263
## item38_d1 -0.332016808 0.17156521 -1.93522224 0.052963029

The direction and magnitude of the significant item-level effects reveal which items were increasing or decreasing the treatment effect. We can subset to significant (p-value < alpha) items and plot their effects and 95% CI’s in relation to the robust estimate to visualize this.

# Subset to significant items (set your own p-value if different from 0.05)
sig.items <- mod[["dif.test"]][mod[["dif.test"]]$p.val < 0.05, ]

# Save robust estimate
rob.est <- mod[["est"]]

# Plot
library(ggplot2) # You may need to install the package first with install.packages("ggplot2")

p <- ggplot(data = sig.items, aes(x = row.names(sig.items), y = delta)) +
  geom_point() +
  geom_errorbar(aes(ymin = delta - 1.96*se, ymax = delta + 1.96*se), width=0.1) +
  geom_hline(yintercept=rob.est, col="red", lwd=1) +
  labs(x = "Item", y = "Delta", title = "Item-level Treatment Effects")
p
Effects
Effects

Items whose 95% CIs do not cross the red line had item-level effects significantly larger or smaller than the robust treatment effect estimate. These items were:

Question 10: (“A group of circles is shown. Which of these groups represents the same number of circles?”)

Question 33: (Using base-ten blocks: “What is 355 - 262?”)

Question 38: (“98 - 36 =”)

Items 10 and 33 had positive item-level effect deltas, biasing the treatment effect upward. Only item 38 had a negative item-level effect delta, biasing the treatment effect down. These results indicate that the upward bias of the naive treatment effect was being driven by only two items. If students using My Math Academy had more exposure to these two question types (using circles and base-ten blocks), then the construct validity of the naive treatment effect using total scores would be threatened. In other words, the total scores may not accurately capture math ability. Additionally, the naive effect may be smaller in studies using tests without these two items.

Step 4: Sensitivity analysis

Before proceeding with the analysis and making inferences about DIF/IL-HTE, use plot() to visually inspect the Rho Function for a clear global minimum.

# Plot Rho Function
plot(mod)

Here, the Rho Function has a clear global minimum, indicating there is a single solution for the scaling parameter. If the Rho function showed multiple local minima of similar values, there would potentially be multiple solutions, and the results would be sensitive to which minima was used during calculations.

Step 5: Conclusion

In the absence of IL-HTE, the treatment effect based on the total test score and the treatment effect on underlying math ability is equivalent. When IL-HTE is present, as in this example, we can conclude the two are not: comparing mean total scores between groups may not be an adequate representation of differences in underlying math ability.

However, it is important to note that a significant diagnostic test should be taken simply as a warning of a salient threat to the validity of the study - it does not mean researchers need to abandon the naive treatment effect estimate or adopt the robust alternative. Like all threats to validity, researchers can evaluate the details of the study to determine the next course of action.

For example, researchers in this situation have several options to address these concerns. The first would be to provide evidence that My Math Academy students did not have more exposure to these question types than control students. Assuming this is true, then researchers might caution readers that the results were largely driven by a few items, or conduct a sensitivity analysis by replacing biased assessment items on a follow-up sample and comparing effect magnitudes between tests.