Title: | Visual Model Checking for Nonlinear Mixed Effect Model |
---|---|
Description: | Various visual and numerical diagnosis methods for the nonlinear mixed effect model, including visual predictive checks, numerical predictive checks, and coverage plots (Karlsson and Holford, 2008, <https://www.page-meeting.org/?abstract=1434>). |
Authors: | Eun-Kyung Lee [aut, cre], Eun-Hwa Kang [aut] |
Maintainer: | Eun-Kyung Lee <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.6 |
Built: | 2024-11-03 06:47:12 UTC |
Source: | CRAN |
This function draws the visual predictive check (VPC) plot using additive quantile regression. The quantile regression methods are used to calculate quantiles.
aqrVPC(orig_data, sim_data, probs = c(0.1,0.5,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, plot_caption = TRUE, DV_point = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, captionsize = 10, qss_lambda = NULL, ...)
aqrVPC(orig_data, sim_data, probs = c(0.1,0.5,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, plot_caption = TRUE, DV_point = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, captionsize = 10, qss_lambda = NULL, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
probs |
A numeric vector of probabilities. |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
plot_caption |
Put caption with additional information if TRUE; omit if FALSE. |
DV_point |
Draw point (X, Y) in the plot if TRUE; omit if FALSE. |
plot_flag |
Draw plot if TRUE; generate data for drawing plot if FALSE. |
linesize |
Size of line in the plot. |
pointsize |
Size of point in the plot. |
captionsize |
Size of caption. |
qss_lambda |
Smoothing parameter in quantreg::qss function. Larger lambda produces a smoother fit. |
... |
Arguments to be passed to methods. |
aqrVPC plot or the values to draw aqrVPC plot.
Koenker, Roger, and Kevin F. Hallock. "Quantile regression." Journal of economic perspectives 15.4 (2001): 143-156.
Jamsen, K. M., Patel, K., Nieforth, K., & Kirkpatrick, C. M. (2018). A regression approach to visual predictive checks for population pharmacometric models. CPT: pharmacometrics & systems pharmacology, 7(10), 678-686.
data(origdata) data(simdata) aqrVPC(origdata,simdata)
data(origdata) data(simdata) aqrVPC(origdata,simdata)
This function draws the average shifted visual predictive check (asVPC) plot. It calculates original and simulated data percentiles using the average shifted histogram method. After calculating percentiles with bin-related or distance-related weights, draw the VPC type plot.
asVPC(orig_data, sim_data, type = "CI", weight_method = "bin", N_xbin = NULL, N_hist = NULL, probs = c(0.1,0.5,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, DV_point = TRUE, CIvpc_type = "line", bin_grid = TRUE, plot_caption = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, captionsize = 10, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8,...)
asVPC(orig_data, sim_data, type = "CI", weight_method = "bin", N_xbin = NULL, N_hist = NULL, probs = c(0.1,0.5,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, DV_point = TRUE, CIvpc_type = "line", bin_grid = TRUE, plot_caption = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, captionsize = 10, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8,...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
type |
Type of VPC graph; "CI", "percentile", or "scatter". |
weight_method |
The way to put weight when the average shifted values are calculated. "bin" or "distance". |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calcuated using optK function. |
N_hist |
The number of shifted histograms. |
probs |
A numeric vector of probabilities. |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
DV_point |
Draw point (X, Y) in the plot if TRUE; omit if FALSE. |
CIvpc_type |
Type of CI area in VPC graph; "line" or "segment". |
bin_grid |
Draw grid lines for binning in X variable if TRUE; omit if FALSE. |
plot_caption |
Put caption with additional information if TRUE; omit if FALSE. |
plot_flag |
Draw plot if TRUE; generate data for drawing plot if FALSE. |
linesize |
Size of line in the plot. |
pointsize |
Size of point in the plot. |
captionsize |
Size of caption. |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins. |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
Arguments to be passed to methods. |
asVPC plot or the values to draw asVPC plot.
data(origdata) data(simdata) asVPC(origdata,simdata,type="CI",N_hist=3,weight_method="distance",N_xbin=8) asVPC(origdata,simdata,type="CI",N_hist=3,weight_method="bin",N_xbin=8)
data(origdata) data(simdata) asVPC(origdata,simdata,type="CI",N_hist=3,weight_method="distance",N_xbin=8) asVPC(origdata,simdata,type="CI",N_hist=3,weight_method="bin",N_xbin=8)
This function draws the visual predictive check plot with bootstrapped data. It compares the distribution of the simulated data to the distribution of the bootstrap samples that draw from the observed data. This plot reflects the uncertainty of the observed data and allows for more objective comparisons with the predicted median.
bootVPC(orig_data, sim_data, B = 1000, N_xbin = NULL, conf.level = 0.95, X_name = "TIME", Y_name = "DV", subject_name = "ID", MissingDV = NULL, DV_point = TRUE, plot_caption = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
bootVPC(orig_data, sim_data, B = 1000, N_xbin = NULL, conf.level = 0.95, X_name = "TIME", Y_name = "DV", subject_name = "ID", MissingDV = NULL, DV_point = TRUE, plot_caption = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
B |
Number of bootstrap samples. |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calcuated using optK function. |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
subject_name |
Name of subject variable in orig_data (usually "ID" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
DV_point |
Draw point (X, Y) in the plot if TRUE; omit if FALSE. |
plot_caption |
Put caption with additional information if TRUE; omit if FALSE. |
plot_flag |
Draw plot if TRUE; generate data for drawing plot if FALSE. |
linesize |
Size of line in the plot. |
pointsize |
Size of point in the plot. |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins. |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
Arguments to be passed to methods. |
bootVPC plot or the values to draw bootVPC plot.
Post, T. M., et al. (2008) Extensions to the visual predictive check for facilitate model performance evaluation, Journal of pharmacokinetics and pharmacodynamics, 35(2), 185-202
data(origdata) data(simdata) bootVPC(origdata,simdata,N_xbin=8)
data(origdata) data(simdata) bootVPC(origdata,simdata,N_xbin=8)
This function draws the detailed coverage plot for the specific prediction level to check over or under estimate regions in each prediction level. The percentages of observations above the prediction interval are calculated in each bin of the independent variable. Additionally, the percentages of observations below the prediction interval are calculated. The white dots in the plot represent the expected percentages.
coverageDetailplot(orig_data, sim_data, N_xbin = NULL, predL = 0.5, conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
coverageDetailplot(orig_data, sim_data, N_xbin = NULL, predL = 0.5, conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calcuated using optK function. |
predL |
Scalar of probability |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data) |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
Arguments to be passed to methods. |
the detailed coverage plot
Post, T. M., et al. (2008) Extensions to the visual predictive check for facilitate model performance evaluation, Journal of pharmacokinetics and pharmacodynamics, 35(2), 185-202
data(origdata) data(simdata) coverageDetailplot(origdata,simdata,predL=0.5,N_xbin=8)
data(origdata) data(simdata) coverageDetailplot(origdata,simdata,predL=0.5,N_xbin=8)
The coverage plot is developed to help visually check the fitted model with the NPC result. In each level of the predicted interval, the ratios between the expected number of points (Exp) outside the prediction interval and the observed number of data (Obs) outside the prediction interval are calculated. These ratios on the upper and lower sides of the prediction interval are calculated separately.
coverageplot(orig_data, sim_data, N_xbin = NULL, pred.level = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, plot_flag = TRUE, linesize = 0.7, pointsize = 1.5, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
coverageplot(orig_data, sim_data, N_xbin = NULL, pred.level = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, plot_flag = TRUE, linesize = 0.7, pointsize = 1.5, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calculated using optK function. |
pred.level |
Numeric vector of probabilities. |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
plot_flag |
Draw plot if TRUE; generate data for drawing plot if FALSE. |
linesize |
Size of line in the plot. |
pointsize |
Size of point in the plot. |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
Yhe maximum number of bins. |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
arguments to be passed to methods |
coverage plot
Holford N, & Karlsson M. (2008). "A tutorial on visual predictive checks, abstr 1434." Annual Meeting of the Populations Approach Group in Europe. www.page-meeting.org. 2008.
data(origdata) data(simdata) coverageplot(origdata,simdata,N_xbin=8)
data(origdata) data(simdata) coverageplot(origdata,simdata,N_xbin=8)
By various rules, find the best cutoff values for a given number of bins.
FindBestCut(X, K, beta = 0.2, ...)
FindBestCut(X, K, beta = 0.2, ...)
X |
A numeric vector to divide into K bins. |
K |
Number of bins. |
beta |
Additional parameter in the penalty. For more detailed explanation, see reference. |
... |
Arguments to be passed to methods. |
The best cutoff values to make K bins using X and the minimum within sums of square values for the binning
Lavielle, M. and Bleakley, K. (2011). Automatic data binning for improved visual diagnosis of pharmacometric models. Journal of pharmacokinetics and pharmacodynamics, 38(6), 861-871.
VPC automatic binning algorithm in PsN 5.0.0 manual.
data(origdata) FindBestCut(origdata$TIME,K=10)
data(origdata) FindBestCut(origdata$TIME,K=10)
Find quantiles of the original data.
findQuantile(Y, X, X_bin, probs=c(0.1,0.5,0.9),...)
findQuantile(Y, X, X_bin, probs=c(0.1,0.5,0.9),...)
Y |
A numeric vector whose sample quantiles are wanted. |
X |
A numeric vector corresponding to Y. |
X_bin |
Binning result from makeCOVbin function. |
probs |
A numeric vector of probabilities. |
... |
Arguments to be passed to methods. |
quantiles of Y using X_bin
data(origdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs time_bin = makeCOVbin(origdata$TIME,K=8,cutoffs = CUT) findQuantile(origdata$DV,origdata$TIME,X_bin=time_bin)
data(origdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs time_bin = makeCOVbin(origdata$TIME,K=8,cutoffs = CUT) findQuantile(origdata$DV,origdata$TIME,X_bin=time_bin)
Find quantiles of the simulated data using Rcpp
findSIMQ(SIM, X, Xbin, probs, confLevel, approx)
findSIMQ(SIM, X, Xbin, probs, confLevel, approx)
SIM |
A matrix of simulated data with only Y values collected. |
X |
A numeric vector corresponding to Y |
Xbin |
Binning result from makeCOVbin function |
probs |
A numeric vector of probabilities |
confLevel |
Confidence level of the interval. |
approx |
Arguments to be passed to methods |
quantiles of SIM using xbin
data(origdata) data(simdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs time_bin = makeCOVbin(origdata$TIME,K=8,cutoffs = CUT) findSIMQ(simdata,origdata$TIME,Xbin=time_bin,probs=c(0.1,0.5,0.9), confLevel=0.95,approx=FALSE)
data(origdata) data(simdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs time_bin = makeCOVbin(origdata$TIME,K=8,cutoffs = CUT) findSIMQ(simdata,origdata$TIME,Xbin=time_bin,probs=c(0.1,0.5,0.9), confLevel=0.95,approx=FALSE)
Find quantiles of the simulated data.
findSIMQuantile(sim_data, X, X_bin, probs = c(0.1,0.5,0.9), conf.level = 0.95, approx = FALSE, ...)
findSIMQuantile(sim_data, X, X_bin, probs = c(0.1,0.5,0.9), conf.level = 0.95, approx = FALSE, ...)
sim_data |
A matrix of simulated data with only Y values collected. |
X |
A numeric vector corresponding to Y. |
X_bin |
Binning result from makeCOVbin function. |
probs |
A numeric vector of probabilities. |
conf.level |
Confidence level of the interval. |
approx |
Arguments to be passed to methods |
... |
Arguments to be passed to methods |
quantiles of sim_data using X_bin
data(origdata) data(simdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs time_bin = makeCOVbin(origdata$TIME,K=8,cutoffs = CUT) findSIMQuantile(simdata,origdata$TIME,X_bin=time_bin)
data(origdata) data(simdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs time_bin = makeCOVbin(origdata$TIME,K=8,cutoffs = CUT) findSIMQuantile(simdata,origdata$TIME,X_bin=time_bin)
Discretise numeric value into a categorical variable using the user-defined breaks. If cutoffs and the number of bins (K) is NULL, find the best number of bins using the optK function and find the best cutoff values using the FindBestCut function.
makeCOVbin(X, K, cutoffs, adjust0bin = TRUE, ...)
makeCOVbin(X, K, cutoffs, adjust0bin = TRUE, ...)
X |
A numeric vector corresponding to Y. |
K |
Number of bins. |
cutoffs |
A numeric vector of two or more unique cut points. |
adjust0bin |
Adjust bin with 0 observation if TRUE. |
... |
Arguments to be passed to methods. |
The result of binning and the summary of the binning results
Lavielle, M. and Bleakley, K. (2011). Automatic data binning for improved visual diagnosis of pharmacometric models. Journal of pharmacokinetics and pharmacodynamics, 38(6), 861-871.
data(origdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs makeCOVbin(origdata$TIME,K=8,cutoffs=CUT)
data(origdata) CUT = FindBestCut(origdata$TIME,8)$cutoffs makeCOVbin(origdata$TIME,K=8,cutoffs=CUT)
This function calculates the numerical predictive checks for each prediction level. For a given level of prediction, the predicted interval is calculated using the simulated data, and the number of observed data below the predicted interval is counted. The expected number of points below the predicted interval is also calculated and compared to the observed number.
NumericalCheck(orig_data, sim_data, N_xbin = NULL, pred.level = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
NumericalCheck(orig_data, sim_data, N_xbin = NULL, pred.level = c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calcuated using optK function. |
pred.level |
Numeric vector of probabilities. |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins. |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
Arguments to be passed to methods. |
The result of numerical predictive check
Holford N, & Karlsson M. (2008). "A tutorial on visual predictive checks, abstr 1434." Annual Meeting of the Populations Approach Group in Europe. www.page-meeting.org. 2008.
Harling, Uekcert, K. 2018. VPC and NPC User Guide. ICON plc.
https://github.com/UUPharmacometrics/PsN/releases/download/4.9.0/vpc_npc_userguide.pdf.
data(origdata) data(simdata) NumericalCheck(origdata,simdata,N_xbin=8)$NPC
data(origdata) data(simdata) NumericalCheck(origdata,simdata,N_xbin=8)$NPC
This function automatically finds the optimal number of bins using dynamic programming.
optK(X, Kmethod = "cluster", maxK = 10, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
optK(X, Kmethod = "cluster", maxK = 10, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
X |
Numeric vector corresponding to Y. |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins. |
beta |
Additional parameter for automatic binning. For more detailed explanation, see reference. |
lambda |
Additional parameter for automatic binning. For more detailed explanation, see reference. |
R |
Additional parameter for automatic binning. For more detailed explanation, see reference. |
C1 |
Additional parameter for automatic binning. For more detailed explanation, see reference. |
C2 |
Additional parameter for automatic binning. For more detailed explanation, see reference. |
... |
Arguments to be passed to methods. |
The optimal number of bins, the result of binning, and the summary of binning including the penalty values up to the maximum number of bins are returned.
Lavielle, M. and Bleakley, K. (2011). Automatic data binning for improved visual diagnosis of pharmacometric models. Journal of pharmacokinetics and pharmacodynamics, 38(6), 861-871.
data(origdata) optK(origdata$TIME)
data(origdata) optK(origdata$TIME)
The simulated Theoph data frame has 132 rows and 3 columns of data from an experiment on the pharmacokinetics of theophylline.
ID |
An ordered factor with levels 1, ..., 12 identifying the subject on whom the observation was made. The ordering is by increasing the maximum concentration of theophylline observed. |
TIME |
Time since drug administration when the sample was drawn (hr). |
DV |
Theophylline concentration in the sample (mg/L). |
data(origdata) dim(origdata)
data(origdata) dim(origdata)
The quantified visual predictive check visually represents actual and unavailable observations around predicted medians, regardless of the density or shape of the observed data distribution, through the form of a percent.
quantVPC(orig_data, sim_data, N_xbin = NULL, prob = 0.5, X_name = "TIME", Y_name = "DV", MissingDV = NULL, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
quantVPC(orig_data, sim_data, N_xbin = NULL, prob = 0.5, X_name = "TIME", Y_name = "DV", MissingDV = NULL, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calcuated using optK function. |
prob |
Scalar of probability. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins. |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
Arguments to be passed to methods. |
quantVPC plot
Post, T.M., et al. (2008) Extensions to the visual predictive check for facilitate model performance evaluation, Journal of pharmacokinetics and pharmacodynamics, 35(2), 185-202
data(origdata) data(simdata) quantVPC(origdata,simdata,prob=0.5,N_xbin=8)
data(origdata) data(simdata) quantVPC(origdata,simdata,prob=0.5,N_xbin=8)
Simulation data from the fitted model of the origdata
data(simdata) dim(simdata)
data(simdata) dim(simdata)
This function draws the original visual predictive check plot proposed by Holford & Karlsson (2008). The visual predictive check plot is a graphical comparison of the distribution of observations and simulated data from the fitted model. In the "scatter" type of the VPC plot, dots indicate the observed data. Two dashed blue lines and one solid line represent profiles of percentiles of the simulated data. If the fitted model represents the observed data well, most observed data are between two dashed blue lines. In the "percentile" type of the VPC plot, profiles of percentiles from the observed data are compared to profiles of percentiles from the simulated data. Red lines represent profiles from the observed data, and blue lines represent profiles from the simulated data. If the fitted model represents the observed data well, two profiles in each percentile - one from the original data and the other from the simulated data - are similar. In the "CI" type of the VPC plot, sky blue and pink areas represent the confidence areas of the profile in each percentile. These confidence areas were calculated from the simulated data. In this plot, it is necessary to verify that the profiles of the original data are in confidence areas of each profile from the simulated data in each percentile. If each percentile line of the observed data is in the corresponding confidence area, this can be evidence that the fitted model represents the observed data quite well. Otherwise, the fitted model needs to be improved.
VPCgraph(orig_data, sim_data, type = "CI", N_xbin = NULL, probs = c(0.1,0.5,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, DV_point = TRUE, CIvpc_type = "line", bin_grid = TRUE, plot_caption = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, captionsize = 10, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
VPCgraph(orig_data, sim_data, type = "CI", N_xbin = NULL, probs = c(0.1,0.5,0.9), conf.level = 0.95, X_name = "TIME", Y_name = "DV", MissingDV = NULL, DV_point = TRUE, CIvpc_type = "line", bin_grid = TRUE, plot_caption = TRUE, plot_flag = TRUE, linesize = 0.7, pointsize = 0.7, captionsize = 10, Kmethod = "cluster", maxK = NULL, beta = 0.2, lambda = 0.3, R = 4, C1 = 2.5, C2 = 7.8, ...)
orig_data |
A data frame of original data with X and Y variable. |
sim_data |
A matrix of simulated data with only Y values collected. |
type |
Type of VPC graph; "CI", "percentile", or "scatter". |
N_xbin |
Number of bins in X variable. If NULL, optimal number of bins are automatically calcuated using optK function. |
probs |
A numeric vector of probabilities. |
conf.level |
Confidence level of the interval. |
X_name |
Name of X variable in orig_data (usually "TIME" in pharmacokinetic data). |
Y_name |
Name of Y variable in orig_data (usually "DV" in pharmacokinetic data). |
MissingDV |
Name of missing indicator variable in orig_data, which have value 1 if missing, value 0 otherwise. (usually "MDV" in pharmacokinetic data). |
DV_point |
Draw point (X, Y) in the plot if TRUE; omit if FALSE. |
CIvpc_type |
Type of CI area in VPC graph; "line" or "segment". |
bin_grid |
Draw grid lines for binning in X variable if TRUE; omit if FALSE. |
plot_caption |
Put caption with additional information if TRUE; omit if FALSE. |
plot_flag |
Draw plot if TRUE; generate data for drawing plot if FALSE. |
linesize |
Size of line in the plot. |
pointsize |
Size of point in the plot. |
captionsize |
Size of caption . |
Kmethod |
The way to calculate the penalty in automatic binning."cluster" or "kernel". |
maxK |
The maximum number of bins. |
beta |
Additional parameter for automatic binning, used in optK function. |
lambda |
Additional parameter for automatic binning, used in optK function. |
R |
Additional parameter for automatic binning, used in optK function. |
C1 |
Additional parameter for automatic binning, used in optK function. |
C2 |
Additional parameter for automatic binning, used in optK function. |
... |
Arguments to be passed to methods. |
Visual predictive check plot or the values to draw VPC plot.
Holford N, & Karlsson M. (2008). "A tutorial on visual predictive checks, abstr 1434." Annual Meeting of the Populations Approach Group in Europe. www.page-meeting.org. 2008.
Harling, Uekcert, K. 2018. VPC and NPC User Guide. ICON plc.
https://github.com/UUPharmacometrics/PsN/releases/download/4.9.0/vpc_npc_userguide.pdf.
data(origdata) data(simdata) VPCgraph(origdata,simdata,type="CI",X_name="TIME",Y_name="DV",N_xbin=8)
data(origdata) data(simdata) VPCgraph(origdata,simdata,type="CI",X_name="TIME",Y_name="DV",N_xbin=8)