Package 'bcc'

Title: Beta Control Charts
Description: Applies Beta Control Charts to defined values. The Beta Chart presents control limits based on the Beta probability distribution, making it suitable for monitoring fraction data from a Binomial distribution as a replacement for p-Charts. The Beta Chart has been applied in three real studies and compared with control limits from three different schemes. The comparative analysis showed that: (i) the Beta approximation to the Binomial distribution is more appropriate for values confined within the [0, 1] interval; and (ii) the proposed charts are more sensitive to the average run length (ARL) in both in-control and out-of-control process monitoring. Overall, the Beta Charts outperform the Shewhart control charts in monitoring fraction data. For more details, see Ângelo Márcio Oliveira Sant’Anna and Carla Schwengber ten Caten (2012) <doi:10.1016/j.eswa.2012.02.146>.
Authors: Ângelo Santanna [aut], Daniel Cerqueira [aut, cre]
Maintainer: Daniel Cerqueira <[email protected]>
License: GPL-3
Version: 1.5
Built: 2025-03-08 03:14:33 UTC
Source: https://github.com/cran/bcc

Help Index


Apply Shewhart Control Rules

Description

Identifies points in a control chart that violate Shewhart control rules. These rules help to determine if a process is out of control and requires corrective action.

Usage

apply_shewhart_rules(data, limits, type, sizes = NULL)

Arguments

data

A numeric vector of data values to be analyzed.

limits

A list containing the control limits, specifically the lower control limit (LCL) and upper control limit (UCL).

type

An integer representing the type of control chart. There are two possible types: 1 for discrete data (such as proportions or counts) and 2 for continuous data.

sizes

An optional numeric vector of sample sizes. This parameter is typically required for type 1 charts.

Value

A vector of indices corresponding to data points that violate the Shewhart control rules.

Examples

# Example with discrete data
data_values <- c(0.1, 0.2, 0.15, 0.3, 0.25)
sample_limits <- list(lcl=0.05, ucl=0.25, center=0.15)
apply_shewhart_rules(data_values, sample_limits, type=1)

# Example with continuous data
data_values <- c(0.55, 0.60, 0.65, 0.70, 0.75)
sample_limits <- list(lcl=0.50, ucl=0.70, center=0.60)
apply_shewhart_rules(data_values, sample_limits, type=2)

Beta Control Charts

Description

Creates and displays a Beta control chart using the specified data, sample sizes, and type. This is the main function for generating control charts in this package.

Usage

bcc(data, sizes = NULL, type, title = NULL)

Arguments

data

A numeric vector of data values to be plotted on the control chart.

sizes

An optional numeric vector of sample sizes. This parameter is required for type 1 charts, which are designed for discrete data.

type

An integer representing the type of control chart. There are two possible types: 1 for discrete data (such as proportions or counts) and 2 for continuous data.

title

An optional string specifying the title of the plot.

Details

The Beta Chart presents control limits based on the Beta probability distribution. It is used for monitoring fraction data from a Binomial distribution as a replacement for p-Charts. The Beta Chart has been applied in three real studies, demonstrating its effectiveness. Comparative analysis revealed that: (i) the Beta approximation to the Binomial distribution is more appropriate for values confined within the [0, 1] interval; and (ii) the proposed charts are more sensitive to the average run length (ARL) in both in-control and out-of-control process monitoring. Overall, the Beta Charts outperform the Shewhart control charts for monitoring fraction data.

Value

A plot of the Beta control chart.

Examples

# Example for type 1 chart with discrete data
data <- c(0.12, 0.18, 0.14, 0.28, 0.22)
sizes <- c(101, 98, 110, 105, 95)
bcc(data, sizes, type=1, title="Beta Control Chart for Discrete Data")

# Example for type 2 chart with continuous data
data <- c(0.59, 0.67, 0.61, 0.70, 0.59)
bcc(data, type=2, title="Beta Control Chart for Continuous Data")

# Example changing the title of the chart
data <- c(0.07, 0.13, 0.21, 0.25, 0.19)
sizes <- c(52, 49, 51, 53, 48)
bcc(data, sizes, type=1, title="Custom Title: Beta Control Chart for Discrete Data")

Calculate Control Limits

Description

Calculates control limits for control charts using given data and sizes. Supports both type 1 (discrete data) and type 2 (continuous data) control charts.

Usage

calculate_limits(data, sizes = NULL, type)

Arguments

data

A numeric vector of data values.

sizes

An optional numeric vector of sample sizes. Required for type 1 charts.

type

An integer representing the type of control chart. There are two possible types: 1 for discrete data and 2 for continuous data.

Value

A list containing the lower and upper control limits, and the center.

Examples

# Example for type 2 chart with continuous data
data_values <- c(0.55, 0.60, 0.65, 0.70, 0.75)
calculate_limits(data_values, type=2)

Plot Control Chart

Description

Generates and plots a control chart using the given data, sizes, type, and control limits.

Usage

plot_control_chart(data, type, limits, title, sizes = NULL)

Arguments

data

A numeric vector of data values.

type

An integer representing the type of control chart (either 1 or 2).

limits

A list containing the lower and upper control limits, and the center.

title

A string for the plot title.

sizes

A numeric vector of sample sizes.

Value

A plot of the control chart.

Examples

data <- c(0.12, 0.18, 0.14, 0.28, 0.22)
sizes <- c(101, 98, 110, 105, 95)
limits <- list(lcl = 4.03915, ucl = 16.0, center = 0.216)
plot_control_chart(data, type=1, limits=limits, title="Sample Control Chart", sizes=sizes)