-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
936adf0
commit a337e73
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |