Skip to contents

Calculate statistics for a normal distribution control chart

Usage

stats_n(data, alpha = 0.0027, mu = NULL, sd = NULL, ...)

Arguments

data

The data matrix

alpha

The significance level

mu

The mean of the distribution (optional)

sd

The standard deviation of the distribution (optional)

...

Additional arguments to be passed to the optimization algorithm

Value

A list containing the estimated parameters, control limits, alpha_hat, ARL, MRL, SDRL, convergence status, and value of the objective function

Examples

set.seed(0)
x <- r_n(lots = 1000, n = 10, mu = 1, sd = 1.7)

# Estimate for maximum likelihood
stats_n(data = x, alpha = 0.0027)
#> $mu_hat
#> [1] 1.017761
#> 
#> $sd_hat
#> [1] 1.671162
#> 
#> $alpha_hat
#> [1] 0.003
#> 
#> $ARL
#> [1] 333.3333
#> 
#> $MRL
#> [1] 230.7023
#> 
#> $SDRL
#> [1] 332.833
#> 
#> $li
#> [1] -0.5676303
#> 
#> $ls
#> [1] 2.603152
#> 
#> $convergence
#> [1] 0
#> 
#> $value
#> [1] 781.165
#> 

# Useing the true parameters
stats_n(data = x, alpha = 0.0027, mu = 1, sd = 1.7)
#> $mu_hat
#> [1] 1
#> 
#> $sd_hat
#> [1] 1.7
#> 
#> $alpha_hat
#> [1] 0.003
#> 
#> $ARL
#> [1] 333.3333
#> 
#> $MRL
#> [1] 230.7023
#> 
#> $SDRL
#> [1] 332.833
#> 
#> $li
#> [1] -0.6127492
#> 
#> $ls
#> [1] 2.612749
#> 
#> $convergence
#> NULL
#> 
#> $value
#> NULL
#>