Computational Provenance & Reproducibility Record

RAISINS - R and AI Solutions for INferential Statistics · Online Statistical Analysis Platform for Agricultural Research

Computational Provenance & Reproducibility Record Propensity Score Matching · 2.0.0 · DOI pending

Computational Provenance & Reproducibility Record

RAISINS · Propensity Score Matching Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Propensity Score Matching module. It is intended to support computational reproducibility and software transparency. Detailed statistical methodology, mathematical derivations, and user guidance are provided separately in the official module documentation.

Any issues or updates required please comment here

Go to the App from here

1 Module Metadata

Parameter Specification
Module Propensity Score Matching
Module Version 2.0.0
DOI pending
Document Type Computational workflow
Statistical Engine R
R Version 4.5.2
Reproducibility Execution Environment: Posit Connect · GCR · renv-locked

2 Statistical Dependency Manifest

Package Version Repository Core Statistical Functions
MatchIt 4.7.2 CRAN matchit(), match.data()
cobalt 4.6.2 CRAN love.plot(), bal.plot(), bal.tab(), summary.matchit()
broom 1.0.13 CRAN tidy()
margins 0.3.28 CRAN margins()
optmatch 0.10.8 CRAN backend for method = "optimal"/"full" matching
stats 4.5.2 Base R glm(), predict(), logLik(), pchisq()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Propensity-score estimation stats::glm(treatment ~ covariates, family = binomial)
Matching MatchIt::matchit(distance = "glm", ...)
Matched analytic sample MatchIt::match.data()
Covariate balance tables (before/after) summary.matchit()$sum.all, summary.matchit()$sum.matched (via cobalt)
Standardized mean difference (Love) plot cobalt::love.plot()
Covariate density / eCDF overlap plot cobalt::bal.plot()
Propensity-score coefficient table broom::tidy() on the fitted glm() object
Average marginal effects margins::margins()

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Propensity
Score Model
Method Logistic regression of the binary treatment indicator on the selected covariates, via stats::glm(family = binomial)
Predictors All user-selected qualitative and quantitative covariates entered additively (no interaction terms by default); the outcome variable is never included as a predictor
Distance measure distance = "glm": the fitted propensity score itself (predicted probability of treatment) is used as the distance metric for matching
Variable requirements Treatment column must have exactly two levels; rows with a covariate that is constant (a single level) across the whole sample cause the model fit to be rejected with an on-screen error
Matching Method User-selectable: nearest-neighbor (default), optimal, full, subclassification, exact, or coarsened exact matching, via MatchIt::matchit()
Ratio 1:1 matching (one control matched to each treated unit)
Caliper Optional, user-specified between 0.1 and 0.5 (in standard-deviation units of the propensity score); when set, a treated unit is left unmatched rather than matched to a control outside the caliper. No caliper is applied if left blank
Balance
Assessment
Metric Standardized mean difference (SMD) of each covariate between treated and control groups, computed before and after matching via summary.matchit()
Practical thresholds |SMD| < 0.1: well balanced; 0.1-0.25: borderline; > 0.25: meaningfully imbalanced (the RA-One assistant and the app narrative apply these same thresholds)
Model
Diagnostics
Model fit Log-likelihood, likelihood-ratio chi-square test, and McFadden's pseudo R-squared, reported for the propensity-score model both before matching (original fit) and after matching (the same model refit, weighted, on the matched sample)
Mean standardized bias Mean of the absolute standardized mean differences across all covariates, reported before and after matching as a single summary diagnostic
Plots Before/After distribution Kernel density of the estimated propensity score by treatment group, before matching (from the fitted model) and after matching (on match.data())
Love plot, jitter plot, balance plot Rendered directly from the MatchIt match object via cobalt::love.plot(), plot(m.out, type = "jitter"), and cobalt::bal.plot() respectively - no statistics are recomputed outside these functions

5 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result, using the built-in Organic_Adoption dataset bundled with the module (a farm-level observational dataset on organic-farming adoption, covariates, and yield).

5.1 Propensity-Score Model

dat <- read.csv("Organic_Adoption.csv")
dat$Education <- as.factor(dat$Education)

form   <- Adoption ~ Farm_Size_ha + Rainfall_mm + Farmer_Age +
                      Education + Extension_Contact + Credit_Access
ps_mod <- glm(form, data = dat, family = binomial)

5.2 Matching

library(MatchIt)
m.out <- matchit(
  form, data = dat,
  method   = "nearest",   # user-selectable
  distance = "glm",
  ratio    = 1,
  caliper  = 0.2,         # optional, user-specified
  link     = "logit",
  replace  = FALSE
)
summary(m.out)$nn          # matched / unmatched / discarded counts

5.3 Covariate Balance (Standardized Mean Difference)

library(cobalt)
bal <- summary(m.out)
bal$sum.all[,      "Std. Mean Diff."]  # before matching
bal$sum.matched[,  "Std. Mean Diff."]  # after matching

love.plot(m.out, stars = "std", abs = TRUE)   # Love plot
bal.plot(m.out, var.name = "distance", which = "both")  # balance plot

5.4 Propensity-Score Coefficient Table & Marginal Effects

library(broom); library(margins)
broom::tidy(ps_mod)                 # coefficient, SE, p-value, odds ratio = exp(estimate)
summary(margins::margins(ps_mod))   # average marginal effect of each covariate

Explore the entire Propensity Score Matching module in preview mode using our demo datasets. To submit suggestions or report a workflow issue, please use the discussion section below, or visit the official RAISINS website.

6 RAISINS Native Statistical Framework

RAISINS uses R for all its statistical computations. Every package used to generate major results is listed and demonstrated with examples, so results can be reproduced independently. These results are then organized and formatted on the RAISINS website along with visualisation to make them easier to use and interpret. RAISINS also has its own custom-built statistical tools for managing workflows, validating results, and generating reports. Details of these are not fully covered here, they’re shared with outside researchers only on request, and are subject to licensing terms.

7 Package References

R Core Team. (2025). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/

Ho, D., Imai, K., King, G., & Stuart, E. (2011). MatchIt: Nonparametric Preprocessing for Parametric Causal Inference. Journal of Statistical Software, 42(8), 1-28. https://doi.org/10.18637/jss.v042.i08

Greifer, N. (2024). cobalt: Covariate Balance Tables and Plots (R package version 4.6.2). https://CRAN.R-project.org/package=cobalt

Rosenbaum, P. R., & Rubin, D. B. (1983). The Central Role of the Propensity Score in Observational Studies for Causal Effects. Biometrika, 70(1), 41-55. https://doi.org/10.1093/biomet/70.1.41

Feedback & Discussion