Skip to contents

Plot Marginal Effects for Numeric Rating Model

Usage

plot_cont_rating_effects(
  df = data.frame(),
  response = character(),
  predictor = character(),
  group = NULL,
  plot = TRUE,
  back_transform = FALSE
)

Arguments

df

Dataframe with column 'abs_deviation_score_estimate', 'lambda' and predictor, response columns

response

A character vector naming the response variable column in df

predictor

A character vector naming the predictor variable column in df

group

An optional character vector naming the random effect / grouping variable column in df

plot

A logical indicating whether the plot should be rendered interactively or not, defaults to TRUE

back_transform

A logical indicating whether the response variable should be back-transformed from the box-cox transformed scale to absolute deviation scores

Value

A list, with the first element containing the fitted statistical model and the second element containing the plot

Examples

# ManyEcoEvo_results$effects_analysis[[1]] %>% #TODO use package data object instead of targets object
# unnest(review_data) %>%
#   plot_cont_rating_effects(response = "box_cox_abs_deviation_score_estimate",
#                            predictor = "RateAnalysis",
#                            group = "ReviewerId",
#                            back_transform = TRUE) %>%
#   pluck(2) +
#   ggforce::facet_zoom(xlim = c(0,100), ylim = c(0,0.55)) +
#   ggpubr::theme_pubclean() +
#   ggplot2::xlab("Rating") +
#   ggplot2::ylab("Deviation In Effect Size from Analytic Mean")