Skip to contents

A regression coefficient from observational data is only as credible as the assumption that no important variable was left out. sensemakr (Cinelli & Hazlett, 2020) makes that assumption concrete: it reports the coefficient you would have obtained had a variable as strong as one of your observed covariates been omitted. bootmakr adds a standard error, a confidence interval and a p-value for that adjusted coefficient, obtained by resampling the data the way you would choose standard errors for the regression itself. This is needed because the usual tools, the impact threshold of a confounding variable (ITCV) and the analytic interval of sensemakr, break down when the regression calls for robust standard errors (Lonati & Wulff, 2026); Why bootstrap? shows why. This page shows a first analysis from start to finish. The same steps in R are in Get started in R.

Installation

bootmakr builds on the sensemakr command, which is on SSC. bootmakr itself is installed from GitHub, and net get copies its example data set into the current folder.

ssc install sensemakr
net install bootmakr, from("https://raw.githubusercontent.com/jespernwulff/bootmakr-stata/main/")
net get bootmakr, from("https://raw.githubusercontent.com/jespernwulff/bootmakr-stata/main/")

Stata 14 or later is required. To update an existing installation, add the replace option to net install. After installation, help bootmakr opens the help file, which is also on this site.

The example data

firms.dta is a simulated panel of 250 firms observed for 20 years. Because the data are simulated, we know the truth: the effect of x on y is 0.25. Two firm-level characteristics affect both x and y, an observed control c and a variable q that we pretend not to have. The within-firm components of x and of the disturbance are persistent, so standard errors must be clustered by firm. (The data are a variant of the simulated example in Lonati and Wulff, 2026; the R package documents how they were generated.)

use firms, clear
describe
(bootmakr example data: variant of Lonati & Wulff (2026), Table 1)

Contains data from firms.dta
 Observations:         5,000                  bootmakr example data: variant of Lonati & Wulff (2026), Table 1
    Variables:             6                  06 Oct 2026 13:09
------------------------------------------------------------------------------------------------------------------------
Variable      Storage   Display    Value
    name         type    format    label      Variable label
------------------------------------------------------------------------------------------------------------------------
firm            long    %12.0g                Firm identifier (cluster)
year            long    %12.0g                Year within firm, 1 to 20
y               double  %10.0g                Outcome
x               double  %10.0g                Predictor of interest; true effect on y is 0.25
c               double  %10.0g                Observed firm-level control
q               double  %10.0g                Unobserved firm-level variable (omitted in the analysis)
------------------------------------------------------------------------------------------------------------------------
Sorted by:

Here is the regression a researcher without q would run.

regress y x c, vce(cluster firm)
Linear regression                               Number of obs     =      5,000
                                                F(2, 249)         =     191.47
                                                Prob > F          =     0.0000
                                                R-squared         =     0.3635
                                                Root MSE          =        1.1

                                 (Std. err. adjusted for 250 clusters in firm)
------------------------------------------------------------------------------
             |               Robust
           y | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
           x |   .4445283   .0405336    10.97   0.000      .364696    .5243607
           c |   .4755564   .0577003     8.24   0.000     .3619135    .5891993
       _cons |    .030529   .0539153     0.57   0.572    -.0756591    .1367171
------------------------------------------------------------------------------

The coefficient is 0.44 instead of 0.25, because q drives both x and y. With real data you would not know this. What you can ask is how the result would change if a variable as strong as something you do observe had been left out. That is the question bootmakr answers.

A first analysis

sensemakr needs a benchmark: an observed covariate that sets the scale for the omitted variable. We take c and ask what the coefficient of x would be had a variable as strong as c been omitted. In these data that is exactly what q is.

bootmakr y x c, treat(x) benchmark(c) cluster(firm) seed(123)
Bootstrap results                               Number of obs     =     5,000
                                                Replications      =     1,000

                 (Replications based on 250 clusters in firm)
------------------------------------------------------------------------------
             |      Observed    Bootstrap                    Percentile
             |       Coef.      Std. Err.    P-value    [95% Conf. Interval]
-------------+----------------------------------------------------------------
x            |    .2521337      .0742285      0.0040     .0877736    .3766737
------------------------------------------------------------------------------
Note: CI is percentile bootstrap confidence interval
      P-value is bootstrap p-value (H0: x = 0)
      Benchmark: c, kd = 1, ky = 1

