Package: delicatessen
DelicatessenThe one-stop sandwich (variance) shop in Python.delicatessenis a Python 3.8+ library for the generalized calculus
of M-estimation.Citation: Zivich PN, Klose M, Cole SR, Edwards JK, & Shook-Sa BE. (2022). Delicatessen: M-Estimation in Python.arXiv:2203.11300[stat.ME]M-Estimation and Estimating EquationsHere, we provide a brief overview of M-estimation theory. For a detailed introduction to M-estimation, see Chapter 7 of
Boos & Stefanski (2013). M-estimation is a generalization of likelihood-based methods.M-estimatorsare solutions to
estimating equations. To apply the M-estimator, we solve the estimating equations using observed data. This is similar
to other approaches, but the key advantage of M-Estimators is estimation of the variance via the sandwich variance.While M-Estimation is a powerful tool, the derivatives and matrix algebra can quickly become unwieldy. This is wheredelicatessencomes in.delicatessentakes an array of estimating functions and data, and solves for the parameter
estimates, computes the derivatives, and performs the matrix algebra calculations. Therefore, M-estimators can be more
easily adopted without having to perform by-hand calculations. In other words, we can let the computer do the math for
us.To further ease use,delicatessenalso comes with a variety of built-in estimating equations. See
thedelicatessen websitefor details on the available estimating equations,
how to use them, and practical examples.InstallationInstalling:You can install viapython -m pip install delicatessenDependencies:The dependencies are:numpy,scipyTo replicate the tests located intests/, you will additionally need to install:panda,statsmodels, andpytestWhile versions ofdelicatessenprior to v1.0 were compatible with older versions of Python 3 and NumPy and SciPy, the
v1.0+ releases are only available for Python 3.8+ with NumPy v1.18.5+ and SciPy v1.9.0. This change was made to use
a better numerical approximation procedure for the derivative. If you want to use with older versions of those packages
or older versions of Python, install v0.6 instead.Getting startedBelow is a simple demonstration of calculating the mean withdelicatessenimportnumpyasnpy=np.array([1,2,3,1,4,1,3,-2,0,2])Loading the M-estimator functionality, building the corresponding estimating equation for the mean, and printing the
results to the consolefromdelicatessenimportMEstimatordefpsi(theta):returny-theta[0]estr=MEstimator(psi,init=[0,])estr.estimate()print(estr.theta)# Estimate of the meanprint(estr.variance)# Variance estimateFor further details on usingdelicatessen, see the full documentation and worked examples available
atdelicatessen websiteor in the examples folder of the GitHub page.ApplicationsThe following papers demonstrate practical applications ofdelicatessenand M-estimation in epidemiology:Zivich PN, Ross RK, Shook-Sa BE, Cole SR, & Edwards JK. (2023). Empirical sandwich variance estimator for iterated
conditional expectation g-computation.arXiv:2306.10976CODEShook-Sa BE, Zivich PN, Rosin SP, Edwards JK, Adimora AA, Hudgens MG, & Cole SR. (2023). Fusing Trial Data for
Treatment Comparisons: Single versus Multi-Span Bridging.arXiv:2305.00845CODEZivich PN, Cole SR, Edwards JK, Mulholland GE, Shook-Sa BE, & Tchetgen Tchetgen EJ. (2023). Introducing Proximal
Causal Inference for Epidemiologists.American Journal of EpidemiologyCODECole SR, Zivich PN, Edwards JK, Shook-Sa BE, & Hudgens MG. (2023). Sensitivity Analyses for Means or Proportions with
Missing Outcome Data.EpidemiologyCODEReferencesBoos DD, & Stefanski LA. (2013). M-estimation (estimating equations). In Essential Statistical Inference
(pp. 297-337). Springer, New York, NY.Stefanski LA, & Boos DD. (2002). The calculus of M-estimation.The American Statistician, 56(1), 29-38.Zivich PN, Klose M, Cole SR, Edwards JK, & Shook-Sa BE. (2022). Delicatessen: M-Estimation in Python.arXiv preprint arXiv:2203.11300.