cmsens is used to conduct sensitivity analysis for unmeasured confounding via the E-value approach by Vanderweele et al. (2017) and Smith et al. (2019), and sensitivity analysis for measurement error via regression calibration by Carroll et al. (1995) and SIMEX by Cook et al. (1994) and Küchenhoff et al. (2006).

  object = NULL,
  sens = "uc",
  MEmethod = "simex",
  MEvariable = NULL,
  MEvartype = NULL,
  MEerror = NULL,
  lambda = c(0.5, 1, 1.5, 2),
  B = 200,
  nboot.rc = 400

# S3 method for cmsens.uc
print(x, ...)

# S3 method for
print(x, ...)

# S3 method for
summary(object, ...)

# S3 method for
print(x, digits = 4, ...)



an object of class cmest.


sensitivity analysis for unmeasured confounding or measurement error. uc represents unmeasured confounding and me represents measurement error. See Details.


method for measurement error correction. rc represents regression calibration and simex represents SIMEX. See Details.


variable measured with error.


type of the variable measured with error. Can be continuous or categorical (first 3 letters are enough).


a vector of standard deviations of the measurement error (when MEvartype is continuous) or a list of misclassification matrices (when MEvartype is categorical).


a vector of lambdas for SIMEX. Default is c(0.5, 1, 1.5, 2).


number of simulations for SIMEX. Default is 200.


number of boots for correcting the var-cov matrix of coefficients with regression calibration. Default is 400.


an object of class cmsens


other arguments.


minimal number of significant digits. See print.default.


If sens is uc, an object of class cmsens.uc is returned:


the function call,


a data frame in which the first three columns are point estimates, lower limits of 95% confidence intervals and upper limits of 95% confidence intervals of causal effects on the risk or rate ratio scale and the last three columns are E-values on the risk or rate ratio scale,

If sens is me, an object of class is returned:

the function call,


a list which might contain MEmethod, MEvariable, MEvartype, MEerror, lambda, B, nboot.rc and reliability ratio (which is calculated by 1 - MEerror[i]/sd(data[, MEvariable]) for i=1,...,length(MEerror) when MEvartype is continuous),


naive causal mediation analysis results,


a list of causal mediation analysis results after correcting errors in MEerror,



Sensitivity Analysis for Unmeasured Confounding

Currently, sensitivity analysis for unmeasured confounding are available when the outcome regression model is fitted by lm, glm, glm.nb, gam, multinom, polr.

All E-values are reported on the risk or rate ratio scale. If the causal effects are estimated on the difference scale (i.e., the outcome is continuous), they are transformed into risk ratios using the transformation described by Vanderweele et al. (2017).

Sensitivity Analysis for Measurement Error

Currently, sensitivity analysis for measurement error are available:

1) when the regression model involving the variable measured with error is fitted by lm, glm (with family gaussian, binomial or poisson), multinom, polr, coxph or survreg and model is rb or gformula; 2) when estimation is paramfunc.

Sensitivity analysis for measurement error only supports a single variable measured with error. Regression calibration requires that the variable measured with error be an independent continuous variable in the regression it's involved in. SIMEX supports a continuous or categorical variable measured with error. Quadratic extrapolation method is implemented for SIMEX.

Methods (by generic)

  • print: Print results of cmsens.uc nicely

  • print: Print results of nicely

  • summary: Summarize results of nicely

  • print: Print the summary of nicely


VanderWeele TJ, Ding P (2017). Sensitivity analysis in observational research: introducing the E-Value. Annals of Internal Medicine. 167(4): 268 - 274.

Smith LH, VanderWeele TJ (2019). Mediational E-values: Approximate sensitivity analysis for unmeasured mediator-outcome confounding. Epidemiology. 30(6): 835 - 837.

Carrol RJ, Ruppert D, Stefanski LA, Crainiceanu C (2006). Measurement Error in Nonlinear Models: A Modern Perspective, Second Edition. London: Chapman & Hall.

Cook JR, Stefanski LA (1994). Simulation-extrapolation estimation in parametric measurement error models. Journal of the American Statistical Association, 89(428): 1314 - 1328.

Küchenhoff H, Mwalili SM, Lesaffre E (2006). A general method for dealing with misclassification in regression: the misclassification SIMEX. Biometrics. 62(1): 85 - 96.

Stefanski LA, Cook JR (1995). Simulation-extrapolation: the measurement error jackknife. Journal of the American Statistical Association. 90(432): 1247 - 56.

Valeri L, Lin X, VanderWeele TJ (2014). Mediation analysis when a continuous mediator is measured with error and the outcome follows a generalized linear model. Statistics in medicine, 33(28): 4875 – 4890.

See also


if (FALSE) { library(CMAverse) # 10 boots are used for illustration naive <- cmest(data = cma2020, model = "rb", outcome = "contY", exposure = "A", mediator = c("M1", "M2"), basec = c("C1", "C2"), EMint = TRUE, mreg = list("logistic", "multinomial"), yreg = "linear", astar = 0, a = 1, mval = list(0, "M2_0"), estimation = "imputation", inference = "bootstrap", nboot = 10) exp1 <- cmsens(object = naive, sens = "uc") exp2 <- cmsens(object = naive, sens = "me", MEmethod = "rc", MEvariable = "C1", MEvartype = "con", MEerror = c(0.1, 0.2)) summary(exp2) # B = 10 is used for illustration exp3 <- cmsens(object = naive, sens = "me", MEmethod = "simex", MEvariable = "M1", MEvartype = "cat", MEerror = list(matrix(c(0.95,0.05,0.05,0.95), nrow = 2), matrix(c(0.9,0.1,0.1,0.9), nrow = 2)), B = 10) summary(exp3) }