R/plot_gam_diff.R

Defines functions plot_gam_diff

Documented in plot_gam_diff

#' Title
#'
#' @param plotdf
#'
#' @return
#' @export
#'
#' @examples
plot_gam_diff <- function(plotdf){
  require(dplyr)
  p<-ggplot(plotdf) + geom_ribbon(aes(x=x, ymin=lb.diff, ymax=ub.diff), alpha=0.5) +
    geom_path(aes(x=x, y=lb.diff), color="blue")+
    geom_path(aes(x=x, y=ub.diff), color="red")+
    geom_path(aes(x=x, y=point.diff), color="black") +
    geom_vline(aes(xintercept=q1)) +
    geom_vline(aes(xintercept=q3)) +
    xlab("Exposure") +
    ylab("GAM-estimated differences from 25th percentile of exposure")
  return(p)
}
washb-eed-substudies/washbgam documentation built on April 12, 2025, 9:41 a.m.