In: Statistics and Probability
The service time in minutes from admit to discharge for ten
patients seeking care in a hospital emergency department are 21,
136, 185, 156, 3, 16, 48, 28, 100, and 12. Construct a
normal probability plot, an exponential probability plot, and a
Weibull probability plot for these data in R. Based on the
plots, which distribution is the best one to describe the
outpatient service time?
Ran the below code to construct a normal probability plot
service.time = c(21, 136, 185, 156, 3, 16, 48, 28, 100,12)
# GET SIZE OF SAMPLE
n <- length(service.time)
# GET FRACTIONS (PERCENTILES) OF THE OBSERVED SAMPLE.
Fi <- (1:n-0.5)/n
# GET THE CORRESPONDING z - scores BY SOLVING Fi = Phi(Zi).
Zi <- qnorm(Fi,0,1)
# PUT THE OBSERVATIONS INTO INCREASING ORDER.
SP <- sort(service.time)
# PLOT SP VS. Zi. DRAW THE BEST FIT LINE THIS TIME.
plot(Zi,SP,ylab="Observed Service time",xlab="z -
Percentile",main="Normal P-P Plot")
abline(lm(SP~Zi),col=2)
Ran the below code to construct a exponential probability plot
service.time = c(21, 136, 185, 156, 3, 16, 48, 28, 100,12)
# GET SIZE OF SAMPLE
n <- length(service.time)
# GET FRACTIONS (PERCENTILES) OF THE OBSERVED SAMPLE.
Fi <- (1:n-0.5)/n
# lambda Qi IS THE QUANTILE. SOLVE EQUATION Fi = 1 - exp(-lambda
Qi)
Qi <- -log(1-Fi)
# PUT THE OBSERVATIONS INTO INCREASING ORDER.
SP <- sort(service.time)
# PLOT SP VS. Zi. DRAW THE BEST FIT LINE THIS TIME.
plot(SP, Qi,ylab="Service time Quantiles",xlab="Theoretical
Exponential Quantiles",main="Exponential P-P Plot")
abline(lm(Qi ~SP),col=2)
Ran the below code to construct a Weibull probability plot
service.time = c(21, 136, 185, 156, 3, 16, 48, 28, 100,12)
# GET SIZE OF SAMPLE
n <- length(service.time)
# GET FRACTIONS (PERCENTILES) OF THE OBSERVED SAMPLE.
Fi <- (1:n-0.5)/n
# Qi/beta IS THE QUANTILE. SOLVE EQUATION Fi = 1 - exp(-(-Qi/beta
)^alpha)
Eta <- log(-log(1-Fi))
# PUT THE OBSERVATIONS INTO INCREASING ORDER.
SP <- sort(service.time)
# PLOT SP VS. Zi. DRAW THE BEST FIT LINE THIS TIME.
plot(Eta,log(SP),ylab="Log Service time Quantiles",
xlab="Theoretical Weibull Quantiles",main="Weibull P-P Plot")
abline(lm(log(SP) ~Eta),col=2)
Weibull distribution is the best one to describe the outpatient service time, because the estimated line in Weibull probability plot, approximately lie on the line y = x and the data points are closer to the estimated line.