# Generate 20 observations from a lognormal distribution with parameters
# mean=10 and cv=1, censor the observations less than 5,
# then create a one-sided upper tolerance interval with 90%
# coverage and 95% confidence based on these Type I left, singly
# censored data.
# (Note: the call to set.seed allows you to reproduce this example.)
set.seed(250)
dat <- rlnormAlt(20, mean = 10, cv = 1)
sort(dat)
# [1] 2.608298 3.185459 4.196216 4.383764 4.569752 5.136130
# [7] 5.209538 5.916284 6.199076 6.214755 6.255779 6.778361
#[13] 7.074972 7.100494 8.930845 10.388766 11.402769 14.247062
#[19] 14.559506 15.437340
censored <- dat < 5
dat[censored] <- 5
tolIntLnormCensored(dat, censored, coverage = 0.9, ti.type="upper")
#Results of Distribution Parameter Estimation
#Based on Type I Censored Data
#--------------------------------------------
#
#Assumed Distribution: Lognormal
#
#Censoring Side: left
#
#Censoring Level(s): 5
#
#Estimated Parameter(s): meanlog = 1.8993686
# sdlog = 0.4804343
#
#Estimation Method: MLE
#
#Data: dat
#
#Censoring Variable: censored
#
#Sample Size: 20
#
#Percent Censored: 25%
#
#Assumed Sample Size: 20
#
#Tolerance Interval Coverage: 90%
#
#Coverage Type: content
#
#Tolerance Interval Method: Exact for
# Complete Data
#
#Tolerance Interval Type: upper
#
#Confidence Level: 95%
#
#Tolerance Interval: LTL = 0.00000
# UTL = 16.85556
# Note: The true 90'th percentile is 20.55231
#---------------------------------------------
qlnormAlt(0.9, mean = 10, cv = 1)
#[1] 20.55231
# Compare the result using the method "gpq"
tolIntLnormCensored(dat, censored, coverage = 0.9, ti.type="upper",
ti.method = "gpq", seed = 432)$interval$limits
# LTL UTL
# 0.00000 17.85474
# Clean Up
#---------
rm(dat, censored)
#--------------------------------------------------------------
# Example 15-1 of USEPA (2009, p. 15-10) shows how to estimate
# the mean and standard deviation using log-transformed multiply
# left-censored manganese concentration data. Here we'll construct a
# 95% upper tolerance limit with 90% coverage using these data.
EPA.09.Ex.15.1.manganese.df
# Sample Well Manganese.Orig.ppb Manganese.ppb Censored
# 1 1 Well.1 <5 5.0 TRUE
# 2 2 Well.1 12.1 12.1 FALSE
# 3 3 Well.1 16.9 16.9 FALSE
# ...
# 23 3 Well.5 3.3 3.3 FALSE
# 24 4 Well.5 8.4 8.4 FALSE
# 25 5 Well.5 <2 2.0 TRUE
with(EPA.09.Ex.15.1.manganese.df,
tolIntLnormCensored(Manganese.ppb, Censored, coverage = 0.9,
ti.type = "upper"))
#Results of Distribution Parameter Estimation
#Based on Type I Censored Data
#--------------------------------------------
#
#Assumed Distribution: Lognormal
#
#Censoring Side: left
#
#Censoring Level(s): 2 5
#
#Estimated Parameter(s): meanlog = 2.215905
# sdlog = 1.356291
#
#Estimation Method: MLE
#
#Data: Manganese.ppb
#
#Censoring Variable: censored
#
#Sample Size: 25
#
#Percent Censored: 24%
#
#Assumed Sample Size: 25
#
#Tolerance Interval Coverage: 90%
#
#Coverage Type: content
#
#Tolerance Interval Method: Exact for
# Complete Data
#
#Tolerance Interval Type: upper
#
#Confidence Level: 95%
#
#Tolerance Interval: LTL = 0.0000
# UTL = 110.9305
Run the code above in your browser using DataLab