#' confidence interval for the estimate of blblm objects
#'
#' @param object blblm object
#' @param parm label of blblm object formula
#' @param level significance level
#' @param ... extra conditions
#'
#' @return confidence interval of the estimate of blblm object
#' @export
#' @method confint blblm
#'
#' @examples
#' confint(blblm(mpg ~ wt * hp, data = mtcars, m = 3, B = 100), c("wt", "hp"))
confint.blblm <- function(object, parm = NULL, level = 0.95, ...) {
if (is.null(parm)) {
parm <- attr(terms(object$formula), "term.labels")
}
alpha <- 1 - level
est <- object$estimates
out <- map_rbind(parm, function(p) {
map_mean(est, ~ map_dbl(., list("coef", p)) %>% quantile(c(alpha / 2, 1 - alpha / 2)))
})
if (is.vector(out)) {
out <- as.matrix(t(out))
}
dimnames(out)[[1]] <- parm
out
}
#' @export
#' @method confint blbglm
#'
confint.blbglm <- function(object, parm = NULL, level = 0.95, ...) {
if (is.null(parm)) {
parm <- attr(terms(object$formula), "term.labels")
}
alpha <- 1 - level
est <- object$estimates
out <- map_rbind(parm, function(p) {
map_mean(est, ~ map_dbl(., list("coef", p)) %>% quantile(c(alpha / 2, 1 - alpha / 2)))
})
if (is.vector(out)) {
out <- as.matrix(t(out))
}
dimnames(out)[[1]] <- parm
out
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.