Shiny Tools for Sample Size
Calculation in Process Performance
Qualification of Large Molecules
Qianqiu (Jenny) Li, Bill Pikounis
May 24, 2017
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
0 of 49
Outline
Overview
Shiny Tools & Statistical Methods
Q/A
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
1 of 49
Overview: Process Validation (PV)
What is process validation?
Process validation is not a one-time milestone event
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
2 of 49
Overview: PV Guidance
1978 CGMP: Validation
2011 FDA PV Guidance (obsolete the 1987
document)
“The sampling plan, including sampling points, number
of samples, and the frequency of sampling for each unit
operation and attribute. The number of samples should
be adequate to provide sufficient statistical confidence of
quality both within a batch and between batches.”
“Before any batch from the process is commercially
distributed for use by consumers, a manufacturer should
have gained a high degree of assurance in the
performance of the manufacturing process such that it
will consistently produce APIs and drug products
meeting those attributes relating to identity, strength,
quality, purity, and potency.”
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
3 of 49
Overview: PV Guidance
2014 EU PV Guidance: “sampling plan -
where, when and how the samples are taken;”
DS-VAL-68021: Janssen R&D Position Paper to
Address Statistically Based Sampling Plan for
Process Validation Stage 2 (Process Performance
Qualification)
Others:
PDA Tech Report 60
Canadian
WHO
ICH Q7, Q8, Q9, Q10, etc
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
4 of 49
Overview: PPQ
Rationale of PPQ Designs/Sampling Plans
To fulfil regulatory expectations: e.g., the
FDA PV guidance states “the level of sampling
and testing in validation must provide statistical
assurance that the process is reproducible and
consistently delivers quality products”.
To evaluate process performance: via critical
quality attributes (CQAs) using the samples from
the intended manufacturing process; including
process input parameters in the design/sampling
plan;
To gain benefits: Quality, Consumers, Business
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
5 of 49
Overview: PPQ
Number of PPQ Batches
Mainly influenced by product knowledge, process
and risk understanding, control strategy,
feasibility (e.g., production rate), etc.
Statistically supported by
process-specific tolerance intervals for CQAs
with acceptance ranges
Batch failure rates via Beta-Binomial Bayesian
approach
Others (e.g., process capability indices)
Number of Samples within Batches:
Primary Objective of Shiny Tools
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
6 of 49
Overview: Sampling Plan References
ANSI/ASQ Z1.4 & ISO 2859-1 (MLD-STD-105E; AQL
attribute sampling plans; single/double/multiple; lot size;
inspection level)
ANSI/ASQ Z1.9 (MLD-STD-414; variable sampling
plans; AQL: 0.04%~15%; also depend on lot size, etc)
ASTM E122-17:
𝑛 = 3𝜎0 𝐸 2 or 𝑛 = 3𝑉0 𝑒 2 : 𝐸 = 𝑀𝑎𝑥 𝐴𝑐𝑐𝑒𝑝𝑡𝑎𝑏𝑙𝑒
𝜇−𝜇
𝑉0 =
𝜎0
𝜇
𝑛 = 3𝜎0 𝐸 2 1 + 2 𝑓 : 𝑓 is the DF for 𝜎0
ASTM E2334 (Binary with 0% observed defect rate;
sample size vs upper confidence limit of defect rate)
ASTM E2709 (Lot conformance rate w.r.t. USP dosage
uniformity test; maximum tolerable RSD vs average
given different sample sizes)
ASTM E2587 (control charts), ASTM E2281 (Cpk, Ppk)
Compendial (e.g., USP <905>, <1010> (𝑛 ≥
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
2𝜎 2
)
𝛿2
)
7 of 49
Overview:
Continuous
Shiny Tools
Data
Type?
Binary
Others
Multi-factor
historical
data?
Yes
VarCompLM
Consult a
statistician
RiskBinom
No
Results for means & variances
SSNormTI
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
8 of 49
Overview: Shiny Applications
What is Shiny?
An R package for interactive web applications
based on R analytics, without need of HTML
CSS, or JavaScript knowledge
End Users
Shiny App
R-based
Resource
http://shiny.rstudio.com/
https://www.rstudio.com/resources/webinars/
for updates: http://blog.rstudio.org
Versions: 0.13~0.14(2016); 1.0(Jan 2017)
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
9 of 49
Overview: Shiny Applications
Build up a Shiny App
Preparation:
- RStudio
- R packages (shiny, shinyFiles, ggplot2, xlsx,
readxl, tolerance, nlme, etc)
- Others (e.g., R functions, Packrat, data, images)
ui.R & server.R (Prior to Shiny 0.10; ui.R: the user
interface defines the structuring part of the app;
server.R: makes the app get its content)
or App.R (with Shiny 0.10.2~; including ui.R &
server.R; at last row: shinyApp(ui=ui,server=server))
Shiny app (on a Shiny server or Rstudio Connect; run from
Rstudio, a URL, Gists on Github, in the cloud Shinyapps.io)
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
10 of 49
Overview: Shiny Applications
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
11 of 49
Overview: Shiny Applications
Example App.R
ui <- shinyUI(pageWithSidebar(
headerPanel("Hello Shiny!"),
sidebarPanel(
sliderInput("nobs", "Number of Data Points:",
min = 0, max = 1000, value = 500)),
mainPanel( plotOutput("distPlot")) # plot of simulation data
))
server <- shinyServer(function(input,output) {
output$distPlot <- renderPlot({
dist <- rnorm(input$nobs)
hist(dist) })
})
shinyApp(ui=ui, server=server)
Reference: http://shiny.rstudio.com/articles/app-formats.html
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
12 of 49
Overview: SSNormTI
For sampling plans of continuous CQAs via normal tolerance intervals
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
13 of 49
Overview: SSNormTI
Specified
1-Sided Batch TIs: 𝑌.. + 𝑜𝑟 − 𝐾1 𝜎𝐸
Exact, Natrella (1963)
2-Sided Batch TIs: 𝑌.. ± 𝐾2 𝜎𝐸
Close to Exact for 𝐾2 : using Eq (2.3.4)
in Krishnamoorthy & Mathew (2009)
Howe (1969)
1-Sided Process TIs
Mee & Owen (1983)
Hoffman (2010)
Krishnamoorthy & Mathew (2004)
2-Sided Process TIs
Mee (1984)
Hoffman & Kringle (2005)
Krishnamoorthy & Lian (2011)
Not
Specified
Batch TIs are
used to calculate
sample sizes via
DIR approach
FW approach
YZGO approach
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
14 of 49
Overview: VarCompLM
For prior information in sampling plans of continuous CQAs
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
15 of 49
Overview: RISKBinom
For sampling plans of binary CQAs via consumer’s & producer’s risk rates
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
16 of 49
Tools & Methods: SSNormTI
For a CQA with Acceptance Range: taking the
Three-Step Procedure as recommended by DSVAL-68021
criticality analysis report: to help define coverage
probability and confidence level of the tolerance intervals
prior knowledge: to help specify distribution &
parameter estimates
numbers of samples: e.g., minimum n to control
normal tolerance intervals within the acceptance range
For a CQA without Acceptance Range: to use
statistical criteria (e.g., estimation accuracy); via
Faulkenberry & Weeks approach (1968); to consider
other CQAs (e.g., sampled simultaneously)
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
17 of 49
Tools & Methods: SSNormTI
EMS & EMS-Based Variances under One-Way Random Effects Models
One-way Random Effects Model: 𝑌𝑖𝑘 = 𝜇 + 𝐴𝑖 + 𝐸𝑘
𝑖
𝒀𝒊𝒌 is the k-th observation from the i-th level of A (e.g., batch)
𝜇 is the overall mean
With equal variances for 𝐴𝑖 and 𝐸𝑘 𝑖 , across all 𝑖 𝑎𝑛𝑑 𝑘,
𝑨𝒊 ~𝑁 0, 𝜎𝐴2
𝑖 = 1, ⋯ , 𝐼
𝑬𝒌 𝒊 ~𝑁 0, 𝜎𝐸2
𝑘 = 1, ⋯ , 𝐾𝑖
1
𝒀.. =
𝑁
𝐼
𝐾𝑖
𝑌𝑖𝑘
𝑖=1 𝑘=1
1
𝒀𝒊. =
𝐾𝑖
𝐾𝑖
2
𝑌𝑖𝑘
𝑘=1
𝐼
2
𝐾
𝑖=1 𝑖
𝑁 −
𝒏𝟎 =
𝑁 𝐼−1
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
𝐼
𝑵=
𝐾𝑖
𝑖=1
18 of 49
Tools & Methods: SSNormTI
EMS & EMS-Based Variances under One-Way Random Effects Models
Mean Squares
EMS
(MS)
Based on Balanced Data (Scenario for PPQ sample size calculation)
Source
DF
Sum of Squares (SS)
𝐼
A (or Batch) 𝑓𝐴 = 𝐼 − 1
𝑆𝑆𝐴 = 𝐾
𝐼
𝑌𝑖. − 𝑌..
𝑖=1
𝐾
Residual 𝑓𝐸 = 𝐼 𝐾 − 1 𝑆𝑆𝐸 =
Corrected
Total
𝑆𝑆𝐴
𝑀𝑆𝐴 =
𝐼−1
2
𝑌𝑖𝑘 − 𝑌𝑖.
2
𝑌𝑖𝑘 − 𝑌..
2
𝑀𝑆𝐸 =
𝑖=1 𝑘=1
𝐼
𝐾
𝑓𝑇 = 𝐼𝐾 − 1 𝑆𝑆𝑇 =
𝑆𝑆𝐸
𝐼 𝐾−1
𝜔𝐴2 =
𝜎𝐸2 + 𝐾𝜎𝐴2
𝜔𝐸2 = 𝜎𝐸2
𝑖=1 𝑘=1
Based on Unbalanced Data
𝐼
A
𝑓𝐴 = 𝐼 − 1
𝐾𝑖
𝑆𝑆𝐴 =
𝑌𝑖. − 𝑌..
2
𝑖=1 𝑘=1
𝐼 𝐾𝑖
Residual
Corrected
Total
𝑓𝐸 = 𝑁 − 𝐼 𝑆𝑆𝐸 =
𝑌𝑖𝑘 − 𝑌𝑖.
2
𝑌𝑖𝑘 − 𝑌..
2
𝑖=1 𝑘=1
𝐼 𝐾𝑖
𝑓𝑇 = 𝑁 − 1 𝑆𝑆𝑇 =
𝑆𝑆𝐴
𝑀𝑆𝐴 =
𝐼−1
𝑀𝑆𝐸 =
𝑆𝑆𝐸
𝑁−𝐼
𝜔𝐴2 =
𝜎𝐸2 + 𝑛0 𝜎𝐴2
𝜔𝐸2 = 𝜎𝐸2
𝝈𝟐𝑨 and 𝝈𝟐𝑬
are the
EMS-based
betweenand withinbatch
variances;
they can be
estimated
by letting
𝑴𝑺 ≈ 𝑬𝑴𝑺
𝑖=1 𝑘=1
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
19 of 49
Tools & Methods: SSNormTI
Batch Tolerance Intervals
One-Sided Tolerance Intervals: 𝑌.. + 𝑜𝑟 − 𝐾1 𝜎𝐸
Exact:𝐾1 = 𝑡1−𝛼,𝐾−1 𝑍𝑝 𝐾
Natrella (1963):𝐾1 =
𝑍𝑝 +
𝐾
𝑍𝑝2 −
𝑍2
1− 1−𝛼
2 𝐾−1
𝑍2
2
𝑍𝑝 − 1−𝛼
𝐾
𝑍2
1−𝛼
1−2 𝐾−1
Two-Sided Tolerance Intervals: 𝑌.. ± 𝐾2 𝜎𝐸
Close to Exact: 𝐾2 is the solution of integral
equation (2.3.4) in Krishnamoorthy & Mathew
(2009)
Howe (1969):𝐾2 =
𝐾−1 1+1/𝐾 𝑍 21+𝑝 2
2
𝜒𝛼,𝐾−1
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
20 of 49
Tools & Methods: SSNormTI
Process Tolerance Intervals under One-Way Random Effects Models
One-Sided
Tolerance Intervals
Two-Sided
Tolerance Intervals
Mee & Owen (1983)
Mee (1984)
Hoffman (2010)
Hoffman & Kringle (2005)
Krishnamoorthy & Mathew
(2004)
Krishnamoorthy & Lian
(2011)
All of the above TIs depends on:
Number of batches (I)
Number of samples within batches (K)
confidence level (1 − 𝛼);
coverage probability (𝑝)
𝑀𝑆𝐴 & 𝑀𝑆𝐸 (as functions of EMS-based variances)
Only Hoffman TIs depends on: 𝝈𝟐𝒀.. & 𝝈𝟐𝒀 (as
functions of 𝑀𝑆𝐴 & 𝑀𝑆𝐸)
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
21 of 49
Tools & Methods: SSNormTI
Mee-Owen Process Tolerance Intervals
One-Sided Tolerance Interval for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 (Mee & Owen 1983)
𝑌.. + 𝑜𝑟 − 𝐾𝑀𝑂 𝑐1 𝑀𝑆𝐴 + 𝑐2 𝑀𝑆𝐸
Where 𝐾𝑀𝑂 =
1
𝑡 ∗
𝐼𝐾𝑅0∗ 𝑓 ,1−𝛼
𝑧𝑝
𝐼𝐾𝑅0∗
,
𝑅0∗
=
𝑅 ∗ +1
𝐾𝑅∗ +1
and
Two-Sided Tolerance Interval for 𝑵 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 (Mee 1984)
𝑌.. ± 𝐾𝑀 𝑐1 𝑀𝑆𝐴 + 𝑐2 𝑀𝑆𝐸
Where 𝐾𝑀 =
1
1,𝑝,
𝐼𝐾𝑅∗0
𝑅∗ + 1
∗
𝑓 =
𝑓 ∗𝜒2
1
+𝐾
𝐼−1
𝑅∗
2
and 𝑅 ∗ = 𝑚𝑎𝑥 0,
2
+
𝜒𝑓2∗ ,𝛼
𝐾−1
𝐼𝐾 2
1
𝑀𝑆𝐴
−1
𝐾 𝑀𝑆𝐸 ∗ 𝐹𝑓𝐴 ,𝑓𝐸 ,1−𝛼
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
22 of 49
Tools & Methods: SSNormTI
Hoffman Process Tolerance Intervals
One-Sided Tolerance Interval for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 (Hoffman 2010)
𝑌.. + 𝑜𝑟 −
𝑧𝑝 𝜎𝑌2 +
𝐻1 𝑐1 𝑀𝑆𝐴
2
+ 𝐻2 𝑐2 𝑀𝑆𝐸
2
+ 𝑧1−𝛼 𝜎𝑌2..
𝑧𝑝 is the 100p% percentile of normal distribution; 𝝈𝟐𝒀.. = ℎ1 𝑀𝑆𝐴 + ℎ2 𝑀𝑆𝐸,
1
𝐼𝐾
ℎ1 = , ℎ2 =0, 𝐻1 =
1
𝐹𝛼,𝑓𝐴 ,∞
− 1, 𝐻2 =
1
𝐹𝛼,𝑓𝐸 ,∞
− 1, with 𝐹𝛼,𝑓,∞ as the lower
100 1 − 𝛼 % lower percentile of F distribution with 𝑓 𝑎𝑛𝑑 ∞ degrees of
freedom
Two-Sided Tolerance Interval for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 (Hoffman & Kringle 2005)
𝑌.. ± 𝑧
Where 𝑁𝑒 =
1+𝑝 2
1+
𝑐1 𝑀𝑆𝐴+𝑐2 𝑀𝑆𝐸
ℎ1 𝑀𝑆𝐴+ℎ2 𝑀𝑆𝐸
1
𝑁𝑒
𝜎𝑌2 +
𝐻1 𝑐1 𝑀𝑆𝐴
2
, 𝝈𝟐𝒀 = 𝑐1 𝑀𝑆𝐴 + 𝑐2 𝑀𝑆𝐸
+ 𝐻2 𝑐2 𝑀𝑆𝐸
1
𝐾
2
𝑤𝑖𝑡ℎ 𝑐1 = , 𝑐2 =1 −
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
1
𝐾
23 of 49
Tools & Methods: SSNormTI
Krishnamoorthy Process Tolerance Intervals
Via Modified Large-Sample Approximation
One-Sided Tolerance Interval for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 (Krishnamoorthy & Mathew
2004)
𝑌.. + 𝑜𝑟 − 𝑡𝑓𝐴 𝛿1 , 1 − 𝛼
𝑀𝑆𝐴
𝐼𝐾
𝑀𝑆𝐸
𝐼+
𝐼 𝐾 − 1 𝐹𝛼,𝑓𝐴,𝑓𝐸
𝑀𝑆𝐴
with 𝛿1 = 𝑧𝑝
Two-Sided Tolerance Interval for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 (Krishnamoorthy & Lian 2011)
𝑌.. ± 𝑧
1+𝑝 2
𝑈1−𝛼
2
Where 𝑈1−𝛼 = 𝑎1MSA+𝑎2 MSE+
𝑎1 MSA
𝑓𝐴
𝜒𝑓2 ,𝛼
𝐴
−1
2
+ 𝑎2 MSE
𝑓𝐸
𝜒𝑓2 ,𝛼
𝐸
−1
𝑎1 = 𝑐1 + ℎ1 , 𝑎2 = 𝑐2 + ℎ2
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
24 of 49
Tools & Methods: SSNormTI
Krishnamoorthy Process Tolerance Intervals
Via Generalized Pivotal Quantities
Assumptions:
2
𝑓𝐴 𝜔𝐴
~𝜒𝑓2𝐴
2
𝜔𝐴
and
2
𝑓𝐸 𝜔𝐸
~𝜒𝑓2𝐸
2
𝜔𝐸
are independent
Generalized pivotal quantities
• for
2
2 𝑓𝐴 𝜔𝐴
𝜔𝐴 : 2 ;
𝜒𝑓
𝐴
• for
𝑎𝐴 𝜔𝐴2
+
𝑎𝐸 𝜔𝐸2
for
2
2 𝑓𝐸 𝜔 𝐸
𝜔𝐸 : 2
𝜒𝑓
𝐸
𝑎𝐴 & 𝑎𝐸 𝑎𝑟𝑒 𝑘𝑛𝑜𝑤𝑛 𝑣𝑎𝑙𝑢𝑒𝑠 :
2
𝑓𝐴 𝜔𝐴
𝑎𝐴 2
𝜒𝑓
𝐴
+
2
𝑓𝐸 𝜔𝐸
𝑎𝐸 2
𝜒𝑓
𝐸
• for 𝜇 : Equation (5) in Krishnamoorthy & Mathew (2004)
One-Sided TI for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 : Krishnamoorthy & Mathew (2004)
Two-Sided TI for 𝐍 𝝁, 𝝈𝟐𝑨 + 𝝈𝟐𝑬 : Krishnamoorthy & Lian (2011)
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
25 of 49
Tools & Methods: SSNormTI
Precision-Based Calculation: using norm.ss()
Approach
Notes
• A quick back-of-the-envelope calculation
simply for planning purposes
• Without ensure any specific bounds relative
the nominal coverage probability
DIR: Owen (1964) • to
Population mean (mu.0) and SD (sig2.0)
are assumed known, thus the coverage
probability for a 2-sided TI is the central
proportion of the data population
FW:
Faulkenberry &
Weeks (1968)
• No direct guidance on setting P.prime and 𝛿
• No need to provide true or estimated values
of population mean and SD
• With use of historical data to help reduce
YGZO:
subjectivity in choosing P.prime and 𝛿
Young et al (2016) • the
Via frequentist and Bayesian approaches
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
26 of 49
Tools & Methods: SSNormTI
Precision-Based Calculation : DIR Approach
Goal: to find the minimum sample size 𝑛∗ to control the
tolerance interval within prespecified acceptance range
Without use of historical data
Inputs:
mean: mu. 0, SD: 𝑠𝑖𝑔2.0, specification range: spec (e.g., spec=c(70,NA))
confidence level: 1 − 𝛼, coverage probability: P
Tolerance intervals (within specification range)
2-sided: mu. 0 ± 𝑠𝑖𝑔2.0 ∗ 𝐾2 𝑛∗ , 𝛼, 𝑃
1-sided: mu. 0 + 𝑠𝑖𝑔2.0 ∗ 𝐾1 𝑛∗ , 𝛼, 𝑃 or mu. 0 + 𝑠𝑖𝑔2.0 ∗ 𝐾1 𝑛∗ , 𝛼, 𝑃
K factors 𝐾1 𝑛∗ , 𝛼, 𝑃 and 𝐾2 𝑛∗ , 𝛼, 𝑃 are calculated using
Owen approach (method=“OCT”)
K.factor(n=10,side=2,method=c("EXACT")) #[1] 4.436909
K.factor(n=10,side=2,method=c("OCT")) #[1] 4.703595
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
27 of 49
Tools & Methods: SSNormTI
Precision-Based Calculation : FW Approach
Faulkenberry & Weeks (1968): to determine a
sample size such that there is only a small probability
that the TI covers too large a proportion of the data
population:
𝑃𝑟 𝑇𝐼 𝐶𝑜𝑣𝑒𝑟𝑎𝑔𝑒 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 ≥ 𝑃. 𝑝𝑟𝑖𝑚𝑒 ≤ 𝛿
(𝑰𝑬𝟏)
Without use of historical data
Inputs:
𝑃. 𝑝𝑟𝑖𝑚𝑒 > P; 𝛿 (e.g., 0.01, 0.05, 0.1)
confidence level: 1 − 𝛼, coverage probability: P
Tolerance interval (TI):
𝑃𝑟 𝑇𝐼 𝐶𝑜𝑣𝑒𝑟𝑎𝑔𝑒 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 ≥ 𝑃 ≤ 1 − 𝛼 (𝑰𝑬𝟐)
Output 𝒏∗ : the smallest n such that two K factors
below are equal: 𝐾𝑗 𝑛, 𝑃′, 𝛿 = 𝐾𝑗 𝑛, 𝑃, 1 − 𝛼 𝑗 = 1 𝑜𝑟 2
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
28 of 49
Tools & Methods: SSNormTI
Precision-Based Calculation: YGZO Approach
Young et al (2016): modified FW approach with 𝑃. 𝑝𝑟𝑖𝑚𝑒
and 𝛿 determined by historical data (and hyper-parameters
and acceptance limits if specified)
With use of historical data
Inputs: prior hyper-parameters (𝜇0 ,𝜎02 ,𝑚0 > 0, 𝑛0 > 0);
used for calculation of Bayesian TI; if not specified, then
frequentist TI based on historical data will be calculated.
Priors: 𝜇|𝜎 ~ 𝑁
2
𝜎2
𝜇0 ,
𝑛0
and 𝜎 2 ~ 𝑆𝑐𝑎𝑙𝑒𝑑 − 𝑖𝑛𝑣 − 𝜒 2 𝑚0 , 𝜎02
When a scaled inverse chi-squared random variable 𝜒 2 𝜐, 𝜏 2 is divided by 𝜐𝜏 2 , it
results in an inverse chi-squared random variable with 𝜐 degrees of freedom.
Joint posterior distribution:𝑃 𝜇, 𝜎 2 = 𝑃 𝜇|𝜎 2 𝑃 𝜎 2 , with 𝑥 and 𝑆 2 as the
average and variance of the historical data, 𝑥 =
2
𝜇|𝜎 ~ 𝑁
𝜎2
𝑥,
𝑛0 +𝑛
𝑛0 𝜇0 +𝑛𝑥
, 𝑞2
𝑛0 +𝑛
=
𝑛 𝑛 𝑥−𝜇0 2
𝑚0 𝜎02 + 𝑛−1 𝑆 2 + 0
𝑛0 +𝑛
𝑚0 +𝑛−1
and 𝜎 2 ~ 𝑆𝑐𝑎𝑙𝑒𝑑 − 𝑖𝑛𝑣 − 𝜒 2 𝑚0 + 𝑛 − 1, 𝑞 2
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
29 of 49
Tools & Methods: SSNormTI
Precision-Based Calculation : YGZO Approach
Input: Relative Error 𝛿; if not specified, then 𝛿 = 𝑃𝑟 𝑁 𝜇0 , 𝜎02 ∈ 𝐶𝑎𝑙𝑐𝑢𝑙𝑎𝑡𝑒𝑑 𝑇𝐼 − 𝑃 𝑃
Calculated Tolerance Interval (TI):
2-sided Bayesian TI: 𝑥 ± 𝐾2 𝑛, 𝑛0 , 𝑚0 , 𝛼, 𝑃, 1 − 𝛼 𝑞, where 𝐾2 𝑛, 𝑛0 , 𝑚0 , 𝛼, 𝑃, 1 − 𝛼
satisfies
2 𝑛+𝑛0
𝜋
∞
𝑃
0
2
𝜒𝑚
0 +𝑛−1
>
2
𝑚0 +𝑛−1 𝜒1;𝑃
𝑧2
𝐾2 𝑛,𝑛0 ,𝑚0 ,𝛼,𝑃,1−𝛼 2
𝑒
−
𝑛+𝑛0 𝑧2
2
𝑑𝑧 = 1 − 𝛼
1-sided Bayesian TI: 𝑥 − 𝐾1 𝑛, 𝑛0 , 𝑚0 , 𝛼, 𝑃, 1 − 𝛼 𝑞 𝑜𝑟 𝑥 + 𝐾1 𝑛, 𝑛0 , 𝑚0 , 𝛼, 𝑃, 1 − 𝛼 𝑞
where 𝐾1 𝑛, 𝑛0 , 𝑚0 , 𝛼, 𝑃, 1 − 𝛼 =
1
𝑡
𝑛+𝑛0 𝑚0 +𝑛−1;1−𝛼
𝑛 + 𝑛0 𝑍𝑃
Frequentist TIs: using EXACT method via normtol.int()
Input: P.prime; if not specified, then it is given below, or 𝑃′ =
𝑃′ =
𝑃𝑟 𝑁 𝜇0 , 𝜎02
1+𝑃
2
𝑤𝑖𝑡ℎ𝑖𝑛 𝐴𝑐𝑐𝑒𝑝𝑡𝑎𝑛𝑐𝑒 𝐿𝑖𝑚𝑖𝑡(𝑠)
1+𝑃
2
if 𝑃′ ≤ P
𝑊𝑖𝑡ℎ𝑜𝑢𝑡 𝐴𝑐𝑐𝑒𝑝𝑡𝑎𝑛𝑐𝑒 𝐿𝑖𝑚𝑖𝑡(𝑠)
𝑊𝑖𝑡ℎ 𝐴𝑐𝑐𝑒𝑝𝑡𝑎𝑛𝑐𝑒 𝐿𝑖𝑚𝑖𝑡(𝑠)
Output 𝒏∗ : the smallest n such that the K factors below are equal
𝐾𝑗 𝑛, 𝑃′ , 𝛿 = 𝐾𝑗 𝑛, 𝑃, 1 − 𝛼
𝑗 = 1 𝑜𝑟 2
via Howe(1969) & EXACT methods for 𝐾2 & 𝐾1 , respectively; with adjustment if 𝑛∗ <4 or the above equation has no solution
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
30 of 49
Tools & Methods: SSNormTI
Illustration
The video will be sent separately
due to email size limitation
Shiny Tools for Sample Size Calculation in Process Performance
Qualification of Large Molecules
31 of 49
© Copyright 2025 Paperzz