2
$\begingroup$

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?

cheers,

Fred

$\endgroup$
1
  • $\begingroup$ DiscretePlot is good for plotting discrete functions $\endgroup$
    – ssch
    Feb 11, 2013 at 3:55

1 Answer 1

5
$\begingroup$

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

DiscretePlot[
 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

$\endgroup$
2
  • $\begingroup$ This is right on what I was trying to do. Excellent. $\endgroup$ Feb 11, 2013 at 17:41
  • $\begingroup$ 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 $\endgroup$ Apr 22, 2013 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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