countimp

Multiple imputation of incomplete count data in R

Count data need their own imputation models. A variable that counts events such as delinquent acts, doctor visits or cigarettes per day is a non-negative integer, usually skewed, frequently overdispersed, and sometimes carries far more zeros than any count distribution predicts. Imputed under a normal model it comes back negative or fractional, and the inferences drawn from it inherit the problem.

The software that is available offers little beyond the first step. Checked in September 2026: Poisson imputation is common, negative binomial less so — and that is largely where it stops. Excess zeros, a hurdle at zero, truncation, censoring, a known upper bound and underdispersion are rarely offered as a model one can simply select, and clustered counts can generally only be imputed under Poisson. countimp exists to fill that gap.

Version 3 at a glance

Version 3.0.3 is a substantially different package from version 2, in four ways.

It no longer needs mice

Versions 1 and 2 were extensions of mice and could not run without it. Version 3 brings its own FCS engine. mice moved to Suggests and is needed for two things only: reading imputation objects created elsewhere, and the redraw behind automatic outlier handling (EV = TRUE). Everything else runs after library(countimp) alone.

The debt to mice is deliberate and visible: argument names, the mice.impute.<name> convention and the structure of the result object are mice’s, and the result still inherits from class mids — so mice’s inspection tools keep working, and anyone who knows one package can read the other.

A formula interface

The imputation model can now be written the way a model is written everywhere else in R:

countimp(data, formulas = list(y ~ x + z + (1 | id)), family = nb())

A grouping term such as (1 | id) makes countimp select the multilevel method by itself, so nobody has to remember whether the function is called 2l.nb or 2l.nb.noint. The version 2 route through method and predictorMatrix still works unchanged.

Four new model families

Situation New methods Example
The count cannot be zero by construction ztp, ztnb days in hospital among those admitted
Counts recorded only up to a reporting limit cp, cnb a top category reading “10 or more”
A known, hard maximum bp, bnb correct answers in a ten-item test
Underdispersion cmp, 2l.cmp check-ups attended under a fixed schedule

Conway–Maxwell–Poisson is the one family that covers counts varying less than a Poisson process would, because they cluster tightly around a typical value.

Variables that live on the cluster level

A therapist’s years of experience is the same for every one of their patients, but in long format it still occupies one cell per row — and a cell-by-cell FCS engine will happily give the same therapist a different career per patient. The 2lonly. methods (2lonly.pois, 2lonly.nb) impute such a variable at its own level, once per cluster.

The full set of models

Thirteen count families, each with a Bayesian and a bootstrap variant — the two differ only in how parameter uncertainty enters (a draw from the posterior versus a refit on a resample of the observed cases), not in the draw that produces the imputed count.

Situation Families
Ordinary counts Poisson, quasi-Poisson
Overdispersion negative binomial
Underdispersion Conway–Maxwell–Poisson
Excess zeros zero-inflated Poisson and negative binomial
A hurdle at zero hurdle Poisson and negative binomial
Zero-truncated zero-truncated Poisson and negative binomial
Right-censored censored Poisson and negative binomial
Known upper bound bounded Poisson and negative binomial

Seven of the thirteen have two-level counterparts, and two- and three-level data are supported for those. The six range-restricting families — zero-truncated, censored, bounded — are single-level so far: their likelihoods are countimp’s own and are maximised directly, with no random-effect layer underneath, so a multilevel version is a new estimator rather than a new argument.

Installation

Distributed under the GPL-3 licence and installed from GitHub:

# install.packages("remotes")
remotes::install_github("kkleinke/countimp")

Documentation

A cautionary note

countimp builds imputations from parametric count models, so the plausibility of what comes out depends on the imputation model fitting the data. Kleinke and Reinecke (2013) found that misspecifying a count imputation model can bias inferences noticeably — this is a place to spend time on modelling rather than to accept a default. Where the assumptions of parametric count models do not hold, Qtools and ImputeRobust offer quantile regression and semi-parametric alternatives.

Citation

Kleinke, K., & Reinecke, J. (2026). countimp 3.0.3: Multiple imputation of incomplete count data [R package]. <https://github.com/kkleinke/countimp>