imputed() reports the fitted values used for explicitly modelled missing
predictors. Gaussian missing predictor values are reported as conditional
modes from the fitted TMB likelihood. When TMB::sdreport() is available,
std_error contains the corresponding likelihood-based conditional standard
error for Gaussian missing predictor values. Binary missing predictor values
are reported as fitted conditional probabilities from the Bernoulli/logit
predictor model and the Gaussian response likelihood. Ordered categorical
missing predictor values are reported as fitted conditional expected scores
from the cumulative-logit predictor model and the Gaussian response
likelihood. Unordered categorical missing predictor values are reported as
fitted conditional modal category scores from the baseline-category softmax
predictor model and the Gaussian response likelihood. Beta/proportion,
zero-one beta boundary-proportion, and denominator-aware beta-binomial
missing predictor values are reported as fitted conditional means from the
fitted predictor model and the Gaussian response likelihood. Count missing
predictor values are reported as
fitted conditional expected counts from Poisson, negative-binomial, or
zero-truncated negative-binomial predictor models and Gaussian response
likelihood. Lognormal, Gamma, and Tweedie missing predictor values are
reported as fitted conditional quadrature means from the positive or
semi-continuous predictor model and Gaussian response likelihood. The first
finite-state, beta/proportion, boundary-proportion, beta-binomial, count,
lognormal, Gamma, and Tweedie routes report NA standard errors.
Usage
imputed(object, ...)
# S3 method for class 'drmTMB'
imputed(object, variable = NULL, rows = c("missing", "all"), se = TRUE, ...)Arguments
- object
A
drmTMBfit.- ...
Reserved for future extractor options.
- variable
Optional missing-predictor name. The default uses the only modelled missing predictor in the fit.
- rows
Which rows to return.
"missing"returns only fitted missing predictor values."all"returns retained model rows, with observed predictor values labelled as observed.- se
Logical; include conditional standard errors when the fit contains a successful
TMB::sdreport()result.
Value
A data frame with variable, original_row, model_row,
observed, estimate, std_error, source, and uncertainty_status.
Details
This is not multiple imputation: the output does not contain posterior means, posterior intervals, credible intervals, or pooled-imputation summaries.
Examples
set.seed(20260532)
n <- 48
dat <- data.frame(
moisture = seq(-1.5, 1.5, length.out = n),
canopy = cos(seq_len(n) / 5)
)
dat$body_mass_full <- 0.2 + 0.7 * dat$moisture - 0.2 * dat$canopy +
rnorm(n, sd = 0.08)
dat$growth <- 0.6 + 1.1 * dat$body_mass_full - 0.3 * dat$moisture +
rnorm(n, sd = 0.20)
dat$body_mass <- dat$body_mass_full
dat$body_mass[c(7, 19, 34, 43)] <- NA_real_
fit <- drmTMB(
bf(growth ~ moisture + mi(body_mass), sigma ~ 1),
family = gaussian(),
data = dat,
impute = list(body_mass = body_mass ~ moisture + canopy),
missing = miss_control(predictor = "model")
)
imputed(fit)
#> variable original_row model_row observed estimate std_error
#> 1 body_mass 7 7 FALSE -0.5977839 0.06694745
#> 2 body_mass 19 19 FALSE 0.1230898 0.06692573
#> 3 body_mass 34 34 FALSE 0.4920569 0.06762264
#> 4 body_mass 43 43 FALSE 1.1676530 0.06729264
#> source uncertainty_status
#> 1 conditional_mode ok
#> 2 conditional_mode ok
#> 3 conditional_mode ok
#> 4 conditional_mode ok