Learn R Programming

AccSamplingDesign (version 0.0.4)

plot.OCdata: 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 OCdata
plot(x, by = c("pd", "mean"), ...)

Value

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

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.

Author

Ha Truong

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.

See Also

OCdata, optAttrPlan, optVarPlan

Examples

Run this code
# 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

Run the code above in your browser using DataLab