Generating pred_corr vpc fails
Hi,
I'm trying to generate a prediction corrected vpc but I keep getting the same error:
Error in
dplyr::group_by(): ! Must group by variables found in.data. ✖ Columnsimis not found.Backtrace: ▆
- ├─vpc::vpc(...)
- ├─vpc:::vpc.default(...)
- │ └─base::do.call(...)
- ├─vpc (local)
<fn>(...)- │ └─vpc:::calc_vpc_continuous(...)
- │ └─sim %>% dplyr::group_by(strat, sim, bin) %>% ...
- ├─dplyr::summarise(...)
- ├─dplyr::group_by(., strat, sim, bin)
- └─dplyr:::group_by.data.frame(., strat, sim, bin)
- └─dplyr::group_by_prepare(.data, ..., .add = .add, error_call = current_env())
└─rlang::abort(bullets, call = error_call)
This is the code I used:
vpc(sim = sim2, obs = obs, sim_cols = list(dv = "DV", sim = "REP"), obs_cols = list(dv = "DV"), show = list(obs_dv = TRUE, obs_ci = TRUE, pi_as_area = FALSE, sim_median_ci = TRUE, pi = FALSE), log_y = FALSE, xlab = "Time (hours)", # Label of the x-axis ylab = "Concentration (ng/ml)", # Label of the y-axis title = "VPC of a single administration of 20 mg of lenvatinib ", scales = "free", pi = c(0.05, 0.95), # prediction interval simulated data to show ci = c(0.05, 0.95), n_bins = "auto", pred_corr = TRUE, pred_corr_lower_bnd = 0, smooth = FALSE, verbose = FALSE )
Sim2 and obs are the following:
head(obs) ID MDV TIME DV PRED 1 1 1 0.0 0.000 0.00 2 1 0 0.5 59.068 159.26 3 1 0 1.0 91.238 237.15 4 1 0 2.0 110.390 273.85 5 1 0 4.0 86.097 212.98 6 1 0 8.0 35.691 105.85 head(sim2) ID MDV TIME DV PRED REP 1 1 1 0 0 0 1 2 1 0 0.5 173. 159. 1 3 1 0 1 314. 237. 1 4 1 0 2 854. 274. 1 5 1 0 4 505. 213. 1 6 1 0 8 95.9 106. 1
Does anyone know what I am doing wrong?
Kind regards, Sybrand