Learn R Programming

Markovchart (version 2.1.5)

plot.Markov_grid: Contour plot for Markov_grid control chart results.

Description

Convenience function for plotting G-values in a contour plot as the function of the time between samplings and the critical value.

Usage

# S3 method for Markov_grid
plot(
     x, y = expression(atop(italic("G")*-value~per, unit~time)),
     xlab = "Time between samplings", ylab = "Critical value",
     low = "white", mid = "#999999", high = "black",
     colour = "white", nbreaks = 16, ...)

Arguments

x

A Markov_grid data.frame with three columns (preferably created by the Markovchart function): time between samplings, critical value and the weighted mean of the expected cost and the cost standard deviation (G-values).

y

The name of the scale.

xlab

A title for the x axis.

ylab

A title for the x axis.

low

Colour for the low end of the gradient.

mid

Colour for the midpoint.

high

Colour for the high end of the gradient.

colour

Colour of the contour lines.

nbreaks

Number of contour breaks. Uses pretty(), thus actual, plotted number of breaks may differ.

Further arguments to be passed down to plot. Mostly kept due to S3 method compatibility.

Value

A plot object of class gg and ggplot produced using the ggplot2 package.

References

Zempleni A, Veber M, Duarte B and Saraiva P. (2004) Control charts: a cost-optimization approach for processes with random shifts. Applied Stochastic Models in Business and Industry, 20(3), 185-200.

Dobi B and Zempleni A. (2019) Markov chain-based cost-optimal control charts for health care data. Quality and Reliability Engineering International, 35(5), 1379-1395.

Dobi B and Zempleni A. (2019) Markov chain-based cost-optimal control charts with different shift size distributions. Annales Univ. Sci. Budapest., Sect. Comp., 49, 129-146.

See Also

Markovchart Markovstat

Examples

Run this code
# NOT RUN {
#Defining parallel_opt parallel settings.
#parallel_opt can also be left empty to be defined automatically by the function.
require(parallel)
num_workers <- min(c(detectCores(),2))

#Exponential shift - default cost functions.
stat_exp <- Markovstat(shiftfun="exp", h=1, k=1, sigma=1, s=0.2, delta=2,
                        RanRep=TRUE, alpha=1, beta=3, Vd=30, V=18)

parall <- list(cl=makeCluster(num_workers), forward=FALSE, loginfo=TRUE)
Gmtx   <-	Markovchart(statdist=stat_exp, h=seq(1,10,by=(10-1)/5),
                      k=seq(0.1,5,by=(5-0.1)/5), p=0.9, cs=1,
                      coparams=c(10,3), crparams=c(1,2),
                      vcoparams=c(8,1.5), vcrparams=c(5,2),
                      V=18, parallel_opt=parall)
plot(Gmtx)
# }

Run the code above in your browser using DataLab