Skip to contents

xp_xtras objects

Functions for creating, checking and manipulating xp_xtras objects.

as_xpdb_x() as_xp_xtras() check_xpdb_x() check_xp_xtras()
Convert an object to an xpose_data and xp_xtras object
check_xpose_set() check_xpose_set_item()
Check an xpose_set object
is_xp_xtras()
Basic class checker for xp_xtras
set_var_levels()
Set variable levels
set_var_types() experimental
Set variable types
set_var_types(<default>) experimental
Set variable types
set_var_types(<xp_xtras>) experimental
Set variable types
set_var_types_x() experimental
Set variable types
as_leveler() is_leveler() lvl_bin() lvl_sex() lvl_inord()
Level-defining helper functions
val2lvl()
Translate values to levels
backfill_iofv()
Add individual objective function to data
xp_var()
xp_var Method
check_levels()
Verify validity of level list

xpose sets

Work with collections of models using xpose_set.

xpose_set()
Generate a set of xpdb objects
xset_lineage()
Determine lineage within a set
xset_waterfall()
Waterfall plot
add_xpdb()
Add one or more xpdb objects to an xpose_set
focus_xpdb() unfocus_xpdb() focused_xpdbs() focus_function() focus_qapply()
Focus on an xpdb object in an xpose_set
reshape_set() unreshape_set()
Convert xpose_set to a nested list.
diagram_lineage() experimental
Visualize xpose_set
add_prm_association() drop_prm_association()
Describe parameter associations
add_cov_association() drop_cov_association()
Describe parameter/covariate associations
mutate_prm()
Transform parameter values in place
add_relationship() remove_relationship()
Add relationship(s) to an xpose_set
`%p%`
Binary check if LHS is parent of RHS
logLik(<xpose_set>) AIC(<xpose_set>) BIC(<xpose_set>) experimental
Log-likelihood, AIC and BIC across an xpose_set

Plotting helpers

Additional plotting functions and themes extending xpose.

xplot_binned()
Generic binned trend plotting function
xplot_boxplot()
Default xpose boxplot function
xplot_forest()
Default xpose forest plot function
xplot_heatmap()
Generic heatmap plotting function
xplot_pairs()
Wrapper around ggpairs
xplot_rocplot()
Default xpose ROC plot function
iofv_vs_mod()
Objective function changes across models
prm_waterfall() eta_waterfall() iofv_waterfall()
Specific waterfall plots
shark_plot() dofv_vs_id()
Individual contributions to dOFV
prm_contcov() prm_catcov() prm_cov()
Continuous/categorical covariate effect tables
eta_vs_catcov()
Eta categorical covariate plots (typical)
eta_vs_contcov()
Eta continuous covariate plots (typical)
eta_grid() cov_grid() eta_vs_cov_grid()
Grid plots
dv_vs_ipred_modavg() dv_vs_pred_modavg() ipred_vs_idv_modavg() pred_vs_idv_modavg() plotfun_modavg() experimental
Model average plots
ipred_vs_ipred() pred_vs_pred()
Compare model predictions
catdv_vs_dvprobs()
Non-simulation based likelihood model diagnostic
catdv_vs_ipred()
Binned calibration plot for categorical DVs
catdv_vs_occ()
Longitudinal binned observed vs. predicted plot for categorical DVs
roc_by_mod()
ROC curve across models
roc_plot()
ROC Plot for categorical DVs
shark_colors()
Change colors of shark plots
shk_grid() shk_vs_cov_grid()
Shrinkage contribution grid plots
shk_vs_catcov()
Shrinkage contribution versus categorical covariates
shk_vs_contcov()
Shrinkage contribution versus continuous covariates
normalize_etas() normalise_etas()
Normalize etas by their omega- or empirical-SD-implied scale
ind_roc()
Individual ROC plots
ind_plots_sample()
Individual plots for a (stratified) sample of individuals
xset_waterfall()
Waterfall plot
cormat()
Parameter correlation/covariance matrix heatmap
xp_xtra_theme()
Extra theme defaults
xp4_xtra_theme()
Updated version of the xpose4 theme
grab_xpose_plot()
Grab processed xpose_plot
wrap_xp_ggally()
Ensure consistent style with GGally functions

