Statistical Methods for Reliability Data

Chapter 4 - Location-Scale-Based Parametric Distributions

W. Q. Meeker, L. A. Escobar, and J. K. Freels

16 July 2018

OVERVIEW

This Chapter Explains...

4.1 - INTRODUCTION

Parametric Models For Reliability Data

4.2 - QUANTITIES OF INTEREST IN RELIABILITY APPLICATIONS

Are not the parameters themselves, but are functions of one or more parameters

4.3 - LOCATION-SCALE AND LOG-LOCATION-SCALE DISTRIBUTIONS

The Location-Scale Family of Distributions

teachingApps::teachingApp('location_scale')

The Log-Location-Scale Family of Distributions

teachingApps::teachingApp('log_location_scale')

4.13 - Generating Psuedorandom Observations From a Specified Distribution

Classifying Types of Psuedorandom Number Generators

Pseudorandom observations in R

PRNG Seed Values

\[\bar{A}=\left[\begin{array}{rrrr} 17 & 40 & 37 & 38 \\ 49 & 42 & 31 & 29 \\ 33 & 3 & 10 & 12 \\ 50 & 18 & 6 & 23 \\ \end{array} \right]\]

\[ \bar{A} = \left[\begin{array}{rrrr} 30 & 38 & 40 & 4 \\ 1 & 12 & 3 & 36 \\ 15 & 32 & 31 & 48 \\ 14 & 39 & 45 & 16 \\ \end{array} \right] \]

4.13 - Generating Psuedorandom Observations From a Specified Distribution

Example: Generate PRN's With and Without Seed Values

  1. Eight observations from a \(NOR(0.75, 1.5)\) distribution set.seed(NULL)

  2. Eight observations from a \(NOR(0.75, 1.5)\) distribution set.seed(NULL)

  3. Eight observations from a \(NOR(0.75, 1.5)\) distribution set.seed(42)

  4. Eight observations from a \(NOR(0.75, 1.5)\) distribution set.seed(42)

What Does This Show?

set1 set2 set3 set4
0.2251 0.1583 0.9075 0.9075
1.0119 1.6559 1.8055 1.8055
1.3853 1.6727 1.8368 1.8368
2.7658 2.7740 3.6499 3.6499
4.0767 4.4050 3.8822 3.8822
7.4931 9.1429 5.4701 5.4701
25.2562 25.5608 16.5509 16.5509
36.6162 63.8440 20.4357 20.4357

4.13 - Generating Psuedorandom Observations From a Specified Distribution

Pseudorandom Numbers From Continuous Distributions

Simulate Observations From A \(EXP(2)\) Distribution

probs <- runif(10,0,1)

probs
 [1] 0.97822643 0.11748736 0.47499708 0.56033275 0.90403139 0.13871017
 [7] 0.98889173 0.94666823 0.08243756 0.51421178

\[ F(t|\theta=2)=1-\exp\left[-\frac{t}{2}\right] \]

\[ t_{p}=-\ln[1-p]\times2 \]

# Create function
t_p.exp <- function(p,theta) -log(1-p)*theta

# Evaluate function
t_p.exp(p = probs, theta = 2)
 [1] 7.6541167 0.2499643 1.2887029 1.6434742 4.6874682 0.2986484 9.0001306
 [8] 5.8624462 0.1720693 1.4439650
par(family = "serif", bg = NA, mfrow = c(1,2))

probs10   <- runif(10,0,1)
probs1000 <- runif(1000,0,1)

t_p.exp2_10   <- t_p.exp(p = probs10,   theta = 2)
t_p.exp2_1000 <- t_p.exp(p = probs1000, theta = 2)

plot(ecdf(t_p.exp2_10), 
     main = "10 observations",
     col = 'red')
curve(pexp(x,1/2), add = TRUE, lwd = 2)

plot(ecdf(t_p.exp2_1000), 
     main = "1000 observations",
     col = 'blue')
curve(pexp(x,1/2), add = TRUE, lwd = 2)

4.13 - Generating Psuedorandom Observations From a Specified Distribution

Example: Generating Psuedorandom Censored Observations

\[ \Pr \left [ U_{(i)}\leq u|U_{(i-1)}=u_{(i-1)}\right ]=1 - \left [\frac{1-u } { 1-u_{(i-1)} } \right ]^{(n-i+1)}, \quad u \ge u_{(i-1)} \]

