OCdata | R Documentation |
Computes and returns an object of class "OCdata"
, which contains the
Operating Characteristic (OC) curve data. This includes the proportion of
nonconforming items and the corresponding probability of acceptance, along
with plan-related metadata. This function supports both optimal plan objects
(e.g. found from "optPlan()"
method) and custom plan parameter inputs.
Accessor functions paccept()
, pd()
, and process_means()
provide safe access to components of the OCdata
object.
OCdata(plan = NULL, pd = NULL,
distribution = c("binomial", "poisson", "normal", "beta"),
n = NULL, c = NULL, k = NULL,
USL = NULL, LSL = NULL, sigma = NULL, theta = NULL,
PRQ = NULL, CRQ = NULL, alpha = NULL, beta = NULL,
sigma_type = c("known", "unknown"),
theta_type = c("known", "unknown"))
plan |
An optional acceptance plan object of class |
pd |
An optional vector of proportions of nonconforming items. If
|
distribution |
Distribution type used for the plan. Options are
|
n |
Sample size. |
c |
Acceptance number (for Attributes Sampling). |
k |
Acceptability constant (for Variables Sampling). |
USL |
Upper Specification Limit (used for variable sampling plans). Only one of |
LSL |
Lower Specification Limit (used for variable sampling plans). Only one of |
sigma |
Standard Deviation for Normal distribution. |
theta |
Precision parameter for Beta distribution. |
PRQ |
Producer's Risk Quality level - optional. |
CRQ |
Consumer's Risk Quality level - optional. |
alpha |
Producer’s risk - optional. |
beta |
Consumer’s risk - optional. |
sigma_type |
Whether sigma is |
theta_type |
Whether theta is |
The function evaluates the Operating Characteristic (OC) curve by computing the
probability of acceptance across a range of proportions of nonconforming items (pd
).
This can be either directly specified or derived based on the plan inputs.
If a plan
object is supplied, it overrides the other input parameters
and uses stored plan details. If no plan is provided, a new one will be constructed
from the inputs.
For:
Binomial
or Poisson
distribution: n
and c
must be provided.
Normal
or Beta
distribution: n
(or m
) and
k
are required. Either USL
or LSL
must be specified to
compute process mean values using muEst
.
The resulting OC curve data includes acceptance probabilities at various quality levels and, for variable plans, optionally maps these probabilities to corresponding mean levels.
For OCdata
: an object of class "OCdata"
(a list) with components:
pd | Numeric vector of proportions of nonconforming items (defective). |
paccept | Numeric vector of probabilities of acceptance at each level of nonconformance. |
process_means | Numeric vector of estimated mean values (only for variable plans with specification limits). |
dist | Distribution type ("binomial" , "poisson" , "normal" , or "beta" ). |
n | Sample size used in the plan. |
k | Acceptability constant (if applicable). |
c | Acceptance number (if applicable). |
Ha Truong
# Example 1: Variables Sampling (Normal distribution)
plan <- optVarPlan(
PRQ = 0.025,
CRQ = 0.1,
alpha = 0.05,
beta = 0.1,
distribution = "normal"
)
# Generate OC data from optimal plan
oc_data <- OCdata(plan, pd = seq(0, 0.15, by = 0.001))
# Plot the OC curve
plot(oc_data)
# Example 2: Attributes Sampling
# Generate OC data from custom plan
oc_data2 <- OCdata(n = 132, c = 5, distribution = "binomial",
pd = seq(0, 0.15, by = 0.001))
# Plot the OC curve
plot(oc_data2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.