From 731382f7867caa7a7ca9cd2c4b652042720360e6 Mon Sep 17 00:00:00 2001 From: CarlosPoses Date: Tue, 28 May 2024 15:55:21 +0200 Subject: [PATCH] solve bug solve bug in predict function (newdata != data) --- R/plot.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/plot.R b/R/plot.R index c735193..f33b672 100644 --- a/R/plot.R +++ b/R/plot.R @@ -41,7 +41,7 @@ dr.histogram <- function(object, # Create data object and estimate density ratio data <- rbind(object$df_numerator, object$df_denominator) - ext <- data.frame(dr = predict(object, data = data, ...), + ext <- data.frame(dr = predict(object, newdata = data, ...), sample = c(rep("numerator", nrow(object$df_numerator)), rep("denominator", nrow(object$df_denominator)))) @@ -230,7 +230,7 @@ plot_univariate <- function(object, vars = NULL, samples = "both", logscale = TR # Create data object, and external object with density ratio and sample indicators data <- rbind(object$df_numerator, object$df_denominator) - ext <- data.frame(dr = predict(object, data = data, ...), + ext <- data.frame(dr = predict(object, newdata = data, ...), sample = c(rep("numerator", nrow(object$df_numerator)), rep("denominator", nrow(object$df_denominator)))) # Check variable names @@ -393,7 +393,7 @@ plot_bivariate <- function(object, vars1, vars2 = NULL, samples = "both", # Create data object and estimate density ratio data <- rbind(object$df_numerator, object$df_denominator) - ext <- data.frame(dr = predict(object, data = data, ...), + ext <- data.frame(dr = predict(object, newdata = data, ...), sample = c(rep("numerator", nrow(object$df_numerator)), rep("denominator", nrow(object$df_denominator))))