\[ \begin{eqnarray*} U_{(1)}&=& 1-[1-U_{(0)}]\times(1-U_{1})^{1/n} \\ U_{(2)}&=& 1-[1-U_{(1)}]\times (1-U_{2})^{1/(n-1)} \\ & \vdots & \\ U_{(r)}&=& 1-[1-U_{(r-1)}] \times (1-U_{r})^{1/(n-r+1)} \end{eqnarray*} \]

Generating Pseudorandom Order Statistics

  1. Generate \(n\) observations from a \(UNIF(0,1)\) distribution
n = 10

obs  <- runif(n,0,1) ; obs 
 [1] 0.93739662 0.63554887 0.48474653 0.08589623 0.94491319 0.34671377
 [7] 0.36934622 0.62414874 0.72740583 0.19792811
  1. Sort the \(n\) observations from smallest to largest
obs <- sort(obs, decreasing = F) ; obs
 [1] 0.08589623 0.19792811 0.34671377 0.36934622 0.48474653 0.62414874
 [7] 0.63554887 0.72740583 0.93739662 0.94491319
  1. Store the ranks of the \(n\) observations from \(1,\ldots,n\)
ranks <- rank(obs) ; ranks
 [1]  1  2  3  4  5  6  7  8  9 10
  1. Pre-allocate a vector in which to write the pseudorandom uniform order statistics
U.order <- double(length(obs)) ; U.order
 [1] 0 0 0 0 0 0 0 0 0 0
  1. For Type II (failure censored data) compute the order statistics for the \(r\) failures

    • For \(r+1,\ldots,n\), \(U_{r+1}\ldots,U_{n} = U_{r}\)

    • The function defined below can be used to produce the psedorandom order statistics

PRUOS <- function(n, r = NULL){
  
  `if`(is.null(r),
       r <- n,
       if(r > n) stop("r value greater than in_vec length - dummy"))
  
  in_vec  <- sort(runif(n,0,1))
  out_vec <- double(r) 
  
  for(i in 1:r) {
    
    `if`(i == 1,
         out_vec[i] <- 1 - (1 - in_vec[i])**(1 / (n - i + 1)),
         out_vec[i] <- 1 - (1 - out_vec[i - 1]) * (1 - in_vec[i])**(1 / (n - i + 1)))
    
    
  }
  
  if(r < n) out_vec[(r + 1):n] <- out_vec[r]
  
  df <- data.frame(probs  = out_vec,
                   censor = rep(c('failed','right'), c(r,n - r)),
                   stringsAsFactors = F)
  
  return(df)
  
}

# Generate order statistics for n=25 systems with r=4 failures
n = 25 ; r = 4
samp1 <- PRUOS(n = n, r = r)

# using these order statistics to generate values from 
# a Weibull(2.25, 10) distribution 
samp1$times <- qweibull(samp1$probs, shape = 2.25, scale = 10)

# Compare values to not using order statistics
samp2 <- data.frame(probs = sort(runif(n)),
                    censor = 'failed',
                    stringsAsFactors = F)

samp2$times <- qweibull(samp2$probs, shape = 2.25, scale = 10)
samp2$times[(r + 1):n] <- samp2$times[r]
samp2$censor[(r + 1):n] <- 'right'

dt1 <- DT::datatable(cbind(samp1,samp2), rownames = F)

DT::formatRound(dt1, 
                digits = 5, 
                columns = which(sapply(dt1$x$data, is.numeric)))
  1. For Type I (time censored data) compute the order statistics for the \(r = n\) failures and cap off the resulting times that occur after a specified censoring time
# Generate order statistics for n=25 systems with r=25 failures
n = 25 ; r = 25
samp3 <- PRUOS(n = n, r = r)

# using these order statistics to generate values from 
# a Weibull(2.25, 10) distribution 
samp3$times <- qweibull(samp3$probs, shape = 2.25, scale = 10)

# Specify a censoring time and cap all values at this time
t_c <- 12.5
samp3$censor[samp3$times >= t_c] <- 'right'
samp3$times[samp3$censor == 'right'] <- max(samp3$times[samp3$times <= t_c])


# Compare values to not using order statistics
samp4 <- data.frame(probs = sort(runif(n)),
                    censor = 'failed',
                    stringsAsFactors = F)

samp4$times <- qweibull(samp4$probs, shape = 2.25, scale = 10)
samp4$censor[samp4$times >= t_c] <- 'right'
samp4$times[samp4$censor == 'right'] <- max(samp4$times[samp4$times <= t_c])

dt2 <- DT::datatable(cbind(samp3,samp4), rownames = F)

DT::formatRound(dt2, 
                digits = 5, 
                columns = which(sapply(dt2$x$data, is.numeric)))