R/getweights.R

'getweights' <- function(x) {
  if(is.vector(x)) x <- matrix(x,ncol=1)
  if(!is.matrix(x)) stop("x must be a real-valued matrix")
  xunique <- unique(x)
  w <- NULL
  for (i in 1:nrow(unique(x))) {
    w <- c(w,sum(apply(x,1,identical,xunique[i,])))
  }  
  w <- w/sum(w)
  return(list(x=xunique,w=w))
}

Try the LogConcDEAD package in your browser

Any scripts or data that you put into this service are public.

LogConcDEAD documentation built on April 6, 2023, 1:11 a.m.