Skip to content

Commit

Permalink
fix: relative non_zeroes calc
Browse files Browse the repository at this point in the history
  • Loading branch information
laresbernardo committed May 13, 2024
1 parent da7acfe commit 3f1438b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/robyn.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ robyn_modelselector <- function(
group_by(.data$solID) %>%
summarise(
performance = sum(.data$xDecompAgg)/sum(.data$total_spend) - 1,
non_zeroes = (1 - length(.data$rn[
which(round(.data$coef, 6) == 0) & .data$rn %in% InputCollect$all_media])),
non_zeroes = length(.data$rn[
round(.data$coef, 6) == 0 & .data$rn %in% InputCollect$all_media]) /
length(InputCollect$all_media),
top_channels = paste(.data$rn[head(rank(-.data$roi_total, ties.method = "first"), 3)], collapse = ", "),
zero_coef = paste(.data$rn[which(round(.data$coef, 6) == 0)], collapse = ", ")) %>%
left_join(potOpt, "solID")
Expand Down

0 comments on commit 3f1438b

Please sign in to comment.