Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I"m trying to plot an OC curve (y-axis Probability of acceptance, x-axis Lot Percent Defective) and there should be a way to plot using a hypergeometric distribution.

In[117]:= NProbability[x <= 0, 
 x \[Distributed] HypergeometricDistribution[8, 7, 500]]

Out[117]= 0.89262

is great for one point. The 7 in the distribution is the number defective in the lot of 500, I'd like to plot this for 1, 2, etc. Then alter the x-axis labels to represent the percent defective in the lot of 500, .1%, 1%, 2%, etc....

I can get the individual values as above, yet not able to get a plot.

I can do this using PoissonDistribution

Plot[{N[Probability[x <= 0, 
    x \[Distributed] PoissonDistribution[13*lpd]]], 
  N[Probability[x <= 0, 
    x \[Distributed] PoissonDistribution[8*lpd]]]}, {lpd, 0, .5}]

which assumes a very large lot size. I have the situation with smaller lot sizes and using hypergeometric is the right way to do the calculation for the OC curve - just not able to sort out the plotting.

Any suggestions?



share|improve this question
DiscretePlot is good for plotting discrete functions – ssch Feb 11 '13 at 3:55
up vote 5 down vote accepted

With the Ticks option you can set custom ticks, see this:

 Probability[x <= 0, x \[Distributed] HypergeometricDistribution[8, d, 500]],
 {d, 0, 250},
 Ticks -> {Table[{i 500/100, ToString@i <> "%"}, {i, 0, 50, 5}],Automatic}

enter image description here

share|improve this answer
This is right on what I was trying to do. Excellent. – Fred Schenkelberg Feb 11 '13 at 17:41
Ok, now is it possible to easily adjust the x-axis ticks to show correct lot percent defective when I change the number of units sampled and the lot size? I apparently do not understanding the Ticks element and how it is constructed as I'm not able to alter it and get meaningful results. cheers, Fred – Fred Schenkelberg Apr 22 '13 at 18:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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