data(TX38lgtrmFlow)
summary(TX38lgtrmFlow)
## Not run:
# # Need to load libraries in this order
# library(lmomco); library(lmomRFA)
# data(TX38lgtrmFlow)
# TxDat <- TX38lgtrmFlow
# TxDat <- TxDat[,-c(4)]; TxDat <- TxDat[,-c(8:15)]
# summary(regtst(TxDat))
# TxDat2 <- TxDat[-c(11, 28),] # Remove 08082700 Millers Creek near Munday
# # Remove 08190500 West Nueces River at Brackettville
# # No explanation for why Millers Creek is so radically discordant with the other
# # streamgages with the possible exception that its data record does not span the
# # drought of the 1950s like many of the other streamgages.
# # The West Nueces is a highly different river from even nearby streamgages. It
# # is a problem in flood frequency analysis too. So not surprizing to see this
# # streamgage come up as discordant.
# summary(regtst(TxDat2))
# S <- summary(regtst(TxDat2))
# # The results suggest that none of the 3-parameter distributions are suitable.
# # The bail out solution using the Wakeby distribution is accepted. Our example
# # will continue on by consideration of the two 4-parameter distributions
# # available. A graphical comparison between three frequency curves will be made.
# kap <- S$rpara
# rmom <- S$rmom
# lmr <- vec2lmom(rmom, lscale=FALSE)
# aep <- paraep4(lmr)
# F <- as.numeric(unlist(attributes(S$quant)$dimnames[2]))
# plot(qnorm(F), S$quant[6,], type="l", lwd=3, lty=2,
# xlab="Nonexceedance probability (as standard normal variate)",
# ylab="Frequency factor (dimensionless)")
# lines(qnorm(F), quakap(F, kap), col=4, lwd=2)
# lines(qnorm(F), quaaep4(F, aep), col=2)
# legend(-1, 0.8, c("Wakeby distribution (5 parameters)",
# "Kappa distribution (4 parameters)",
# "Asymmetrical Exponential Power distribution (4 parameters)"),
# bty = "n", cex=0.75, lwd=c(3,2,1), lty=c(2,1,1), col=c(1,4,2)
# )
# # Based on general left tail behavior the Wakeby distribution is not acceptable.
# # Based on general right tail behavior the AEP is preferred.
# #
# # It is recognized that the regional analysis provided by regtst() indicates
# # substantial heterogeneity by all three definitions of that statistic. Further
# # analysis to somehow compensate for climatological and general physiographic
# # differences between the watersheds might be able to compensate for the
# # heterogeneity. Such an effort is outside scope of this example.
# #
# # Suppose that the following data set is available for particular stream site from
# # a short record streamgage, let us apply the dimensionless frequency curve as
# # defined by the asymmetric exponential power distribution. Lettuce also use the
# # 50-year drought as an example. This recurrence interval has a nonexceedance
# # probability of 0.02. Lastly, there is the potential with this particular process
# # to compute a negative annual mean streamflow, when this happens truncate to zero.
# data <- c(11.9, 42.8, 36, 20.4, 43.8, 30.7, 91.1, 54.7, 43.7, 17, 28.7, 20.5, 81.2)
# xbar <- mean(log10(data + 10)) # shift, log, and mean
# # Note the application of the "the index method" within the exponentiation.
# tmp.quantile <- 10^(xbar*quaaep4(0.02, aep)) - 10 # detrans, offset
# Q50yeardrought <- ifelse(tmp.quantile < 0, 0, tmp.quantile)
# # The value is 2.53 cubic feet per second average streamflow.
# ## End(Not run)
Run the code above in your browser using DataLab