# Sample size and confidence level to verify existing data [duplicate]

I understand that to many this will be a frustratingly basic question which will not require much thought, but hopefully there are a few who can answer it anyway.

I have various sets of data on spreadsheets. Some worksheets have 900 rows of data and some have 15,000. There are many columns to each row, but essentially one row is one 'record'. The significant thing is that for each set of data, there is a finite and known population size.

I want to set up a 'checking' plan to provide me with a level of confidence (ideally without a tolerance, but if I have to have one then I have to have one). Each row (i.e. each record) on each worksheet can be correct or incorrect. There is no numerical variance, it is simply whether the data provided on each row accords to the various hard copy documents, data and calculations which feed into it.

My objective is to be able to state that I have reviewed the data and can say, with a given % confidence (and potentially tolerance, but ideally not), that the sample size I have examined (n) represents the larger population (N).

The ideal answer would provide me with a simple worked solution, but also a reference or several references to the genre of statistics that this exercise belongs in, so that I can go on to research it further and understand the basis for the worked solution provided. I understand that I may be looking at a huge sample size, but I want to investigate the various possibilities, for instance to be able to work the formula (optimistic that one exists) backwards to determine what % confidence I could have with an n sample size.

EDIT:

I have a spreadsheet with 1000 rows on it. In each row there is an invoice number and an invoice value, just two columns. I want to know whether all 1000 rows are correct, but I don't want to check all 1000 rows manually. How would I calculated a sample size for this (say 20, 50 or 75?) and what confidence level could I have that all 1000 were correct, if for example I checked 20 invoices and all 20 were correct.

## marked as duplicate by gung♦, Wayne, John, mdewey, Nick CoxOct 24 '16 at 21:15

• Welcome to Cross Validated! A "level of confidence" in what? What does it mean to say the sample "represents the larger population" (or that it doesn't)? What's "tolerance"? A more concrete explanation of what you're trying to find out might help. It rather sounds as if you're interested in estimating the no. correct rows in the population from the no. correct rows in the sample, quantifying the uncertainty in that estimate, & coming up with a sampling scheme to limit that uncertainty to a required degree. (Please change the title too - it's not very informative.) – Scortchi Oct 24 '16 at 16:18
• Hi - my objective is to be able to state that I have reviewed the data and can say, with a given % confidence (and potentially tolerance, but ideally not), that the sample size I have examined (n, i.e. the number of rows I have actually checked to be correct, or not) represents the larger population (N, i.e. the total number of rows in each data set). Hope that is clear? – Renter Oct 24 '16 at 16:24
• Your comment just seems to restate what you said in the question, but I think the edit clarifies things. See How to calculate a sample size for validating correct/incorrectness of records in a data table?. – Scortchi Oct 24 '16 at 16:42
• Thankyou. So in the link you have provided, if I want a 95% confidence level that there are zero invalid records in a population size of 1000, I would need to check 950? Assuming that is correct, if I were to required no more that 10 invalid records, what would the sample size be? – Renter Oct 24 '16 at 16:49
• Set $K=11$ & find an $n^*$ such that $f(0)\approx 0.05$. ($f(0)$ is a monotonically decreasing function of $n^*$, an integer, so trial & error or bisection search are fine.) – Scortchi Oct 25 '16 at 9:20

if you want to calculate the confidence intervals we need some more information let me give a basic example. I have asked five people in the class what their age is. I got the average age of those 5 people m=19.6 and the sample standard deviation to be s = 5.45.

Then I use estudents t test with degrees of freedom of n-1=5-1=4 at the 'classical' confidence level of 95 precent I get ( we need to take alpha/2=0.025).

upper bound = m + t(alpha/2) * (s/sqrt(n)) so we get 19.6 + 2.77 *(5.45/2.236) = 26.36

lower bound = 19.6 - 2.77 *(5.45/2.236) = 12.83 Thus the inference is, with confidence of 95% we can state that the population age is between 26.36 and 12.83. Hope this was useful.

• @Renter Check the student's T distribution to get t(alpha/2, n-1). Note that we use no Z score since we have no sigma for population. – Erik Hambardzumyan Oct 24 '16 at 16:33
• Ok let me try and give an example because this isn't working so far. – Renter Oct 24 '16 at 16:34
• I have a spreadsheet with 1000 rows on it. In each row there is an invoice number and an invoice value, just two columns. I want to know whether all 1000 rows are correct, but I don't want to check all 1000 rows manually. How would I calculated a sample size for this (say 20, 50 or 75?) and what confidence level could I have that all 1000 were correct, if for example I checked 20 invoices and all 20 were correct. – Renter Oct 24 '16 at 16:37
• @Renter I need more info you say "are correct" what is correct what do you measure? – Erik Hambardzumyan Oct 24 '16 at 16:40
• Correct - as in the value for a given invoice shown on the spreadsheet matches the hard copy invoice value. I am saying invoice as an example to try to represent my situation more simply. – Renter Oct 24 '16 at 16:43