search for: cminx

Displaying 1 result from an estimated 1 matches for "cminx".

Did you mean: cmin
2006 May 17
5
Convention difference in tseries.maxdrawdown (PR#8872)
...ibility with the current version. It has the flaw that it does not check for zero or negative values. maximumdrawdown <- function (x) { if (NCOL(x) > 1) stop("x is not a vector or univariate time series") if (any(is.na(x))) stop("NAs in x") cminx <- x/cummax(x) mdd <- min(cminx) to <- which(mdd == cminx) from <- double(NROW(to)) for (i in 1:NROW(to)) { from[i] <- max( which(cminx[1:to[i]] == 1) ) } return(list(maximumdrawdown = 1-mdd, maxdrawdown = (1-mdd)*x[from], from = from, to = to)) }