Learn R Programming

NMAR

NMAR provides estimators for finite-population means when outcomes are subject to nonignorable nonresponse (Not Missing at Random, NMAR). It supports iid data.frame inputs and complex survey designs via survey.design objects from the survey package, and exposes a unified interface through nmar().

Methods

NMAR currently provides the following engines:

  • el_engine(): empirical likelihood (Qin, Leung and Shao, 2002).
  • exptilt_engine(): exponential tilting (Riddles, Kim and Im, 2016).
  • exptilt_nonparam_engine(): nonparametric exponential tilting for aggregated categorical data (Riddles, Kim and Im, 2016, Appendix 2).

References:

  • Qin, J., Leung, D., and Shao, J. (2002). Estimation with survey data under nonignorable nonresponse or informative sampling. Journal of the American Statistical Association, 97(457), 193-200. https://doi.org/10.1198/016214502753479338
  • Riddles, M. K., Kim, J. K., and Im, J. (2016). A propensity-score-adjustment method for nonignorable nonresponse. Journal of Survey Statistics and Methodology, 4(2), 215-245. https://doi.org/10.1093/jssam/smv047

See browseVignettes("NMAR") and the package website for worked examples and engine-specific assumptions: https://ncn-foreigners.ue.poznan.pl/NMAR/.

Installation

Install the CRAN release:

install.packages("NMAR")

Install the development version from GitHub:

# install.packages("pak")
pak::pak("ncn-foreigners/NMAR")

Or with remotes:

# install.packages("remotes")
remotes::install_github("ncn-foreigners/NMAR")

To build vignettes locally:

remotes::install_github("ncn-foreigners/NMAR", build_vignettes = TRUE)

Usage

Formula interface

nmar() uses a two-sided formula with the outcome on the left-hand side. In the common “missing values indicate nonresponse” workflow, nonrespondents are encoded as NA in the outcome.

Many engines support a partitioned right-hand side via | (e.g., y_miss ~ block1_vars | block2_vars), but the interpretation of these blocks is engine-specific. See ?el_engine and ?exptilt_engine for details.

Example

suppressPackageStartupMessages(library(NMAR))

data("riddles_case1", package = "NMAR")

# Empirical likelihood (EL)
fit_el <- nmar(
  y ~ x,
  data = riddles_case1,
  engine = el_engine(variance_method = "none")
)
summary(fit_el)
#> NMAR Model Summary
#> =================
#> y mean: -1.001986
#> Converged: TRUE 
#> Variance method: none 
#> Variance notes: Variance skipped (variance_method='none') 
#> Total units: 500 
#> Respondents: 368 
#> Call: nmar(y ~ x, data = <data.frame: N=500>, engine = empirical_likelihood)
#> 
#> Missingness-model coefficients:
#>              Estimate
#> (Intercept)  0.860555
#> y           -0.175376

# Exponential tilting (ET)
fit_et <- nmar(
  y ~ x,
  data = riddles_case1,
  engine = exptilt_engine(y_dens = "normal", family = "logit", variance_method = "none")
)
summary(fit_et)
#> NMAR Model Summary (Exponential tilting)
#> =================================
#> y mean: -1.004076
#> Converged: TRUE 
#> Variance method: none 
#> Call: nmar(y ~ x, data = <data.frame: N=?>, engine = exponential_tilting)
#> 
#> Response-model (theta) coefficients:
#>   (Intercept)          : 0.864241
#>   y                    : -0.169948

Result objects returned by nmar() support methods such as summary(), weights(), se(), and confint(), and tidy() / glance() via the generics package.

Survey designs

if (requireNamespace("survey", quietly = TRUE)) {
  suppressPackageStartupMessages(library(survey))
  set.seed(1)
  d <- riddles_case1
  d$w <- runif(nrow(d), 0.5, 2)
  des <- survey::svydesign(ids = ~1, weights = ~w, data = d)

  fit_svy <- nmar(y ~ x, data = des, engine = el_engine(variance_method = "none"))
  summary(fit_svy)
}
#> NMAR Model Summary
#> =================
#> y mean: -1.005961
#> Converged: TRUE 
#> Variance method: none 
#> Variance notes: Variance skipped (variance_method='none') 
#> Total units: 621.7412 
#> Respondents: 368 
#> Call: nmar(y ~ x, data = <survey.design: N=621.741>, engine = empirical_likelihood)
#> 
#> Missingness-model coefficients:
#>              Estimate
#> (Intercept)  0.893453
#> y           -0.129256

Getting help

If you encounter a clear bug, please file an issue with a minimal reproducible example on GitHub

Citation

If you use NMAR in academic work, please cite the package and the relevant method paper(s):

citation("NMAR")

Authors and acknowledgments

Research grant: OPUS 20 #2020/39/B/HS4/00941

Copy Link

Version

Install

install.packages('NMAR')

Version

0.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Maciej Ber<c4><99>sewicz

Last Published

February 5th, 2026

Functions in NMAR (0.1.2)

el_compute_variance

Variance driver
constraint_summaries

Constraint summaries for diagnostics
confint.summary_nmar_result

Confidence intervals for summary objects
el_compute_diagnostics

Compute diagnostics
el_log_banner

Log a step banner line
el_log_solver_result

Log solver termination status
el_log_solver_config

Log solver configuration
el_log_data_prep

Log data prep summary
el_log_variance_header

Log variance header and result
el_log_trace

Log a short trace message with the chosen level
create_verboser

Create Verbose Printer Factory
el

Empirical likelihood estimator
el.data.frame

Empirical likelihood for data frames
el_core_eta_state

