UniIS is a distribution-independent R package for importance-sampling
inference with univariate complete, censored, and truncated data. Users supply
the probability functions of a distribution and a proposal over its parameters;
the package constructs the observed likelihood and all log-scale importance
weights.
The initial release supports complete, left/right/interval-censored, Type-I, Type-II, progressive Type-II, first-failure, progressive first-failure, doubly Type-II, middle-censored, left-truncated, and right-truncated observations. It includes ordinary, self-normalized, defensive-mixture, and adaptive deterministic-mixture importance sampling, evidence estimation, ESS and weight diagnostics, S3 summaries, likelihood information criteria, predictive functionals, plotting, and generic simulation helpers. New schemes can be provided as a parser function returning exact values, censoring intervals, and truncation regions.
The package intentionally distinguishes implemented methods from planned extensions. Sequential Monte Carlo, bridge sampling, Pareto-smoothed weights, and specialised joint/hybrid censoring likelihoods belong to future releases, where their methods can be documented and validated rather than silently approximated by a different design.
library(UniIS)
set.seed(2026)
x <- rexp(100, rate = 1.5)
fit <- is_fit(
data = x,
pdf = function(x, theta) dexp(x, rate = exp(theta[1])),
cdf = function(x, theta) pexp(x, rate = exp(theta[1])),
survival = function(x, theta) pexp(x, rate = exp(theta[1]), lower.tail = FALSE),
theta0 = c(log_rate = log(1)),
proposal = is_proposal_normal(log(1), 0.75),
scheme = "complete",
control = is_control(n_draws = 5000, method = "adaptive")
)
summary(fit)
exp(coef(fit))
is_predictive(fit, c(0.5, 1), "survival")For a positive parameter, sampling its logarithm as above avoids invalid proposal draws. Include the relevant Jacobian in a prior or proposal density when you use a custom transformed parameterisation.