###################### ### Epigraph Index ### ###################### ## The epigraph index of a curve x (EI) is one minus the proportion of curves in the sample that lie above x. # This function computes the EI of a bunch of B curves. EI <- function(curves){ index <- numeric() B <- dim(curves)[1] lengthcurves <- dim(curves)[2] for (i in 1:B){ index[i] <- 0 env.min <- curves[i,] for (j in 1:B){ inpoints <- sum((curves[j,] >= env.min)) if (inpoints == lengthcurves) {index[i] <- index[i]+1} } } index <- index/B return (1-index) } ####################### ### Hypograph Index ### ####################### ## The hypograph index of a curve x (HI) is the proportion of curves in the sample that lie below x. # This function computes the HI of a bunch of B curves. HI <- function(curves){ index <- numeric() B <- dim(curves)[1] lengthcurves <- dim(curves)[2] for (i in 1:B){ index[i] <- 0 env.max <- curves[i,] for (j in 1:B){ inpoints <- sum(curves[j,]<=env.max) if (inpoints == lengthcurves) {index[i] <- index[i]+1} } } index <- index/B return (index) } ################################## ### Generalized Epigraph Index ### ################################## ## The generalized epigraph index of a curve x (MEI) is ## one minus the "proportion of time" that the curves of the sample are above x. # This function computes the MEI of a bunch of B curves. MEI <- function(curves){ index <- numeric() B <- dim(curves)[1] lengthcurves <- dim(curves)[2] for (i in 1:B){ index[i] <- 0 env.min <- curves[i,] for (j in 1:B){ inpoints <- sum(curves[j,] >= env.min) index[i] <- index[i]+inpoints } } index <- index/(B*lengthcurves) return (1-index) } ################################### ### Generalized Hypograph Index ### ################################### ## The generalized hypograph index of a curve x (MHI) is ## the "proportion of time" that the curves of the sample are below x. # This function computes the MHI of a bunch of B curves. MHI <- function(curves){ index <- numeric() B <- dim(curves)[1] lengthcurves <- dim(curves)[2] for (i in 1:B){ index[i] <- 0 env.max <- curves[i,] for (j in 1:B){ inpoints <- sum(curves[j,]<=env.max) index[i] <- index[i]+inpoints } } index <- index/(B*lengthcurves) return (index) }