Core computations
el_run_solver

Solver orchestration
el_validate_design_spec

Validate design dimensions
el_denominator

Compute denominator
el_validate_matrix

Validate matrix columns for NA and zero variance
el_extract_strata_factor

Extract strata factor
el_build_result

Build EL result object
el_log_solving

Log a short solver progress note
el_lambda_W

Compute lambda_W
el_log_start_values

Log starting values
el_build_jacobian_survey

Empirical likelihood analytical jacobian for survey designs
el_estimator_core

Core of the empirical likelihood estimator
el_resolve_auxiliaries

Auxiliary design computation
el_engine

Empirical likelihood engine for NMAR
exptilt_nonparam

Nonparametric Exponential Tilting (Internal Generic)
el_prepare_nleqslv

Prepare nleqslv args
logit_family

Construct logit response family
polish_households

Polish Household Budget Data with Simulated Nonignorable Nonresponse
merge_nleqslv_top

Prefer explicit solver_args over control-provided top-level args
nmar_fmt_num

Format a number with fixed decimal places using nmar.digits
exptilt_nonparam_engine

Nonparametric exponential tilting engine for NMAR
exptilt

Exponential tilting estimator
el_mean

Compute the mean
riddles_case3

Riddles Simulation, Case 3: Sine Wave Mean
new_nmar_result

Construct for result objects
riddles_case4

Riddles Simulation, Case 4: Cubic Mean
new_nmar_engine_el

Construct EL Engine Object
exptilt_engine

Exponential tilting engine for NMAR
print.nmar_result

Print method for nmar_result
nmar_format_call_line

Format an abridged call line for printing
print.nmar_engine

Print method for engines
generate_conditional_density

Generate conditional density
prepare_nmar_scaling

Prepare scaled matrices and moments
glance.nmar_result

Glance summary for NMAR results
nmar_get_digits

Resolve global digits setting for printing
enforce_nonneg_weights

Enforce nonnegativity of weights
print.summary_nmar_result

Print method for summary.nmar_result
scale_aux_multipliers

Map unscaled auxiliary multipliers to scaled space
validate_nmar_result

Validate nmar_result
el_prepare_inputs

Input preprocessing
format.nmar_engine

Formatter for engines
nmar_get_el_denom_floor

EL denominator floor
formula.nmar_result

Default formula for NMAR results
nmar_get_numeric_settings

NMAR numeric settings
el_assert_no_offset

Assert that terms object lacks offsets
probit_family

Construct probit response family
el.survey.design

Empirical likelihood estimator for survey designs
riddles_case1

Riddles Simulation, Case 1: Linear Mean
riddles_case2

Riddles Simulation, Case 2: Exponential Mean
vcov.nmar_result

Variance-covariance for NMAR results
el_build_equation_system_survey

Empirical likelihood equations for survey designs
el_build_jacobian

Empirical likelihood analytical jacobian for srs
summary.nmar_result_el

Summary method for EL results
summary.nmar_result

Summary method for nmar_result
trim_weights

Trim weights by capping and proportional redistribution
el_log_final

Log final summary
el_masses

Compute probability masses
el_log_detailed_diagnostics

Log detailed diagnostics
el_log_weight_diagnostics

Log weight diagnostics
scale_coefficients

Map unscaled coefficients to scaled space
weights.nmar_result

Extract weights from an `nmar_result`
voting

Aggregated Exit Poll Data for Gangdong-Gap (2012)
unscale_coefficients

Unscale coefficients and covariance
tidy.nmar_result

Tidy summary for NMAR results
summary.nmar_result_exptilt

Summary method for Exponential Tilting results (engine-specific)
validate_and_apply_nmar_scaling

Validate and apply scaling for engines
validate_data

Validate Data for NMAR Analysis
se

Extract standard error for NMAR results
validate_nmar_engine_el

Validate EL Engine Settings
engine_name

Canonical engine name
shared_weighted_gram

Weighted linear algebra
extract_nleqslv_top

Extract top-level nleqslv arguments from a control-like list
fitted.nmar_result

Default fitted values for NMAR results
engine_config

Extract engine configuration
nmar_result_get_estimate

Internal helpers for nmar_result objects
validate_nleqslv_top

Validate top-level nleqslv arguments and coerce invalid to defaults
new_nmar_result_el

Construct EL Result Object
print.nmar_result_el

Print method for EL results
nmar

Not Missing at Random Estimation
print.nmar_result_exptilt

Print method for Exponential Tilting results (engine-specific)
sanitize_nleqslv_control

Parse nleqslv control list for compatibility
run_engine.nmar_engine_el

Run method for EL engine
bootstrap_variance.data.frame

Bootstrap for IID data frames
coef.nmar_result

Default coefficients for NMAR results
bootstrap_variance

Bootstrap variance estimation module
apply_nmar_scaling

Apply scaling to a matrix using a recipe
bootstrap_variance.default

Default dispatch
confint.nmar_result

Wald confidence interval for NMAR results
el_build_start

Build starting values
compute_weighted_stats

Compute mean and standard deviation
el_build_equation_system

Empirical likelihood estimating equations for SRS
bootstrap_variance.survey.design

Bootstrap for survey designs
el_augment_strata_aux

Strata augmentation for survey designs
bootstrap_variance.svyrep.design

Replicate-weight designs not supported
el_check_auxiliary_inconsistency_matrix

Check auxiliary means consistency against respondents sample support.
coef.summary_nmar_result

Coefficient table for summary objects
create_nmar_scaling_recipe

Build a scaling recipe from one or more design matrices