Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(1)
- m <- 10
- n <- 7
- A <- matrix(rexp(m*n), ncol = m, nrow = n)
- p <- c(0.05,0.1,0.3,0.05,0.05,0.05,0.07,0.03,0.2,0.1)
- numerator <- sweep(A, 2, p, "*")
- d <- colSums(sweep(numerator, 1, rowSums(numerator), "/"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement