Skip to contents

regsensitivity 0.1.2

Plots

  • The Oster equality identified-set plot no longer draws a false vertical connector where the numerically ordered solution branches swap arms across an asymptote. Branches are now split exactly where a step would cross a vertical asymptote of delta(beta), computed from the model rather than guessed from the drawing. With several r2long values the curves are now drawn (and coloured) per r2long instead of being interleaved into one line.

  • plot() gains xline, drawing vertical reference lines. This closes a gap against the Stata package, whose vignette uses xline() to mark values such as rmax or a breakdown point; those figures could not be reproduced in R before.

  • New theme_regsen() and scale_colour_regsen() (with scale_color_regsen() and scale_fill_regsen() aliases), exported so a plot can be rebuilt with the same look. Defaults are aimed at print: a faint y-grid, a thin panel border, legend on top, and the colourblind-safe Okabe-Ito palette, which also survives greyscale printing.

  • Axis and legend titles now use plotmath, so they read as the symbols in the papers rather than as parameter names.

  • plot() gains base_size; use 9 for a two-column journal figure.

  • Passing NA to title, subtitle, xtitle or ytitle drops the annotation. The auto-generated subtitle is no longer applied by default, since a journal figure carries its description in the caption.

Calibration

  • New calibrate_rho() and calibrate_partial_r2(), computing the point-identified reference values of DMP (2026) Section 3.4 (Table 4) and Table 3, so the sensitivity parameters can be read against the observed covariates they are calibrated to.

Verification

  • The Oster (2019) implementation is now checked against the paper rather than against its own past output. A test round-trips Proposition 3 into Proposition 2: the delta reported as the breakdown for a target beta, fed back through the identified set, must return that beta. It does, to machine precision, for several targets.
  • results$breakdown is documented as signed. The sign carries the direction of selection; passing abs() of it back into regsen_bounds() lands on a different branch of the Oster cubic. The scalar $breakdown reports the magnitude and exists on regsen_bounds() output only – a regsen_breakdown() result carries the value in results$breakdown alone.

Replication fidelity

  • The DMP (2026) Figure 1 reproduction now matches the published figure. The left panel gains the dashed bounds under the common-maximal-impact restriction rybar = rxbar and the Table 4 calibration tick marks; both zero crossings are reported and agree with the published 0.804 and 0.959. The right panel previously plotted the breakdown point against cbar, a different object from the paper’s, which is the breakdown frontier in (rxbar, rybar) space; it is now that frontier, one curve per cbar.
  • plot() no longer paints a line along the panel edge when a stretch of the sweep is unbounded. Only the first point of each unbounded run is routed off-panel and the rest are blank, so the curve leaves the plot once instead of running along its boundary. Runs are detected per series, so one beginning at a group boundary still gets its own exit.

Bug fixes

  • regsen_bounds(analysis = "oster", delta_type = "bound") reported a bounded identified set where the set is in fact unbounded. The solver correctly returns -Inf/Inf for |delta| <= dbar with dbar >= 1, but the routine accumulating bounds across the grid discarded infinite values alongside NA and carried the last finite bound forward. On the bundled data, delta = c(0.5, 1, 2) reported [1.31, 2.98] at every point instead of (-Inf, Inf) from dbar = 1 on.

    NA still carries over, since it means the solver failed and carries no information; an infinity is a bound and now propagates. This is the one direction a sensitivity analysis must not err in, since it made results look more robust than they are. Previously validated numbers are unchanged – the snapshot tests pass untouched.

Interactive

  • New regsen_explore(), a shiny application for moving the sensitivity parameters by hand and watching the identified set respond. is a Suggests, so the rest of the package works without it. Inputs are validated and the model is fitted once before the app opens, so a bad call reports at the console rather than as a banner in a browser tab.

Several treatments

  • New regsen_multi(), running the analysis once per candidate treatment and collecting the breakdown points into one table, with a plot() method ordering treatments by fragility. Every treatment is analysed in the same specification – the others stay as controls – so the rows are comparable. A treatment whose analysis fails yields an NA row with the reason rather than aborting the sweep.

Inference

  • regsen_boot() gains ncores, running replications in parallel: forking on macOS and Linux, a PSOCK cluster on Windows. A progress bar is not shown in parallel, since it cannot report meaningfully from several workers.
  • Results for a given seed are now identical regardless of ncores. Each replicate seeds itself from a vector drawn once up front, rather than relying on parallel RNG substreams, which would have made the numbers depend on how the work happened to be divided.

Documentation

  • New vignette “Publication-ready plots and tables”, covering figure sizing for journals, greyscale and colour-vision safety, and the LaTeX / HTML / Markdown table output.
  • New vignette “Coming from the Stata package”, mapping every command and option in the Stata package’s own vignette onto its R equivalent. It doubles as a coverage check: a gap would show as a missing row rather than going unnoticed.

Interoperability

Replication

  • The DMP (2026) vignette now checks its numbers against the published values in a table, and stopifnot()s the comparison, so a regression stops the build instead of quietly shipping a wrong replication.
  • Calibration labels in the Figure 1 overlay are staggered across three x positions; at a single x they collided into an unreadable stack.

Tables

  • New as.data.frame() method returning the results as a plain data frame, so they can be passed to any table package (kableExtra, gt, modelsummary, huxtable, tinytable, xtable).
  • New regsen_table() rendering results as LaTeX, HTML or Markdown, so the same call works in an Rmd/Qmd knitting to PDF, HTML or Markdown. LaTeX output uses booktabs and puts notes in a threeparttable, with notes = TRUE generating a note recording the analysis, hypothesis and sample size. Infinite bounds render as the correct symbol per format rather than being blanked out.

regsensitivity 0.1.1

  • Fix a Windows-only crash when the DIRECT optimizer (DMP analysis with rybar < Inf and cbar > 0) explored parameter points where varx_bounds() returned NA endpoints. The downstream quad_ineq_bounds() did unguarded if (b1 <= r1 && b2 <= r1) comparisons which evaluated to NA and triggered “missing value where TRUE/FALSE needed”. Symptoms: BFG2020 vignette failed to build on Windows (Status: 1 ERROR on win-builder), but built clean on macOS due to floating-point determinism differences in nloptr’s DIRECT-L.
  • Audit all bare if (...) numeric comparisons in dmp.R and guard against NA propagation. Every comparison now uses isTRUE() / isFALSE() so a single NA cannot poison the dispatch logic.
  • Add 13 NA-robustness regression tests pinning the failure mode (tests/testthat/test-na-robustness.R).

regsensitivity 0.1.0

  • Initial CRAN-ready release.
  • Implements:
    • DMP (2026) identified set and breakdown frontier (rybar = Inf analytic, rybar < Inf, cbar = 0 analytic, rybar < Inf, cbar > 0 via DIRECT global optimization (nloptr)).
    • Oster (2019) identified set (eq and bound modes) and breakdown points.
    • Masten & Poirier (2026) maxovb extension.
  • User API: regsen_bounds(), regsen_breakdown(), regsen_summary(), regsensitivity() dispatcher, hypothesis helpers (bnd_lb(), bnd_ub(), bnd_eq()).
  • Visualization: plot.regsensitivity() (ggplot2).
  • Vignettes:
    • regsensitivity: end-to-end tour with the BFG2020 application.
    • dmp2022-replication: reproduces every table and figure of Diegert, Masten & Poirier (2026) that uses the bundled data.
    • mp2022-stylized: reproduces the stylized Oster examples from Masten & Poirier (2026).
  • Bundled data: bfg2020 (Bazzi, Fiszbein, Gebresilasse 2020, subset).