returnperiod<-function(excess,parameter){ # Compute return period for a given matrix of excesses and a given array of # Generalized Pareto distribution parameters # # Description: # # Returns return period of excesses # # Usage: returnperiod(excess,parameter) # # Input: # # excess: p x q matrix of excesses # # parameter: 2 x p x q array with scale (first level of the array) and # shape (second level of the array) parameters # # Output: # # A matrix containing the return period of excesses # # Authors: # # Caio Coelho 28 Feb 2006 rp<-excess for(i in 1:dim(excess)[1]) for(j in 1:dim(excess)[2]) if (any(is.na(c(excess[i,j],parameter[1,i,j],parameter[2,i,j])))){ rp[i,j]<-NA } else{ rp[i,j]<-1/(1-pgpd(excess[i,j],loc=0,scale=parameter[1,i,j],shape=parameter[2,i,j])) } rp }