I tend to do plots like below ( with same style and axis ticks etc. but did not put the effort on this for the example below)
the plotting method can be slightly modified to take the vpc$pctblq as input and then produce a plot with proper style, breaks and legend.
library(tidyvpc) #> tidyvpc is part of Certara.R! #> Follow the link below to learn more about R package development at Cerara. #> https://certara.github.io/R-Certara/ library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union library(ggplot2) library(patchwork) obs_data <- tidyvpc::obs_data[MDV == 0] sim_data <- tidyvpc::sim_data[MDV == 0] #Add LLOQ for each Study obs_data$LLOQ <- obs_data[, ifelse(STUDY == "Study A", 50, 25)] # Binning Method on x-variable (NTIME) vpc <- observed(obs_data, x=TIME, y=DV) %>% simulated(sim_data, y=DV) %>% censoring(blq=(DV < LLOQ), lloq=LLOQ) %>% stratify(~ STUDY) %>% binning(bin = NTIME) %>% vpcstats() A <- plot(vpc) B<- ggplot(vpc$pctblq) + facet_grid(~STUDY) + geom_ribbon(aes(x = xbin, ymin= lo, ymax = hi), fill = "green", alpha = .2) + geom_line(aes(x = xbin, y = y)) + geom_line(aes(x = xbin, y = md), color = "red") + labs(x= "TIME", y= "% BLQ") A/B #> Warning: Removed 8 row(s) containing missing values (geom_path).
Created on 2022-09-29 with reprex v2.0.2
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4