. Error in get(paste0(generic, ".", class), envir = get_method_env()) :
. object 'type_sum.accel' not found
df <- pmplots_data_obs() %>% mutate(CWRES = CWRESI)
id <- pmplots_data_id()
dayx <- defx(breaks = seq(0,168,24))
.yname <- "MRG1557 (ng/mL)"
etas <- c("ETA1//ETA-CL", "ETA2//ETA-V2", "ETA3//ETA-KA")
covs <- c("WT//Weight (kg)", "ALB//Albumin (g/dL)", "SCR//Creatinine (mg/dL)")
Override the df
and id
objects in the above
chunk
## Nothing here
col//title
specification
This is a way to specify the column name for source data along with the axis label
col_label("CL//Clearance (L)")
. [1] "CL" "Clearance (L)"
When only the column is given, then the column name will be used for the column title:
col_label("WT")
. [1] "WT" "WT"
You can also pull col//title
data from a
yspec
object. Load the yspec
package and
generate an example data specification object
library(yspec)
spec <- ys_help$spec()
Typically, you’ll want to select a subset of columns and then call
axis_col_labs()
You should install the yspec
to use this
functionality.
CWRES
if it doesn’t exist
dat <- mutate(df, CWRES = NULL)
cwresi_time(df)
.
[1m
[22m`geom_smooth()` using formula = 'y ~ x'
cwres_time(dat)
. Creating CWRES column from CWRESI
.
[1m
[22m`geom_smooth()` using formula = 'y ~ x'
dv_pred
)
dv_pred(df, yname = .yname)
dv_pred(df, loglog=TRUE, yname = .yname)
dv_ipred
)
dv_ipred(df, yname=.yname)
dv_ipred(df, loglog=TRUE, yname = .yname)
res_time
)
res_time(df)
res_tafd
)
res_tafd(df)
res_tad
)
res_tad(df)
res_pred
)
res_pred(df)
res_cont
)
res_cont(df, x="WT//Weight (kg)")
This function is also vectorized in x.
res_cat
)
dplyr::count(df, STUDYc)
.
[38;5;246m# A tibble: 4 × 2
[39m
. STUDYc n
.
[3m
[38;5;246m<fct>
[39m
[23m
[3m
[38;5;246m<int>
[39m
[23m
.
[38;5;250m1
[39m SAD 424
.
[38;5;250m2
[39m MAD
[4m1
[24m199
.
[38;5;250m3
[39m Renal 960
.
[38;5;250m4
[39m Hepatic 559
res_cat(df, x="STUDYc//Study type")
res_hist
)
res_hist(df)
wres_time
)
wres_time(df)
wres_tafd
)
wres_tafd(df)
wres_tad
)
wres_tad(df)
wres_pred
)
wres_pred(df)
wres_cont
)
This function is also vectorized in x.
wres_cont(df, x="WT//Weight (kg)")
wres_cat
)
wres_cat(df, x="STUDYc//Study type")
wres_hist
)
wres_hist(df)
wres_q
)
wres_q(df)
cwres_time
)
cwres_time(df)
cwres_tafd
)
cwres_tafd(df)
cwres_tad
)
cwres_tad(df)
cwres_cont
)
cwres_cont(df, x="WT//Weight (kg)")
Vectorized version
cwres_cont(df, covs) %>% pm_grid(ncol=2)
cwres_cat
)
cwres_cat(df, x="STUDYc//Study type")
cwres_cat(df, x="STUDYc//Study type", shown=FALSE)
Vectorized version
. $STUDYc
.
. $RF
cwres_hist
)
cwres_hist(df)
cwres_pred
)
cwres_pred(df)
cwres_q
)
cwres_q(df)
npde_time
)
npde_time(df)
npde_tad
)
npde_tad(df)
npde_tafd
)
npde_tafd(df)
npde_pred
)
npde_pred(df)
npde_cont
)
npde_cont(df, "WT")
npde_cat
)
npde_cat(df, "STUDYc")
npde_q
)
npde_q(df)
npde_hist
)
npde_hist(df)
etas <- c("ETA1//ETA-CL", "ETA2//ETA-V2", "ETA3//ETA-KA")
covs <- c("WT//Weight (kg)", "ALB//Albumin (g/dL)", "SCR//Creatinine (mg/dL)")
eta_hist
)
pm_grid(p)
dv_time
)
dv_time(df, yname = .yname)
dv_time(df, yname="MRG1557 (ng/mL)") + facet_wrap(~DOSE, scales="free_x")
NOTE this will not work as you expect; the labels are wrong.
cwres_cat(df, x = "STUDYc") + facet_wrap(~CPc)
The only way to get this right is
cwres_cat(df, x = "STUDYc", shown=FALSE) + facet_wrap(~CPc)
dv_time(df, yname="MRG1557 (ng/mL)", log=TRUE) + facet_wrap(~STUDYc)
dd1 <- filter(df, ID <= 15)
dv_pred_ipred(dd1, nrow = 3, ncol = 3, ylab = "Concentration (ng/mL)", log_y=TRUE)
. $`1`
.
. $`2`
wrap_eta_cont(df, y = "ETA1", x = c("WT", "ALB"), scales="free_x")
wrap_cont_cat(df, y = c("WT", "CRCL", "AAG"), x = "STUDYc", ncol = 2)
wrap_cont_cont(df, y = "CWRES" , x = c("WT", "CRCL", "AAG"), ncol = 2, scales="free_x")
wrap_res_time(df, y = c("RES", "WRES", "CWRES"), ncol = 2, scales="free_y")
wrap_dv_preds(df, ncol=1)
wrap_eta_cont(
df,
y = "ETA1",
x = c("WT//Weight (kg)", "ALB//Albumin (g/dL)"),
scales="free_x",
use_labels=TRUE
)
This is a simple wrapper around GGally::ggpairs
with
some customizations that have been developed internally at Metrum over
the years.
pairs_plot(id, c("WT//Weight", "ALB//Albumin", "SCR//Serum creat"))
Pass a function that customizes the scatter plots on the lower triangle. This function should accept a gg object and add a geom to it
my_lower <- function(p) {
p + geom_point(aes(color = STUDYc)) +
geom_smooth(se = FALSE, color = "black")
}
pairs_plot(id, c("WT", "ALB"), lower_plot = my_lower)
pm_scatter(df, x = "TIME", y = c("RES", "WRES", "CWRES"))
. $RES
.
. $WRES
.
. $CWRES
cont_cat
)
cont_cat(id, x="STUDYc", y="WT")
cont_hist
)
cont_hist(id, x = "WT", bins = 20)
dv_pred(df, x = "PRED//Concentration ($\\mu$g)")
y <- c("WT//Weight (kg)", "BMI//BMI (kg/m$^2$)", "SCR//SCR (g/dL)")
wrap_cont_time(df, y = y, use_labels=TRUE)
dv_time(df, ys=a, yname="Y-axis name")
p <- ggplot(df, aes(PRED,DV)) + geom_point() + pm_theme()
layer_s(p)
dv_pred(df, smooth=NULL)
dv_pred(df, abline=NULL)
cwres_time(df, hline = NULL)
dv_pred(df, abline=NULL, smooth = NULL)
For example, change the values of argument for
geom_smooth
cwres_time(df, smooth = list(method = "loess", span = 0.1, se=TRUE))
dv_pred(df, add_layers=FALSE)
Default breaks:
dv_time(df)
Break every 3 days
dv_time(df, xby=72)
Custom breaks and limits
p <- ggplot(df, aes(IPRED,DV)) + geom_point()
p
p + pm_theme()
p + theme_plain()
p + pm_smooth()
p + pm_abline()
ggplot(df, aes(TIME,CWRES)) + geom_point() + pm_hline()
We are typically rotating the tick labels on the x-axis and frequently it is convenient to ask for a totally vertical rendering
cwres_cat(df, x = "STUDYc") +
facet_wrap(~CPc) + rot_x(vertical = TRUE)
. [1] "TIME//Time {xunit}"
. [1] "TAD//Time after dose {xunit}"
. [1] "TAFD//Time after first dose {xunit}"
. [1] "RES//Residual"
. [1] "WRES//Weighted residual"
. [1] "CWRES//CWRES"
. [1] "CWRESI//CWRES with interaction"
. [1] "NPDE//NPDE"
. [1] "DV//Observed {yname}"
. [1] "PRED//Population predicted {xname}"
. [1] "IPRED//Individual predicted {xname}"
logbr3()
. [1] 1e-10 3e-10 1e-09 3e-09 1e-08 3e-08 1e-07 3e-07 1e-06 3e-06 1e-05 3e-05
. [13] 1e-04 3e-04 1e-03 3e-03 1e-02 3e-02 1e-01 3e-01 1e+00 3e+00 1e+01 3e+01
. [25] 1e+02 3e+02 1e+03 3e+03 1e+04 3e+04 1e+05 3e+05 1e+06 3e+06 1e+07 3e+07
. [37] 1e+08 3e+08 1e+09 3e+09 1e+10 3e+10
logbr()
. [1] 1e-10 1e-09 1e-08 1e-07 1e-06 1e-05 1e-04 1e-03 1e-02 1e-01 1e+00 1e+01
. [13] 1e+02 1e+03 1e+04 1e+05 1e+06 1e+07 1e+08 1e+09 1e+10