Skip to content

Commit

Permalink
got negbinom going for unstd series
Browse files Browse the repository at this point in the history
  • Loading branch information
quantifish committed Oct 3, 2023
1 parent 64cd0d3 commit 7b7147f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/get-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ get_unstandarsied <- function(fit, year = "year", rescale = 1) {

if (!is.brmsfit(fit)) stop("fit is not an object of class brmsfit.")

if (fit$family$family == "bernoulli" | grepl("hurdle", fit$family$family)) {
if (fit$family$family %in% c("bernoulli", "negbinomial") | grepl("hurdle", fit$family$family)) {
prop <- data.frame(y = fit$data[,1], Year = fit$data[,year]) %>%
mutate(y = ifelse(.data$y > 0, 1, 0)) %>%
group_by(.data$Year) %>%
Expand All @@ -57,8 +57,8 @@ get_unstandarsied <- function(fit, year = "year", rescale = 1) {
gm <- geo_mean(unstd$cpue)

fout <- unstd %>%
mutate(Mean = .data$cpue, Median = .data$cpue) %>%
select(-.data$cpue)
mutate(Mean = cpue, Median = cpue) %>%
select(-cpue)

# Rescale the series
if (rescale == "raw") {
Expand Down

0 comments on commit 7b7147f

Please sign in to comment.