ccpoints: Calculates Control Systems points

Description Usage Arguments Value Examples

View source: R/cchart.R

Description

Control Charts made easy. Calculates Control Systems for a time series. The current distribution uses the following Control Rules to define systems: 1. Mean Rule: N continuous points above or below mean. See points.vs.avg argument. 2. Out of Control Points Rule: Points above or below 3 Standard Deviation are excluded from calculations.

Usage

1
2
ccpoints(data, dates, values, points.vs.avg = 7,
         date.type = TRUE, already.ordered = FALSE)

Arguments

data

The input Data Frame.

dates

Column name for date or ordering variable.

values

Column name for data points values. Class should be numeric, if not, will attempt to coerce.

points.vs.avg

For Mean Rule, establishes how many continuous points should be above or below mean to define a system. Default to 6.

date.type

States if observations are based on dates. Defaults to TRUE. If TRUE, will attempt to coerce to a date format using extensive use of lubridate package dates formats.

already.ordered

Tells the function if the data is already ordered. Defaults to FALSE. The function will attempt to order it.

Value

The function will return a list object with class ccpoints. A list including the data frame with the system points, and column names of the series.
The data frame will include the submited series and the following new columns:

data.mean: the mean value for each system
data.ll: the lower standard deviation of each system
data.ul: the upper standard deviation of each system

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Create a random time series
set.seed(154)
time.series <- data.frame(t.dates = seq.Date(as.Date("2014-02-01"), as.Date("2016-08-01"), "month"),
               t.values = c(
               seq(0.1, 0.8, by = 0.1) * runif(8) + 3,
               seq(0.1, 0.7, by = 0.1) * runif(7) + 4,
               seq(0.1, 0.7, by = 0.1) * runif(7) + 5,
               seq(0.1, 0.4, by = 0.1) * runif(4) + 4,
               seq(0.1, 0.5, by = 0.1) * runif(5) + 4)
               )

# Execute function
control.chart.data <- ccpoints(time.series, "t.dates", "t.values")
print(control.chart.data)

# To extract only the data frame
control.chart.data[["data"]]

jbaxx/ccharter documentation built on Feb. 27, 2021, 9:10 p.m.