I have a question which should be a failry common question, but for which I can not find any reference. For simplicity, we will assume that our variables are all i.i.d and normally distributed. I take a sample of some incoming parts, and measure a dimension. I obtain a mean m, and a standard deviation s. I also have an engineering specification which says that this dimension should be between LL and UL (lower and upper limits). I am trying to figure out, based on what I measured on the sample, the interval (min and max) proportion of parts I could expect to be "in spec". I.e. some interval which says that at least min% of the parts can be expected in spec, and at most max% of the parts can be expected to be in spec. I could use the standard normal distribution, but this assumes that I know the sample mean and standard deviation, which I do not (only have an estimate). So what I compute with the Z distribution will underestimate [min, max], as it does not account for the expected variability in the measured m and s statistics. I am not trying to get a tolerance interval (based on the normal distribution): that would tell be that P% will be within a given interval at a certain confidence level. I am trying to get basically the reverse: given an interval [LL, UL], what percentage of observations could lie in this interval, at a given confidence level. It would seem to be a typical problem for any manufacturing operation, but I am drawing blanks? Thaks
2 Answers
Let $X$ denote the random variable from the Normal distribution of which all realizations (parts) come,
$$X \sim N(\mu_x , \sigma_x^2).$$
Set ($\Phi$ is the standard Normal CDF) $$LL \equiv Q_L \implies \Pr(X \leq Q_L) = \Phi\left(\frac{Q_L - \mu_x}{\sigma_x}\right)$$
$$LU \equiv Q_U \implies \Pr(X \leq Q_U) = \Phi\left(\frac{Q_U - \mu_x}{\sigma_x}\right)$$
The theoretical "within specs" interval (a proportion) is therefore $$R_T = \Phi\left(\frac{Q_U - \mu_x}{\sigma_x}\right) - \Phi\left(\frac{Q_L - \mu_x}{\sigma_x}\right) \equiv \Phi_U - \Phi_L.$$
The right-hand-side is the difference of two distribution functions. Their sample analogue is the difference of the corresponding empirical distribution functions, which result in your $R$ becoming a random variable, with $n$ being the sample size
$$R_S = \frac 1n \sum_{i=1}^n I\{x_i \leq Q_U\} - \frac 1n \sum_{i=1}^n I\{x_i \leq Q_L\}$$
or compactly
$$R_S = \widehat F(Q_U) - \widehat F(Q_L).$$
Then, the limiting distribution of $ R_S$ (based on the CLT for empirical distribution functions) is
$$\sqrt{n}\left(R_S - R_T\right) \to_d N(0, {\rm Avar})$$
$${\rm Avar} = \Phi_U(1-\Phi_U) + \Phi_L(1-\Phi_L) -2\Phi_L(1-\Phi_U)$$
So the finite-sample approximate distribution (after some $n$-size) is
$$R_S \sim_{approx} N(R_T, \frac 1n{\rm Avar}).$$
Now you have a distribution for your $R$, and a mean and variance that you can estimate, and so you can determine an $R_{min}$ and an $R_{max}$ with a given probability.
PS
We have $${\rm Var}(R_S) = {\rm Var}(\widehat F(Q_U)) + {\rm Var}(\widehat F(Q_L)) - 2{\rm Cov}(\widehat F(Q_U),\widehat F(Q_L)) .$$
Using the i.i.d assumption, which means among other things that $widehat F$ is unbiased, and the properties of indicator functions, we have
$${\rm Var}(\widehat F(Q_U)) = \frac 1n \Phi_U(1-\Phi_U),\quad {\rm Var}(\widehat F(Q_L)) = \frac 1n \Phi_L(1-\Phi_L),$$
while
$${\rm Cov}(\widehat F(Q_U),\widehat F(Q_L)) = E\left(\frac 1n \sum_{i=1}^n I\{x_i \leq Q_U\}\cdot \frac 1n \sum_{i=1}^n I\{x_i \leq Q_U\}\right) - \Phi_L\Phi_U.$$
The remaining expected value is $$E\left(\frac 1n \sum_{i=1}^n I\{x_i \leq Q_U\}\cdot \frac 1n \sum_{i=1}^n I\{x_i \leq Q_U\}\right) = $$
$$=\frac 1 {n^2} E\left\{\sum_{i=1}^n I\{x_i \leq Q_U\}\cdot \{x_i \leq Q_L\}+ \sum_{i=1}^n \left[I\{x_i \leq Q_U\}\cdot \left(\sum_{j\neq i}^n I\{x_j \leq Q_L\}\right)\right]\right\}$$
$$=\frac 1n \Phi_L + \frac{n-1}{n}\Phi_L\Phi_U.$$
So
$${\rm Cov}(\widehat F(Q_U),\widehat F(Q_L)) = \frac 1n \Phi_L + \frac{n-1}{n}\Phi_L\Phi_U - \Phi_L\Phi_U = \frac 1n \Phi_L(1-\Phi_U).$$
This is basically a variation of the prediction interval. Consider your sample of incoming parts as independent realisations $(x_1, \cdots, x_n)$ generated from some process $X\sim N(\mu, \sigma)$ (let's assume it's normally distributed).
From them, you calculate the sample mean $\hat\mu$ and the sample standard deviation $\hat \sigma$ according to the standard formulae. We now have an estimate of $X$. This is $\hat X \sim N(\hat\mu, \hat\sigma)$.
We are then interested in knowing the proportion of parts which lie within the interval $(\text{LL}, \text{UL})$. This is the simple calculation $Pr(\text{LL} < \hat X < \text{UL})$, which you can calculate easily from most statistical packages.
This is probably good enough to get by with. We have ignored the fact that $\hat\mu$ and $\hat\sigma$ each have uncertainty associated with them. If this worries you, you could do a bootstrap to account for this. But if your sample size $n$ is large enough it's probably not worth worrying about.
-
$\begingroup$ Thanks for the answer. As you indicated, this is the "basic" answer; just look it up in a Z table, and I would have my answer. But then all I get a a point estimate of that proportion (just like I got a point estimate of the mean and sd). $\endgroup$ Commented Feb 18, 2023 at 23:20
-
$\begingroup$ Thanks for the answer. As you indicated, this is the "basic" answer; just look it up in a Z table, and I would have my answer. But then all I get a a point estimate ̂p of that proportion (just like I got a point estimate of the mean and sd). What I am really after is the "confidence interval" of the proportion, e.g. there is 95% confidence that we will find between p1 and p2 inside (LL, UL). And indeed p1 and p2 will take into account the uncertainties on μ^ and σ^. I have not found any source on this... $\endgroup$ Commented Feb 18, 2023 at 23:26
-
$\begingroup$ Tbh I'd probably just try a bootstrap method. $\endgroup$– Alex JCommented Feb 19, 2023 at 23:01