Learn R Programming

AccSamplingDesign (version 0.0.4)

optVarPlan: Variable Acceptance Sampling Plan

Description

Creates variable sampling plans for normal or beta distributed measurements.

Usage

optVarPlan(PRQ, CRQ, alpha = 0.05, beta = 0.10, USL = NULL, LSL = NULL,
           distribution = c("normal", "beta"), sigma_type = c("known", "unknown"),
           theta_type = c("known", "unknown"), sigma = NULL, theta = NULL)

Value

A VarPlan object containing:

distribution

Distribution used ("normal" or "beta").

sample_size

Final sample size after rounding (integer).

k

Acceptability constant.

n

Unrounded sample size.

Arguments

PRQ

Producer Risk Quality (must be within valid range for the chosen distribution).

CRQ

Consumer Risk Quality (must be greater than PRQ and within valid range).

alpha

Producer's risk (numeric between 0 and 1).

beta

Consumer's risk (numeric between 0 and 1).

USL

Upper Specification Limit (numeric). Only one of USL or LSL should be provided.

LSL

Lower Specification Limit (numeric). Only one of USL or LSL should be provided.

distribution

Measurement distribution: "normal" or "beta".

sigma_type

Indicates whether sigma (population standard deviation) is "known" or "unknown".

theta_type

Indicates whether theta (population precision parameter for beta) is "known" or "unknown".

sigma

Known standard deviation (used for normal distribution). Required if sigma_type = "known".

theta

Dispersion parameter (used for beta distribution). Required if theta_type = "known".

Author

Ha Truong

Details

The function generates variable acceptance sampling plans based on specified producer and consumer risks and either a normal or beta distribution model.

The specification limit must be defined via either USL (upper specification limit) or LSL (lower specification limit), depending on whether the one-sided quality criterion concerns the upper or lower tail. Only one limit should be provided.

The plan design accounts for known or unknown standard deviation in the normal case, and known or unknown dispersion parameter (theta) in the beta case. Measurement error, if any, can be incorporated via the measurement_error argument.

References

ISO 3951-1:2013 - Sampling procedures for inspection by variables.

Wilrich, PT. (2004). Single Sampling Plans for Inspection by Variables under a Variance Component Situation. In: Lenz, HJ., Wilrich, PT. (eds) Frontiers in Statistical Quality Control 7. Physica, Heidelberg. tools:::Rd_expr_doi("10.1007/978-3-7908-2674-6_4")

K. Govindaraju and R. Kissling (2015). Sampling plans for Beta-distributed compositional fractions.

Examples

Run this code
# Example for normal distribution plan
norm_plan <- optVarPlan(
  PRQ = 0.025,        # Acceptable quality level (% nonconforming)
  CRQ = 0.1,          # Rejectable quality level (% nonconforming)
  alpha = 0.05,       # Producer's risk
  beta = 0.1,         # Consumer's risk
  distribution = "normal",
  USL = 10
)
summary(norm_plan)

# Example for beta distribution plan
beta_plan <- optVarPlan(
  PRQ = 0.025,        # Target quality level (% nonconforming)
  CRQ = 0.1,          # Minimum quality level (% nonconforming)
  alpha = 0.05,       # Producer's risk
  beta = 0.1,         # Consumer's risk
  distribution = "beta",
  theta = 44000000,   # Beta distribution parameter
  LSL = 0.00001
)
summary(beta_plan)

Run the code above in your browser using DataLab