Benchmark strength (descriptive; no standard errors involved)
------------------------------------------------------------------------------
Benchmark: c
                                                 Partial R2    |Partial corr.|
  with x | X                                         0.1433             0.379
  with y | x, X                                      0.1248             0.353
------------------------------------------------------------------------------
Implied strength of the omitted variable (sensemakr bounds):
     kd      ky      R2dz.x     R2yz.dx     Impact
   1.00    1.00       0.1673     0.1998      0.222
------------------------------------------------------------------------------
Note: R2dz.x (R2yz.dx) = partial R2 of the omitted variable with the
      treatment given the covariates (with the outcome given treatment
      and covariates). Impact = product of its partial correlations with
      the outcome and with the treatment, both given the covariates only:
      the scale of the ITCV; signed so that the omitted variable biases
      the estimate away from zero. Descriptive only: independent of the
      variance estimator, and not a threshold.

The command line has the same form as regress: the outcome first, then the treatment and the covariates. The options name the treatment (treat()), the benchmark (benchmark()) and, because observations of the same firm are not independent, the variable that identifies the clusters to resample (cluster()). Everything else is left at its default: an omitted variable exactly as strong as the benchmark (kd(1)) and 1,000 bootstrap replications. seed() makes the result reproducible. The run takes about a minute. For longer runs, dots(100) prints a dot for every 100 replications.

Reading the output

The adjusted estimate. Had a variable as strong as c been omitted, the coefficient of x would be 0.252 rather than 0.445. This is the estimate sensemakr reports for the same benchmark, and it is close to the true 0.25. It does not involve the bootstrap.

Its uncertainty. The remaining columns come from the bootstrap. In each of the 1,000 replications bootmakr draws firms with replacement, reruns sensemakr and stores the adjusted estimate. The standard deviation of those 1,000 values is the standard error (0.074), their 2.5th and 97.5th percentiles form the 95 percent confidence interval (0.088 to 0.377), and the p-value (.004) is twice the smaller of the two shares of replications that fall on either side of zero. The effect of x remains positive and statistically distinguishable from zero even if an omitted variable as strong as c is at work.

The benchmark strength. The second block says what “as strong as c” means: the share of the variance of x, and of the variance of y that x leaves unexplained, that c explains (partial R2), and the strength of the omitted variable these numbers imply, including its impact: the product of its partial correlations with y and with x, which is the scale on which the ITCV is stated. All of this is computed from the data. No standard error is involved, so the block is the same whatever variance estimator you prefer. See How strong is the benchmark? for the details.

Stored results

bootmakr is an r-class command.

return list
scalars:
             r(r_yd_x) =  .4201003465134852
             r(impact) =  .2216809386813333
            r(r2yz_dx) =  .1998386969880782
             r(r2dz_x) =  .1672788528775167
           r(r2yxj_dx) =  .1247741705206282
            r(r2dxj_x) =  .1433066764339555
                  r(p) =  .004
           r(ci_upper) =  .3766737282276154
           r(ci_lower) =  .0877736173570156
                 r(se) =  .0742284676435436
           r(estimate) =  .2521337283967872
            r(N_clust) =  250
       r(N_successful) =  1000
             r(N_reps) =  1000
                  r(N) =  5000

matrices:
      r(ci_percentile) :  2 x 1
  r(benchmark_strengt
    h)                 :  1 x 8

From one strength to many: the breakdown point

An omitted variable as strong as c does not overturn the result. How much stronger would it have to be? Give kd() several values and bootmakr evaluates each of them on the same bootstrap samples. The plot option draws the result.

bootmakr y x c, treat(x) benchmark(c) kd(0.5 0.75 1 1.25 1.5) ///
    cluster(firm) seed(123) plot
Bootstrap results                               Number of obs     =     5,000
                                                Replications      =     1,000

                 (Replications based on 250 clusters in firm)
------------------------------------------------------------------------------
             |      Observed    Bootstrap                    Percentile
             |       Coef.      Std. Err.    P-value    [95% Conf. Interval]
