Fitted values on the training design
fitted.mixgpd_fit.Rdfitted.mixgpd_fit() is a thin training-data wrapper around
predict.mixgpd_fit for conditional models.
Arguments
- object
A fitted object of class
"mixgpd_fit"(must have covariates).- type
Which fitted functional to return:
"mean": posterior predictive mean"median": posterior predictive median"quantile": posterior predictive quantile at levelp
- p
Quantile level used when
type = "quantile".- level
Credible level for confidence intervals (default 0.95 for 95 percent credible intervals).
- interval
Character or NULL; type of credible interval:
NULL: no interval"credible"(default): equal-tailed quantile intervals"hpd": highest posterior density intervals
- seed
Random seed used for deterministic fitted values.
- ...
Unused.
Value
A data frame with columns for fitted values, optional intervals, and residuals computed on the training sample.
Details
The method returns posterior predictive fitted values on the observed design matrix. It is available only when the fitted model stored covariates.
Examples
if (FALSE) { # \dontrun{
# Conditional model (with covariates X)
y <- abs(stats::rnorm(50)) + 0.1
X <- data.frame(x1 = stats::rnorm(50), x2 = stats::runif(50))
bundle <- build_nimble_bundle(y = y, X = X, backend = "sb", kernel = "normal",
GPD = TRUE, components = 6,
mcmc = list(niter = 200, nburnin = 50, thin = 1, nchains = 1))
fit <- run_mcmc_bundle_manual(bundle)
fitted(fit)
fitted(fit, level = 0.90)
fitted(fit, interval = "hpd") # HPD intervals
fitted(fit, interval = NULL) # No intervals
} # }