0

I'm using the following R code:

library(AcceptanceSampling)

x <- OC2c(50, 2, type="hypergeom", N=4000)
plot(x, xlim=c(0,0.2))

which generates the plot:

enter image description here

I will like to find the proportion when P(accept) (Y-axis) is 0.1. Is there a way to do this in R? I have a feeling this package does not allow direct computation of that according to its documentation at https://cran.r-project.org/web/packages/AcceptanceSampling/AcceptanceSampling.pdf.

Stoner
  • 846
  • 1
  • 10
  • 30

1 Answers1

1

As far as I know, you can't get this exactly, but you can get close. x is an S4 object, and the slots you're interested in here are paccept and pd. We can get the pd value with the paccept value closest to 0.1 of all the paccept values:

idx <- which.min(abs(x@paccept - 0.1))
round(cbind(paccept = x@paccept[idx], pd = x@pd[idx]), 3)
#      paccept  pd
# [1,]    0.11 0.1
duckmayr
  • 16,303
  • 3
  • 35
  • 53
  • That's fast! Thanks for the insights, I'll take note them. I'm also trying to solve via obtaining the root to the operating characteristic equation, but then again the libraries that are able to give a solution only give approximate ones.. – Stoner Mar 21 '20 at 15:01