WorldHealthOrganization / anthro

Computation of the WHO Child Growth Standards
https://worldhealthorganization.github.io/anthro/
GNU General Public License v3.0
29 stars 9 forks source link

Obtaining Z-scores for children at 60 months of age #37

Closed bzki closed 3 years ago

bzki commented 3 years ago

Thanks for the excellent work on this package.

I noticed in some exploratory code that if you input an observation with 60 months of age (given in months rather than days), then the function returns an NA for the Z-score, but not for the equivalent number days. See for example:

library(anthro)
anthro_zscores(sex = 1, age = 60, is_age_in_month = TRUE, armc = 16)$zac
#> [1] NA
anthro_zscores(sex = 1, age = anthro:::round_up(60*30.4375), 
               is_age_in_month = FALSE, armc = 16)$zac
#> [1] -0.37

Created on 2021-02-02 by the reprex package (v0.3.0)

The code doing this is here:

https://github.com/dirkschumacher/anthro/blob/855299eb35c48a57d56f191457d002a590ba5c5d/R/z-score-helper.R#L149

This occurs even though the WHO's own tables have values for 60 months, and when converted into days, the age (1826 days) is in the accepted range for the other functions, e.g. https://github.com/dirkschumacher/anthro/blob/855299eb35c48a57d56f191457d002a590ba5c5d/R/z-score-arm-circumference-for-age.R#L24

If this were to be changed, it would be as simple as changing from < to <=. What are your thoughts on this? I just wanted to raise the issue in case it hadn't been discussed before, or if the above behavior was unintended.

Thanks, BK