# NOT RUN {
f <- c(A = 0.1, B = 0.2, C = 0.7)
e <- expected_number_of_distinct_alleles(3, f)
# by hand calculation
p <- pr_number_of_distinct_alleles(3, f)
e_by_hand <- sum(as.numeric(names(p)) * p)
stopifnot(isTRUE(all.equal(e, e_by_hand)))
# }
Run the code above in your browser using DataLab