optsize function

Optimal sample size allocation