R/ST_Unordered.R

ST_Unordered <-
function(N,x,p_x)  {
  F_x <- cumsum(p_x)
  disc_sim <- numeric(length=N)
  for(i in 1:N){
    temp <- runif(1)
    disc_sim[i] <- x[min(which(F_x>temp))]
  }
  return(disc_sim)
}

Try the ACSWR package in your browser

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

ACSWR documentation built on May 2, 2019, 6:53 a.m.