66
$\begingroup$

This is not a home work question but real problem faced by our company.

Very recently (2 days ago) we ordered for manufacturing of 10000 product labels to a dealer. Dealer is independent person. He gets the labels manufactured from outside and company make payment to the dealer. Each label cost exactly $1 to the company.

Yesterday, dealer came with labels but labels were bundled in a packet of 100 labels each. In this way there were total 100 packet and each packet contained 100 labels, so total 10000 label. Before making payment to the dealer of $10000, we decided to count few packet to ensure that each packet exactly contain 100 labels. When we counted the labels we found packet short of 100 labels (we found 97 labels). To ensure that this is not by chance but has done intentionally we counted 5 more packets and found following number of labels in each packet (including first packet) :

Packet Number    Number of labels
1                97 
2                98  
3                96
4                100
5                95 
6                97  

It was not possible to count each and every packet, so we decided to make payment on average basis. So, average number of labels in six packet is 97.166, so total payment decided was $9716.

I just want to know how statistician must have deal with such type of problem.
Further I want to know how much should we pay to get 95% assurance that we have not paid more than actual number of whole labels.

Additional information:

P(any packet contained more than 100 label)= 0
P(any packet contained label less than 90) =0 {labels less than 90 would be easily detected while counting packets because packet would be of lesser weight}


EDIT : Dealer simply denied of such malpractice. We found these dealer works on a specific commission which they get from the manufacturer on what is being paid by the company.When we communicated directly to manufacturer, we found that it is neither manufacturer nor dealer fault. Manufacturer said, “Labels gets short because sheets are not standardized in size, and whatever number is cut from the single sheet they get them bundle together in a packet”.

Further, we get validated our first assertion given in additional information, because manufacturer admitted that from marginal increase in size of sheet, it is not possible to cut additional labels, also, from a marginal reduction in size of sheet it is not possible to cut 100 labels of exactly same size.

$\endgroup$
14
  • 7
    $\begingroup$ +1 (1) How can you justify the first assertion in the "additional information" section? (2) How accurately can you weigh the packets? $\endgroup$
    – whuber
    Jan 21, 2016 at 15:12
  • 15
    $\begingroup$ England and Isaac Newton faced the very same problem 300 years ago. (The stakes were somewhat greater, because the "labels" in question were minted coins.) You therefore might enjoy reading Stephen Stigler's account of the Trial of the Pyx at stat.wisc.edu/sites/default/files/TR442_0.pdf . $\endgroup$
    – whuber
    Jan 21, 2016 at 17:26
  • 7
    $\begingroup$ @Neeraj If the weights of all items are consistent, why not just weigh the entire delivery? $\endgroup$
    – Sycorax
    Jan 21, 2016 at 19:45
  • 9
    $\begingroup$ Offer to pay $9000 and wait for them to say "But we only shorted you 600 not 1000" $\endgroup$ Jan 21, 2016 at 23:11
  • 5
    $\begingroup$ Aside from the great statistics question, +1, I wanted to share a more direct piece of advise from years in the printing business: all proper, professional printers have a overrun/underrun policy like this because most printers don't offer exact counts on anything that doesn't use "numbering" (individual serial numbers). But they should have an excellent count of what they gave you, and if shorted discount you if more than minor (5%, say). Charging full price for known underruns is NOT standard policy. $\endgroup$
    – BrianH
    Jan 22, 2016 at 18:10

7 Answers 7

20
$\begingroup$

I would be interested in feedback on the paragraph beginning "Upon reflection...", since particular part of the model has been keeping me up at night.

The Bayesian model

The revised question makes me think that we can develop the model explicitly, without using simulation. Simulation introduced additional variability due to the inherent randomness of sampling. Sophologists answer is great, though.

Assumptions: the smallest number of labels per envelope is 90, and the largest is 100.

