localgrowth Vignette - adblackwell/localgrowth GitHub Wiki
The localgrowth package provides functions to calculate z-scores and centile values for measurements of height, weight, and BMI based on both widely used growth standards and references (CDC, WHO) and references from other populations. The included LMS files are for calculating height-for-age, weight-for-age, BMI-for-age, and weight-for-height z-scores.
The primary function for localgrowth is growthRef
, which provides an interface for calcualting z-scores or centiles from one or more growth references. Other functions include centilesLMS
which generates centile tables for reference or plotting, and ZfromLMS
which does simple calculations from LMS values.
localgrowth can be installed directly from github. If devtools is already installed the first line can be skipped:
install.packages('devtools')
devtools::install_github('adblackwell/localgrowth',build_vignettes = TRUE)
Bug reports can also be filed on github, at https://github.com/adblackwell/localgrowth/issues.
Four sets of references/standards are currently including in localgrowth. These include references for the Tsimane and Shuar indigenous groups of Bolivia and Ecuador, which were developed as population specific references, but may be useful for other South American populations. See the papers under the References section for further details on the development and use of these references.
The included data set TsimaneData
includes 200 measurements of height, weight, and BMI, taken from the Tsimane growth data set in Blackwell, et al (2017). further documentation can be found with ?TsimaneData
. We will use this data for examples:
library(localgrowth)
data(TsimaneData)
head(TsimaneData)
#> PID Sex Age Height Weight BMI
#> 1 TGD3465 Male 8.0219028 122.8 26.4 17.50682
#> 2 TGD1433 Female 15.1869724 150.0 60.1 26.71111
#> 3 TGD7135 Female 2.3053840 84.0 11.7 16.58163
#> 4 TGD0304 Male 0.5778006 68.0 7.4 16.00346
#> 5 TGD6486 Female 16.6133927 164.4 77.4 28.63765
#> 6 TGD3227 Female 10.8118868 134.0 31.9 17.76565
To calculate z-scores based on all four references, for height-for-age:
HFA<-growthRef(Age,Height,Sex,data=TsimaneData,type="Height")
head(HFA)
#> Z.CDC.Height Z.WHO.Height Z.Tsimane.Height Z.Shuar.Height
#> 1 -0.9119514 -0.8102912 0.968145840 1.2686779
#> 2 -1.8618328 -1.7323427 0.001605685 0.5694053
#> 3 -1.1298073 -1.4140430 0.472562277 0.2313592
#> 4 -0.2162897 -0.4914509 0.297327698 0.3471471
#> 5 0.2477139 0.2450246 3.105175105 3.2166799
#> 6 -1.2310664 -1.4820008 0.105049843 0.4281562
Similarly for weight-for-height:
WFH<-growthRef(Height,Weight,Sex,data=TsimaneData,type="WFH")
head(WFH)
#> Z.CDC.WFH Z.WHO.WFH Z.Tsimane.WFH Z.Shuar.WFH
#> 1 NA NA 0.8281672 NA
#> 2 NA NA 1.7066106 NA
#> 3 0.06541016 0.5398625 0.2554352 NA
#> 4 -0.90851972 -0.9112184 -0.4794951 NA
#> 5 NA NA NA NA
#> 6 NA NA 0.3032575 NA
Note that weight-for-height can only be calculated for selected ranges of heights, and is not available for the Shuar references at all. When a value is out of range of the reference, a NA
is returned.
We can also request just values based on CDC and Tsimane references, and format output as centiles instead of z-scores:
HFA<-growthRef(Age,Height,Sex,data=TsimaneData,type="Height",pop=c("CDC","Tsimane"),z="centile")
head(HFA)
#> Z.CDC.Height Z.Tsimane.Height
#> 1 -0.9119514 0.968145840
#> 2 -1.8618328 0.001605685
#> 3 -1.1298073 0.472562277
#> 4 -0.2162897 0.297327698
#> 5 0.2477139 3.105175105
#> 6 -1.2310664 0.105049843
When only a single type of score is requested, a vector rather than a data frame is returned:
BFA<-growthRef(Age,BMI,Sex,data=TsimaneData,type="BMI",pop="CDC")
head(BFA)
#> [1] 0.8695613 1.4507304 0.2943497 NA 1.5671976 0.1711645
Typically, growthRef
will be used with the type
and pop
arguements which allow for multiple references to be returned simultaneously. However, sometimes it may be useful to call an LMS table directly. LMS tables internal to localgrowth are named after the population and type, i.e. CDC.WFH
or Tsimane.Weight
. These can be called by name with the LMS
arguement. Note that other, non-internal LMS tables can also be used, provided they are in the right format.
WFH<-growthRef(Height,Weight,Sex,data=TsimaneData,LMS=CDC.WFH,z="centile")
head(WFH)
#> [1] NA NA 0.06541016 -0.90851972 NA NA
‘growthRef’ works by organizing the input and calling he function getZ
to calculate Z-scores. getZ
can also be called directly with an LMS table specified, as can ‘getCentile’:
#Tsimane specific z-score for a single individual, age 2 yrs, 75 cm, male.
getZ(2,75,"Male",Tsimane.Height)
#> [1] -1.100132
getCentile(2,75,"Male",Tsimane.Height)
#> [1] 0.1356373
The function ‘centilesLMS’ allows for the production of custom centile tables from either internal or external LMS files. This can be useful for producing comparisons for plots. For example, we might want to show how a particular individuals growth compares to Tsimane standards:
#Subset the observations for one individual
ind<-TsimaneData[TsimaneData$PID=='TGD0734',]
#Get the 2.5, 50, and 97.5 centiles for age 2 to 7, for plotting
cent<-centilesLMS(seq(2,7,0.1),"Female",Tsimane.Height,cent=c(0.025,0.5,0.975),xname="Age")
plot(Height~Age,data=ind,ylim=range(cent[,2:4]),xlim=c(2,7),pch=19,main="Height growth for TGD0734")
lines(cent$Age,cent$'0.5',col="red",lty=1)
lines(cent$Age,cent$'0.025',col="red",lty=2)
lines(cent$Age,cent$'0.975',col="red",lty=2)
localgrowth functions contain additional options not documented here. Visit the help files for the respective functions for further details.
?localgrowth
?growthRef
?centilesLMS
?ZfromLMS
?TsimaneData
The following growth references/standards are included in localgrowth and should be cited appropriately if used:
Blackwell, AD, Urlacher, SS, Beheim, B, von Rueden, C, Jaeggi, A, Stieglitz, J, Tumble, BC, Gurven, MD, Kaplan, H. (2017) Growth references for Tsimane forager-horticulturalists of the Bolivian Amazon, American Journal of Physical Anthropology. 162(3) 441-461. DOI: 10.1002/ajpa.23128.
Urlacher, SS, Blackwell, AD, Liebert, MA, Madimenos, FC, Cepon-Robins, TJ, Gildner, TE, Snodgrass, JJ, Sugiyama, LS. (2016) Physical Growth of the Shuar: Height, Weight, and BMI Growth References for an Indigenous Amazonian Population, American Journal of Human Biology, 28(1): 16-30. DOI: 10.1002/ajhb.22747.
Kuczmarski, R. J., Ogden, C. L., Guo, S. S., Grummer-Strawn, L. M., Flegal, K. M., Mei, Z., Wei, R., Curtin, L. R., Roche, A. F., Johnson, C. L. (2002). 2000 CDC Growth Charts for the United States: Methods and development. Vital Health Statistics 11,1-190. https://www.cdc.gov/growthcharts/data_tables.htm
World Health Organization. (2006). New child growth standards: Length/ height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. Geneva: World Health Organization
de Onis, M., Onyango, A., Borghi, E., Siyam, A., Nishida, C., & Siekman, J. (2007). Development of a WHO growth reference for school-aged children and adolescents. Bulletin of World Health Organization, 85, 660-667.
http://www.who.int/childgrowth/en/ http://www.who.int/growthref/en/