-------------+----------------------------------------------------------------
x_.5         |    .3540423      .0518952      0.0000       .25325    .4484074
x_.75        |    .3046965      .0614491      0.0000     .1763916    .4110296
x_1          |    .2521337      .0742285      0.0040     .0877736    .3766737
x_1.25       |     .195903      .0907298      0.0700     -.013256    .3365256
x_1.5        |    .1354581       .111817      0.2760    -.1330485    .3039364
------------------------------------------------------------------------------
Note: CI is percentile bootstrap confidence interval
      P-value is bootstrap p-value (H0: x = 0)
      Benchmark: c, kd = .5 .75 1 1.25 1.5, ky = .5 .75 1 1.25 1.5

Benchmark strength (descriptive; no standard errors involved)
------------------------------------------------------------------------------
Benchmark: c
                                                 Partial R2    |Partial corr.|
  with x | X                                         0.1433             0.379
  with y | x, X                                      0.1248             0.353
------------------------------------------------------------------------------
Implied strength of the omitted variable (sensemakr bounds):
     kd      ky      R2dz.x     R2yz.dx     Impact
   0.50    0.50       0.0836     0.0973      0.113
   0.75    0.75       0.1255     0.1478      0.168
   1.00    1.00       0.1673     0.1998      0.222
   1.25    1.25       0.2091     0.2536      0.274
   1.50    1.50       0.2509     0.3093      0.324
------------------------------------------------------------------------------
Note: R2dz.x (R2yz.dx) = partial R2 of the omitted variable with the
      treatment given the covariates (with the outcome given treatment
      and covariates). Impact = product of its partial correlations with
      the outcome and with the treatment, both given the covariates only:
      the scale of the ITCV; signed so that the omitted variable biases
      the estimate away from zero. Descriptive only: independent of the
      variance estimator, and not a threshold.
Adjusted estimate and bootstrap 95 percent confidence interval for an omitted variable 0.5 to 1.5 times as strong as c. Solid markers: p < .05.
Adjusted estimate and bootstrap 95 percent confidence interval for an omitted variable 0.5 to 1.5 times as strong as c. Solid markers: p < .05.

The adjusted estimate shrinks as the assumed omitted variable grows stronger, and its confidence interval widens. In this run the result holds up to an omitted variable 1 times as strong as c and breaks down at 1.25 times: from there on the interval includes zero. That breakdown point is a compact summary of how robust the finding is.

With several values of kd(), the full table is returned in r(results), with the number of successful replications behind each row, and the implied strength of the omitted variable in r(benchmark_strength).

matrix list r(results)
matrix list r(benchmark_strength)
r(results)[5,6]
      estimate          se    ci_lower    ci_upper      pvalue        N_ok
r1   .35404231   .05189517   .25325005   .44840744           0        1000
r2   .30469646   .06144914   .17639161   .41102959           0        1000
r3   .25213373   .07422847   .08777362   .37667373        .004        1000
r4   .19590303   .09072977  -.01325604   .33652565         .07        1000
r5   .13545811   .11181698  -.13304852   .30393642        .276        1000

r(benchmark_strength)[5,8]
           kd         ky     r2dz_x    r2yz_dx     r_dz_x    r_yz_dx     r_yz_x     impact
r1         .5         .5  .08363943  .09728672  .28920482  .31190819  .39244926  .11349822
r2        .75        .75  .12545914  .14781734  .35420212  .38447021   .4750791  .16827402
r3          1          1  .16727885   .1998387  .40899738  .44703322  .54201066  .22168094
r4       1.25       1.25  .20909857  .25356964  .45727297  .50355699  .59849309  .27367471
r5        1.5        1.5  .25091828  .30927622  .50091744  .55612608  .64722672  .32420715

Checking the answer

Simulated data have one advantage over real ones: the omitted variable is in the file.

regress y x c q, vce(cluster firm)
Linear regression                               Number of obs     =      5,000
                                                F(3, 249)         =     199.21
                                                Prob > F          =     0.0000
                                                R-squared         =     0.4785
                                                Root MSE          =     .99577

                                 (Std. err. adjusted for 250 clusters in firm)
------------------------------------------------------------------------------
             |               Robust
           y | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
           x |   .2286068    .036788     6.21   0.000     .1561516    .3010621
           c |    .578841   .0492042    11.76   0.000     .4819316    .6757504
           q |   .5125708   .0486366    10.54   0.000     .4167793    .6083623
       _cons |   .0400548   .0455783     0.88   0.380    -.0497133    .1298229
------------------------------------------------------------------------------

