From 5a036c4aa594ab7925a343672c0ac585d9b3d5a5 Mon Sep 17 00:00:00 2001 From: laresbernardo Date: Fri, 13 Jan 2023 08:24:17 -0500 Subject: [PATCH] fix: get rid og QA decomp not matching linear model message --- R/R/model.R | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/R/R/model.R b/R/R/model.R index bd6e2e36b..1a42b4e9a 100644 --- a/R/R/model.R +++ b/R/R/model.R @@ -1041,24 +1041,24 @@ model_decomp <- function(coefs, dt_modSaturated, y_pred, dt_saturatedImmediate, regressor * coeff }, regressor = dt_saturatedCarryover, coeff = coefs_media)) - ## QA decomp - check_split <- all(round(xDecomp[, names(coefs_media)], 2) == - round(mediaDecompImmediate + mediaDecompCarryover, 2)) - if (!check_split) { - message(paste0( - "Attention for loop ", i, - ": immediate & carryover decomp don't sum up to total" - )) - } - y_hat <- rowSums(xDecomp, na.rm = TRUE) - errorTerm <- y_hat - y_pred - if (prod(round(y_pred) == round(y_hat)) == 0) { - message(paste0( - "Attention for loop ", i, - ": manual decomp is not matching linear model prediction. ", - "Deviation is ", round(mean(errorTerm / y) * 100, 2), "%" - )) - } + # ## QA decomp + # check_split <- all(round(xDecomp[, names(coefs_media)], 2) == + # round(mediaDecompImmediate + mediaDecompCarryover, 2)) + # if (!check_split) { + # message(paste0( + # "Attention for loop ", i, + # ": immediate & carryover decomp don't sum up to total" + # )) + # } + # y_hat <- rowSums(xDecomp, na.rm = TRUE) + # errorTerm <- y_hat - y_pred + # if (prod(round(y_pred) == round(y_hat)) == 0) { + # message(paste0( + # "Attention for loop ", i, + # ": manual decomp is not matching linear model prediction. ", + # "Deviation is ", round(mean(errorTerm / y) * 100, 2), "%" + # )) + # } ## Output decomp y_hat.scaled <- rowSums(abs(xDecomp), na.rm = TRUE)