## estimate optimal sample composition lambda and precision SEz for 9 centiles
## spaced 2/3 of a z-score apart, based on a sample of 10,000 children
optimal_design(z = -4:4*2/3, N = 10000)
## calculate age group sizes optimised for centiles from the 50th to the 99.6th
## (or equivalently from the 50th to the 0.4th)
## with a sample of 10,000 children from 0 to 20 years in one-year groups
purrr::map_dfc(0:4*2/3, ~{
n_agegp(z = .x, N = 10000) %>%
dplyr::select(!!z2cent(.x) := n_varying)
}) %>%
dplyr::bind_cols(tibble::tibble(age = paste(0:19, 1:20, sep='-')), .)
Run the code above in your browser using DataLab