The coefficient of x with q in the model, 0.23, lies inside the bootstrap interval at kd(1). The Why bootstrap? article uses the same data to show what the ITCV and the analytic interval of sensemakr make of this example.

The choices you make

The benchmark. Choose an observed covariate that is strong and that you can argue an omitted variable is unlikely to exceed. Report why you chose it. A group of covariates can serve as a joint benchmark with gbenchmark(x1 x2).

The multiple. kd() scales the benchmark’s relationship with the treatment and ky() its relationship with the outcome. ky() follows kd() unless you set it.

The resampling scheme. It should mirror how the data were sampled and how you would compute standard errors in the regression itself. Without cluster(), observations are resampled, which allows for heteroskedasticity. With cluster(id), whole clusters are resampled, and strata() requests a stratified bootstrap. See Clustered and stratified data.

Replications and seed. The default of 1,000 replications is fine for a first look. For results you report, use more (reps(5000) or reps(10000)), set a seed(), and when the verdict is close to the significance threshold check that it has settled with the converge() option.

Many indicator variables. Stata re-estimates the regression in every replication. A model with hundreds of indicator variables (say, one per village or firm) can take about a second per replication, so start such a model with a few hundred replications and dots() to see how long it will take.

Bootstrapping your own program

In standard mode bootmakr builds the sensemakr call for you. If something has to happen in every replication before sensemakr runs, or you want full control over the call, write a small e-class program and hand it to bootmakr with program(). The program must leave sensemakr’s results behind. treat() is then only a label for the output.

capture program drop my_sens
program define my_sens, eclass
    sensemakr y x c, treat(x) benchmark(c) kd(1) suppress
end

bootmakr, treat(x) program(my_sens) cluster(firm) seed(123)
Bootstrap results                               Number of obs     =     5,000
                                                Replications      =     1,000

                 (Replications based on 250 clusters in firm)
                 (Using user-supplied program: my_sens)
------------------------------------------------------------------------------
             |      Observed    Bootstrap                    Percentile
             |       Coef.      Std. Err.    P-value    [95% Conf. Interval]
-------------+----------------------------------------------------------------
x            |    .2521337      .0742285      0.0040     .0877736    .3766737
------------------------------------------------------------------------------
Note: CI is percentile bootstrap confidence interval
      P-value is bootstrap p-value (H0: x = 0)

Benchmark strength (descriptive; no standard errors involved)
------------------------------------------------------------------------------
Implied strength of the omitted variable (sensemakr bounds):
     kd      ky      R2dz.x     R2yz.dx     Impact
   1.00    1.00       0.1673     0.1998      0.222
------------------------------------------------------------------------------
Note: R2dz.x (R2yz.dx) = partial R2 of the omitted variable with the
      treatment given the covariates (with the outcome given treatment
      and covariates). Impact = product of its partial correlations with
      the outcome and with the treatment, both given the covariates only:
      the scale of the ITCV; signed so that the omitted variable biases
      the estimate away from zero. Descriptive only: independent of the
      variance estimator, and not a threshold.

With the same seed this reproduces the first analysis exactly. In program mode the benchmark-strength block shows only the implied strength of the omitted variable, because bootmakr does not know which covariate your program uses as benchmark.

Where next

  • The worked example takes a published study through a complete analysis: the choice of standard errors, the benchmark, the breakdown point, a grouped benchmark and the convergence check.
  • Why bootstrap? shows, on these data, why the ITCV and the analytic interval of sensemakr cannot be trusted with robust standard errors.
  • The help file documents every option and stored result.
  • The R package of the same name runs the same analysis. See R and Stata side by side.

References

Cinelli, C., & Hazlett, C. (2020). Making sense of sensitivity: Extending omitted variable bias. Journal of the Royal Statistical Society: Series B, 82(1), 39–67. https://doi.org/10.1111/rssb.12348

Cinelli, C., Ferwerda, J., & Hazlett, C. (2024). sensemakr: Sensitivity analysis tools for OLS in R and Stata. Observational Studies, 10(2), 93–127. https://doi.org/10.1353/obs.2024.a946583

Lonati, S., & Wulff, J. N. (2026). Why you should not use the ITCV with robust standard errors (and what to do instead). Academy of Management Proceedings, 2026(1). https://doi.org/10.5465/AMPROC.2026.247bp