Skip to content

Commit

Permalink
add confint method
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Sep 6, 2024
1 parent 936adf0 commit a337e73
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions R/generics_confint.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#' @export
#' @noRd
confint.feglm <- function(object, parm, level = 0.95, ...) {
# Extract the summary of the feglm object
res <- summary(object)$cm
colnames(res) <- c("estimate", "std.error", "statistic", "p.value")

# Calculate the critical value for the specified confidence level
alpha <- 1 - level
z <- qnorm(1 - alpha / 2)

# Compute the confidence intervals
conf.int <- data.frame(
conf.low = res[, "estimate"] - z * res[, "std.error"],
conf.high = res[, "estimate"] + z * res[, "std.error"]
)

colnames(conf.int) <- paste(100 * (c(0, 1) + c(1, -1) * (1 - conf.level) / 2),
"%")

# Return the confidence intervals
conf.int
}

0 comments on commit a337e73

Please sign in to comment.