| catdv_vs_occ | R Documentation |
A longitudinal alternative to catdv_vs_ipred() and to xpose's own
xpose::dv_preds_vs_idv() for categorical outcomes. Rather than binning
by predicted probability (as catdv_vs_ipred() does) or plotting raw
per-subject values against a continuous independent variable, this bins
observations by a discrete, typically ordered grouping variable (eg an
occ-typed occasion column) and plots the observed proportion meeting
the cutpoint condition alongside the mean predicted probability, one
point/line per bin.
catdv_vs_occ(
xpdb,
mapping = NULL,
bin = NULL,
cutpoint = 1,
type = "pl",
title = "Observed and predicted probability vs. @x | @run",
subtitle = "Ofv: @ofv, Number of individuals: @nind",
caption = "@dir",
tag = NULL,
facets,
.problem,
quiet,
...
)
xpdb |
< |
mapping |
|
bin |
< |
cutpoint |
< |
type |
String setting the type of plot to be used: point |
title |
Plot title |
subtitle |
Plot subtitle |
caption |
Plot caption |
tag |
Plot tag |
facets |
Additional facets |
.problem |
Problem number |
quiet |
Silence extra debugging output |
... |
Any additional aesthetics. |
The desired plot
catdv_vs_ipred(), catdv_vs_dvprobs()
# Derive an occasion column (TIME is in hours here) and level it in
# visit order
vismo_xpdb <- vismo_pomod %>%
set_var_types(.problem = 1, catdv = DV, dvprobs = matches("^P\\d+$")) %>%
set_dv_probs(.problem = 1, 0~P0, 1~P1, ge(2)~P23) %>%
xpose::mutate(OCC = ceiling((TIME + 1) / 24), .problem = 1) %>%
set_var_types(.problem = 1, occ = OCC) %>%
set_var_levels(.problem = 1, OCC = lvl_inord(paste("Day", 1:12)))
vismo_xpdb %>%
catdv_vs_occ()
vismo_xpdb %>%
catdv_vs_occ(cutpoint = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.