Therefore, the smallest possible number of labels is 9000+7+8+6+10+5+7=9043 (as given by OP's data), 9000 due to our lower bound, and the additional labels coming from the observed data.

Denote $Y_i$ the number of labels in an envelope $i$. Denote $X_i$ the number of labels over 90, i.e. $X=Y-90$, so $X\in\{0,1,2,...,10\}$. The binomial distribution models the total number of successes (here a success is the presence of a label in an envelope) in $n$ trials when the trials are independent with constant success probability $p$ so $X$ takes values $0, 1, 2, 3, ..., n.$ We take $n=10$, which gives 11 different possible outcomes. I assume that because the sheet sizes are irregular, some sheets only have room for $X$ additional labels in excess of 90, and that this "additional space" for each label in excess of 90 occurs independently with probability $p$. So $X_i\sim\text{Binomial}(10,p).$

(Upon reflection, the independence assumption/binomial model is probably a strange assumption to make, since it effectively fixes the composition of the printer's sheets to be unimodal, and the data can only change the location of the mode, but the model will never admit a multimodal distribution. For example, under an alternative model, it's possible that the printer only has sheets of sizes 97, 98, 96, 100 and 95: this satisfies all the stated constraints and data doesn't exclude this possibility. It might be more appropriate to regard each sheet size as its own category and then fit a Dirichlet-multinomial model to the data. I do not do this here because the data are so scarce, so posterior probabilities on each of the 11 categories will be very strongly influenced by the prior. On the other hand, by fitting the simpler model we are likewise constricting the kinds of inferences that we can make.)

Each envelope $i$ is an iid realization of $X$. The sum of binomial trials with the same success probability $p$ is also binomial, so $\sum_i X_i\sim\text{Binomial}(60,p).$ (This is a theorem -- to verify, use the MGF uniqueness theorem.)

I prefer to think about these problems in a Bayesian mode, because you can make direct probability statements about posterior quantities of interest. A typical prior for binomial trials with unknown $p$ is the beta distribution, which is very flexible (varies between 0 and 1, can be symmetric or asymmetric in either direction, uniform or one of two Dirac masses, have an antimode or a mode... It's an amazing tool!). In the absence of data, it seems reasonable to assume uniform probability over $p$. That is, one might expect to see a sheet accommodate 90 labels as often as 91, as often as 92, ..., as often as 100. So our prior is $p\sim\text{Beta}(1,1).$ If you don't think this beta prior is reasonable, the uniform prior can be replaced with another beta prior, and the math won't even increase in difficulty!

The posterior distribution on $p$ is $p\sim\text{Beta}(1+43,1+17)$ by the conjugacy properties of this model. This is only an intermediate step, though, because we don't care about $p$ as much as we care about the total number of labels. Forunately, the properties of conjugacy also mean that the posterior predictive distribution of sheets is beta-binomial, with parameters of the beta posterior. There are $940$ reamining "trials", i.e. labels for which their presence in the delivery is uncertain, so our posterior model on the remaining labels $Z$ is $Z\sim\text{BB}(44,18,940).$

enter image description here

Since we have a distribution on $Z$ and a value model per label (the vendor agreed to one dollar per label), we can also infer a probability distribution over the value of the lot. Denote $D$ the total dollar value of the lot. We know that $D=9043+Z$, because $Z$ only models the labels that we are uncertain about. So the distribution over value is given by $D$.

What's the appropriate way to consider pricing the lot?

We can find that the quantiles at 0.025 and 0.975 (a 95% interval) are 553 and 769, respectively. So the 95% interval on D is $[9596, 9812]$. Your payment falls in that interval. (The distribution on $D$ is not exactly symmetric, so this is not the central 95% interval -- however, the asymmetry is negligible. Anyway, as I elaborate below, I'm not sure that a central 95% interval is even the correct one to consider!)

I'm not aware of a quantile function for beta binomial distribution in R, so I wrote my own using R's root-finding.

qbetabinom.ab <- function(p, size, shape1, shape2){
    tmpFn <- function(x) pbetabinom.ab(x, size=size, shape1=shape1, shape2=shape2)-p
    q <- uniroot(f=tmpFn, interval=c(0,size))
    return(q$root)
}

Another way to think about it is just to think about the expectation. If you repeated this process many times, what's the average cost you would pay? We can compute the expectation of $D$ directly. $\mathbb{E}(D)=\mathbb{E}(9043+Z)=\mathbb{E}(Z)+9043.$ The beta binomial model has expectation $\mathbb{E}(Z)=\frac{n\alpha}{\alpha+\beta}=667.0968$, so $\mathbb{E}(D)=9710.097,$ almost exactly what you paid. Your expected loss on the deal was only 6 dollars! All told, well done!

But I'm not sure either of these figures is the most relevant. After all, this vendor is trying to cheat you! If I were doing this deal, I'd stop worrying about breaking even or the fair-value price of the lot and start working out the probability that I'm overpaying! The vendor is clearly trying to defraud me, so I'm perfectly within my rights to minimize my losses and not concern myself with the break-even point. In this setting, the highest price I would offer is 9615 dollars, because this is the 5% quantile of the posterior on $D$, i.e. there's 95% probability that I'm underpaying. The vendor can't prove to me that all the labels are there, so I'm going to hedge my bets.

(Of course, the fact that the vendor accepted the deal tells us that he has nonnegative real loss... I haven't figured out a way to use that information to help us determine more precisely how much you were cheated, except to note that because he accepted the offer, you were at best breaking even.)

Comparison to the bootstrap

We only have 6 observations to work with. The justification for the bootstrap is asymptotic, so let's consider what the results look like on our small sample. This plot shows the density of the boostrap simulation. enter image description here

The "bumpy" pattern is an artifact of the small sample size. Including or excluding any one point will have a dramatic effect on the mean, creating this "bunchy" apperance. The Bayesian approach smooths out these clumps and, in my opinion, is a more believable portrait of what's going on. Vertical lines are the 5% quantiles.

$\endgroup$
8
  • $\begingroup$ it is a great answer. You provided new insight by penalizing for the risk. Thanks $\endgroup$
    – Neeraj
    Jan 22, 2016 at 16:44
  • 1
    $\begingroup$ I was just happy to find out that your expected loss was only $6. :-) Thanks again for a great question. $\endgroup$
    – Sycorax
    Jan 22, 2016 at 16:46
  • 1
    $\begingroup$ The binomial distribution models the number of successes in $n$ trials when the trials are independent with constant success probability $p$ so it takes values $0, 1, 2, 3, ...., n.$ We take $n=10$, which gives 11 different possible outcomes. I assume that because the sheet sizes are irregular, some sheets only have room for $X$ additional labels in excess of 90, and that this "additional space" for each label occurs with probability $p$. $\endgroup$
    – Sycorax
    Jan 22, 2016 at 16:50
  • 1
    $\begingroup$ The Poisson model can take values $0,1,2,3,...$. So it assigns positive probability to there being $101, 102, 103, ..., 10^6$ labels per packet. Now, there's small probability of $10^6$ items under any reasonable Poisson model to this data, but no one used the Poisson model because it doesn't respect the constraints $0\le X\le 10$. $\endgroup$
    – Sycorax
    Jan 22, 2016 at 16:58
  • 1
    $\begingroup$ Let us continue this discussion in chat. $\endgroup$
    – Sycorax
    Jan 22, 2016 at 17:03
20
$\begingroup$

EDIT: Tragedy! My initial assumptions were incorrect! (Or in doubt, at least -- do you trust what the seller is telling you? Still, hat tip to Morten, as well.) Which I guess is another good introduction to statistics, but The Partial Sheet Approach is now added below (since people seemed to like the Whole Sheet one, and maybe somebody will still find it useful).

First of all, great problem. But I'd like to make it a little more complicated.

Because of that, before I do, let me make it a little simpler, and say -- the method you're using right now is perfectly reasonable. It's cheap it's easy it makes sense. So if you have to stick with it, you shouldn't feel bad. Just make sure you choose your bundles randomly. AND, if you can just weigh everything reliably (hat tip to whuber and user777), then you should do that.

The reason I want to make it a little more complicated though is that you already have -- you just haven't told us about the whole complication, which is that -- counting takes time, and time is money too. But how much? Maybe it actually is cheaper to count everything!

So what you're really doing is balancing the time it takes to count, with the amount of money you're saving. (IF, of course, you only play this game once. NEXT time you have this happen with the seller, they may have caught on, and tried a new trick. In game theory, this is the difference between Single Shot Games, and Iterated Games. But for now, let's pretend the seller will always do the same thing.)

One more thing before I get to the estimation though. (And, sorry to have written so much and still not gotten to the answer, but then, that's a pretty good answer to What would a statistician do? They would spend a huge amount of time making sure they understood every tiny part of the problem before they were comfortable saying anything about it.) And that thing is an insight based on the following:

(EDIT: IF THEY'RE ACTUALLY CHEATING ...) Your seller doesn't save money by removing labels -- they save money by not printing sheets. They can't sell your labels to somebody else (I assume). And maybe, I don't know and I don't know if you do, they can't print half a sheet of your stuff, and half a sheet of somebody else's. In other words, before you've even started counting, you can assume that the total number of labels is either 9000, 9100, ... 9900, or 10,000. That's how I'll approach it, for now.

The Whole Sheet Method

When a problem is a little tricky like this one (discrete, and bounded), a lot of statisticians will simulate what might happen. Here's what I simulated:

# The number of sheets they used
sheets <- sample(90:100, 1)
# The base counts for the stacks
stacks <- rep(90, 100)
# The remaining labels are distributed randomly over the stacks
for(i in 1:((sheets-90)*100)){
    bucket <- sample(which(stacks!=100),1)
    stacks[bucket] <- stacks[bucket] + 1
}

This gives you, assuming they're using whole sheets, and your assumptions are correct, a possible distribution of your labels (in the programming language R).

Then I did this:

alpha = 0.05/2
for(i in 4:20){
    s <- replicate(1000, mean(sample(stacks, i)))
    print(round(quantile(s, probs=c(alpha, 1-alpha)), 3))
}

This finds, using a "bootstrap" method, confidence intervals using 4, 5, ... 20 samples. In other words, On average, if you were to use N samples, how big would your confidence interval be? I use this to find an interval that's small enough to decide on the number of sheets, and that's my answer.

By "small enough," I mean my 95% confidence interval has only one whole number in it -- e.g. if my confidence interval was from [93.1, 94.7], then I would choose 94 as the correct number of sheets, since we know it's a whole number.

ANOTHER difficulty though -- your confidence depends on the truth. If you have 90 sheets, and every pile has 90 labels, then you converge really fast. Same with 100 sheets. So I looked at 95 sheets, where there is the greatest uncertainty, and found that to have 95% certainty, you need about 15 samples, on average. So let's say overall, you want to take 15 samples, because you never know what's really there.

AFTER you know how many samples you need, you know that your expected savings are:

$100N_{missing} - 15c$

where $c$ is the cost of counting one stack. If you assume that there's an equal chance of every number between 0 and 10 being missing, then your expected savings are $500 - 15*$c$. But, and here's the point of making the equation -- you could also optimize it, to trade off your confidence, for the number of samples you need. If you're okay with the confidence that 5 samples gives you, then you can also calculate how much you'll make there. (And you can play with this code, to figure that out.)

But you should also charge the guy for making you do all this work!

(EDIT: ADDED!) The Partial Sheet Approach

Okay, so let's assume what the manufacturer is saying is true, and it's not intentional -- a few labels are just lost in every sheet. You still want to know, About how many labels, overall?

This problem is different because you no longer have a nice clean decision that you can make -- that was an advantage to the Whole Sheet assumption. Before, there were only 11 possible answers -- now, there are 1100, and getting a 95% confidence interval on exactly how many labels there are is probably going to take a lot more samples than you want. So, let's see if we can think about about this differently.

Because this is really about you making a decision, we're still missing a few parameters -- how much money are you willing to lose, in a single deal, and how much money it costs to count one stack. But let me set up what you could do, with those numbers.

Simulating again (although props to user777 if you can do it without!), it's informative to look at the size of the intervals when using different numbers of samples. That can be done like this:

stacks <- 90 + round(10*runif(100))
q <- array(dim=c(17,2))
for(i in 4:20){
    s <- replicate(1000, mean(sample(stacks, i)))
    q[i-3,] <- quantile(s, probs=c(.025, .975))
}
plot(q[,1], ylim=c(90,100))
points(q[,2])

Which assumes (this time) that each stack has a uniformly random number of labels between 90 and 100, and gives you:

Bounds on Confidence Intervals By Number of Samples

Of course, if things were really like they've been simulated, the true mean would be around 95 samples per stack, which is lower than what the truth appears to be -- this is one argument in fact for the Bayesian approach. But, it gives you a useful sense of how much more certain you're becoming about your answer, as you continue to sample -- and you can now explicitly trade off the cost of sampling with whatever deal you come to about pricing.

Which I know by now, we're all really curious to hear about.

$\endgroup$
12
  • 6
    $\begingroup$ +1 This analysis directly and creatively addresses the question: how would a (good) statistician think of the problem? Focusing on the sheet count is a valuable insight. $\endgroup$
    – whuber
    Jan 21, 2016 at 20:52
  • 1
    $\begingroup$ The cost-benefit approach is a great idea. Already I'd say the collective man*hours of brainpower devoted to this problem has exceeded the $284 savings from the n=6 sample Neeraj used. :) $\endgroup$
    – RobertF
    Jan 21, 2016 at 21:51
  • 1
    $\begingroup$ Nice answer. As you currently coded it, when the printer picks up a full stack he just drops the extra label to the ground, which is maybe reasonable. But if you want to have 9000,9100...10000 total labels at the end you could replace your if logic with bucket <- sample(which(stacks!=100),1) and then always increment the stack. $\endgroup$
    – Adam C
    Jan 21, 2016 at 21:57
  • 1
    $\begingroup$ Ah, just noticed that myself! Thanks for the catch. Definitely a mistake. $\endgroup$ Jan 21, 2016 at 22:00
  • 1
    $\begingroup$ How are you calculating confidence intervals? Using the bootstrap? $\endgroup$
    – RobertF
    Jan 22, 2016 at 0:14
3
$\begingroup$

This is a fairly limited sample. (Code snippets are in R)

> sample <- c(97,98,96,100,95,97)

For an initial guess at expected number in the total population and a 95% confidence value for price we can start with the mean and the 5% quantile

> 100*mean(sample)
[1] 9716.667
> 100*quantile(sample,0.05)
  5% 
9525 

To go further, we are going to have to create a theoretical model and make additional assumptions. There are several sources of uncertainty at play - (1) uncertainty for functional form of a model of packet filling, (2) uncertainty in estimating parameters for the model, and (3) sampling error.

For the model, let's assume that there is a process for dropping each label independently into a packet that is prone to failure at some unknown rate $p$. We'll not assume the manufacturer is engaging in fraud, just that some portion end up mangled or otherwise on the floor. The success of each drop is then a Bernoulli random variable. For each packet, the process is repeated $n=100$ times, meaning the number of labels in each packet will follow a binomial distribution. We can estimate $p$ from the sample as follows:

> n <- 100
> (p<-1-mean(sample)/100)
[1] 0.02833333

Since $n\ge100$ and $np \le 10$, we can approximate the binomial distribute well with the simpler Poisson distribution

> (lambda <- n*p)
[1] 2.833333

We can find some small assurance in that the Poisson distribution has a variance equal to its mean, $\lambda = $lambda, and that the sample variance is fairly close to the sample mean

> var(sample)
[1] 2.966667

If we assume that each packet is filled independently, then the number of failures for the entire run of 100 packets is also approximately Poisson with parameter $\lambda_r = $100*lambda. The mean and 95% quantile are then

> 100*100-100*lambda
[1] 9716.667
> 100*100-qpois(0.95,100*lambda)
[1] 9689

The problem is that the failure rate, $p$, is unknown, and we have not accounted for its uncertainty. Let's return to the binomial distribution, and, for the sake of flexibility and simplicity, assume that $p$ is a Beta random variable with unknown shape parameters $\alpha$ and $\beta$. This makes the process a Beta-Bernoulli process. We need some prior assumption for $\alpha$ and $\beta$, so we'll give the manufacturer the benefit of the doubt, but not much confidence, and make $\alpha = 1$ and $\beta = 0$.

In 600 observations, you observed 583 successes and 17 failures, so we update the Beta-Bernoilli process to have parameters $\alpha^* = 1+583$ and $\beta^* = 0+17$. So, for a packet of 100, we would expect a mean of 97.17138 and standard deviation of 1.789028 (see e.g. Wikipedia's entry for the formulas). Using the distribution function, we can see that the probability of having fewer than 90 in a packet is sufficiently low (0.05%) that we will ignore that assumption; doing so is conservative for setting our price.

The beauty of this model is it is easy to update $\alpha^*$ and $\beta^*$ (add new successes to $\alpha$ and new failures to $\beta$, the posterior model remains a beta-binomial) for more observations to reduce uncertainty and your initial assumptions are explicit.

Now, assuming each packet is filled independently, we can view the entire box of packets as 10000 independent events rather than 100 events of 100 subevents. The mean is therefore 9717.138 with standard deviation 69.57153. Using the distribution function, you can calculate the 95% confidence number to be around 9593. I've used the R package VGAM for its *betabinom.ab functions in doing so.

So, the uncertainty in the estimated parameter reduces the 95% confidence price by nearly 100, and we end up fairly close to our initial simple approximation.

Whatever the approach or model, additional data can be used to validate the model, that is to see the additional data are reasonable under the theoretical model or whether adjustments or a new model is warranted. The modeling process is similar to the scientific method.

$\endgroup$
2
$\begingroup$

In a pinch, my first inclination would be to calculate a 95% confidence interval for your sample mean over a truncated normal distribution falling between the lower and upper bounds of 90 and 100 labels.

The R package truncnorm allows you to find confidence intervals for a truncated normal distribution given a specified sample mean, sample standard deviation, lower bound, and upper bound.

Since you're taking a sample of n=5 from a relatively small population (N=100), you may want to multiply your sample standard deviation by a finite population factor = [(N-n)/(N-1)]^.5 = 0.98.

$\endgroup$
7
  • 5
    $\begingroup$ I wonder whether the additional complications of assuming a truncated Normal are worthwhile--or even valid--given that the counts are discrete and can take on only a small number of possible values. $\endgroup$
    – whuber
    Jan 21, 2016 at 17:22
  • $\begingroup$ @whuber - True, but the confidence interval is over the distribution of the sample mean, which is a continuous quantity. Rather than use a 95% confidence interval, perhaps a better choice would be to find the area under the distribution between discrete quantities, say 93 and 99. $\endgroup$
    – RobertF
    Jan 21, 2016 at 17:35
  • $\begingroup$ You don't need a truncated Normal to work with the sample mean, though. It looks like an unnecessary complication. $\endgroup$
    – whuber
    Jan 21, 2016 at 17:48
  • 1
    $\begingroup$ The CLT does not assert that anything will follow a truncated normal distribution. Bootstrapping is likely to be problematic because it relies on asymptotic results for its validity. $\endgroup$
    – whuber
    Jan 21, 2016 at 18:43
  • 1
    $\begingroup$ Because the standard deviation of the mean rapidly becomes much smaller than the range, the truncation is practically irrelevant. We're talking about a practical solution that is not overcomplicated by unnecessary and possibly distracting details. $\endgroup$
    – whuber
    Jan 21, 2016 at 18:59
2
$\begingroup$

A quick and simple approach is to consider all possible resamples of size 6. There are only 15,625 permutations. Looking at these and taking the average for each case, and then sorting the averages and extracting the 5% quantile, we get a value of 96.

So the estimated amount you should be willing to pay is about 9600. This is in good agreement with a couple of the more sophisticated approaches.

An improvement here would be to simulate a large number of samples of size 6 and use the same procedure to find the 5th percentile of the sample means. Using slightly more than a million resamples, I found the 5th percentile to be 96.1667, so to the nearest dollar the payment would be 9617 dollars, which is only a 2 dollar difference from user777's result of 9615.

$\endgroup$
3
  • 1
    $\begingroup$ Could you explain why this is a suitable answer to how much should be paid? Why not use the mean of the sample, for instance? $\endgroup$
    – whuber
    Jan 22, 2016 at 15:53
  • $\begingroup$ You would use the sample mean if you wanted to have a payment that is aligned with how many labels you think there are. But the questioner asked for 95% assurance that he not pay for more labels than were made. So we get an idea of the distribution of the sample mean for samples of size 6 and use the 5th percentile. $\endgroup$
    – soakley
    Jan 22, 2016 at 18:47
  • 1
    $\begingroup$ It would be good to include that explanation in your answer. You might consider also explaining why you think this resampling procedure actually produces a valid or reliable confidence limit. Although it can do so with many large datasets, one ought to consider whether it can be used in the same way with such a small dataset. $\endgroup$
    – whuber
    Jan 22, 2016 at 21:11
0
$\begingroup$

It seems like you have already concluded that the error was done intentionally, but a statistician would not jump to such conclusions (even though the evidence seems to support this).

One could set this up as an hypothesis test:

H0: The dealer is honest but quite sloppy

H1: The dealer is fraudulent, and the shortfall is intentional.

Let´s assume H0, then each deviation is a random event with mean = 0 and equal chance of being positive or negative. Let´s further assume that the deviations are normally distributed. The standard deviation for the normal distribution based on the deviations in the 6 data points is sd=1.722

If the statistician did not remember his theory very well, but had R nearby (not an unlikely scenario) then he/she could write the following code to check the likelihood of receiving no positive deviations (no packages of more then 100) if H0 is true.

numpackages=c(97,98,96,100,95,97)
error<-100-numpackages
errorStdev<-sd(error)
numSimulations<-1000000
max100orLes<-0
for(p in 1:numSimulations)
{
  simulatedError<-rnorm(6,mean=0,sd=errorStdev)

  packageDeviations<-round(simulatedError)

  maxValue<-max(packageDeviations)
  if(maxValue<=0)
  {
    max100orLes<-max100orLes+1
  }   
}
probH0<-100*max100orLes/numSimulations
cat("The probability the H0 is correct is:",probH0,"%")

The result of the simulation is:

The probability the H0 is correct is: 5.3471 %

The probability of the dealer being Honest is only 5.35% , and it´s therefore quite likely that you have been a victim of fraud.

Since you say that this is not a homework question, but a real situation for your company, then this ceases to be an exercise in calculation the correct expected number labels, but instead it´s a tricky case of how to handle an dishonest supplier.

What you do from here, really cant be answered by statistics alone. It very much depends on your leverage and relationship with the dealer.

Best of luck !

Morten Bunes Gustavsen

$\endgroup$
4
  • 1
    $\begingroup$ I'm having a hard time seeing how you arrive at 5.35%. It sounds like you are assuming the label counts are the result of random allocation of an average of 100 labels per package. If so, then you have observed a mean deviation of $17/6$ with a standard error of $1.72/\sqrt{6}\approx 0.70$, indicating the observation is $17/6/0.70 \approx 4.0$ standard errors below $100$. A normal approximation, as you suggest, gives p-value of $0.00003$, far below 5.35%--and there's no need to run any simulation to figure that out. However, this calculation ignores the explicit assumptions in the question. $\endgroup$
    – whuber
    Jan 21, 2016 at 21:13
  • $\begingroup$ failure is always an option, so I might have made a mistake... my calculations are however documented in the R code I have supplied, so there should not be any reason to wonder how I got my result. Yes the H0 Hypothesis in my case is that the dealer is honest, and then the deviations would be random fluctuations with a mean on 100. The Stdev in my calculation is just the Stdev of the series (-3, -2, -4, 0, -5,-3) which is the deviation from 100 in each package. $\endgroup$ Jan 21, 2016 at 21:37
  • $\begingroup$ I really just use this normal deviation, and draw 6 samples, and check if none of them are larger than 0. I run the simulation 1000,000 times, and conunts how many times I am so unlucky to get no sample above 0. This turns out to be 5.35% of the cases. The reason I choose this angle was that the question explicitly stated that it´s a real situation (i.e. not an academic exercise), and that he/she would like to know what a statistician would do in this case. $\endgroup$ Jan 21, 2016 at 21:43
  • 3
    $\begingroup$ The question also stated there was no chance of counting more than 100 labels in a packet. Regardless, what you have done is an extensive simulation of numbers that sort of look like the data--but what, if anything, it has to do with the question ("how much should we pay") is obscure. $\endgroup$
    – whuber
    Jan 21, 2016 at 22:10
-2
$\begingroup$

How about something like a multinomial model.

Prob of each outcome is estimated as 1/6, 1/6, .... (based on the 6 observations) and so E(x)=97.16 and Var(x)=sum(95^2*1/6+...)-E(x)^2=2.47 so the 95% CI would be [94, 100]

$\endgroup$
3
  • 3
    $\begingroup$ This does not appear to be multinomial at all: your CI seems to be a Normal-theory interval using the uncorrected formula for the variance. Besides, how does it answer the question about how much to pay? $\endgroup$
    – whuber
    Jan 21, 2016 at 19:06
  • $\begingroup$ the multinomial applies on the outcome, i.e. 95, 96, 97...100 and yes the CI is Normal-theory because x-e(x)/sd ~ N. how much to pay would be the same as the expectation so it is 97.16*100 $\endgroup$
    – Xing
    Jan 21, 2016 at 19:26
  • 4
    $\begingroup$ Did you notice that you don't use the multinomial assumption at all? Your CI is too short, as W. S. Gosset observed in 1908. But if you are going to base your recommendation only on the mean of the sample, why compute a CI? $\endgroup$
    – whuber
    Jan 21, 2016 at 19:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.