File: methods_phylolm.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 915 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# ci -----------------

#' @export
ci.phylolm <- function(x, ci = 0.95, dof = NULL, method = "wald", verbose = TRUE, ...) {
  method <- match.arg(method, choices = c("wald", "residual", "normal", "boot"))

  if (method == "boot" && (is.null(x$boot) || x$boot <= 0)) {
    insight::format_warning(
      "Bootstrapped confidence intervals are not available",
      "Try re-fitting your model, using `boot = <n>`, where `n` is the number of bootstrap replicates."
    )
    method <- "wald"
  }

  if (method == "boot") {
    s <- stats::coef(summary(x))
    out <- .data_frame(
      Parameter = row.names(s),
      CI_low = as.vector(s[, "lowerbootCI"]),
      CI_high = as.vector(s[, "upperbootCI"])
    )
  } else {
    out <- ci.default(x = x, ci = ci, dof = dof, method = method, verbose = verbose, ...)
  }

  row.names(out) <- NULL
  out
}

#' @export
ci.phyloglm <- ci.phylolm