Title: | 'ggplot2' Based Tool to Facilitate Diagnostic Plots for NLME Models |
---|---|
Description: | At Novartis, we aimed at standardizing the set of diagnostic plots used for modeling activities in order to reduce the overall effort required for generating such plots. For this, we developed a guidance that proposes an adequate set of diagnostics and a toolbox, called 'ggPMX' to execute them. 'ggPMX' is a toolbox that can generate all diagnostic plots at a quality sufficient for publication and submissions using few lines of code. This package focuses on plots recommended by ISoP <doi:10.1002/psp4.12161>. While not required, you can get/install the 'R' 'lixoftConnectors' package in the 'Monolix' installation, as described at the following url <https://monolix.lixoft.com/monolix-api/lixoftconnectors_installation/>. When 'lixoftConnectors' is available, 'R' can use 'Monolix' directly to create the required Chart Data instead of exporting it from the 'Monolix' gui. |
Authors: | Amine Gassem [aut], Bruno Bieth [aut], Irina Baltcheva [aut], Thomas Dumortier [aut], Christian Bartels [aut], Souvik Bhattacharya [aut], Inga Ludwig [aut], Ines Paule [aut], Didier Renard [aut], Matthew Fidler [aut, cre] , Seid Hamzic [aut], Benjamin Guiastrennec [ctb], Kyle T Baron [ctb] , Qing Xi Ooi [ctb], Novartis Pharma AG [cph] |
Maintainer: | Matthew Fidler <[email protected]> |
License: | GPL-2 |
Version: | 1.2.11.9000 |
Built: | 2024-10-25 04:34:03 UTC |
Source: | https://github.com/ggpmxdevelopment/ggpmx |
Method for subsetting "pmx_gpar" objects
## S3 method for class 'pmx_gpar' x[index, ...]
## S3 method for class 'pmx_gpar' x[index, ...]
x |
pmx_gpar object |
index |
can be character/integer of element |
... |
other parameter (not used just for generic) |
if exists the parameter description
Give the whole abbreviation definition
abbrev(param)
abbrev(param)
param |
abbreviation term |
character abbreviation definition
abbrev("VPC")
abbrev("VPC")
This function adds the word draft to certain graphics.
add_draft( label = "DRAFT", size = 10, colour = "grey50", x = Inf, y = -Inf, ... )
add_draft( label = "DRAFT", size = 10, colour = "grey50", x = Inf, y = -Inf, ... )
label |
draft layer default to DRAFT |
size |
size of the annotation |
colour |
color of the annotation default to grey50 |
x |
|
y |
|
... |
extra parameters to geom text used to annotate the draft |
ggplot2 annotation
Performs checks of names in shrink list
check_shrink(shrink_list)
check_shrink(shrink_list)
shrink_list |
|
creates a graphic distribution object
distrib( labels, is.shrink, type = c("box", "hist"), is.jitter = FALSE, jitter = NULL, facets = NULL, histogram = NULL, shrink = NULL, dname = NULL, ... )
distrib( labels, is.shrink, type = c("box", "hist"), is.jitter = FALSE, jitter = NULL, facets = NULL, histogram = NULL, shrink = NULL, dname = NULL, ... )
labels |
list of texts/titles used within the plot |
is.shrink |
|
type |
box for boxplot or histogram |
is.jitter |
|
jitter |
list set jitter parameter |
facets |
list set the facet setting in case of histogram plot |
histogram |
|
shrink |
|
dname |
name of dataset to be used |
... |
others graphics arguments passed to |
labels is a list that contains:
title: plot title default "EBE distribution"
subtitle: plot subtitle default empty
x: x axis label default to "Etas"
y: y axis label default to empty
legend: legend title default to "random Effect"
shrink is a list that contains:
fun: shrinkage function can be sd
or var
size: shrinkage text size
color: shrinkage text color
vjust: shrinkage position vertical adjustment
distrib object
Other plot_pmx:
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
This creates an ETA covariance matrix which can be used to define the co-relation between the parameters and its shrinkage..
eta_cov( labels, type = c("cats", "conts"), dname = NULL, show.correl = TRUE, correl = NULL, facets = NULL, point = NULL, covariates = NULL, is.strat.color = FALSE, ... )
eta_cov( labels, type = c("cats", "conts"), dname = NULL, show.correl = TRUE, correl = NULL, facets = NULL, point = NULL, covariates = NULL, is.strat.color = FALSE, ... )
labels |
list of texts/titles used within the plot |
type |
box for cats or conts |
dname |
name of dataset to be used |
show.correl |
|
correl |
|
facets |
|
point |
|
covariates |
|
is.strat.color |
|
... |
others graphics arguments passed to |
labels is a list that contains:
title: plot title default "EBE vs. covariates"
x: x axis label default to "Etas"
y: y axis label default to empty
eta_cov
object
Other plot_pmx:
distrib()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
Eta Covariates plots
Relationships between (ETA) and categorical covariates
Relationships between (ETA) and continuous covariates
dummy( dname, show.correl, correl, point, facets, filter, strat.facet, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales ) pmx_plot_eta_cats(ctr, ...) pmx_plot_eta_conts(ctr, ...)
dummy( dname, show.correl, correl, point, facets, filter, strat.facet, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales ) pmx_plot_eta_cats(ctr, ...) pmx_plot_eta_conts(ctr, ...)
dname |
|
show.correl |
|
correl |
|
point |
|
facets |
pmx_update parameters |
filter |
|
strat.facet |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
ctr |
pmx controller |
... |
others graphics parameters passed :
eta_cov parameters |
ggplot2 object
# basic use --------------------------------------- ctr <- theophylline() ctr %>% pmx_plot_eta_cats ctr %>% pmx_plot_eta_conts # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_eta_cats( labels = list(title = "New eta cats title") ) ## remove draft ctr %>% pmx_plot_eta_cats(is.draft = FALSE) ## change text color line ctr %>% pmx_plot_eta_conts( correl=list(colour="magenta") ) ## set covariates custom labels ctr %>% pmx_plot_eta_conts( covariates=pmx_cov(values=list("WT0","AGE0"), labels=list("Weight","Age")) ) ## set effects and covaraites custom labels ctr <- theophylline( settings = pmx_settings( effects=list( levels=c("ka", "V", "Cl"), labels=c("Concentration","Volume","Clearance") ) ) ) ctr %>% pmx_plot_eta_conts( covariates=pmx_cov(values=list("WT0","AGE0"), labels=list("Weight","Age")) )
# basic use --------------------------------------- ctr <- theophylline() ctr %>% pmx_plot_eta_cats ctr %>% pmx_plot_eta_conts # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_eta_cats( labels = list(title = "New eta cats title") ) ## remove draft ctr %>% pmx_plot_eta_cats(is.draft = FALSE) ## change text color line ctr %>% pmx_plot_eta_conts( correl=list(colour="magenta") ) ## set covariates custom labels ctr %>% pmx_plot_eta_conts( covariates=pmx_cov(values=list("WT0","AGE0"), labels=list("Weight","Age")) ) ## set effects and covaraites custom labels ctr <- theophylline( settings = pmx_settings( effects=list( levels=c("ka", "V", "Cl"), labels=c("Concentration","Volume","Clearance") ) ) ) ctr %>% pmx_plot_eta_conts( covariates=pmx_cov(values=list("WT0","AGE0"), labels=list("Weight","Age")) )
Eta distribution plots
Eta Distribution boxplot
Eta Distribution histogram plot
eta_distribution_plot( jitter, type, dname, is.shrink, shrink, is.jitter, histogram, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... ) pmx_plot_eta_box(ctr, ...) pmx_plot_eta_hist(ctr, ...)
eta_distribution_plot( jitter, type, dname, is.shrink, shrink, is.jitter, histogram, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... ) pmx_plot_eta_box(ctr, ...) pmx_plot_eta_hist(ctr, ...)
jitter |
list set jitter parameter |
type |
box for boxplot or histogram |
dname |
name of dataset to be used |
is.shrink |
|
shrink |
|
is.jitter |
|
histogram |
pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
... |
others graphics parameters passed :
distrib parameters |
ctr |
pmx controller |
ggplot2 object
# *************** basic use ***************** ------ ctr <- theophylline() ## boxplot variation p <- ctr %>% pmx_plot_eta_box() ## histogram variation p <- ctr %>% pmx_plot_eta_hist() # update graphical parameter ---------------------- ## add jitter ctr %>% pmx_plot_eta_hist(is.jitter = TRUE, jitter = list(alpha = 0.4, color = "red")) ## remove shrinkage ctr %>% pmx_plot_eta_hist(is.shrink = FALSE) ## update histogram graphical parameters ctr %>% pmx_plot_eta_hist( histogram = list( color = NA, position = "fill", binwidth = 1 / 100 ) ) # stratification ---------------------------------- ## categorical stratification color parameter ctr %>% pmx_plot_eta_hist(is.jitter = TRUE, strat.facet = ~STUD, strat.color = ~SEX) ## categorical stratification facetting ctr %>% pmx_plot_eta_hist(strat.facet = ~SEX) ## using formula categorical stratification facetting ctr %>% pmx_plot_eta_hist( strat.facet = STUD ~ SEX, shrink = pmx_shrink(hjust = 0.5) ) # subsetting -------------------------------------- ## select a set of random effect ctr %>% pmx_plot_eta_hist(filter = EFFECT %in% c("ka", "Cl")) ## filter and stratify by facets ctr %>% pmx_plot_eta_hist( filter = EFFECT %in% c("ka", "Cl"), strat.facet = ~SEX ) ctr %>% pmx_plot_eta_hist( filter = EFFECT %in% c("ka", "Cl"), strat.facet = ~SEX )
# *************** basic use ***************** ------ ctr <- theophylline() ## boxplot variation p <- ctr %>% pmx_plot_eta_box() ## histogram variation p <- ctr %>% pmx_plot_eta_hist() # update graphical parameter ---------------------- ## add jitter ctr %>% pmx_plot_eta_hist(is.jitter = TRUE, jitter = list(alpha = 0.4, color = "red")) ## remove shrinkage ctr %>% pmx_plot_eta_hist(is.shrink = FALSE) ## update histogram graphical parameters ctr %>% pmx_plot_eta_hist( histogram = list( color = NA, position = "fill", binwidth = 1 / 100 ) ) # stratification ---------------------------------- ## categorical stratification color parameter ctr %>% pmx_plot_eta_hist(is.jitter = TRUE, strat.facet = ~STUD, strat.color = ~SEX) ## categorical stratification facetting ctr %>% pmx_plot_eta_hist(strat.facet = ~SEX) ## using formula categorical stratification facetting ctr %>% pmx_plot_eta_hist( strat.facet = STUD ~ SEX, shrink = pmx_shrink(hjust = 0.5) ) # subsetting -------------------------------------- ## select a set of random effect ctr %>% pmx_plot_eta_hist(filter = EFFECT %in% c("ka", "Cl")) ## filter and stratify by facets ctr %>% pmx_plot_eta_hist( filter = EFFECT %in% c("ka", "Cl"), strat.facet = ~SEX ) ctr %>% pmx_plot_eta_hist( filter = EFFECT %in% c("ka", "Cl"), strat.facet = ~SEX )
This creates an eta correlation which defines the relationship between parameters
eta_pairs( is.title, title, dname = NULL, type.eta = c("mode", "mean"), text_color = "black", is.shrink = TRUE, is.smooth = TRUE, smooth = NULL, point = NULL, shrink = NULL, is.hline = FALSE, hline = NULL, is.vreference_line = FALSE, vreference_line = list(colour = "orange", linetype = "longdash"), ... )
eta_pairs( is.title, title, dname = NULL, type.eta = c("mode", "mean"), text_color = "black", is.shrink = TRUE, is.smooth = TRUE, smooth = NULL, point = NULL, shrink = NULL, is.hline = FALSE, hline = NULL, is.vreference_line = FALSE, vreference_line = list(colour = "orange", linetype = "longdash"), ... )
is.title |
|
title |
character the plot title |
dname |
name of dataset to be used |
type.eta |
|
text_color |
color of the correlation text in the upper matrix |
is.shrink |
|
is.smooth |
|
smooth |
|
point |
|
shrink |
|
is.hline |
|
hline |
|
is.vreference_line |
|
vreference_line |
|
... |
others graphics arguments passed to |
ecorrel object
Other plot_pmx:
distrib()
,
eta_cov()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
Try to evaluate a symbol in the parent frame (on errorr eturn the symbol)
eval_sym_parent_env(x)
eval_sym_parent_env(x)
x |
any object |
Get abbreviation definition by key
get_abbrev(ctr, param)
get_abbrev(ctr, param)
ctr |
|
param |
abbreviation term |
character
abbreviation definition
Get category covariates
get_cats(ctr)
get_cats(ctr)
ctr |
the controller object |
a charcater vector
Other pmxclass:
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
Get continuous covariates
get_conts(ctr)
get_conts(ctr)
ctr |
the controller object |
a charcater vector
Other pmxclass:
get_cats()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
Get covariates variables
get_covariates(ctr)
get_covariates(ctr)
ctr |
the controller object |
a charcater vector
Other pmxclass:
get_cats()
,
get_conts()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
Get controller data set
get_data( ctr, data_set = c("estimates", "predictions", "eta", "finegrid", "input", "sim", "individual") )
get_data( ctr, data_set = c("estimates", "predictions", "eta", "finegrid", "input", "sim", "individual") )
ctr |
the controller object |
data_set |
the data set name |
a data.table of the named data set if available.
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
Get controller occasional covariates
get_occ(ctr)
get_occ(ctr)
ctr |
the controller object |
a charcater vector
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
Get plot object
get_plot(ctr, nplot, which_pages = "all")
get_plot(ctr, nplot, which_pages = "all")
ctr |
|
nplot |
character the plot name |
which_pages |
integer vector (can be length 1), set page number in case of multi pages plot, or character "all" to plot all pages. |
ggplot object
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
library(ggPMX) ctr <- theophylline() p1 <- ctr %>% get_plot("iwres_ipred") ## get all pages or some pages p2 <- ctr %>% get_plot("individual") ## returns one page of individual plot p2 <- ctr %>% get_plot("individual", which_pages = 1) p3 <- ctr %>% get_plot("individual", which_pages = c(1, 3)) ## get distribution plot pdistri <- ctr %>% get_plot("eta_hist")
library(ggPMX) ctr <- theophylline() p1 <- ctr %>% get_plot("iwres_ipred") ## get all pages or some pages p2 <- ctr %>% get_plot("individual") ## returns one page of individual plot p2 <- ctr %>% get_plot("individual", which_pages = 1) p3 <- ctr %>% get_plot("individual", which_pages = c(1, 3)) ## get distribution plot pdistri <- ctr %>% get_plot("eta_hist")
Get the plot config by name
get_plot_config(ctr, pname)
get_plot_config(ctr, pname)
ctr |
the controller object |
pname |
the plot name |
the config object
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
ctr <- theophylline() ctr %>% set_plot("IND", pname = "indiv1") ctr %>% get_plot_config("distr1")
ctr <- theophylline() ctr %>% set_plot("IND", pname = "indiv1") ctr %>% get_plot_config("distr1")
Get extra stratification variables
get_strats(ctr)
get_strats(ctr)
ctr |
the controller object |
a charcater vector
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
Get ggPMX Option
getPmxOption(name, default = NULL)
getPmxOption(name, default = NULL)
name |
Name of an option to get. |
default |
Value to be returned if the option is not currently set. |
## Not run: pmxOptions(myOption = 10) getPmxOption("myOption") ## End(Not run)
## Not run: pmxOptions(myOption = 10) getPmxOption("myOption") ## End(Not run)
Remove named elements from gtable
gtable_remove_grobs(table, names, ...)
gtable_remove_grobs(table, names, ...)
table |
The table from which grobs should be removed |
names |
A character vector of the grob names (as listed in |
... |
Other parameters passed through to |
This function can be used to obtain individual prediction and compare with observed data and population prediction for each individual separately
individual( labels, facets = NULL, dname = NULL, ipred_line = NULL, pred_line = NULL, point = NULL, bloq = NULL, is.legend, use.finegrid, ... )
individual( labels, facets = NULL, dname = NULL, ipred_line = NULL, pred_line = NULL, point = NULL, bloq = NULL, is.legend, use.finegrid, ... )
labels |
plot texts. labels, axis, |
facets |
list facets settings nrow/ncol |
dname |
name of dataset to be used |
ipred_line |
|
pred_line |
|
point |
|
bloq |
|
is.legend |
|
use.finegrid |
|
... |
others graphics arguments passed to |
individual fit object
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
Merge input and fingrid data sets
input_finegrid(input, finegrid)
input_finegrid(input, finegrid)
input |
|
finegrid |
|
data.table
Check if an object is a pmx_gpar class
is.pmx_gpar(x)
is.pmx_gpar(x)
x |
pmx_gpar object |
logical
returns TRUE if it is a pmx_gpar
object
left join , the first list is updated by the seond one
l_left_join(base_list, overlay_list, recursive = TRUE)
l_left_join(base_list, overlay_list, recursive = TRUE)
base_list |
list to update |
overlay_list |
list used to update the first list |
recursive |
logical if TRUE do the merge in depth |
list
Obtain the data source config
load_config(x, sys = c("mlx", "nm", "mlx18"))
load_config(x, sys = c("mlx", "nm", "mlx18"))
x |
the config name. |
sys |
can be mlx,nm,... |
a list :data configuration object
Load data set
load_data_set(x, path, sys, ...)
load_data_set(x, path, sys, ...)
x |
data set config |
path |
character path to the directory |
sys |
|
... |
extra parameter passed to special readers |
data.table
Load all/or some source data set
load_source(sys, path, dconf, ...)
load_source(sys, path, dconf, ...)
sys |
type cane mlx/nom |
path |
|
dconf |
configuration object |
... |
any extra parameters for readers |
list of data.table
This is a simple helper that returns the number of pages it takes to plot all
panels when using facet_wrap_paginate
. It partially builds the plot so depending
on the complexity of your plot it might take some time to calculate...
n_pages(plot)
n_pages(plot)
plot |
A ggplot object using either facet_wrap_paginate or facet_grid_paginate |
If the plot uses using either facet_wrap_paginate or facet_grid_paginate it returns the total number of pages. Otherwise it returns NULL
Creates parameter kable
param_table(ctr, fun, return_table = FALSE, scientific = FALSE, digits = 2)
param_table(ctr, fun, return_table = FALSE, scientific = FALSE, digits = 2)
ctr |
Generated controller from e.g. |
fun |
|
return_table |
If TRUE, returns the same table as in get_data('estimates') otherwise it returns a kable |
scientific |
|
digits |
|
Returns a kable with the parameter estimates from get_data('estimates')
#ctr <- theophylline() #my_params <- ctr %>% param_table(fun = "var")
#ctr <- theophylline() #my_params <- ctr %>% param_table(fun = "var")
Parse MONOLIX mlxtran file
parse_mlxtran(file_name)
parse_mlxtran(file_name)
file_name |
absolute path to mlxtran file |
list
key/values to initialize ggPMX controller
Creates pmx controller using monlix data having Occasional variable
pk_occ()
pk_occ()
pmx controller
## Not run: pk_occ() ## End(Not run)
## Not run: pk_occ() ## End(Not run)
Creates pkpd pmx controller using package internal data
pk_pd(code = "3")
pk_pd(code = "3")
code |
can be 3 or 4 |
Get plot names
plot_names(ctr)
plot_names(ctr)
ctr |
|
list of plot names
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plots()
,
pmx_update()
,
set_data()
,
set_plot()
This is a generic plot method that produces all plots by default described in pmx model evaluation guidance.
plot_pmx(x, dx, ...) ## S3 method for class 'pmx_vpc' plot_pmx(x, dx, ...)
plot_pmx(x, dx, ...) ## S3 method for class 'pmx_vpc' plot_pmx(x, dx, ...)
x |
object to plot |
dx |
data.table , plot source data |
... |
extra argument (not used) |
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
Plot EBE distribution
## S3 method for class 'distrib' plot_pmx(x, dx, ...)
## S3 method for class 'distrib' plot_pmx(x, dx, ...)
x |
distribution object |
dx |
data set |
... |
not used for the moment |
ggplot2 plot
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
This plots an ETA covariance matrix which can be used to define the co-relation between the parameters and its shrinkage
## S3 method for class 'eta_cov' plot_pmx(x, dx, ...)
## S3 method for class 'eta_cov' plot_pmx(x, dx, ...)
x |
eta_cov object |
dx |
data set |
... |
not used for the moment |
ggplot2 plot
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
Plot random effect correlation plot
## S3 method for class 'eta_pairs' plot_pmx(x, dx, ...)
## S3 method for class 'eta_pairs' plot_pmx(x, dx, ...)
x |
distribution object |
dx |
data set |
... |
not used for the moment |
ggpairs plot
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
This function can be used to plot individual prediction and compare with observed data and population prediction for each individual separately
## S3 method for class 'individual' plot_pmx(x, dx, ...)
## S3 method for class 'individual' plot_pmx(x, dx, ...)
x |
individual object |
dx |
data set |
... |
not used for the moment |
a list of ggplot2
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
This function plots EBE versus covariates using qq plots
## S3 method for class 'pmx_dens' plot_pmx(x, dx, ...)
## S3 method for class 'pmx_dens' plot_pmx(x, dx, ...)
x |
eta_cov object |
dx |
data set |
... |
not used for the moment |
ggplot2 plot
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
This function should be called internally by other plots to set general settings like , smoothing, add band, labelling, theming,...
## S3 method for class 'pmx_gpar' plot_pmx(x, dx, ...)
## S3 method for class 'pmx_gpar' plot_pmx(x, dx, ...)
x |
object of pmx_gpar type |
dx |
plot |
... |
ignored parameters |
ggplot2 object
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_qq()
,
plot_pmx.residual()
,
plot_pmx()
This function plot EBE versus covariates using qq plots
## S3 method for class 'pmx_qq' plot_pmx(x, dx, ...)
## S3 method for class 'pmx_qq' plot_pmx(x, dx, ...)
x |
pmx_qq object |
dx |
data set |
... |
not used for the moment |
ggplot2 plot
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.residual()
,
plot_pmx()
This function plots residual for each observed value by finding the difference between observed and predicted points. It also fits a distribution to the residual value.
## S3 method for class 'residual' plot_pmx(x, dx, ...)
## S3 method for class 'residual' plot_pmx(x, dx, ...)
x |
residual object |
dx |
data set |
... |
not used for the moment |
ggplot2 object
Other plot_pmx:
distrib()
,
eta_cov()
,
eta_pairs()
,
individual()
,
plot_pmx.distrib()
,
plot_pmx.eta_cov()
,
plot_pmx.eta_pairs()
,
plot_pmx.individual()
,
plot_pmx.pmx_dens()
,
plot_pmx.pmx_gpar()
,
plot_pmx.pmx_qq()
,
plot_pmx()
Plot shrink in eta matric
plot_shrink(x, shrink.dx, shrink)
plot_shrink(x, shrink.dx, shrink)
x |
pmx_gpar object |
shrink.dx |
data.table of shrinkage |
shrink |
|
ggplot2 object
Get plots description
plots(ctr)
plots(ctr)
ctr |
|
data.frame of plots
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
pmx_update()
,
set_data()
,
set_plot()
Create a pmx object from a data source
pmx( config, sys = "mlx", directory, input, dv, dvid, cats = NULL, conts = NULL, occ = NULL, strats = NULL, settings = NULL, endpoint = NULL, sim = NULL, bloq = NULL, id = NULL, time = NULL, sim_blq = NULL ) pmx_mlx( config, directory, input, dv, dvid, cats, conts, occ, strats, settings, endpoint, sim, bloq, id, time, sim_blq ) pmx_mlxtran( file_name, config = "standing", call = FALSE, endpoint, version = -1, ... )
pmx( config, sys = "mlx", directory, input, dv, dvid, cats = NULL, conts = NULL, occ = NULL, strats = NULL, settings = NULL, endpoint = NULL, sim = NULL, bloq = NULL, id = NULL, time = NULL, sim_blq = NULL ) pmx_mlx( config, directory, input, dv, dvid, cats, conts, occ, strats, settings, endpoint, sim, bloq, id, time, sim_blq ) pmx_mlxtran( file_name, config = "standing", call = FALSE, endpoint, version = -1, ... )
config |
Can be either : The complete path for the configuration file, the name of configuration within the built-in list of configurations, or a configuration object. |
sys |
the system name can "mlx" (for Monolix 2016) or "mlx18" (for Monolix 2018/19 and later) |
directory |
|
input |
|
dv |
|
dvid |
[Optional] |
cats |
[Optional] |
conts |
[Optional] |
occ |
[Optional] |
strats |
[Optional] |
settings |
[Optional] |
endpoint |
|
sim |
|
bloq |
|
id |
[Optional] |
time |
[Optional] |
sim_blq |
|
file_name |
|
call |
|
version |
|
... |
extra arguments passed to pmx_mlx. |
pmx_mlx
is a wrapper to mlx for the MONOLIX system ( sys="mlx"
)
pmx_mlxtran
parses mlxtran file and guess pmx_mlx
arguments. In case of
multi endpoint the first endpoint is selected. You can though set the endpoint through the same argument.
When you set call=TRUE
,no controller is created but only the parameters parsed
by mlxtran. This can be very helpful, in case you would like to customize parameters
(adding settings vi pmx_settings, chnag eth edefault endpoint.)
pmxClass
controller object.
## Example to create the controller using theophylline data theophylline <- file.path(system.file(package = "ggPMX"), "testdata", "theophylline") WORK_DIR <- file.path(theophylline, "Monolix") input_file <- file.path(theophylline, "data_pk.csv") ## using only mandatory variables ctr <- pmx( sys="mlx", config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid ="DVID" ) ## Using covariates ctr <- pmx( sys="mlx", config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid ="DVID", cats=c("SEX"), conts=c("WT0","AGE0"), strats="STUD" ) ## using settings parameter ctr <- pmx( sys="mlx", config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid ="DVID", settings=list(is.draft=FALSE) ) ## using mlxtran file mlxtran_file <- file.path(system.file(package = "ggPMX"), "testdata","1_popPK_model","project.mlxtran") pmx_mlxtran(mlxtran_file) ## mlxtran , call =TRUE to get the pmx_mlx argument parsed by pmx_mlxtran params <- pmx_mlxtran(mlxtran_file,call=TRUE) str(params) # $ directory: chr results_pathile # $ input : chr observation file path # $ dv : chr "DV" # $ cats : chr [1:4] "SEX" "RACE" "DISE" "ILOW" # $ conts : chr [1:4] "AGE0" "WT0" "HT0" "TRT" # $ occ : chr "ISS" # $ dvid : chr "YTYPE" # $ endpoint :List of 5 # ..$ code : chr "1" # ..$ label : chr "" # ..$ unit : chr "" # ..$ file.code: chr "1" # ..$ trans : NULL # ..- attr(*, "class")= chr "pmxEndpointClass" # $ config : chr "standing"
## Example to create the controller using theophylline data theophylline <- file.path(system.file(package = "ggPMX"), "testdata", "theophylline") WORK_DIR <- file.path(theophylline, "Monolix") input_file <- file.path(theophylline, "data_pk.csv") ## using only mandatory variables ctr <- pmx( sys="mlx", config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid ="DVID" ) ## Using covariates ctr <- pmx( sys="mlx", config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid ="DVID", cats=c("SEX"), conts=c("WT0","AGE0"), strats="STUD" ) ## using settings parameter ctr <- pmx( sys="mlx", config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid ="DVID", settings=list(is.draft=FALSE) ) ## using mlxtran file mlxtran_file <- file.path(system.file(package = "ggPMX"), "testdata","1_popPK_model","project.mlxtran") pmx_mlxtran(mlxtran_file) ## mlxtran , call =TRUE to get the pmx_mlx argument parsed by pmx_mlxtran params <- pmx_mlxtran(mlxtran_file,call=TRUE) str(params) # $ directory: chr results_pathile # $ input : chr observation file path # $ dv : chr "DV" # $ cats : chr [1:4] "SEX" "RACE" "DISE" "ILOW" # $ conts : chr [1:4] "AGE0" "WT0" "HT0" "TRT" # $ occ : chr "ISS" # $ dvid : chr "YTYPE" # $ endpoint :List of 5 # ..$ code : chr "1" # ..$ label : chr "" # ..$ unit : chr "" # ..$ file.code: chr "1" # ..$ trans : NULL # ..- attr(*, "class")= chr "pmxEndpointClass" # $ config : chr "standing"
Creates BLOQ object attributes
pmx_bloq( cens = "CENS", limit = "LIMIT", colour = "pink", size = 2, linewidth = 1, alpha = 0.9, show = TRUE, ... )
pmx_bloq( cens = "CENS", limit = "LIMIT", colour = "pink", size = 2, linewidth = 1, alpha = 0.9, show = TRUE, ... )
cens |
|
limit |
|
colour |
|
size |
|
linewidth |
|
alpha |
|
show |
|
... |
any other graphical parameter |
To define that a measurement is censored, the observation data set should include
a CENSORING column ( default to 'CENS' ) and put 1 for lower limit or -1 for upper limit.
Optionally, data set can contain have a limit column ( default to 'LIMIT') column to set the other limit.
Compute Shrinkage
pmx_comp_shrink( ctr, fun = c("var", "sd"), strat.facet, strat.color, filter, ... )
pmx_comp_shrink( ctr, fun = c("var", "sd"), strat.facet, strat.color, filter, ... )
ctr |
|
fun |
|
strat.facet |
|
strat.color |
|
filter |
optional filter which will be applied to plotting data |
... |
others parameters not used for the moment |
data.table
This function can be used to define the pmx configuration used in plots. e.g. Monolix/Nonmem
pmx_config(sys = "mlx", inputs, plots, ...)
pmx_config(sys = "mlx", inputs, plots, ...)
sys |
|
inputs |
|
plots |
|
... |
extra arguments not used |
To create a controller user can create a pmxConfig object using
- either an input template file
- or a plot template file
- or both.
By default the 'standing' configuration will be used.
pmxConfig
object
# *************** Create a controller using custom plot configuration ***************** ------ library(ggPMX) theophylline <- file.path( system.file(package = "ggPMX"), "testdata", "theophylline" ) WORK_DIR <- file.path(theophylline, "Monolix") input_file <- file.path(theophylline, "data_pk.csv") # create a controller with a custom plots template ctr <- pmx_mlx( config = pmx_config( plots=file.path( system.file(package = "ggPMX"),"examples/plots.yaml"), inputs = system.file(package = "ggPMX","examples/custom_inputs.yaml") ), directory = WORK_DIR, input = input_file, dv = "Y", dvid = "DVID", cats = c("SEX"), conts = c("WT0", "AGE0"), strats = "STUD" ) ## get the list of plots ctr %>% plots ctr %>% get_plot("custom_res_time") ctr %>% get_plot("custom_npde_time")
# *************** Create a controller using custom plot configuration ***************** ------ library(ggPMX) theophylline <- file.path( system.file(package = "ggPMX"), "testdata", "theophylline" ) WORK_DIR <- file.path(theophylline, "Monolix") input_file <- file.path(theophylline, "data_pk.csv") # create a controller with a custom plots template ctr <- pmx_mlx( config = pmx_config( plots=file.path( system.file(package = "ggPMX"),"examples/plots.yaml"), inputs = system.file(package = "ggPMX","examples/custom_inputs.yaml") ), directory = WORK_DIR, input = input_file, dv = "Y", dvid = "DVID", cats = c("SEX"), conts = c("WT0", "AGE0"), strats = "STUD" ) ## get the list of plots ctr %>% plots ctr %>% get_plot("custom_res_time") ctr %>% get_plot("custom_npde_time")
Creates a deep copy of the controller
pmx_copy(ctr, keep_globals = FALSE, ...)
pmx_copy(ctr, keep_globals = FALSE, ...)
ctr |
|
keep_globals |
|
... |
extra parameters passed to |
The controller is an 'R6' object, it behaves like a reference object.
Some functions ( methods) can have a side effect on the controller and modify it internally.
Technically speaking we talk about chaining not piping here. However ,
using pmx_copy
user can work on a copy of the controller.
By default the copy does not keep global parameters set using pmx_settings.
an object of pmxClass
ctr <- theophylline() cctr <- ctr %>% pmx_copy() ## Any change in the ctr has no side effect in the ctr and vice versa
ctr <- theophylline() cctr <- ctr %>% pmx_copy() ## Any change in the ctr has no side effect in the ctr and vice versa
Select/Map covariates using human labels
pmx_cov(values, labels = NULL)
pmx_cov(values, labels = NULL)
values |
|
labels |
|
In case of 'pmx_plot_eta_cats' and 'pmx_plot_eta_conts' you can customize the covariates and covaraites labels using 'pmx_cov'.
pmxCOVObject
object
Creates a density plot object
pmx_dens( x, labels, dname = NULL, xlim = 3, var_line = NULL, snd_line = NULL, vline = NULL, is.legend = TRUE, ... )
pmx_dens( x, labels, dname = NULL, xlim = 3, var_line = NULL, snd_line = NULL, vline = NULL, is.legend = TRUE, ... )
x |
|
labels |
list of texts/titles used within the plot |
dname |
name of dataset to be used |
xlim |
|
var_line |
|
snd_line |
|
vline |
|
is.legend |
|
... |
others graphics arguments passed to |
labels is a list that contains:
title: plot title default "IWRES density plot"
x: x axis label default to "Etas"
y: y axis label default to empty
var_line is a list that contains:
linetype: default to 1
color: default to black
linewidth: default to 1
snd_line is a list that contains:
linetype: default to 2
color: default to black
linewidth: default to 1
vline is a list that contains:
linetype: default to 3
color: default to black
linewidth: default to 1
Creates pmx endpoint object
pmx_endpoint(code, label = "", unit = "", file.code = code, trans = NULL)
pmx_endpoint(code, label = "", unit = "", file.code = code, trans = NULL)
code |
|
label |
|
unit |
|
file.code |
|
trans |
|
In case of multiple endpoints, pkpd case for example, we need to pass endpoint to the pmx call.
Internally , ggPMX will filter the observations data set to keep only rows satisfying DVID==code
.
The code
is also used to find the right predictions and or fingrid files.
ggPMX use the configuration file to fine the path of the predictions file
(like the single endpoint case) and then filter the right file using the code parameter.
For example:
predictions{code}.txt for mlx16
predictions{code}.txt and y{code}_residual for mlx18
For some tricky examples the code parameter is not enough to find the files. In that case the
file.code
parameter is used to distinguish the endpoint files.
## Use file.code parameter pk_pd_path <- file.path(system.file(package = "ggPMX"), "testdata","pk_pd") WORK_DIR <- file.path(pk_pd_path, "RESULTS") ep <- pmx_endpoint( code="4", file.code="2" ) input_file <- file.path(pk_pd_path, "pk_pd.csv") ctr <- pmx_mlx( config = "standing", directory = WORK_DIR, input = input_file, dv = "dv", dvid = "dvid", cats = "sex", conts = "wt", endpoint = ep ) ## using mlxtran ep <- pmx_endpoint( code="3", file.code="1" ) mlxtran_file <- file.path(pk_pd_path, "pk_pd.mlxtran") ctr <- pmx_mlxtran(mlxtran_file,endpoint=ep)
## Use file.code parameter pk_pd_path <- file.path(system.file(package = "ggPMX"), "testdata","pk_pd") WORK_DIR <- file.path(pk_pd_path, "RESULTS") ep <- pmx_endpoint( code="4", file.code="2" ) input_file <- file.path(pk_pd_path, "pk_pd.csv") ctr <- pmx_mlx( config = "standing", directory = WORK_DIR, input = input_file, dv = "dv", dvid = "dvid", cats = "sex", conts = "wt", endpoint = ep ) ## using mlxtran ep <- pmx_endpoint( code="3", file.code="1" ) mlxtran_file <- file.path(pk_pd_path, "pk_pd.mlxtran") ctr <- pmx_mlxtran(mlxtran_file,endpoint=ep)
filter data in a pmx controller
pmx_filter( ctr, data_set = c("estimates", "predictions", "eta", "finegrid", "shrink", "input", "individual", "sim_blq"), pmx_exp )
pmx_filter( ctr, data_set = c("estimates", "predictions", "eta", "finegrid", "shrink", "input", "individual", "sim_blq"), pmx_exp )
ctr |
A controller. An object of 'pmxClass' |
data_set |
A data_set within the controller to apply a filter to. |
pmx_exp |
A filter expression |
Returns a pmx controller with a filtered data set.
## example of global filter ctr <- theophylline() ctr %>% pmx_filter(data_set = "prediction", ID == 5 & TIME < 2) ctr %>% get_data("prediction")
## example of global filter ctr <- theophylline() ctr %>% pmx_filter(data_set = "prediction", ID == 5 & TIME < 2) ctr %>% get_data("prediction")
Get List of built-in configurations
pmx_get_configs(sys = "mlx")
pmx_get_configs(sys = "mlx")
sys |
can be mlx, by default all configurations will be listed |
names of the config
pmx_get_configs()
pmx_get_configs()
Handling pmx Graphical parameters
pmx_gpar( is.title, labels, axis.title, which_pages, print, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, discrete, is.identity_line, identity_line, smooth_with_bloq, scale_x_log10, scale_y_log10, color.scales, is.legend, legend.position )
pmx_gpar( is.title, labels, axis.title, which_pages, print, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, discrete, is.identity_line, identity_line, smooth_with_bloq, scale_x_log10, scale_y_log10, color.scales, is.legend, legend.position )
is.title |
|
labels |
list of labels, like title, subtitle, x , y |
axis.title |
list or element_text (same as ggplot2 axis.title theme) |
which_pages |
page(s) to display; if "all" display all pages, if 1 display first page, if c(1,2) display first and second pages |
print |
if TRUE the ouptut will be a print not a ggplot2. This is useful for rmarkdwon output to avoid verbose list index print. |
axis.text |
list or element_text (same as ggplot2 axis.text theme) |
ranges |
limits of x/y ranges |
is.smooth |
logical if set to TRUE add smooth layer |
smooth |
smooth layer parameters |
is.band |
logical if TRUE add horizontal band |
band |
horizontal band parameters |
is.draft |
logical if TRUE add draft layer |
draft |
draft layer parameters |
discrete |
logical if TRUE x axis is discrete(FALSE by default) |
is.identity_line |
|
identity_line |
|
smooth_with_bloq |
|
scale_x_log10 |
logical if TRUE add scale_x_log10 layer |
scale_y_log10 |
logical if TRUE add scale_y_log10 layer |
color.scales |
|
is.legend |
|
legend.position |
|
This object contains all general graphic settings. It used internally by all pmx_plot(generic function) to set the default behavior.
An object of class "pmx_gpar"
.
List NONMEM output tables file names from a nm_model
object.
pmx_list_nm_tables(nm_model = NULL)
pmx_list_nm_tables(nm_model = NULL)
nm_model |
An nm_model object generated with |
pmx_read_nm_model
, pmx_read_nm_tables
## Not run: pmx_read_nm_model(file = 'run001.lst') %>% pmx_list_nm_tables() ## End(Not run)
## Not run: pmx_read_nm_model(file = 'run001.lst') %>% pmx_list_nm_tables() ## End(Not run)
Manually provide names of the table files to be imported.
pmx_manual_nm_import( tab_names = c("sdtab", "mutab", "patab", "catab", "cotab", "mytab", "extra", "xptab", "cwtab"), tab_suffix = "", sim_suffix = "sim" )
pmx_manual_nm_import( tab_names = c("sdtab", "mutab", "patab", "catab", "cotab", "mytab", "extra", "xptab", "cwtab"), tab_suffix = "", sim_suffix = "sim" )
tab_names |
Provide the name of the tables to import e.g. 'sdtab', 'patab', 'cotab', 'catab' for NONMEM. |
tab_suffix |
Default is ”, but can be changed to any character string to be used as suffix in the table names. |
sim_suffix |
Default is 'sim', but can be changed to any character string to be used as suffix in the simulation table names e.g. sdtab001sim. |
Creates pmx controller from an nlimxr fit object
pmx_nlmixr(fit, dvid, conts, cats, strats, endpoint, settings, vpc = FALSE)
pmx_nlmixr(fit, dvid, conts, cats, strats, endpoint, settings, vpc = FALSE)
fit |
nlmixr object |
dvid |
[Optional] |
conts |
[Optional] |
cats |
[Optional] |
strats |
[Optional] |
endpoint |
|
settings |
[Optional] |
vpc |
[Optional] |
pmxClass
controller object.
Creates pmx controller from NONMEM model outputs
pmx_nm( file = NULL, directory = ".", runno = NULL, ext = ".lst", table_suffix = "", sim_suffix = "sim", simfile = NULL, prefix = "run", table_names = c("sdtab", "mutab", "patab", "catab", "cotab", "mytab", "extra", "xptab", "cwtab"), dvid = "DVID", pred = "PRED", time = "TIME", dv = "DV", conts, cats, npde, iwres, ipred, endpoint, strats = "", settings = pmx_settings(), vpc = TRUE, bloq = NULL, obs = FALSE, quiet = FALSE )
pmx_nm( file = NULL, directory = ".", runno = NULL, ext = ".lst", table_suffix = "", sim_suffix = "sim", simfile = NULL, prefix = "run", table_names = c("sdtab", "mutab", "patab", "catab", "cotab", "mytab", "extra", "xptab", "cwtab"), dvid = "DVID", pred = "PRED", time = "TIME", dv = "DV", conts, cats, npde, iwres, ipred, endpoint, strats = "", settings = pmx_settings(), vpc = TRUE, bloq = NULL, obs = FALSE, quiet = FALSE )
file |
A character vector of path to the files or a |
directory |
directory of the model files. |
runno |
run number which is used for generating the model file name, or used for alternative import of NONMEM-output tables. |
ext |
Extension to be used to generate model file name. Should be one of'.lst' (default), '.out', '.res', '.mod' or '.ctl' for NONMEM. |
table_suffix |
suffix of the output tables, standard is "" (no suffix). |
sim_suffix |
suffix of the simulation output tables, standard is "sim" (e.g. stdab1sim). |
simfile |
Useful if the simulation is peformed post-hoc and an additional simulation model file is generated e.g. "simulation.lst"; similar to "file" see above. |
prefix |
Prefix to be used to generate model file name. Used in combination with |
table_names |
contains the names of the NONMEM-output tables e.g. "sdtab", "patab", "cotab", "catab". |
dvid |
[Optional] |
pred |
[Optional] |
time |
[Optional] |
dv |
|
conts |
[Optional] |
cats |
[Optional] |
npde |
[Optional] |
iwres |
[Optional] |
ipred |
[Optional] |
endpoint |
[Optional] |
strats |
[Optional] |
settings |
|
vpc |
|
bloq |
|
obs |
|
quiet |
Logical, if |
pmxClass
controller object.
The ggPMX NONMEM reader (pmx_nm) is strongly based on NONMEM reading functions of the xpose package (v.0.4.11) (Thanks to Benjamin Guiastrennec) To avoid conflicts with the xpose package, the necessary xpose-based functions have been renamed with a "pmx_" prefix. If the user wants to use individual functions e.g. "read_nm_tables" please use the xpose-package
## using only runnumber # ctr <- pmx_nm( # directory=model_dir, # runno = "001" #) ## using a model file (e.g. run001.lst) #ctr <- pmx_nm( # directory=model_dir, # file = "run001.lst" #) ## if simulation was performed post-hoc, an additional simulation file can be loaded for VPC #ctr <- pmx_nm( # directory=model_dir, # file = "run001.lst", # simfile = "simulation.ctl" #) ## loading with individual table(s)-names #ctr <- pmx_nm(directory = model_dir, # runno = 3, # table_names = "xptab")
## using only runnumber # ctr <- pmx_nm( # directory=model_dir, # runno = "001" #) ## using a model file (e.g. run001.lst) #ctr <- pmx_nm( # directory=model_dir, # file = "run001.lst" #) ## if simulation was performed post-hoc, an additional simulation file can be loaded for VPC #ctr <- pmx_nm( # directory=model_dir, # file = "run001.lst", # simfile = "simulation.ctl" #) ## loading with individual table(s)-names #ctr <- pmx_nm(directory = model_dir, # runno = 3, # table_names = "xptab")
Generic pmx plot
pmx_plot(ctr, pname, ...)
pmx_plot(ctr, pname, ...)
ctr |
|
pname |
plot name |
... |
others graphics parameters passed :
|
Generic pmx stratified plot
pmx_plot_cats(ctr, pname, cats, chunk = "", print = TRUE, ...)
pmx_plot_cats(ctr, pname, cats, chunk = "", print = TRUE, ...)
ctr |
|
pname |
plot name |
cats |
list of categorical variables. By default all of them |
chunk |
chunk name |
print |
|
... |
others graphics parameters passed :
|
Eta matrix plot
pmx_plot_eta_matrix( ctr, title, dname, type.eta, text_color, is.shrink, shrink, point, is.smooth, smooth, is.hline, hline, is.vreference_line, vreference_line, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... )
pmx_plot_eta_matrix( ctr, title, dname, type.eta, text_color, is.shrink, shrink, point, is.smooth, smooth, is.hline, hline, is.vreference_line, vreference_line, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... )
ctr |
pmx controller |
title |
character the plot title |
dname |
name of dataset to be used |
type.eta |
|
text_color |
color of the correlation text in the upper matrix |
is.shrink |
|
shrink |
|
point |
|
is.smooth |
|
smooth |
|
is.hline |
|
hline |
|
is.vreference_line |
|
vreference_line |
pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
... |
others graphics parameters passed :
eta_pairs parameters |
ggplot2 object
# basic use --------------------------------------- ctr <- theophylline() p <- ctr %>% pmx_plot_eta_matrix # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_eta_matrix( labels = list(title = "Eta matrix new title") ) ## remove draft ctr %>% pmx_plot_eta_matrix(is.draft = FALSE) ## change text color line ctr %>% pmx_plot_eta_matrix( text_color="red", shrink=pmx_shrink(mapping=aes(color="magenta")) ) ## custom point aes and static parameters ## we can customize any geom_point parameter ctr %>% pmx_plot_eta_matrix( point = list(color = "blue", shape = 4) ) # stratification ---------------------------------- ## IGNORE continuous stratification ctr %>% pmx_plot_eta_matrix(strat.color = "WT0") ## IGNORE categorical stratification ctr %>% pmx_plot_eta_matrix(strat.facet = ~SEX) # subsetting -------------------------------------- ## we can use any expression involving the data ctr %>% pmx_plot_eta_matrix(filter = EFFECT%in% c("Cl","ka"))
# basic use --------------------------------------- ctr <- theophylline() p <- ctr %>% pmx_plot_eta_matrix # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_eta_matrix( labels = list(title = "Eta matrix new title") ) ## remove draft ctr %>% pmx_plot_eta_matrix(is.draft = FALSE) ## change text color line ctr %>% pmx_plot_eta_matrix( text_color="red", shrink=pmx_shrink(mapping=aes(color="magenta")) ) ## custom point aes and static parameters ## we can customize any geom_point parameter ctr %>% pmx_plot_eta_matrix( point = list(color = "blue", shape = 4) ) # stratification ---------------------------------- ## IGNORE continuous stratification ctr %>% pmx_plot_eta_matrix(strat.color = "WT0") ## IGNORE categorical stratification ctr %>% pmx_plot_eta_matrix(strat.facet = ~SEX) # subsetting -------------------------------------- ## we can use any expression involving the data ctr %>% pmx_plot_eta_matrix(filter = EFFECT%in% c("Cl","ka"))
Individual plot
pmx_plot_individual( ctr, which_pages = 1L, print = FALSE, dname, pred_line, ipred_line, point, is.legend, use.finegrid, bloq, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... )
pmx_plot_individual( ctr, which_pages = 1L, print = FALSE, dname, pred_line, ipred_line, point, is.legend, use.finegrid, bloq, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... )
ctr |
pmx controller |
which_pages |
|
print |
|
dname |
|
pred_line |
|
ipred_line |
|
point |
|
is.legend |
|
use.finegrid |
|
bloq |
pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
... |
others graphics parameters passed :
individual parameters |
ggplot2 or list of ggplot2 objects
# basic use --------------------------------------- ctr <- theophylline() ctr %>% pmx_plot_individual(which_pages = 1) ## multiple pages ctr %>% pmx_plot_individual(which_pages = c(1, 3)) ## change faceting ctr %>% pmx_plot_individual(facets = list(nrow = 5, ncol = 5), which_pages = 2) # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_individual( labels = list(title = "Custom individual plot") ) ## remove draft ctr %>% pmx_plot_individual(is.draft = FALSE) ## Customize ipred_line with any geom_line parameter ctr %>% pmx_plot_individual( pred_line = list(color = "red", linetype = 20, alpha = 0.5) ) ## Customize ipred_line with any geom_line parameter ctr %>% pmx_plot_individual( ipred_line = list(size = 5) ) ## Customize any geom_point parameter ctr %>% pmx_plot_individual( point = list(aes(alpha = DV), color = "green", shape = 4) ) ## legend p <- ctr %>% pmx_plot_individual( is.legend=TRUE, point=list(shape=20), pred_line=list(linetype=6) ) # # stratification ---------------------------------- # # ## continuous stratification ctr %>% pmx_plot_individual(strat.color = "WT0") # # subsetting -------------------------------------- # # ## we can use any expression involving the data # ## filter and stratify ctr %>% pmx_plot_individual( filter = SEX == 1, strat.facet = ~SEX, facets = list(nrow = 5, ncol = 5)) # # transformation -------------------------------------- # # ## apply a log transformation in y ctr %>% pmx_plot_individual(trans = "log10_y") # ## apply a custonm trsnformation to normalize axis between 0 and 1 ## get a list of parameter p <- ctr %>% pmx_plot_individual( which_pages="all", point=list(shape=4,color='blue',size=10), facets = list(nrow = 5, ncol = 5), labels = list(title = "My individuals",x='my time',y='PD data') )
# basic use --------------------------------------- ctr <- theophylline() ctr %>% pmx_plot_individual(which_pages = 1) ## multiple pages ctr %>% pmx_plot_individual(which_pages = c(1, 3)) ## change faceting ctr %>% pmx_plot_individual(facets = list(nrow = 5, ncol = 5), which_pages = 2) # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_individual( labels = list(title = "Custom individual plot") ) ## remove draft ctr %>% pmx_plot_individual(is.draft = FALSE) ## Customize ipred_line with any geom_line parameter ctr %>% pmx_plot_individual( pred_line = list(color = "red", linetype = 20, alpha = 0.5) ) ## Customize ipred_line with any geom_line parameter ctr %>% pmx_plot_individual( ipred_line = list(size = 5) ) ## Customize any geom_point parameter ctr %>% pmx_plot_individual( point = list(aes(alpha = DV), color = "green", shape = 4) ) ## legend p <- ctr %>% pmx_plot_individual( is.legend=TRUE, point=list(shape=20), pred_line=list(linetype=6) ) # # stratification ---------------------------------- # # ## continuous stratification ctr %>% pmx_plot_individual(strat.color = "WT0") # # subsetting -------------------------------------- # # ## we can use any expression involving the data # ## filter and stratify ctr %>% pmx_plot_individual( filter = SEX == 1, strat.facet = ~SEX, facets = list(nrow = 5, ncol = 5)) # # transformation -------------------------------------- # # ## apply a log transformation in y ctr %>% pmx_plot_individual(trans = "log10_y") # ## apply a custonm trsnformation to normalize axis between 0 and 1 ## get a list of parameter p <- ctr %>% pmx_plot_individual( which_pages="all", point=list(shape=4,color='blue',size=10), facets = list(nrow = 5, ncol = 5), labels = list(title = "My individuals",x='my time',y='PD data') )
IWRES density plot
pmx_plot_iwres_dens( ctr, sim_blq, dname, xlim, var_line, snd_line, vline, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... )
pmx_plot_iwres_dens( ctr, sim_blq, dname, xlim, var_line, snd_line, vline, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... )
ctr |
pmx controller |
sim_blq |
|
dname |
|
xlim |
|
var_line |
|
snd_line |
|
vline |
pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
... |
others graphics parameters passed :
pmx_dens parameters |
ggplot2 or list of ggplot2 objects
VPC plot
pmx_plot_vpc( ctr, type, idv, obs, pi, ci, rug, bin, is.legend, sim_blq, dname, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, is.footnote, ... )
pmx_plot_vpc( ctr, type, idv, obs, pi, ci, rug, bin, is.legend, sim_blq, dname, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, is.footnote, ... )
ctr |
pmx controller |
type |
|
idv |
|
obs |
|
pi |
|
ci |
|
rug |
|
bin |
|
is.legend |
|
sim_blq |
|
dname |
added for compatibility with other ggPMX plots pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
is.footnote |
|
... |
others graphics parameters passed :
pmx_vpc parameters |
You can use pmx_vpc_bin to set the bin parameters. In case of stratification,
binning can be different for each strat level (case within_strat
equal to FALSE).
ggplot2 or list of ggplot2 objects
Other vpc:
pmx_vpc_bin()
,
pmx_vpc_ci()
,
pmx_vpc_obs()
,
pmx_vpc_pi()
,
pmx_vpc_rug()
,
pmx_vpc()
library(ggPMX) theo_path <- file.path( system.file(package = "ggPMX"), "testdata", "theophylline" ) WORK_DIR <- file.path(theo_path, "Monolix") input_file <- file.path(theo_path, "data_pk.csv") vpc_file <- file.path(theo_path, "sim.csv") ctr <- pmx_mlx( config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid = "dvid", cats = c("SEX"), conts = c("WT0", "AGE0"), strats = "STUD", settings = pmx_settings( use.labels=TRUE, cats.labels=list( SEX=c("0"="Male","1"="Female") ) ), sim = pmx_sim( file = vpc_file, irun ="rep", idv="TIME" ) ) ctr %>% pmx_plot_vpc( strat.facet=~SEX, facets=list(nrow=2), type="percentile", is.draft = FALSE, pi = pmx_vpc_pi(interval = c(0.1,0.9), median=list(color="green"), extreme= list(color="green")), obs = pmx_vpc_obs(color="blue",shape=18,size=2), ci = pmx_vpc_ci(interval = c(0.1,0.9), median=list(fill="pink")), bin=pmx_vpc_bin("kmeans",n=5) ) ctr %>% pmx_plot_vpc(bin= pmx_vpc_bin( style = "fixed", fixedBreaks=c(-10,2, 5, 10,15,50)) ) # example with legend ctr %>% pmx_plot_vpc( is.legend = TRUE, pi = pmx_vpc_pi(interval=c(0.02,0.98),median = list(linetype="dotted")), ci = pmx_vpc_ci(interval = c(0.05,0.95),median=list(fill="red")) )
library(ggPMX) theo_path <- file.path( system.file(package = "ggPMX"), "testdata", "theophylline" ) WORK_DIR <- file.path(theo_path, "Monolix") input_file <- file.path(theo_path, "data_pk.csv") vpc_file <- file.path(theo_path, "sim.csv") ctr <- pmx_mlx( config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid = "dvid", cats = c("SEX"), conts = c("WT0", "AGE0"), strats = "STUD", settings = pmx_settings( use.labels=TRUE, cats.labels=list( SEX=c("0"="Male","1"="Female") ) ), sim = pmx_sim( file = vpc_file, irun ="rep", idv="TIME" ) ) ctr %>% pmx_plot_vpc( strat.facet=~SEX, facets=list(nrow=2), type="percentile", is.draft = FALSE, pi = pmx_vpc_pi(interval = c(0.1,0.9), median=list(color="green"), extreme= list(color="green")), obs = pmx_vpc_obs(color="blue",shape=18,size=2), ci = pmx_vpc_ci(interval = c(0.1,0.9), median=list(fill="pink")), bin=pmx_vpc_bin("kmeans",n=5) ) ctr %>% pmx_plot_vpc(bin= pmx_vpc_bin( style = "fixed", fixedBreaks=c(-10,2, 5, 10,15,50)) ) # example with legend ctr %>% pmx_plot_vpc( is.legend = TRUE, pi = pmx_vpc_pi(interval=c(0.02,0.98),median = list(linetype="dotted")), ci = pmx_vpc_ci(interval = c(0.05,0.95),median=list(fill="red")) )
This function creates a qq plot object
pmx_qq( x, labels, dname = NULL, point = NULL, xmax = TRUE, facets = NULL, is.reference_line = NULL, reference_line = NULL, is.shrink = NULL, shrink = NULL, is.hline = NULL, hline = NULL, is.vline = NULL, vline = NULL, ... )
pmx_qq( x, labels, dname = NULL, point = NULL, xmax = TRUE, facets = NULL, is.reference_line = NULL, reference_line = NULL, is.shrink = NULL, shrink = NULL, is.hline = NULL, hline = NULL, is.vline = NULL, vline = NULL, ... )
x |
|
labels |
list of texts/titles used within the plot |
dname |
name of dataset to be used |
point |
|
xmax |
|
facets |
|
is.reference_line |
|
reference_line |
|
is.shrink |
|
shrink |
|
is.hline |
logical if TRUE add horizontal line y=0 ( TRUE by default) |
hline |
geom hline graphical parameters |
is.vline |
logical if TRUE add vertical line x=0 ( TRUE by default) |
vline |
geom vline graphical parameters |
... |
others graphics arguments passed to |
labels is a list that contains:
title: plot title default "EBE vs. covariates"
x: x axis label default to "Etas"
y: y axis label default to empty
point is a list that contains:
shape: default to 1
color: default to black
size: default to 1
pmx_qq
object
Quantile-quantile plots
Quantile-quantile plot of IWRES
Quantile-quantile plot of eta variables
Quantile-quantile plot of NPDE
Quantile-quantile plot of NPD
Quantile-quantile plot of CWRES
pmx_qq_plot( dname, point, is.reference_line, reference_line, is.shrink, shrink, is.hline, hline, is.vline, vline, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... ) pmx_plot_iwres_qq(ctr, ...) pmx_plot_eta_qq(ctr, ...) pmx_plot_npde_qq(ctr, ...) pmx_plot_npd_qq(ctr, ...) pmx_plot_cwres_qq(ctr, ...)
pmx_qq_plot( dname, point, is.reference_line, reference_line, is.shrink, shrink, is.hline, hline, is.vline, vline, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... ) pmx_plot_iwres_qq(ctr, ...) pmx_plot_eta_qq(ctr, ...) pmx_plot_npde_qq(ctr, ...) pmx_plot_npd_qq(ctr, ...) pmx_plot_cwres_qq(ctr, ...)
dname |
name of dataset to be used |
point |
|
is.reference_line |
|
reference_line |
|
is.shrink |
|
shrink |
|
is.hline |
|
hline |
|
is.vline |
|
vline |
pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
an object of class pmx_gpar |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
... |
others graphics parameters passed :
pmx_qq parameters |
ctr |
pmx controller |
ggplot2 object
# *************** basic use ***************** ------ ctr <- theophylline() ctr %>% pmx_plot_eta_qq ctr %>% pmx_plot_npde_qq ctr %>% pmx_plot_iwres_qq # update graphical parameter ---------------------- ## add reference line ctr %>% pmx_plot_npde_qq(reference_line=list(color="blue")) ## remove reference line ctr %>% pmx_plot_eta_qq(reference_line=NULL) # stratification ---------------------------------- ## categorical stratification color parameter ctr %>% pmx_plot_iwres_qq(strat.facet=~STUD,strat.color="SEX") ## categorical stratification facetting ctr %>% pmx_plot_eta_qq(strat.facet = ~SEX) ## do not use symmetric axis ctr %>% pmx_plot_npde_qq(xmax=FALSE,reference_line=list())
# *************** basic use ***************** ------ ctr <- theophylline() ctr %>% pmx_plot_eta_qq ctr %>% pmx_plot_npde_qq ctr %>% pmx_plot_iwres_qq # update graphical parameter ---------------------- ## add reference line ctr %>% pmx_plot_npde_qq(reference_line=list(color="blue")) ## remove reference line ctr %>% pmx_plot_eta_qq(reference_line=NULL) # stratification ---------------------------------- ## categorical stratification color parameter ctr %>% pmx_plot_iwres_qq(strat.facet=~STUD,strat.color="SEX") ## categorical stratification facetting ctr %>% pmx_plot_eta_qq(strat.facet = ~SEX) ## do not use symmetric axis ctr %>% pmx_plot_npde_qq(xmax=FALSE,reference_line=list())
Quickly import NONMEM output files into R.
pmx_read_nm_files( runno = NULL, prefix = "run", ext = c(".ext", ".cor", ".cov", ".phi", ".grd", ".shk"), file = NULL, dir = NULL, quiet = FALSE )
pmx_read_nm_files( runno = NULL, prefix = "run", ext = c(".ext", ".cor", ".cov", ".phi", ".grd", ".shk"), file = NULL, dir = NULL, quiet = FALSE )
runno |
Run number to be evaluated. |
prefix |
Prefix of the model file names. |
ext |
A vector of the file extension to import. By default '.ext', '.cor', '.cov', '.phi', '.grd', '.shk' files are listed. |
file |
Names of the model output file to be imported. Alternative argument to |
dir |
Location of the model files. |
quiet |
Logical, if |
## Not run: # Using the `file` argument to import a model file: ext_file <- pmx_read_nm_files(file = 'run001.ext', dir = 'models') # Using the `runno` argument to import a model file: ext_file <- pmx_read_nm_files(runno = '001', ext = '.ext', dir = 'models') ## End(Not run)
## Not run: # Using the `file` argument to import a model file: ext_file <- pmx_read_nm_files(file = 'run001.ext', dir = 'models') # Using the `runno` argument to import a model file: ext_file <- pmx_read_nm_files(runno = '001', ext = '.ext', dir = 'models') ## End(Not run)
Parse NONMEM model files in R format
pmx_read_nm_model( runno = NULL, prefix = "run", ext = ".lst", file = NULL, dir = NULL )
pmx_read_nm_model( runno = NULL, prefix = "run", ext = ".lst", file = NULL, dir = NULL )
runno |
run number which is used for generating the model file name |
prefix |
Prefix to be used to generate model file name. Used in combination with |
ext |
Extension to be used to generate model file name. Should be one of'.lst' (default), '.out', '.res', '.mod' or '.ctl' for NONMEM. |
file |
A character vector of path to the files or a |
dir |
directory of the model files. |
A tibble
of class model
containing the following columns:
problem: a numeric identifier for the $PROBLEM associated with the code.
level: a unique numeric identifier to each subroutine block associated with the code.
subroutine: a character identifier named after the 3 first letters of the subroutine name e.g. '$THETA' and '$TABLE' will become 'the' and 'tab' respectively. In addition all output from the .lst is labeled 'lst', the general nonmem output e.g. NM-TRAN messages are labelled 'oth'. With priors thp, tpv, omp, opd, sip, spd abbreviations are given to the THETAP, THETAPV, OMEGAP, etc.
code: the code without comments or subroutine names e.g. '$THETA 0.5 ; TVCL' will return '0.5'.
comment: the last comment of a record e.g. '0.5 ; Clearance (L/h) ; TVCL' will return 'TVCL'.
## Not run: # Using the `file` argument to import a model file: nm_model <- pmx_read_nm_model(file = 'run001.lst', dir = 'models') # Using the `runno` argument to import a model file: nm_model <- pmx_read_nm_model(runno = '001', ext = '.lst', dir = 'models') ## End(Not run)
## Not run: # Using the `file` argument to import a model file: nm_model <- pmx_read_nm_model(file = 'run001.lst', dir = 'models') # Using the `runno` argument to import a model file: nm_model <- pmx_read_nm_model(runno = '001', ext = '.lst', dir = 'models') ## End(Not run)
Quickly import NONMEM output tables into R. This function automatically detects the optimal settings to import the tables from nonmem. It is based on the read_nm_tables function of xpose. Slight adjustment were made for purposes of pmx_nm()
pmx_read_nm_tables( file = NULL, dir = NULL, combined = TRUE, rm_duplicates = TRUE, quiet = FALSE, simtab = NULL, ziptab = TRUE, user_mode = TRUE, ... )
pmx_read_nm_tables( file = NULL, dir = NULL, combined = TRUE, rm_duplicates = TRUE, quiet = FALSE, simtab = NULL, ziptab = TRUE, user_mode = TRUE, ... )
file |
A character vector of path to the files or a |
dir |
Location of the model files. |
combined |
Logical value indicating whether multiple tables should be combined into a single one. If the number of rows does not match an error will be returned. |
rm_duplicates |
Logical value indicating whether duplicated columns should be removed. |
quiet |
Logical, if |
simtab |
If |
ziptab |
If |
user_mode |
Adjustment to the original code: usermode is set to "usermode = TRUE" in order to improve this function for purposes of pmx_nm() (nonmem_reader.R), In order to use this function seperatly, the use of the original function in the xpose package is advised. |
... |
Additional arguments to be passed to the |
When using pmx_read_nm_tables
with the combined
argument set to FALSE
an ID
column
must be present in all data tables. When combined
is set to TRUE
instead an ID
column must be
present in at least one table for each problem and for each 'firstonly' category. ID
columns are required
to properly combine/merge tables and removing NA
records. If the ID
column is missing from a table and
combined = FALSE
pmx_read_nm_tables
will return the following warning: Unknown variables: `ID`
. While
the data is returned beware that NA
records might be left in the data and the output should be checked carefully.
If combined = TRUE
pmx_read_nm_tables
is more strict and will return the following warning instead:
Dropped `<tablenames>` due to missing required `ID` column.
.
## Not run: # Adjustment to the original code: usermode is set to "usermode = TRUE" # in order to improve this function for purposes of pmx_nm() (nonmem_reader.R) # In order to use this function seperatly, the use of the original function in # the xpose package is advised. # Import tables manually and return them as a list of individual tables nm_tables <- pmx_read_nm_tables(file = c('sdtab001', 'patab001'), dir = 'models', combined = FALSE) # Import tables manually and return them as a single merged table nm_tables <- pmx_read_nm_tables(file = c('sdtab001', 'patab001'), dir = 'models', combined = TRUE) ## End(Not run)
## Not run: # Adjustment to the original code: usermode is set to "usermode = TRUE" # in order to improve this function for purposes of pmx_nm() (nonmem_reader.R) # In order to use this function seperatly, the use of the original function in # the xpose package is advised. # Import tables manually and return them as a list of individual tables nm_tables <- pmx_read_nm_tables(file = c('sdtab001', 'patab001'), dir = 'models', combined = FALSE) # Import tables manually and return them as a single merged table nm_tables <- pmx_read_nm_tables(file = c('sdtab001', 'patab001'), dir = 'models', combined = TRUE) ## End(Not run)
Register plot
pmx_register_plot(ctr, pp, pname = NULL)
pmx_register_plot(ctr, pp, pname = NULL)
ctr |
|
pp |
|
pname |
|
Generates ggpmX report from a pre-defined template
pmx_report( contr, name, save_dir, plots_subdir = "ggpmx_GOF", output = c("all", "plots", "report"), template = "standing", footnote = output == "all", edit = FALSE, format = NULL, title, ... )
pmx_report( contr, name, save_dir, plots_subdir = "ggpmx_GOF", output = c("all", "plots", "report"), template = "standing", footnote = output == "all", edit = FALSE, format = NULL, title, ... )
contr |
|
name |
|
save_dir |
Output directory. A directory to write the results files to |
plots_subdir |
Output folder name, ggpmx_GOF by default |
output |
|
template |
|
footnote |
|
edit |
|
format |
|
title |
|
... |
extra parameters depending in the template used |
pmx_report
uses pre-defined template .Rmd to generate the report.
The idea is to pass the controller as a report argument using knitr params
artifact.
library(ggPMX) # you probably want to create the report in your own directory # But using a temp directory allows for easy cleanup ## case1: generate a single report withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name = "my_report", save_dir = getwd(), output="report" ) }) ## case2: generate standalone plots withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name = "my_report", save_dir = getwd(), output="plots" ) }) ## case3: generate both : reports + plots ## by default add footnote ## Note, you can force footnote to FALSE using footnote parameter withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name="my_report", save_dir=getwd(), output="all" ) }) ## case4 : generate standalone plots with footnotes withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name="my_report", save_dir=getwd(), footnote=TRUE, output="plots" ) }) ## case6: dynamic edit ## uncomment to run # ctr <- theophylline() # ctr %>% pmx_report( # save_dir = file.path(getwd(),"case6"), # name="my_report", # output="report", # edit = TRUE) ## case7 : generate individual plots report ## ctr <- theophylline() ## ctr %>% pmx_report( ## name="report2", ## save_dir = getwd(), ## template="individual", ## format="all", ## which_pages=1:2 ## )
library(ggPMX) # you probably want to create the report in your own directory # But using a temp directory allows for easy cleanup ## case1: generate a single report withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name = "my_report", save_dir = getwd(), output="report" ) }) ## case2: generate standalone plots withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name = "my_report", save_dir = getwd(), output="plots" ) }) ## case3: generate both : reports + plots ## by default add footnote ## Note, you can force footnote to FALSE using footnote parameter withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name="my_report", save_dir=getwd(), output="all" ) }) ## case4 : generate standalone plots with footnotes withr::with_tempdir({ ctr <- theophylline() ctr %>% pmx_report( name="my_report", save_dir=getwd(), footnote=TRUE, output="plots" ) }) ## case6: dynamic edit ## uncomment to run # ctr <- theophylline() # ctr %>% pmx_report( # save_dir = file.path(getwd(),"case6"), # name="my_report", # output="report", # edit = TRUE) ## case7 : generate individual plots report ## ctr <- theophylline() ## ctr %>% pmx_report( ## name="report2", ## save_dir = getwd(), ## template="individual", ## format="all", ## which_pages=1:2 ## )
Gets build-in report templates
pmx_report_template()
pmx_report_template()
list of templates names
pmx_report_template()
pmx_report_template()
Create controller global settings
pmx_settings( is.draft = TRUE, use.abbrev = TRUE, color.scales = NULL, cats.labels = NULL, use.labels = FALSE, use.titles = FALSE, effects = NULL, ... )
pmx_settings( is.draft = TRUE, use.abbrev = TRUE, color.scales = NULL, cats.labels = NULL, use.labels = FALSE, use.titles = FALSE, effects = NULL, ... )
is.draft |
|
use.abbrev |
|
color.scales |
|
cats.labels |
|
use.labels |
|
use.titles |
|
effects |
|
... |
extra parameter not used yet |
pmxSettingsClass object
library(ggPMX) library(ggplot2) ctr <- theophylline( settings= pmx_settings( color.scales=list( "Study", labels=c("Study 1","Study 2"), values=c("1"="lightyellow","2"="lightblue")), cats.labels=list( SEX=c("0"="M","1"="F"), STUD=c("1"="Study 1","2"="Study 2") ), use.abbrev=TRUE, is.draft=TRUE, use.labels=TRUE ) ) ctr %>% pmx_plot_npde_time(strat.color="STUD",strat.facet=~SEX) # # ctr %>% pmx_plot_eta_box(strat.color="STUD", strat.facet =~SEX) ctr %>% pmx_plot_eta_hist
library(ggPMX) library(ggplot2) ctr <- theophylline( settings= pmx_settings( color.scales=list( "Study", labels=c("Study 1","Study 2"), values=c("1"="lightyellow","2"="lightblue")), cats.labels=list( SEX=c("0"="M","1"="F"), STUD=c("1"="Study 1","2"="Study 2") ), use.abbrev=TRUE, is.draft=TRUE, use.labels=TRUE ) ) ctr %>% pmx_plot_npde_time(strat.color="STUD",strat.facet=~SEX) # # ctr %>% pmx_plot_eta_box(strat.color="STUD", strat.facet =~SEX) ctr %>% pmx_plot_eta_hist
Create shrinkage parameter object
pmx_shrink( fun = c("var", "sd"), size = 1, color = "green", vjust = 1.5, hjust = 0.5, ... )
pmx_shrink( fun = c("var", "sd"), size = 1, color = "green", vjust = 1.5, hjust = 0.5, ... )
fun |
|
size |
|
color |
|
vjust |
|
hjust |
|
... |
any other parameter |
pmxShrinkClass
object (list
)
Create simulation object
pmx_sim(file, data, irun, idv)
pmx_sim(file, data, irun, idv)
file |
|
data |
|
irun |
|
idv |
|
library(ggPMX) theo_path <- file.path( system.file(package = "ggPMX"), "testdata", "theophylline" ) WORK_DIR <- file.path(theo_path, "Monolix") input_file <- file.path(theo_path, "data_pk.csv") vpc_file <- file.path(theo_path, "sim.csv") ctr <- pmx_mlx( config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid = "dvid", cats = c("SEX"), conts = c("WT0", "AGE0"), strats = "STUD", settings = pmx_settings( use.labels=TRUE, cats.labels=list( SEX=c("0"="Male","1"="Female") ) ), sim = pmx_sim( file = vpc_file, irun ="rep", idv="TIME" ) ) ctr %>% pmx_plot_vpc( strat.facet=~SEX, facets=list(nrow=2), type="percentile", is.draft = FALSE, pi = pmx_vpc_pi(interval = c(0.1,0.9), median=list(color="green"), extreme= list(color="green")), obs = pmx_vpc_obs(color="blue",shape=18,size=2), ci = pmx_vpc_ci(interval = c(0.1,0.9), median=list(fill="pink")), bin=pmx_vpc_bin("kmeans",n=5) ) ctr %>% pmx_plot_vpc(bin= pmx_vpc_bin( style = "fixed", fixedBreaks=c(-10,2, 5, 10,15,50)) ) # example with legend ctr %>% pmx_plot_vpc( is.legend = TRUE, pi = pmx_vpc_pi(interval=c(0.02,0.98),median = list(linetype="dotted")), ci = pmx_vpc_ci(interval = c(0.05,0.95),median=list(fill="red")) )
library(ggPMX) theo_path <- file.path( system.file(package = "ggPMX"), "testdata", "theophylline" ) WORK_DIR <- file.path(theo_path, "Monolix") input_file <- file.path(theo_path, "data_pk.csv") vpc_file <- file.path(theo_path, "sim.csv") ctr <- pmx_mlx( config = "standing", directory = WORK_DIR, input = input_file, dv = "Y", dvid = "dvid", cats = c("SEX"), conts = c("WT0", "AGE0"), strats = "STUD", settings = pmx_settings( use.labels=TRUE, cats.labels=list( SEX=c("0"="Male","1"="Female") ) ), sim = pmx_sim( file = vpc_file, irun ="rep", idv="TIME" ) ) ctr %>% pmx_plot_vpc( strat.facet=~SEX, facets=list(nrow=2), type="percentile", is.draft = FALSE, pi = pmx_vpc_pi(interval = c(0.1,0.9), median=list(color="green"), extreme= list(color="green")), obs = pmx_vpc_obs(color="blue",shape=18,size=2), ci = pmx_vpc_ci(interval = c(0.1,0.9), median=list(fill="pink")), bin=pmx_vpc_bin("kmeans",n=5) ) ctr %>% pmx_plot_vpc(bin= pmx_vpc_bin( style = "fixed", fixedBreaks=c(-10,2, 5, 10,15,50)) ) # example with legend ctr %>% pmx_plot_vpc( is.legend = TRUE, pi = pmx_vpc_pi(interval=c(0.02,0.98),median = list(linetype="dotted")), ci = pmx_vpc_ci(interval = c(0.05,0.95),median=list(fill="red")) )
This theme is a simple wrapper gdoc theme from ggthems package.
pmx_theme(...)
pmx_theme(...)
... |
can contain any valid argument of |
Update plot object
pmx_update( ctr, pname, strat.color = NULL, strat.facet = NULL, color.scales = NULL, filter = NULL, trans = NULL, ..., pmxgpar = NULL )
pmx_update( ctr, pname, strat.color = NULL, strat.facet = NULL, color.scales = NULL, filter = NULL, trans = NULL, ..., pmxgpar = NULL )
ctr |
|
pname |
character the plot name to update |
strat.color |
|
strat.facet |
|
color.scales |
|
filter |
optional filter which will be applied to plotting data |
trans |
|
... |
others graphical parameters given to set the plot |
pmxgpar |
a object of class pmx_gpar possibly the output of the |
trans is a transformation that user can apply to x, or y coordinates. The transformation is applied to the data before the plotting. This gives more felxiblilty to the user and also conserves all static positions like annotations ( draft specially)
For example:
var_x apply variance to x coordinates the variance function
var_xy apply variance to both This mechanism is applied internally to scale log.
controller object with the plot updated
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
set_data()
,
set_plot()
Creates vpc object
pmx_vpc( type = c("percentile", "scatter"), idv = "TIME", obs = pmx_vpc_obs(), pi = pmx_vpc_pi(), ci = pmx_vpc_ci(), rug = pmx_vpc_rug(), bin = pmx_vpc_bin(), labels = NULL, facets = NULL, is.legend = TRUE, is.footnote = TRUE, dname = NULL, ... )
pmx_vpc( type = c("percentile", "scatter"), idv = "TIME", obs = pmx_vpc_obs(), pi = pmx_vpc_pi(), ci = pmx_vpc_ci(), rug = pmx_vpc_rug(), bin = pmx_vpc_bin(), labels = NULL, facets = NULL, is.legend = TRUE, is.footnote = TRUE, dname = NULL, ... )
type |
|
idv |
|
obs |
|
pi |
|
ci |
|
rug |
|
bin |
|
labels |
|
facets |
is a list of parameters passed to facet_wrap in case of startification |
is.legend |
|
is.footnote |
|
dname |
added for compatibility with other ggPMX plots |
... |
extra parameters passed to base graphical parameters |
Other vpc:
pmx_plot_vpc()
,
pmx_vpc_bin()
,
pmx_vpc_ci()
,
pmx_vpc_obs()
,
pmx_vpc_pi()
,
pmx_vpc_rug()
Creates vpc bins
pmx_vpc_bin(style, within_strat = TRUE, seed = 42, ...)
pmx_vpc_bin(style, within_strat = TRUE, seed = 42, ...)
style |
|
within_strat |
|
seed |
|
... |
other classInt::classIntervals parameters excpet |
This is a wrapper to the bin based VPC
Other vpc:
pmx_plot_vpc()
,
pmx_vpc_ci()
,
pmx_vpc_obs()
,
pmx_vpc_pi()
,
pmx_vpc_rug()
,
pmx_vpc()
Sets vpc confidence interval layer
pmx_vpc_ci( show = c("all", "median"), interval = c(0.025, 0.975), method = c("ribbon", "rectangle"), median = list(fill = "red", alpha = 0.3), extreme = list(fill = "#3388cc", alpha = 0.3) )
pmx_vpc_ci( show = c("all", "median"), interval = c(0.025, 0.975), method = c("ribbon", "rectangle"), median = list(fill = "red", alpha = 0.3), extreme = list(fill = "#3388cc", alpha = 0.3) )
show |
|
interval |
|
method |
|
median |
|
extreme |
|
Other vpc:
pmx_plot_vpc()
,
pmx_vpc_bin()
,
pmx_vpc_obs()
,
pmx_vpc_pi()
,
pmx_vpc_rug()
,
pmx_vpc()
Sets vpc observation layer
pmx_vpc_obs(show = TRUE, color = "#000000", size = 1, alpha = 0.7, shape = 1)
pmx_vpc_obs(show = TRUE, color = "#000000", size = 1, alpha = 0.7, shape = 1)
show |
|
color |
|
size |
|
alpha |
|
shape |
|
Other vpc:
pmx_plot_vpc()
,
pmx_vpc_bin()
,
pmx_vpc_ci()
,
pmx_vpc_pi()
,
pmx_vpc_rug()
,
pmx_vpc()
Sets vpc percentile layer
pmx_vpc_pi( show = c("all", "median", "area"), interval = c(0.05, 0.95), median = list(color = "#000000", linewidth = 1, alpha = 0.7, linetype = "solid"), extreme = list(color = "#000000", linewidth = 1, alpha = 0.7, linetype = "dashed"), area = list(fill = "blue", alpha = 0.1) )
pmx_vpc_pi( show = c("all", "median", "area"), interval = c(0.05, 0.95), median = list(color = "#000000", linewidth = 1, alpha = 0.7, linetype = "solid"), extreme = list(color = "#000000", linewidth = 1, alpha = 0.7, linetype = "dashed"), area = list(fill = "blue", alpha = 0.1) )
show |
|
interval |
|
median |
|
extreme |
|
area |
|
Other vpc:
pmx_plot_vpc()
,
pmx_vpc_bin()
,
pmx_vpc_ci()
,
pmx_vpc_obs()
,
pmx_vpc_rug()
,
pmx_vpc()
Sets vpc rug layer
pmx_vpc_rug(show = TRUE, color = "#000000", linewidth = 1, alpha = 0.7, size)
pmx_vpc_rug(show = TRUE, color = "#000000", linewidth = 1, alpha = 0.7, size)
show |
|
color |
|
linewidth |
|
alpha |
|
size |
|
When the vpc confidence interval layer method is rectangles we don't show rug separators.
Other vpc:
pmx_plot_vpc()
,
pmx_vpc_bin()
,
pmx_vpc_ci()
,
pmx_vpc_obs()
,
pmx_vpc_pi()
,
pmx_vpc()
getPmxOption
retrieves the value of a ggPMX option.
ggPMXOptions
sets the value of ggPMX options; it can also be used to
return a list of all currently-set ggPMX options.
pmxOptions(...)
pmxOptions(...)
... |
Options to set, with the form |
There is a global option set, which is available by default.
template_dir: path to template directory
## Not run: pmxOptions(template_dir = PATH_TO_CUSTOM_CONFIGURATION) ## End(Not run)
## Not run: pmxOptions(template_dir = PATH_TO_CUSTOM_CONFIGURATION) ## End(Not run)
S3 print abbreviation
## S3 method for class 'abbreviation' print(x, ...)
## S3 method for class 'abbreviation' print(x, ...)
x |
object of class configs |
... |
pass additional options (not used presently) |
print abbreviation
This function can be used to print configuration of the defined object using S3 method.
## S3 method for class 'configs' print(x, ...)
## S3 method for class 'configs' print(x, ...)
x |
object of class configs |
... |
pass additional options (not used presently) |
print result
Print pmx_gpar object
## S3 method for class 'pmx_gpar' print(x, ...)
## S3 method for class 'pmx_gpar' print(x, ...)
x |
pmx_gpar object |
... |
argument passed to print ( to satisfy generic) |
a character description of graphical parameters
Print pmxClass object
## S3 method for class 'pmxClass' print(x, ...)
## S3 method for class 'pmxClass' print(x, ...)
x |
pmxClass object |
... |
additinal arguments to pass to print |
print object to screen
S3 method print pmxConfig object
## S3 method for class 'pmxConfig' print(x, ...)
## S3 method for class 'pmxConfig' print(x, ...)
x |
pmxConfig object |
... |
addtional arguments to pass to print (unused currently) |
invisible object
Reads .ext files generated by NONMEM
read_extfile( run = NA_real_, project = getwd(), file = paste0(run, ".ext"), path = NULL, read_fun = c("data.table", "read.table"), quiet )
read_extfile( run = NA_real_, project = getwd(), file = paste0(run, ".ext"), path = NULL, read_fun = c("data.table", "read.table"), quiet )
run |
run a run number or run identifier |
project |
project the NONMEM project directory |
file |
file the 'ext' file name |
path |
path full path and file name for 'ext' file |
read_fun |
read_fun function to read the 'ext' file |
quiet |
Logical, if |
A list with param, omega, and sigma in a format ready to be used.
This function is based on read_nmext from mrgsolve, Original Author: Kyle T Baron. This function has some changes to the original code: Addition of param, "quiet", (option of pmx_msg function, from xpose package) (Line: 27) The code was slightly adjusted to check for multiple tables and also extract SE (ITERATION == 1000000001) (Line: 44-58, Line: 86-96, respectively) The output was also slightly adjusted to fit ggPMX output (df and df2) (Line: 105,106) as_bmat was replaced by bmat_like to create the diagonal matrix (Line 116:142)
#project <- system.file("nonmem", package = "mrgsolve") #est <- read_nmext(1005, project = project)
#project <- system.file("nonmem", package = "mrgsolve") #est <- read_nmext(1005, project = project)
Read Modelling input data
read_input( ipath, dv, dvid, cats = "", conts = "", strats = "", occ = "", endpoint = NULL, id = NULL, time = NULL )
read_input( ipath, dv, dvid, cats = "", conts = "", strats = "", occ = "", endpoint = NULL, id = NULL, time = NULL )
ipath |
full path of the input file |
dv |
|
dvid |
|
cats |
[Optional] |
conts |
[Optional] |
strats |
[Optional] |
occ |
[Optional] |
endpoint |
|
id |
|
time |
|
data.table well formatted containing modelling input data
Read MONOLIX individual parameters
read_mlx_ind_est(path, x, ...)
read_mlx_ind_est(path, x, ...)
path |
character path to the file |
x |
dataset object |
... |
extra parameter not used |
data.table object
Read MONOLIX parameter estimation file
read_mlx_par_est(path, x, ...)
read_mlx_par_est(path, x, ...)
path |
character path to the file |
x |
dataset object |
... |
extra parameter not used |
data.table object
Read MONOLIX model predictions
read_mlx_pred(path, x, ...)
read_mlx_pred(path, x, ...)
path |
character path to the file |
x |
dataset object |
... |
extra parameter not used |
data.table object
This function create a residual for each observed value and also generates a residual distribution
residual( x, y, labels = NULL, point = NULL, is.hline = FALSE, hline = NULL, dname = NULL, facets = NULL, bloq = NULL, square_plot = TRUE, ... )
residual( x, y, labels = NULL, point = NULL, is.hline = FALSE, hline = NULL, dname = NULL, facets = NULL, bloq = NULL, square_plot = TRUE, ... )
x |
x axis aesthetics |
y |
y axis aesthetics |
labels |
list that contain title,subtitle, axis labels |
point |
geom point graphical parameters |
is.hline |
logical if TRUE add horizontal line y=0 ( TRUE by default) |
hline |
geom hline graphical parameters |
dname |
name of dataset to be used |
facets |
|
bloq |
|
square_plot |
square dv_pred plot (TRUE by default) |
... |
others graphics arguments passed to |
Some parameters are a list of parameters :
point is a list that contains:
shape: default to 1
color: default to black
size: default to 1
labels is a list that contains:
title: plot title default to AES_X versus AES_Y
subtitle: plot subtitle default empty
x: x axis label default to AES_X
y: y axis label default to AES_Y
a residual object
Scatter residual plots
DV vs PRED plot
DV vs IPRED plot
IWRES vs IPRED plot
|IWRES| vs IPRED plot
|IWRES| vs TIME plot
IWRES vs TIME plot
NPDE vs TIME plot
NPDE vs PRED plot
NPD vs TIME plot
NPD vs EPRED plot
NPD vs PRED plot
CWRES vs TIME plot
CWRES vs CPRED plot
CWRES vs PRED plot
residual_scatter( sim_blq, point, is.hline, hline, dname, bloq, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... ) pmx_plot_dv_pred(ctr, ...) pmx_plot_dv_ipred(ctr, ...) pmx_plot_iwres_ipred(ctr, ...) pmx_plot_abs_iwres_ipred(ctr, ...) pmx_plot_abs_iwres_time(ctr, ...) pmx_plot_iwres_time(ctr, ...) pmx_plot_npde_time(ctr, ...) pmx_plot_npde_pred(ctr, ...) pmx_plot_npd_time(ctr, ...) pmx_plot_npd_epred(ctr, ...) pmx_plot_npd_pred(ctr, ...) pmx_plot_cwres_time(ctr, ...) pmx_plot_cwres_cpred(ctr, ...) pmx_plot_cwres_pred(ctr, ...)
residual_scatter( sim_blq, point, is.hline, hline, dname, bloq, filter, strat.facet, facets, strat.color, trans, pmxgpar, labels, axis.title, axis.text, ranges, is.smooth, smooth, is.band, band, is.draft, draft, is.identity_line, identity_line, scale_x_log10, scale_y_log10, color.scales, ... ) pmx_plot_dv_pred(ctr, ...) pmx_plot_dv_ipred(ctr, ...) pmx_plot_iwres_ipred(ctr, ...) pmx_plot_abs_iwres_ipred(ctr, ...) pmx_plot_abs_iwres_time(ctr, ...) pmx_plot_iwres_time(ctr, ...) pmx_plot_npde_time(ctr, ...) pmx_plot_npde_pred(ctr, ...) pmx_plot_npd_time(ctr, ...) pmx_plot_npd_epred(ctr, ...) pmx_plot_npd_pred(ctr, ...) pmx_plot_cwres_time(ctr, ...) pmx_plot_cwres_cpred(ctr, ...) pmx_plot_cwres_pred(ctr, ...)
sim_blq |
|
point |
|
is.hline |
|
hline |
|
dname |
|
bloq |
pmx_update parameters |
filter |
|
strat.facet |
|
facets |
|
strat.color |
|
trans |
|
pmxgpar |
a object of class pmx_gpar possibly the output of the pmx_gpar: Shared basic graphics parameters |
labels |
|
axis.title |
|
axis.text |
|
ranges |
|
is.smooth |
|
smooth |
|
is.band |
|
band |
|
is.draft |
|
draft |
|
is.identity_line |
|
identity_line |
|
scale_x_log10 |
|
scale_y_log10 |
|
color.scales |
|
... |
others graphics parameters passed :
residual parameters |
ctr |
pmx controller |
ggplot2 object
# NOTES ###################### # examples are availables for all residual plots: # - pmx_plot_abs_iwres_ipred # - pmx_plot_dv_ipred # - pmx_plot_dv_pred # - pmx_plot_iwres_ipred # - pmx_plot_iwres_time # - pmx_plot_npde_time # basic use --------------------------------------- ctr <- theophylline() p <- ctr %>% pmx_plot_dv_pred() ## p is a ggplot2 object you can add any layer here p + ggplot2::theme_minimal() # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_dv_pred( labels = list(title = "DV versus PRED new title") ) ## remove draft ctr %>% pmx_plot_dv_pred(is.draft = FALSE) ## remove horizontal line ctr %>% pmx_plot_dv_pred(is.hline = FALSE) ## custom point aes and static parameters ## we can customize any geom_point parameter ctr %>% pmx_plot_dv_pred( point = list(aes(alpha = DV), color = "green", shape = 4) ) # stratification ---------------------------------- ## continuous stratification ctr %>% pmx_plot_dv_pred(strat.color = ~WT0) ## categorical stratification ctr %>% pmx_plot_dv_pred(strat.facet = ~SEX) ## using formula notation ctr %>% pmx_plot_dv_pred(strat.facet = STUD~SEX) # subsetting -------------------------------------- ## we can use any expression involving the data ctr %>% pmx_plot_dv_pred(filter = DV > mean(DV) & PRED < median(PRED)) ## filter and stratify ctr %>% pmx_plot_dv_pred(filter = SEX == 1, strat.facet = ~SEX) # transformation -------------------------------------- ## apply a log transformation in y ctr %>% pmx_plot_dv_pred(trans = "log10_y")
# NOTES ###################### # examples are availables for all residual plots: # - pmx_plot_abs_iwres_ipred # - pmx_plot_dv_ipred # - pmx_plot_dv_pred # - pmx_plot_iwres_ipred # - pmx_plot_iwres_time # - pmx_plot_npde_time # basic use --------------------------------------- ctr <- theophylline() p <- ctr %>% pmx_plot_dv_pred() ## p is a ggplot2 object you can add any layer here p + ggplot2::theme_minimal() # update graphical parameter ---------------------- ## update labels ctr %>% pmx_plot_dv_pred( labels = list(title = "DV versus PRED new title") ) ## remove draft ctr %>% pmx_plot_dv_pred(is.draft = FALSE) ## remove horizontal line ctr %>% pmx_plot_dv_pred(is.hline = FALSE) ## custom point aes and static parameters ## we can customize any geom_point parameter ctr %>% pmx_plot_dv_pred( point = list(aes(alpha = DV), color = "green", shape = 4) ) # stratification ---------------------------------- ## continuous stratification ctr %>% pmx_plot_dv_pred(strat.color = ~WT0) ## categorical stratification ctr %>% pmx_plot_dv_pred(strat.facet = ~SEX) ## using formula notation ctr %>% pmx_plot_dv_pred(strat.facet = STUD~SEX) # subsetting -------------------------------------- ## we can use any expression involving the data ctr %>% pmx_plot_dv_pred(filter = DV > mean(DV) & PRED < median(PRED)) ## filter and stratify ctr %>% pmx_plot_dv_pred(filter = SEX == 1, strat.facet = ~SEX) # transformation -------------------------------------- ## apply a log transformation in y ctr %>% pmx_plot_dv_pred(trans = "log10_y")
update or add a new abbreviation
set_abbrev(ctr, ...)
set_abbrev(ctr, ...)
ctr |
|
... |
Options to set or add, with the form |
ctr <- theophylline() ctr %>% set_abbrev("new_param" = "new value") ctr %>% get_abbrev("new_param")
ctr <- theophylline() ctr %>% set_abbrev("new_param" = "new value") ctr %>% get_abbrev("new_param")
Set a controller data set
set_data(ctr, ..., envir = parent.frame())
set_data(ctr, ..., envir = parent.frame())
ctr |
the controller object |
... |
a named list parameters (see example) |
envir |
the |
This function can be used to set an existing data set or to create a new one. The basic idea is to change the built-in data set (change the factor level names, change some rows values or apply any other data set operation) and use the new data set using the dname parameter of pmx_plot family functions.
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_plot()
ctr <- theophylline() dx <- ctr %>% get_data("eta") dx <- dx[, EFFECT := factor( EFFECT, levels = c("ka", "V", "Cl"), labels = c("Concentration", "Volume", "Clearance") )] ## update existing data set ctr %>% set_data(eta = dx) ## or create a new data set ctr %>% set_data(eta_long = dx)
ctr <- theophylline() dx <- ctr %>% get_data("eta") dx <- dx[, EFFECT := factor( EFFECT, levels = c("ka", "V", "Cl"), labels = c("Concentration", "Volume", "Clearance") )] ## update existing data set ctr %>% set_data(eta = dx) ## or create a new data set ctr %>% set_data(eta_long = dx)
Create a new plot of the desired type
set_plot( ctr, ptype = c("IND", "DIS", "SCATTER", "ETA_PAIRS", "ETA_COV", "PMX_QQ", "VPC", "PMX_DENS"), pname, use.defaults = TRUE, filter = NULL, strat.color = NULL, strat.facet = NULL, color.scales = NULL, trans = NULL, ... )
set_plot( ctr, ptype = c("IND", "DIS", "SCATTER", "ETA_PAIRS", "ETA_COV", "PMX_QQ", "VPC", "PMX_DENS"), pname, use.defaults = TRUE, filter = NULL, strat.color = NULL, strat.facet = NULL, color.scales = NULL, trans = NULL, ... )
ctr |
|
ptype |
plot type can be:
|
pname |
plot name, if missing it will be created using function aestetics |
use.defaults |
|
filter |
optional filter which will be applied to plotting data |
strat.color |
|
strat.facet |
|
color.scales |
|
trans |
|
... |
other plot parameters to configure |
invisible ctr object
Other pmxclass:
get_cats()
,
get_conts()
,
get_covariates()
,
get_data()
,
get_occ()
,
get_plot_config()
,
get_plot()
,
get_strats()
,
plot_names()
,
plots()
,
pmx_update()
,
set_data()
Creates pmx controller using theophylline data
theophylline(settings = NULL, ...)
theophylline(settings = NULL, ...)
settings |
|
... |
other parameters of pmx_mlx like endpoint |
pmx controller
## Not run: theophylline() ## End(Not run)
## Not run: theophylline() ## End(Not run)
merge facets formula with new formula
wrap_formula(x, origin = "lfacet")
wrap_formula(x, origin = "lfacet")
x |
|
origin |
the origin formula default to ~lfacets |
formula
object