Markovsim: Progression and monitoring simulation of a process with...

View source: R/Markovchart_functions_20220203.r

MarkovsimR Documentation

Progression and monitoring simulation of a process with random shift size, random repair and random sampling time.

Description

Wrapper for simulation of processes with a Markov chain-based control chart setup. Includes methods for different shift size distributions.

Usage

Markovsim(shiftfun = c("exp", "exp-geo"), num = 100, h, k, sigma,
          s, delta, probmix = 0, probnbin = 0.5, disj=1,
          RanRep = FALSE, alpha = NULL, beta = NULL, RanSam = FALSE,
          StateDep = FALSE, a = NULL, b = NULL, q = NULL,
          z = NULL, detail = 100, Vd = 50, V, burnin = 1)

Arguments

shiftfun

A string defining the shift size distribution to be used. Must be either "exp", "exp-geo".

num

Integer. The number of sampling intervals simulated. This means that the time elapsed in the simulation is num*h.

h

The time between samplings. Must be a positive value.

k

The control limit (critical value). Must be a positive value. Only one sided shifts are allowed, thus there is only one control limit.

sigma

Process standard deviation (the distribution is normal).

s

Expected number of shifts in an unit time interval.

delta

Expected shift size.

probmix

The weight of the geometric distribution in case of exponential-geometric mixture shift distribution and should be between 0 and 1.

probnbin

The probability parameter of the geometric distribution in case of exponential-geometric mixture shift distribution and should be between 0 and 1.

disj

The size of a discrete jump in case of exponential-geometric mixture shift distribution, must be a positive number.

RanRep

Logical. Should the repair be random? Default is FALSE (no).

alpha

First shape parameter for the random repair beta distribution.

beta

Second shape parameter for the random repair beta distribution.

RanSam

Logical. Should the sampling be random? Default is FALSE (no).

StateDep

Logical. Should the sampling probability also depend on the distance from the target value (state dependency)? (If TRUE, a beta distribution is used for the sampling probability, if FALSE then a logistic function.)

a

First parameter*h for the random sampling time beta distribution. The first shape parameter is a/h to create dependency on the time between samplings.

b

Second shape parameter for the random sampling time beta distribution.

q

The steepness of the curve of the random sampling time logistic function.

z

The logistic sigmoid's midpoint of the random sampling time logistic function.

detail

The detail of the simulation, i.e. how many data points (including the moment of the sampling itself) should be simulated within a unit time. Should be a positive integer greater than 1, and the user should consider the length of the sampling interval h, as a shorter interval leads to less datapoints.

Vd

Integer discretisation parameter: the number of states after the equidistant discretisation of the state space. Should be an integer value greater than 2. This parameter is needed to calculate a stationary distibution that can be compared to results of the Markovchart function.

V

Numeric discretisation parameter: the maximum (positive) distance from the target value taken into account. This parameter is needed to calculate a stationary distibution that can be compared to results of the Markovchart function and for the calculation of sampling probabilities in the case of random sampling.

burnin

Numeric burn-in parameter: the number of samplings deemed as a burn-in period. Should be an integer greater than one.

Details

The simulation only includes the more complicated process and control chart cases and is meant for model checking and for situations when the exact calculation is problematic (such as low probabilities in the stationary distribution leading to rounding errors).

Value

A Markov_sim object which is a list of length 4.

Value_at_samplings

The process value at sampling.

Sampling_event

The event at sampling, each can either be success (there was a sampling but no alarm), alarm (sampling with alarm) or failure (no sampling occurred).

Simulation_data

The simulated data (distances from the target value).

Stationary_distribution

The stationary distribution of the Markov chain, created by discretising the simulated data. See the documentaion of the Markovchart function.

Author(s)

Balazs Dobi and Andras Zempleni

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

Markovstat

Examples

#Simulation using exponential shifts, random repair and random samling.
simres1	<-	Markovsim(shiftfun="exp", num=500, h=1, k=1, sigma=1, s=0.2, delta=2,
                          RanRep=TRUE, alpha=1, beta=3, RanSam=TRUE, StateDep=TRUE,
                          a=0.1, b=1, V=10)
simres1
hist(simres1[[1]], 20, freq=FALSE)

#Simulation using exponential-geometric mixture shifts, random repair and random samling.
simres2	<-	Markovsim(shiftfun="exp-geo", num=500, h=1, k=1, sigma=1, s=0.2, delta=2,
                          probmix=0.9, probnbin=0.6, RanRep=TRUE, alpha=1, beta=3, RanSam=TRUE,
                          StateDep=TRUE, a=0.1, b=1, V=10)
simres2
hist(simres2[[1]], 20, freq=FALSE)

Markovchart documentation built on April 10, 2022, 1:06 a.m.