I have 2,000 transactions and I have to check the accuracy of those transactions. I want to select a sample, check all transactions in this sample and make conclusions on population with 95 percent of confidence level. is there any formula for selecting the correct sample size? Please also give me advice about how to make a conclusion on the population.
-
2$\begingroup$ What exactly does it mean for a transaction to be accurate? Defining this will go a long way towards answering your question. $\endgroup$– DaveCommented Sep 26, 2019 at 20:50
-
$\begingroup$ In addition to the question that @Dave asks, what fraction of transactions do you expect to be inaccurate, and how narrow do you need your 95% CI to be? For example, if you expect 5% to be inaccurate, would 95% CI of 1%-9% be adequate, or do you need something tighter like 4%-6%? $\endgroup$– EdMCommented Sep 26, 2019 at 21:44
-
$\begingroup$ in my case accurate means that all parameters of transactions were specified correctly. inaccurate means at least one parameter in transaction is incorrect. @EdM I have no idea how much of transaction are accurate. confidence interval of 1-9 % would be adequate. $\endgroup$– ilia rukhadzeCommented Sep 27, 2019 at 7:31
1 Answer
What you have is a set of transactions, each of which is either accurate or inaccurate. Each binary inaccurate/accurate observation can be considered a Bernoulli trial. If this status of each transaction is independent of the others and each has the same probability of being inaccurate, then a set of such observations follows a binomial distribution. There are several approaches to estimating confidence intervals in this situation, explained on this Wikipedia page and this Cross Validated page.
The size of the sample you will need depends both on the fraction of inaccurate transactions and on how tight you want the "confidence level" to be. As you have no idea about the fraction of inaccurate cases to start, I recommend playing with the Jeffreys credible interval, based on the beta distribution, to get an idea of what will be involved. The credible intervals produced by such a Bayesian approach can more readily agree with intuition about "confidence levels" than the confidence intervals provided by standard frequentist analysis, and the Jeffreys interval "has good frequentist properties" too, as the Wikipedia page puts it.
This Shiny app can provide a useful graphical display of Jeffreys credible intervals for this situation. Choose the Jeffreys prior option, the credible level you want, and your choice of number of transactions observed and the number of "successes." (I'd recommend calling an inaccurate transaction a "success" but that is up to you.) The app then shows the estimated distribution of success probability values and the credible interval.
For example, say you analyze 50 randomly sampled transactions. If you find none inaccurate, that app provides a 95% credible interval for the fraction of inaccurate cases of [0, 0.049]. If you find 6 inaccurate, the interval is [0.052, 0.231]. If you find 20, the interval is [0.273, 0.538]. Playing with different possibilities will point the way forward as you start to analyze these cases. My guess is that if you sample about 50 transactions to start you will get a reasonable idea about the inaccuracy probability and the number of observations needed to get a narrow enough credible interval to meet your needs.