knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Functions for the determination of similarity of highly variable dissolution profiles of two drug formulations are provided. Estimation of f~1~, f~2~ and bootstrap f~2~ is implemented. In addition, functions following the model-independent MCR (multivariate confidence region) procedure and the T^2^-test for equivalence procedure are available.
A stable version of disprofas
can be installed from CRAN:
install.packages("disprofas")
The development version is available from GitHub by:
# install.packages("devtools") # devtools::install_github("piusdahinden/disprofas")
Example 1 illustrates how to solve a common problem by aid of the bootstrap f~2~ procedure proposed by Shah et al. (1998) using a data set containing the dissolution data of one reference batch and one test batch of n = 12 tablets each, i.e. the dissolution profiles of the % drug release observed at 0, 30, 60, 90 and 180 minutes (See Shah et al. (1998), Table 4).
``` {r example-1, message = FALSE} library(disprofas)
str(dip2)
res1 <- bootstrap_f2(data = dip2[dip2$batch %in% c("b0", "b4"), ], tcol = 5:8, grouping = "batch", rr = 200, new_seed = 421, use_ema = "no")
class(res1) summary(res1)
plot(res1)
### Example 2 *Example 2* illustrates how to solve a common problem by aid of the model-independent non-parametric multivariate confidence region (MCR) procedure proposed by Tsong et al. (1996) using a data set containing the dissolution data of one reference batch and one test batch of *n* = 6 tablets each, i.e. the dissolution profiles of the % drug release observed at 5, 10, 15, 20, 30, 60, 90 and 120 minutes (see Tsong et al. (1996), Table 1). ``` {r example-2, message = FALSE} library(disprofas) # Data frame str(dip3) # Perform estimation and print a summary res2 <- mimcr(data = dip3, tcol = 4:6, grouping = "batch") class(res2) summary(res2)
Example 3 illustrates how to solve a common problem by aid of the T^2^-test for equivalence procedure proposed by Hoffelder (2016) using a data set containing the dissolution data of one reference batch and one test batch of n = 12 capsules each, i.e. the dissolution profiles of the % drug release observed at 15, 20 and 25 minutes (see Hoffelder (2016), Figure 1 (data not shown in publication, but the data set is available on CRAN, package T2EQ, data set ex_data_pharmind
)).
``` {r example-3, message = FALSE} library(disprofas)
str(dip4)
res3 <- mimcr(data = dip4, tcol = 2:4, grouping = "type") summary(res3)
### Example 4 *Example 4* illustrates the tolerance interval approach proposed by Martinez & Zhao (2018) using the data set that was used in *Example 1*. In the graphical representation of the data, the data points of the reference batch are shown as grey dots, the data points of the test batch as red crosses, the average time course is shown as blue line and the associated tolerance interval limits (*TL*) as green, orange and red lines that are drawn at *TL*, *TL* ± S1 (5%) and *TL* ± S2 (15%), respectively. ``` {r example-4, message = FALSE} library(disprofas) # Data frame str(dip1) # Perform estimation and print a summary res4 <- mztia(data = dip1, shape = "wide", tcol = 3:10, grouping = "type", reference = "R") class(res4) summary(res4) # Prepare a graphical representation ggres4 <- plot_mztia(res4) class(ggres4) plot(ggres4)
Example 5 illustrates how to solve a common problem by aid of the model-dependent approach as proposed by Sathe, Tsong & Shah (1996) or by Tsong, Hammerstrom & Chen (1997).
In Example 5a, the data set shown in Table 4 of Tsong, Hammerstrom & Chen (1997) is used which contains the Weibull parameter estimates obtained from fitting of Weibull curves to the cumulative dissolution profiles of individual tablets of three reference batches and one test batch of n = 12 tablets each. First, a one-sample T^2^-test is performed with the Weibull parameters of the reference group only, followed by a two-sample T^2^-test to compare the Weibull parameters of the reference batches with the Weibull parameters of the test batch.
``` {r example-5a-step-1, message = FALSE} library(disprofas)
str(dip7) t_param <- c("alpha", "beta")
res1 <- get_T2_one(m = as.matrix(dip7[dip7$type == "ref", t_param]), mu = colMeans(as.matrix(dip7[dip7$type == "test", t_param])), signif = 0.05)
res2 <- get_T2_two(m1 = as.matrix(dip7[dip7$type == "ref", t_param]), m2 = as.matrix(dip7[dip7$type == "test", t_param]), signif = 0.05)
res1$Parameters res2$Parameters
Since in the current example we have a two-dimensional situation, the results can be illustrated graphically. Based on the reference batch parameter estimates, a (1−*signif*)100% confidence region (*CR*) can be constructed. All points on this *CR* have the same Mahalanobis distance. This distance sets the upper confidence limit (*UCL*). ``` {r example-5a-step-2, message = FALSE} # Stretch factor qfk <- as.numeric(sqrt(res2$Parameters["k"] / res2$Parameters["K"] * res2$Parameters["F.crit"])) # Cholesky decomposition, scaling and centering of confidence region RR <- chol(res2$covs$S.b1) # chol(res1$cov) angles <- seq(0, 2 * pi, length.out = 200) ellipse <- qfk[1] * cbind(cos(angles), sin(angles)) %*% RR ellipseCtr <- sweep(ellipse, 2, res2$means$mean.b1, "+") # Determination of ucl ucl <- mahalanobis(x = ellipseCtr[1, ], center = res2$means$mean.b1, cov = res2$covs$S.b1)
The UCL allows checking which points lie outside the CR and which points lie inside.
``` {r example-5a-step-3, message = FALSE}
scores <- c(mahalanobis(x = as.matrix(dip7[dip7$type == "ref", t_param]), center = res2$means$mean.b1, cov = res2$covs$S.b1), mahalanobis(x = as.matrix(dip7[dip7$type == "test", t_param]), center = res2$means$mean.b1, cov = res2$covs$S.b1))
is_out <- scores > ucl
dip7[is_out, ]
These results are displayed graphically in the following figure. The points of the reference batches are shown as blue circles and the points of the test batch as red crosses. The *CR* boundary is shown as blue ellipse. The bold blue diamond represents the centre point of the ellipse. The points that have been identified to lie outside the *CR* are highlighted by yellow greek crosses. ``` {r example-5a-step-4, message = FALSE} op <- par(mar = c(2.5, 2.5, 1.2, 0.5), mgp = c(1.5, 0.5, 0), lwd = 1.5) { plot(dip7[dip7$type == "ref", t_param], asp = 1, xlim = c(0.3, 0.8), ylim = c(0.3, 0.8), pch = 1, col = "royalblue", xlab = "Weibull Scale Parameter (alpha)", ylab = "Weibull Shape Parameter (beta)") points(dip7[dip7$type == "test", t_param], pch = 4, col = "red") points(res1$means$mean.r[1], res1$means$mean.r[2], pch = 5, col = "royalblue", lwd = 2) lines(ellipseCtr, col = "royalblue") # Highlight the points detected to lie outside the confidence region points(dip7[is_out, t_param], pch = 3, col = "gold") }
In Example 5b, the data set shown in Table III of Sathe, Tsong & Shah (1996) is used which contains the Weibull parameter estimates obtained from fitting of Weibull curves to the cumulative dissolution profiles of individual tablets of one reference batch and one test / post-change batch with a minor modification and a second test / post-change batch with a major modification, n = 12 tablets each. One-sample T^2^-tests are performed with the Weibull parameters of the reference and the two test groups separately.
``` {r example-5b-step-1, message = FALSE} library(disprofas)
str(dip8)
d_dat <- dip8 d_dat[, c("alpha", "beta")] <- log(d_dat[, c("alpha", "beta")]) t_param <- c("alpha", "beta")
res1ref <- get_T2_one(m = as.matrix(d_dat[d_dat$type == "ref", t_param]), mu = colMeans(as.matrix(d_dat[d_dat$type == "ref", t_param])), signif = 0.05) res1min <- get_T2_one(m = as.matrix(d_dat[d_dat$type == "minor", t_param]), mu = colMeans(as.matrix(d_dat[d_dat$type == "minor", t_param])), signif = 0.05) res1maj <- get_T2_one(m = as.matrix(d_dat[d_dat$type == "major", t_param]), mu = colMeans(as.matrix(d_dat[d_dat$type == "major", t_param])), signif = 0.05)
res1ref$Parameters res1min$Parameters res1maj$Parameters
Since in the current example we have a two-dimensional situation, the results can be illustrated graphically. Based on the reference batch parameter estimates, a (1−*signif*)100% confidence region (*CR*) or similarity region, as it is called in the article from Sathe, Tsong & Shah (1996), can be constructed. All points on this *CR* have the same Mahalanobis distance. The distance obtained with the *CR* of the reference batches sets the upper confidence limit (*UCL*). ``` {r example-5b-step-2, message = FALSE} # Stretch factor qfk <- c(ref = as.numeric(sqrt(res1ref$Parameters["k"] / res1ref$Parameters["K"] * res1ref$Parameters["F.crit"])), min = as.numeric(sqrt(res1min$Parameters["k"] / res1min$Parameters["K"] * res1min$Parameters["F.crit"])), maj = as.numeric(sqrt(res1maj$Parameters["k"] / res1maj$Parameters["K"] * res1maj$Parameters["F.crit"]))) # Cholesky decomposition, scaling and centering of confidence region # Cholesky decomposition, scaling and centering of ellipse RR_ref <- chol(res1ref$cov) angles_ref <- seq(0, 2 * pi, length.out = 200) ellipse_ref <- qfk["ref"] * cbind(cos(angles), sin(angles)) %*% RR_ref ellipseCtr_ref <- sweep(ellipse_ref, 2, res1ref$means$mean.r, "+") RR_min <- chol(res1min$cov) angles_min <- seq(0, 2 * pi, length.out = 200) ellipse_min <- qfk["min"] * cbind(cos(angles), sin(angles)) %*% RR_min ellipseCtr_min <- sweep(ellipse_min, 2, res1min$means$mean.r, "+") RR_maj <- chol(res1maj$cov) angles_maj <- seq(0, 2 * pi, length.out = 200) ellipse_maj <- qfk["maj"] * cbind(cos(angles), sin(angles)) %*% RR_maj ellipseCtr_maj <- sweep(ellipse_maj, 2, res1maj$means$mean.r, "+") # Determination of ucl ucl <- mahalanobis(x = ellipseCtr_ref[1, ], center = res1ref$means$mean.r, cov = res1ref$cov)
The UCL allows checking which points lie outside the CR and which points lie inside of it.
``` {r example-5b-step-3, message = FALSE}
scores <- c(mahalanobis(x = as.matrix(d_dat[d_dat$type == "ref", t_param]), center = res1ref$means$mean.r, cov = res1ref$cov), mahalanobis(x = as.matrix(d_dat[d_dat$type == "minor", t_param]), center = res1ref$means$mean.r, cov = res1ref$cov), mahalanobis(x = as.matrix(d_dat[d_dat$type == "major", t_param]), center = res1ref$means$mean.r, cov = res1ref$cov))
is_out <- scores > ucl
d_dat[is_out, ]
Finally, the results collected above are displayed graphically for illustration. The black rectangle represents the *3 STD Similarity Region* as shown in Figure 4 in the article from Sathe, Tsong & Shah (1996). The points of the reference batch are shown as blue circles, the points of the minor modification batch as green crosses and the points of the major modification batch as magenta crosses. The *CR* boundaries are shown as ellipses that are coloured according to the corresponding data points. The bold diamonds coloured according to the corresponding data points represent the centre points of the ellipses. The points that have been identified to lie outside the *CR* of the reference batch are highlighted by yellow greek crosses. ``` {r example-5b-step-4, message = FALSE} op <- par(mar = c(2.5, 2.5, 1.2, 0.5), mgp = c(1.5, 0.5, 0), lwd = 1.5) t_multiple <- 3 { plot(d_dat[d_dat$type == "ref", t_param], asp = 1, xlim = c(-0.6, 0.6), ylim = c(-0.2, 0.6), pch = 1, col = "blue2", xlab = "ln(alpha)", ylab = "ln(beta)") points(d_dat[d_dat$type == "minor", t_param], pch = 4, col = "green3") points(d_dat[d_dat$type == "major", t_param], pch = 4, col = "magenta2") points(res1ref$means$mean.r[1], res1ref$means$mean.r[2], pch = 5, col = "blue2", lwd = 2) points(res1min$means$mean.r[1], res1min$means$mean.r[2], pch = 5, col = "green3", lwd = 2) points(res1maj$means$mean.r[1], res1maj$means$mean.r[2], pch = 5, col = "magenta2", lwd = 2) lines(ellipseCtr_ref, col = "blue3") lines(ellipseCtr_min, col = "green3") lines(ellipseCtr_maj, col = "magenta2") rect(xleft = t_multiple * -sqrt(diag(res1ref$cov))["alpha"] + res1ref$means$mean.r["alpha"], ybottom = t_multiple * -sqrt(diag(res1ref$cov))["beta"] + res1ref$means$mean.r["beta"], xright = t_multiple * sqrt(diag(res1ref$cov))["alpha"] + res1ref$means$mean.r["alpha"], ytop = t_multiple * sqrt(diag(res1ref$cov))["beta"] + res1ref$means$mean.r["beta"]) # Highlight the points detected to lie outside the confidence region points(d_dat[is_out, t_param], pch = 3, col = "gold") }
Pius Dahinden, Tillotts Pharma AG
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.