R/RMSSTD_FUNC.R

#' RMSSTD_FUNC function
#'
#' This is one of a few functions created by Joe Cauteruccio, Jessie Li, Andrew West of Yale University that are used together to create the hclust_eval() function.
#'
#'@keywords RMSSTD_FUNC
#'@export
#'
RMSSTD_FUNC <- function(mod_dat, row_v, dim_obs){
  RMSSTD_vec <- rep(NA, dim_obs)
  RMSSTD_vec[dim_obs] <- 0

  for (i in (dim_obs - 1):1) {
    x_bar_k <- apply(mod_dat[row_v[[i]], ], 2, mean)
    w_k <- sum(apply(mod_dat[row_v[[i]], ], 1, function(x) (dist(rbind(x, x_bar_k))^2)))
    RMSSTD_vec[i] <- sqrt(w_k/(dim(mod_dat)[2]*(length(row_v[[i]]) - 1)))
  }

  return(RMSSTD_vec)

}
18kimn/yalestats documentation built on May 9, 2019, 2:17 a.m.