Skip to content

Commit

Permalink
Fix exponentiate in tidy() #353
Browse files Browse the repository at this point in the history
And make conf.int = TRUE default
  • Loading branch information
seananderson committed Jun 19, 2024
1 parent 8ff58fe commit 4464143
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions R/tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#' tidy(fit, "ran_vals")

tidy.sdmTMB <- function(x, effects = c("fixed", "ran_pars", "ran_vals"), model = 1,
conf.int = FALSE, conf.level = 0.95, exponentiate = FALSE,
conf.int = TRUE, conf.level = 0.95, exponentiate = FALSE,
silent = FALSE, ...) {
effects <- match.arg(effects)
assert_that(is.logical(exponentiate))
Expand Down Expand Up @@ -131,7 +131,6 @@ tidy.sdmTMB <- function(x, effects = c("fixed", "ran_pars", "ran_vals"), model =
b_j_se <- se$b_j[!fe_names == "offset", drop = TRUE]
fe_names <- fe_names[!fe_names == "offset"]
out <- data.frame(term = fe_names, estimate = b_j, std.error = b_j_se, stringsAsFactors = FALSE)
if (exponentiate) out$estimate <- trans(out$estimate)

if (x$tmb_data$threshold_func > 0) {
if (x$threshold_function == 1L) {
Expand All @@ -152,6 +151,8 @@ tidy.sdmTMB <- function(x, effects = c("fixed", "ran_pars", "ran_vals"), model =
out$conf.low <- as.numeric(trans(out$estimate - crit * out$std.error))
out$conf.high <- as.numeric(trans(out$estimate + crit * out$std.error))
}
out$estimate <- trans(out$estimate)
if (exponentiate) out$std.error <- NULL

out_re <- list()
log_name <- c("log_range")
Expand Down
2 changes: 1 addition & 1 deletion man/tidy.sdmTMB.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4464143

Please sign in to comment.