Calculate how many defective parts with p=0.95 After a 2 month test, there is a result of 5 defective parts out of the total sample size of 50 tested parts.
How many defective parts can be expected for an annual production of 70000 parts (p=0.95)?
I am not really understanding this, do I have to use some kind of distribution such as binomial, and why?
Thanks in advance :)
 A: There are a number of ways you can approach this problem, all of which will generally involve some kind of binomial model.  This model assumes that the defectivenss status of your items are independent with a fixed probability.  Assuming you are willing to follow this assumption, one simple method for your inference (but by no means the only method) is to form a confidence interval for the proportion of defective items and then adjust this estimate to take account of the finite population and the fact that you are making an inference about the number of defective items in an unsampled part of the total population.
In my humble opinion, the best confidence interval for a binomial proportion is the Wilson score interval.  Adjustment of the Wilson score interval to accomodate a finite population, and inference to an unsampled part, is available in O'Neill (2021).  It is implemented computationally in the CONF.prop function in the stat.extend package in R.  With the values you have specified, we could proceed as follows.
#Form 95% confidence interval for unsampled proportion
library(stat.extend)
CONF.INT <- CONF.prop(alpha = 0.05, sample.prop = 0.1, n = 50, N = 70050, unsampled = TRUE)
CONF.INT

        Confidence Interval (CI) 
 
95.00% CI for proportion for unsampled population of size 70000 
Interval uses 50 binary data points with sample proportion = 0.1000 

[0.0434635609661074, 0.213651620474345]

#Compute interval for number of defective items in unsampled part
round(CONF.INT*70000)

3042..14956

Here we obtain a prediction interval of 3042-14956 defective items in your unsampled group of 70000 items.  Note that the rounding that occurs in the above caculations is due to the fact that the Wilson score interval uses a normal/chi-squared approximation, which gives continuous bounds for the interval; for the prediction interval we can round this back to give discrete bounds on the answer.
