fitcensBayes-methods: Methods for Objective Bayesian Fits with Right Censoring

fitcensBayes-methodsR Documentation

Methods for Objective Bayesian Fits with Right Censoring

Description

Summarizes posterior draws, assesses simulation diagnostics, generates uncensored future observations, computes survival probabilities, imputes censored lifetimes, and extracts the observed-data log likelihood.

Usage

## S3 method for class 'fitcensBayes'
print(x, digits = 4L, ...)
## S3 method for class 'fitcensBayes'
summary(object, ...)
## S3 method for class 'summary.fitcensBayes'
print(x, digits = 4L, ...)
## S3 method for class 'fitcensBayes'
coef(object, ...)
## S3 method for class 'fitcensBayes'
confint(object,
  parm = object$model$parameters, level = 0.95, ...)
## S3 method for class 'fitcensBayes'
as.data.frame(x,
  row.names = NULL, optional = FALSE, ...)
## S3 method for class 'fitcensBayes'
plot(x,
  type = c("trace", "density", "acf", "pairs"),
  pars = x$model$parameters, ...)
## S3 method for class 'fitcensBayes'
predict(object,
  type = c("response", "survival", "impute"),
  times = NULL, draws = 1000L, size = 1L, seed = NULL, ...)
## S3 method for class 'fitcensBayes'
log_lik(object, draws = NULL, seed = NULL, ...)
log_lik_cens(object, draws = NULL, seed = NULL)

Arguments

x, object

A "fitcensBayes" object, or for its summary print method an object of class "summary.fitcensBayes".

digits

Number of significant digits printed.

parm

Parameter names for credible intervals.

level

Credible probability, strictly between zero and one.

row.names, optional

Compatibility arguments, currently ignored. Stored draw identifiers are retained.

type

Plot or prediction type. See Details for prediction.

pars

Parameter names to plot. Pairs plots need at least two.

times

Finite numeric evaluation times for survival prediction. Must be NULL for other prediction types.

draws

Number of posterior samples to select. For log_lik, NULL uses all stored draws. Prediction samples posterior rows without replacement unless more rows are requested than are stored.

size

Number of future observations per draw for response prediction. A positive integer; irrelevant to the other prediction types.

seed

Optional seed passed to set.seed() before simulation or posterior row selection. RNG state advances normally.

...

Additional graphical arguments for plot. Unused arguments to prediction or log-likelihood extraction are errors; other methods accept them for generic compatibility.

Details

The methods dispatch separately from those for uncensored fits. predict(type = "response") generates future uncensored values from the lifetime distribution, not an observed value/indicator pair. predict(type = "survival") returns P(T>t\mid\theta) at each requested time for sampled parameter values. predict(type = "impute") samples latent lifetimes conditionally on each censored record. Every imputed value is strictly above its observed limit, including in discrete models. Imputation does not change the fit. No imputation is possible without censored records.

log_lik dispatches to the censored method. log_lik_cens is an explicit convenience wrapper with the same result. Each observation contributes either its log density or its log survival, according to the observed indicator, not a completed-data log density. The censoring mechanism's own likelihood is excluded under the non-informative censoring assumption.

Prediction and likelihood extraction require callbacks stored by control = list(store_callables = TRUE), the fitting default.

Value

print, print.summary

The supplied object, invisibly, after printing model, censoring, posterior and diagnostic information. The summary print method also displays the moment audit.

summary

A list of class "summary.fitcensBayes" containing model, prior, summary, moment_status, diagnostics, initialization, engine, and censoring from the fit.

coef

A named numeric vector of posterior medians.

confint

A numeric matrix with one row per requested parameter and two columns of equal-tail posterior credible limits. These are credible intervals, not frequentist confidence intervals.

as.data.frame

A data frame of retained posterior draws with chain, iteration and draw identifiers and parameter columns.

plot

The original fitted object, invisibly. Produces trace, density, autocorrelation or pairs plots as a side effect.

predict

Always a numeric matrix with draws rows. For response prediction it has size columns of future values; for survival it has length(times) columns of conditional survival probabilities; for imputation it has one column per censored individual, in their order in the retained data. Rows incorporate posterior parameter uncertainty.

log_lik, log_lik_cens

A numeric matrix with selected posterior draws in rows and retained observations in columns. Entries are observed-data log-likelihood contributions.

See Also

fitcensBayes, fitcensBayes_models

Examples

fit <- fitcensBayes(c(0.3, 0.7, 1.2, 1.5, 2),
                   c(1, 1, 0, 1, 0), "exponential", "jeffreys",
                   seed = 15)
summary(fit)
coef(fit)
confint(fit, level = 0.9)
head(as.data.frame(fit))
predict(fit, type = "survival", times = c(1, 2), draws = 3, seed = 16)
predict(fit, type = "impute", draws = 3, seed = 17)
predict(fit, type = "response", draws = 3, size = 2, seed = 18)
log_lik(fit, draws = 3, seed = 19)
plot(fit, type = "density")

fitdistrBayes documentation built on Sept. 21, 2026, 5:08 p.m.