plot.OCdata: Plot Method for OCdata Objects

View source: R/OCdata.R

plot.OCdataR Documentation

Plot Method for OCdata Objects

Description

Plots the Operating Characteristic (OC) curve from an object of class "OCdata", either by proportion nonconforming or process mean levels.

Usage

## S3 method for class 'OCdata'
plot(x, by = c("pd", "mean"), ...)

Arguments

x

An object of class "OCdata", typically generated using OCdata().

by

A character string indicating the type of OC curve to plot. Options are:

"pd"

(Default) Plot the OC curve by proportion nonconforming.

"mean"

Plot the OC curve by estimated process mean levels (only available for variable sampling plans).

...

Additional graphical parameters passed to the plot() function.

Details

This method visualizes the OC curve based on the content of the "OCdata" object.

By default, the curve is plotted against the proportion of nonconforming items (@pd). If by = "mean" is specified and the plan includes valid mean-level estimates (@process_means), the curve is plotted against mean levels.

If by = "mean" is requested but no mean estimates are available (e.g., for attribute plans), a message will be shown and no plot will be drawn.

Value

A plot showing the OC curve for the given attribute/variable sampling plan.

Author(s)

Ha Truong

See Also

OCdata, optAttrPlan, optVarPlan

Examples

# Attribute plan
plan_attr <- optAttrPlan(PRQ = 0.01, CRQ = 0.05)
oc_attr <- OCdata(plan_attr)
plot(oc_attr)               # OC curve by pd (default)
plot(oc_attr, by = "mean")  # Will show message if not available

# Variable plan
plan_var <- optVarPlan(PRQ = 0.025, CRQ = 0.1, USL = 0.1,
                       distribution = "normal", sigma=0.01)
oc_var <- OCdata(plan_var)
plot(oc_var)                # OC curve by pd
plot(oc_var, by = "mean")   # OC curve by mean levels

AccSamplingDesign documentation built on June 27, 2025, 1:08 a.m.