SODF2: IV Dissolution similarity of tablets made at two manufacturing sites
Introduction
In this second example, we compare the dissolution profiles of a tablet product (SODF2) made at two different manufacturing sites, referred to as sites 1 and 2. We treat site 1 as the approved (or reference) site and site 2 as an unapproved (or test) site. We illustrate Bayesian model dependent tests of similarity based on both
Data description
We index the SODF2 manufacturing site with
Model description
Some key assumptions of this model
Conditional independence of sampling and prior events (i.e., all “~”s are iid).
Homogeneity of error variance,
as a function of time and mean % dissolution. This is an important assumption that is partially justified in this example. However, usually variance is lower near zero and 100% dissolution and higher near 50% dissolution.Lot and unit (tablet) effects can be approximated as linear effects on the 3 underlying Weibull coefficients (
, , and ).Covariance of lot effects are negligible. Actually this assumption has little justification. however, with only 6 lots the covariances are not well determined. So we assume they are zero.
The dissolution profile of all units (tablets) can be adequately described by a 3-parameter Weibull model. The Weibull model does have a good success history. However, there are other models that may be appropriate in various applications.
Hierarchical likelihood sampling model
The model is identical to that used in the accompanying SODF1 example, except that data from each manufacturing site are included. The data from each manufacturing site are fitted independently except that the same analytical standard deviation,
The variable names have been necessarily modified from the SODF1 example and are slightly different than those described in BMIPR Chapter 23. The variable names include an “
Prior model
Initially, more informative priors were employed, but these were gradually relaxed. The vague priors seemed to have little impact on the posterior estimates. Ultimately it was found that essentially “flat” priors gave essentially the same estimates as vague priors. It is possible that informative priors would be more appropriate scientifically and also might lead to better convergence properties.
Stan model code
# Create model for Stan
= "
modelString data {
int<lower=1> K;
int<lower=0> N1;
int<lower=1> NL1;
int<lower=1> NU1;
int<lower=1,upper=NL1> lot1[N1];
int<lower=1,upper=NU1> unit1[N1];
vector[N1] y1;
vector[N1] x1;
int<lower=0> N2;
int<lower=1> NL2;
int<lower=1> NU2;
int<lower=1,upper=NL2> lot2[N2];
int<lower=1,upper=NU2> unit2[N2];
vector[N2] y2;
vector[N2] x2;
}
transformed data {
vector[K] zero;
zero = rep_vector(0., K);
}
parameters {
real<lower=0> sigma;
cholesky_factor_corr[K] L1;
vector<lower=0>[K] sig_l1;
vector<lower=0>[K] sig_u1;
vector[K] beta_l1[NL1];
vector[K] beta_u1[NU1];
vector[K] mu1;
cholesky_factor_corr[K] L2;
vector<lower=0>[K] sig_l2;
vector<lower=0>[K] sig_u2;
vector[K] beta_l2[NL2];
vector[K] beta_u2[NU2];
vector[K] mu2;
}
transformed parameters {
vector[N1] wb1;
vector[K] theta1;
vector[N2] wb2;
vector[K] theta2;
matrix[K,K] C1 = L1 * L1';
matrix[K,K] C2 = L2 * L2';
matrix[K,K] Sigma_unit1 = quad_form_diag(C1, sig_u1);
matrix[K,K] Sigma_unit2 = quad_form_diag(C2, sig_u2);
for (n in 1:N1){
theta1 = mu1 + beta_l1[lot1[n]] + beta_u1[unit1[n]];
wb1[n] = theta1[1]*(1 - exp(-(x1[n]/exp(theta1[2]))^exp(theta1[3])));
}
for (n in 1:N2){
theta2 = mu2 + beta_l2[lot2[n]] + beta_u2[unit2[n]];
wb2[n] = theta2[1]*(1 - exp(-(x2[n]/exp(theta2[2]))^exp(theta2[3])));
}
}
model {
// Priors
//sigma ~ normal(0, 1);
//mu1[1] ~ normal(100, 320);
//mu1[2] ~ normal(0, 64);
//mu1[3] ~ normal(0, 64);
//sig_l1 ~ normal(0, 64);
//sig_u1 ~ normal(0, 64);
L1 ~ lkj_corr_cholesky(1);
//mu2[1] ~ normal(100, 320);
//mu2[2] ~ normal(0, 64);
//mu2[3] ~ normal(0, 64);
//sig_l2 ~ normal(0, 64);
//sig_u2 ~ normal(0, 64);
L2 ~ lkj_corr_cholesky(1);
// Likelihood
for (i in 1:NL1) beta_l1[i] ~ normal(0, sig_l1);
beta_u1 ~ multi_normal_cholesky(zero, diag_pre_multiply(sig_u1,L1));
y1 ~ normal(wb1, sigma);
for (i in 1:NL2) beta_l2[i] ~ normal(0, sig_l2);
beta_u2 ~ multi_normal_cholesky(zero, diag_pre_multiply(sig_u2,L2));
y2 ~ normal(wb2, sigma);
}
" # close quote for modelString
MCMC execution time
The code is set up to request 16,000 MCMC draws ( 4 chains of 4,000 draws each after warm up). This can take as long as 2 hours on a 4 core machine. Considerably fewer draws may be adequate. Some parameters appear poorly estimated and result in disappointing n_eff and Rhat (e.g.,
I recommend modifying the code to execute the stan() function and then save the StanFit object to disk. Then in subsequent executions (if needed) to adjust the code to read the StanFit object from disk.
As always, patience, persistence, perseverance, and due-diligence are in order to assure MCMC convergence. I have found it is helpful to purchase a rubber ducky and keep it nearby as you work. It can be a source of comfort and inspiration in times of stress.
[1] "2022-09-23 16:39:25 BST"
[1] "2022-09-23 16:39:30 BST"
Posterior statistical summary
[1] "Table 23.5: Posterior summary for two manufacturers of SODF2."
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
sigma 2.28017066 7.025449e-04 6.206215e-02 2.163255698 2.23742922 2.27871696 2.32099255 2.40476285 7803.78790 1.001072
sig_l1[1] 2.41475494 1.065102e-02 9.251326e-01 1.280218921 1.80139038 2.21653073 2.77658711 4.73453700 7544.41175 1.000619
sig_l1[2] 0.08747982 7.597702e-04 4.146739e-02 0.028806398 0.06055267 0.08070320 0.10552064 0.18841095 2978.85166 1.000249
sig_l1[3] 0.04950760 2.180364e-04 2.108883e-02 0.022171220 0.03542551 0.04539870 0.05846073 0.10212481 9355.07447 1.000367
sig_l2[1] 5.44518040 1.504359e-01 4.471154e+00 2.089350362 3.27963694 4.40631096 6.19202696 14.97376988 883.35754 1.004873
sig_l2[2] 0.39509036 8.253042e-03 3.268176e-01 0.152495805 0.23531278 0.31329146 0.44060345 1.13635348 1568.13228 1.003097
sig_l2[3] 0.06345259 1.007974e-03 5.697027e-02 0.004187357 0.03025603 0.05088474 0.07904362 0.20203897 3194.46283 1.001520
sig_u1[1] 1.35736328 4.726255e-03 2.195613e-01 0.939765040 1.20944367 1.35082682 1.49913433 1.79824680 2158.12957 1.002936
sig_u1[2] 0.15717111 1.324626e-04 1.256546e-02 0.134534303 0.14826410 0.15647380 0.16523001 0.18367945 8998.50843 1.000126
sig_u1[3] 0.02102480 1.281161e-03 1.136480e-02 0.001411619 0.01254504 0.02087509 0.02897995 0.04398608 78.68937 1.046081
sig_u2[1] 2.57945803 2.820568e-03 3.209238e-01 2.017568358 2.35490036 2.55983303 2.78010014 3.27259280 12945.85528 1.000201
sig_u2[2] 0.14196343 1.380837e-04 1.534317e-02 0.114786489 0.13130494 0.14076951 0.15153301 0.17492592 12346.54103 1.000104
sig_u2[3] 0.08866669 2.035069e-04 1.537214e-02 0.059796450 0.07825088 0.08823686 0.09844477 0.12028818 5705.72502 1.000291
C1[1,1] 1.00000000 NaN 0.000000e+00 1.000000000 1.00000000 1.00000000 1.00000000 1.00000000 NaN NaN
C1[1,2] 0.70624704 1.913693e-03 1.016140e-01 0.487182324 0.64336911 0.71382389 0.77706867 0.88431367 2819.43746 1.003651
C1[1,3] 0.14853170 9.950780e-03 3.834284e-01 -0.599322329 -0.12749011 0.15211476 0.43214202 0.85330828 1484.75306 1.002639
C1[2,1] 0.70624704 1.913693e-03 1.016140e-01 0.487182324 0.64336911 0.71382389 0.77706867 0.88431367 2819.43746 1.003651
C1[2,2] 1.00000000 4.578939e-19 5.131565e-17 1.000000000 1.00000000 1.00000000 1.00000000 1.00000000 12559.43236 0.999750
C1[2,3] 0.45586639 7.418190e-03 3.243305e-01 -0.358520931 0.28393129 0.50176243 0.69114552 0.93554032 1911.52397 1.001038
C1[3,1] 0.14853170 9.950780e-03 3.834284e-01 -0.599322329 -0.12749011 0.15211476 0.43214202 0.85330828 1484.75306 1.002639
C1[3,2] 0.45586639 7.418190e-03 3.243305e-01 -0.358520931 0.28393129 0.50176243 0.69114552 0.93554032 1911.52397 1.001038
C1[3,3] 1.00000000 4.784209e-19 5.283211e-17 1.000000000 1.00000000 1.00000000 1.00000000 1.00000000 12194.82910 0.999750
C2[1,1] 1.00000000 NaN 0.000000e+00 1.000000000 1.00000000 1.00000000 1.00000000 1.00000000 NaN NaN
C2[1,2] 0.36807151 1.197018e-03 1.336909e-01 0.085009391 0.28188831 0.37566302 0.46306393 0.60617986 12473.90228 1.000010
C2[1,3] -0.14239190 2.094871e-03 1.911487e-01 -0.497730810 -0.27689751 -0.14864541 -0.01537035 0.24669587 8325.83606 1.000362
C2[2,1] 0.36807151 1.197018e-03 1.336909e-01 0.085009391 0.28188831 0.37566302 0.46306393 0.60617986 12473.90228 1.000010
C2[2,2] 1.00000000 6.909260e-19 8.677163e-17 1.000000000 1.00000000 1.00000000 1.00000000 1.00000000 15772.20630 0.999750
C2[2,3] -0.51004753 1.404582e-03 1.401675e-01 -0.748983319 -0.61065500 -0.52228036 -0.42029909 -0.20380040 9958.65003 1.000241
C2[3,1] -0.14239190 2.094871e-03 1.911487e-01 -0.497730810 -0.27689751 -0.14864541 -0.01537035 0.24669587 8325.83606 1.000362
C2[3,2] -0.51004753 1.404582e-03 1.401675e-01 -0.748983319 -0.61065500 -0.52228036 -0.42029909 -0.20380040 9958.65003 1.000241
C2[3,3] 1.00000000 9.048801e-19 7.444731e-17 1.000000000 1.00000000 1.00000000 1.00000000 1.00000000 6768.86636 0.999750
mu1[1] 95.57517761 1.668159e-02 9.558253e-01 93.715785423 95.01577926 95.56262236 96.12219737 97.48783404 3283.08443 1.002009
mu1[2] 1.88329995 5.539943e-04 3.701418e-02 1.808017780 1.86141766 1.88330704 1.90494729 1.95778940 4464.01413 1.001386
mu1[3] 0.54360908 2.900954e-04 2.056420e-02 0.502194135 0.53178729 0.54368020 0.55568525 0.58442917 5025.06724 1.000151
mu2[1] 95.75226750 1.241873e-01 3.212510e+00 89.807536471 94.36059805 95.72847901 97.08067699 101.22728362 669.16771 1.006042
mu2[2] 1.56043740 7.020145e-03 2.266532e-01 1.132841981 1.46427397 1.55927301 1.65740267 1.99766039 1042.39302 1.001799
mu2[3] 0.50412983 7.496008e-04 3.943456e-02 0.425603647 0.48464568 0.50360980 0.52302921 0.58509991 2767.54094 1.001870
Comparison of observed and predicted % dissolution
The dissolution profiles for each unit are shown in Figure 23.5 below. Each of the 13 panels includes dissolution profiles for 12 tablets with symbols indicating individual observed dissolution values and lines joining corresponding Weibull model based predicted posterior mean values.
Posterior probability of similarity relative to the spheroidal similarity region
As described in the text, only the first
Letting
where
Figure 23.7 provides a kernal density estimate of the posterior distribution of
There is no universal regulatory standard for the minimum posterior probability of similarity, not should their be. From a scientific and risk management perspective, this minimum should depend on the consequences of non-similarity and decision errors in any particular application. However, this result seems low. Figure 23.6 below shows that the grand mean dissolution difference between sites at 5 minutes is greater than 10% which is consistent with the low posterior probability of similarity.
Posterior probability of similarity relative to a hyper-rectangular similarity region
An alternative definition of similarity is based on the proposal of Sathe et al (1996) who defined a hyper-rectangular region
where
Here, the superscript
Again, using the simple counting exercise to determine the proportion of posterior draws lying within the hyper-rectangular similarity region
A criticism of the