Plot output & session options

Default labels, watermarks, saving, batch plotting, and the xpose.xtras.* option family.

apply_default_labs()
Apply default label overrides to a plot
set_default_labs()
Set default plot label overrides on an xp_xtras object
add_watermark()
Add a watermark to a plot
set_default_watermark()
Set default watermark options on an xp_xtras object
ggsave_xp()
Save a plot with xpose.xtras default output resolution
plot(<xpose_data>)
Generate a batch of diagnostic plots from an xpdb
set_default_plots()
Set a default plot spec on an xp_xtras object
set_xtras_options()
Set xpose.xtras session options
get_xtras_option()
Inspect which xpose.xtras option value is dominant

Utilities

Miscellaneous helpers and integrations.

modavg_xpdb() experimental
Create a model-averaged xpose data object
cov_forest()
Covariate effect forest plot
eta_grid() cov_grid() eta_vs_cov_grid()
Grid plots
attach_nlmixr2()
Attach nlmixr2 fit object to xpose data object
backfill_nlmixr2_props()
Populate some properties from nlmixr2 fit
get_prm_nlmixr2()
get_prm equivalent for nlmixr2 fits
nlmixr2_as_xtra()
Convenience function for ingesting an nlmixr2 model to xpose and xpose.xtras
nlmixr2_prm_associations()
Based on associations baked into nlmixr2, automatically add to xpose data
nlmixr_example() nlmixr2_example()
Generate example xp_xtras objects from nlmixr2 fits
desc_from_comments()
Backfill utility for descriptions
edit_xpose_data()
Master xpdb editing function
expose_param()
Expose a model parameter of xpdb objects in an xpose_set
expose_property()
Expose a property of xpdb objects in an xpose_set
get_prop()
Generic function to extract a property from a model summary
set_prop()
Set a summary property
get_index() set_index()
Get full index for xpose_data data
set_base_model() get_base_model() unset_base_model()
Base model for xpose_set
set_dv_probs()
Set probability columns for categorical endpoints
list_dv_probs()
For a categorical DV variable, show associated probabilities
group_by_x() ungroup_x()
Group/ungroup and summarize variables in an xpdb
mutate_x() rename_x()
Add, remove or rename variables in an xpdb
left_join_x() left_join(<xpose_data>) experimental
Backfill missing variables via a left join
select_subset()
Convenience wrapper for tidyselect
set_option()
Set an xpose option
reportable_digits()
Reportable digits for model fit
test_xpdb()
Logical instead of exception for xpose data check
irep()
Add simulation counter
patch_condn() experimental
Patch condition number extraction
derive_prm() backfill_derived()
Derive full parameter set for mammillary PK model
derive_shk() backfill_shk()
Derive per-individual contribution to eta shrinkage
recalc_shk()
Recalculate eta shrinkage from individual estimates
diagnose_constants()
Check for potential parameterization issues
get_prm()
Access model parameters
get_shk()
Get shrinkage estimates from model summary
get_cov_matrix()
Extract a parameter covariance or correlation matrix
list_vars()
Updates to list_vars
xp_from_bbr()
Convenience function for ingesting a bbr model into xpose and xpose.xtras
xtras_data()
Read model outputs directly into an xp_xtras object
logLik(<xpose_data>) experimental
Log-likelihood, AIC and BIC for xpose_data objects
add_process_preset() process_preset() print_process_preset() remove_process_preset() amend_process_preset() experimental
Add, apply, list, amend or remove xpdb processing presets
persist_process_presets()
Write current process presets out to a .Rprofile

Data

Example objects for documentation.

pheno_base
An xp_xtras example of a base model
pheno_final
An xp_xtras example of a final model
pheno_saem
An xp_xtras example of a final model
pheno_set
A more complex example of xpose_set object
pkpd_m3
An xp_xtras example of an M3 model
pkpd_m3_df
An xp_xtras example of an M3 model (dataset)
vismo_dtmm
An xp_xtras example of the discrete-time Markov model of categorical vismodegib data
vismo_pomod
An xp_xtras example of the proportional odds categorical vismodegib model
vismodegib
A tibble of mock data used for fitting vismodegib models
xpdb_set
An example xpose_set object
xpdb_x
An example xp_xtras object