Created
March 25, 2015 03:07
-
-
Save TonyLadson/acdbdc1d835a5d12c2fd to your computer and use it in GitHub Desktop.
Function to return delta as used to estimate confidence intervals for flood frequency analysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to return delta as used to estimate | |
# confidence intervals for flood frequency analysis | |
# Usage | |
# Delta(g, aep) | |
# | |
# g = skewness | |
# aep = Annual exceedance probability | |
# | |
# Implementing equation 9-54 from Kite (2004) | |
# Frequency and risk analysis in hydrology. Water Resources Publications | |
# and Equation 2.17 Book IV Australian Rainfall and Runoff | |
Delta <- function(g, aep){ | |
require(lmomco) | |
require(numDeriv) | |
Ky_Qp3 <- function(g, aep){ | |
# Return the quantile of the Pearson III distribution given | |
# skewness of g, and annual exceedance probability, aep | |
param <- vec2par(c(0,1,g), type='pe3') | |
quape3(1 - aep, param) | |
} | |
K <- Ky_Qp3(g, aep) | |
dK <- grad(Ky_Qp3, g, method="Richardson", aep = aep) | |
sqrt(1 + K*g + 0.5*(K^2)*(0.75*(g^2) + 1) + 3*K*dK*(g + 0.25*g^3) + 3*(dK^2)*(2 + 3*g^2 + (5/8)*g^4)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment