This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. The [R-markdown source code](`r paste0("https://raw.githubusercontent.com/hoehleatsu/hoehleatsu.github.io/master/_source/",current_input())`) of this blog is available under a [GNU General Public License (GPL v3)](https://www.gnu.org/licenses/gpl-3.0.html) license from GitHub. ## Introduction Percentiles of a reference population at a given age are often used to assess under- and overweight of children. As an example, the WHO defines obesity for children under 5 years of age when the [weight-for-height](https://cdn.who.int/media/docs/default-source/child-growth/child-growth-standards/indicators/weight-for-length-height/cht-wfl-girls-z-0-2.pdf?sfvrsn=a683172c_11) of a child is greater than 3 standard deviations above WHO Child Growth Standards median for that age](https://www.who.int/news-room/fact-sheets/detail/obesity-and-overweight) (see also the WHO R package [anthro](https://cran.r-project.org/web/packages/anthro/index.html). In order to estimate these percentiles, data from a sample of the reference population is often fitted using flexible regression models such as GAMLSS [@rigby_stasinopoulos2005] or quantile regression [@koenker2005]. This allows for a flexible modelling of the percentiles as smooth functions of age [@fenske_etal2013]. The reference curves used in Germany are based on the Box-Cox Cole and Green distribution [@KromeyerHauschild_etal2001] (aka. the LMS method). The [childsds](https://cran.r-project.org/web/packages/childsds/index.html) R package contains an implementation of these curves as `data(kro.ref)`. Furthermore, the package contains similar reference curves for several other countries as well as the WHO reference. In what follows, we will re-purpose the package as work-horse for generating individualized birthday cards for children. ## Results Quantiles of the reference population are obtained with the `childsds::make_percentile_tab` function. As an example, let's get the 5th, 50th and 95th percentile of the height distribution for the population of girls in Germany aged 0 and 4 years, respectively. ```{r, echo=TRUE, message=FALSE} library(childsds) data(kro.ref) childsds::make_percentile_tab( ref = kro.ref, item = "height", age=c(0,4), perc=c(5,50,95), include.pars= FALSE ) %>% filter(sex == "female") ``` The main result of this short blog post is a [Rmd file](https://github.com/hoehleatsu/hoehleatsu.github.io/blob/master/figure/source/2022-06-11-refpop/birth_stats.Rmd), which contains a visualization of an imaginary child's growth trajectory: Albert B. Cook born on 2018-06-11. The data of Albert are stored in a [CSV file]({{ site.baseurl }}/figure/source/2022-06-11-refpop/kid_measurements.csv). We show the trajectories for height, weight and BMI and compare to 5 quantiles of the German reference population, i.e. the 2.5%, 5%, 50%, 95% and 97.5% quantile. The resulting visualization looks as follows:

```{r make_birth_report, child=file.path(filePath, "birth_stats.Rmd")} ```

The Rmd file can be obtained from GitHub and serves as a template for creating [html based congratulation cards]({{ site.baseurl }}/figure/source/2022-06-11-refpop/birth_stats.html) in response to news of newborn (which usually are annotated with birth height and birth weight) or to track the growth of your own kids. ## Discussion Percentile curves for longitudinal trajectories in populations can also be used in very different contexts than anthropometry. As an example consider the development of your [solve time for the 3x3x3 Rubik's cube as a function of time since first WCA competition](https://staff.math.su.se/hoehle/blog/2019/05/06/wcamining.html). ## Literature