Skip to content

Commit

Permalink
solve bug
Browse files Browse the repository at this point in the history
solve bug in predict function (newdata != data)
  • Loading branch information
CarlosPoses committed May 28, 2024
1 parent 1b56697 commit 731382f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))))

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))))

Expand Down

0 comments on commit 731382f

Please sign in to comment.