Suppose you have administered GSED SF, GSED LF (McCray et al. 2023) or GSED HH to one or more children. The next step is calculating each child’s developmental score (\(D\)-score) and age-adjusted equivalent (DAZ). This step is known as scoring. The present section provides recipes for calculating the \(D\)-score and DAZ. We may pick one of the following two methods:
R
. The
app contains online documentation and instructions and will not be
further discussed here.R
package dscore
. The R
package dscore
at https://CRAN.R-project.org/package=dscore is a flexible
option with all the tools needed to calculate the \(D\)-score. It is an excellent choice for
users familiar with R
and users who like to incorporate
\(D\)-score calculations into a
workflow.R
language. If you are new to R
consult the Getting
Started with R site;R
package dscore
on your local machine;data.frame
, a
standard R
tabular structure;dscore()
function to calculate the
\(D\)-score and DAZ. The function
returns a table with six columns with the estimates with the same number
of rows as your data.dscore
packageThe dscore
package contains tools to
The required input consists of item level responses on milestones collected using instruments for measuring child development, including the GSED LF, GSED SF and GSED HH.
There are two versions of the dscore
package. For daily
use, we recommend the curated and published version on CRAN. In
R
, install the dscore
package as
install.packages("dscore")
In some cases, you might need a more recent version that includes extensions and bug fixes not yet available on CRAN. You can install the development version from GitHub by:
install.packages("remotes")
::install_github("d-score/dscore") remotes
The development version requires a local C++ compiler for building the package from source.
The dscore()
function accepts item names that follow the
GSED 9-position schema. A name with a length of nine characters
identifies every milestone. The following table shows the construction
of names.
Position | Description | Example |
---|---|---|
1-3 | instrument | by3 |
4-5 | developmental domain | cg |
6 | administration mode | d |
7-9 | item number | 018 |
Thus, item by3cgd018
refers to the 18th item in the
cognitive scale of the Bayley-III. The label of the item can be obtained
by
library(dscore)
get_labels("by3cgd018")
## by3cgd018
## "Inspects own hand"
The dscore
package maintains a list of items names.
Rows: One measurement, i.e., one test administration for a child at a given age, occupies a row in the data set. Thus, if a child is measured three times at different ages, there will be three rows for that child in the dataset.
Columns: There should be at least two columns in the data set:
1
, a FAIL as 0
. If
there is no answer or if the item was not administered use the missing
value code NA
. Items that are never administered may be
coded as all NA
or deleted.The dataset may contain additional columns, e.g., the child number or health information. These are ignored by the \(D\)-score calculation.
The most important steps is preparing the data for the D-score calculations are:
0
, 1
or
NA
The table below lists the five available GSED instruments:
Instrument name | Instrument code | Length | Status |
---|---|---|---|
GSED SF V1 |
gs1 |
139 | Active |
GSED LF V1 |
gl1 |
155 | Active |
GSED HH V1 |
gh1 |
55 | Active |
GSED SF V0 |
gpa |
139 | Retired |
GSED LF V0 |
gto |
155 | Retired |
Select the section corresponding to your instrument for further instructions.
GSED SF V1
The GSED SF V1
instrument contains 139 items and has
instrument code gs1
.
Obtain the full list of item name for as
<- "gs1"
instrument <- get_itemnames(instrument = instrument, order = "indm")
items length(items)
## [1] 139
head(items)
## [1] "gs1sec001" "gs1moc002" "gs1sec003" "gs1lgc004" "gs1moc005" "gs1cgc006"
The order
argument is needed to sort items according to
sequence number 1 to 139. Check that you have the correct version by
comparing the labels of the first few items as:
<- get_labels(items)
labels head(cbind(items, substr(labels, 1, 50)))
## items
## gs1sec001 "gs1sec001" "Does your child smile?"
## gs1moc002 "gs1moc002" "When lying on his/her back, does your child move h"
## gs1sec003 "gs1sec003" "Does your child look at your face when you speak t"
## gs1lgc004 "gs1lgc004" "Does your child cry when he/she is hungry, wet, ti"
## gs1moc005 "gs1moc005" "Does your child grasp your finger if you touch her"
## gs1cgc006 "gs1cgc006" "Does your child look at and focus on objects in fr"
Suppose that you stored your data with items names sf001
to sf139
. For example,
<- dscore::sample_sf
sf head(sf[, c(1:2, 101:105)])
## subjid agedays sf099 sf100 sf101 sf102 sf103
## 1 1 811 1 1 1 1 1
## 2 2 898 1 1 1 1 1
## 3 3 203 NA NA NA NA NA
## 4 4 966 NA NA NA 1 NA
## 5 8 770 1 1 1 0 1
## 6 9 306 NA NA NA NA NA
Make sure that the items are in the correct order. Rename the columns with gsed 9-position item names.
colnames(sf)[3:141] <- items
head(sf[, c(1:2, 101:105)])
## subjid agedays gs1lgc099 gs1lgc100 gs1moc101 gs1sec102 gs1lic103
## 1 1 811 1 1 1 1 1
## 2 2 898 1 1 1 1 1
## 3 3 203 NA NA NA NA NA
## 4 4 966 NA NA NA 1 NA
## 5 8 770 1 1 1 0 1
## 6 9 306 NA NA NA NA NA
The data in sf
are now ready for the
dscore()
function.
Once the data are in proper shape, calculation of the \(D\)-score is straightforward. The
sf
dataset has properly named columns that identify each
item.
<- dscore(sf, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 29 0.7586 64.78 0.6444784 -0.540
## 2 2.4586 39 0.6923 67.13 0.6492821 -0.515
## 3 0.5558 49 0.6531 38.36 0.9415629 1.055
## 4 2.6448 36 0.7500 73.22 0.6560832 0.828
## 5 2.1081 50 0.5000 65.49 0.6150650 -0.011
## 6 0.8378 49 0.6939 41.58 0.9687909 -0.595
The table below provides the interpretation of the output:
Name | Interpretation |
---|---|
a |
Decimal age in years |
n |
Number of items used to calculate the \(D\)-score |
p |
Proportion of passed milestones |
d |
\(D\)-score (posterior mean) |
sem |
Standard error of measurement (posterior standard deviation) |
daz |
\(D\)-score corrected for age |
The number of rows of result
is equal to the number of
rows of sf
. We save the result for later processing.
<- data.frame(sf, results) sf2
It is possible to calculate \(D\)-score for item subsets by setting the
items
argument. We do not advertise this option for
practical application, but suppose we are interested in the \(D\)-score based on items from
gs1
and gl1
for domains mo
or
gm
(motor) only. The “motor” \(D\)-score can be calculated as follows:
<- get_itemnames(instrument = c("gs1", "gl1"), domain = c("mo", "gm"))
items_motor <- dscore(sf, items = items_motor, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 6 0.8333 63.40 1.713268 -0.908
## 2 2.4586 8 0.7500 66.68 1.851939 -0.638
## 3 0.5558 30 0.7333 39.45 1.077956 1.365
## 4 2.6448 5 0.8000 75.07 1.487556 1.384
## 5 2.1081 10 0.7000 69.57 1.787357 1.178
## 6 0.8378 31 0.7419 41.17 1.133857 -0.702
GSED LF V1
The GSED LF V1
instrument contains 155 items and has
instrument code gl1
.
Obtain the full list of item name for as
<- "gl1"
instrument <- get_itemnames(instrument = instrument)
items length(items)
## [1] 155
head(items)
## [1] "gl1fmd001" "gl1fmd002" "gl1fmd003" "gl1fmd004" "gl1fmd005" "gl1fmd006"
Reorder item names so that they corresponds to streams A, B and C, respectively.
<- items[c(55:155, 1:54)]
items head(items)
## [1] "gl1gmd001" "gl1gmd002" "gl1gmd003" "gl1gmd004" "gl1gmd005" "gl1gmd006"
Check that you have the correct version by comparing the labels of the first few items as:
<- get_labels(items)
labels head(cbind(items, substr(labels, 1, 50)))
## items
## gl1gmd001 "gl1gmd001" "Moves body in reaction to caregiver"
## gl1gmd002 "gl1gmd002" "Moves body, kicking legs and moving arms equally o"
## gl1gmd003 "gl1gmd003" "Pulls to sit - no head lag"
## gl1gmd004 "gl1gmd004" "Lifts head in prone 45 degrees"
## gl1gmd005 "gl1gmd005" "Lifts head, shoulders, chest when prone (2X)"
## gl1gmd006 "gl1gmd006" "Puts hands together in front of face"
Suppose that you stored your data with items names lf001
to lf155
. For example,
<- dscore::sample_lf
lf head(lf[, c(1:2, 60:64)])
## subjid agedays lf058 lf059 lf060 lf061 lf062
## 1 1 811 NA NA NA NA NA
## 2 2 898 NA NA NA NA NA
## 3 3 203 0 0 0 NA NA
## 4 4 966 NA NA NA NA NA
## 5 8 770 0 0 0 0 0
## 6 9 306 1 1 0 1 0
Make sure that the items are in the correct order. Rename the columns with gsed 9-position item names.
colnames(lf)[3:157] <- items
head(lf[, c(1:2, 60:64)])
## subjid agedays gl1lgd009 gl1lgd010 gl1lgd011 gl1lgd012 gl1lgd013
## 1 1 811 NA NA NA NA NA
## 2 2 898 NA NA NA NA NA
## 3 3 203 0 0 0 NA NA
## 4 4 966 NA NA NA NA NA
## 5 8 770 0 0 0 0 0
## 6 9 306 1 1 0 1 0
The data in lf
are now ready for the
dscore()
function.
Once the data are in proper shape, calculation of the \(D\)-score is straightforward. The
lf
dataset has properly named columns that identify each
item.
<- dscore(lf, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 45 0.5556 67.11 0.5870206 0.117
## 2 2.4586 53 0.6226 70.65 0.5484131 0.504
## 3 0.5558 34 0.5588 34.13 0.8412858 -0.150
## 4 2.6448 54 0.5185 70.80 0.5239288 0.103
## 5 2.1081 58 0.1724 37.53 1.1685368 -4.444
## 6 0.8378 32 0.5625 44.40 0.7570235 0.174
The table below provides the interpretation of the output:
Name | Interpretation |
---|---|
a |
Decimal age in years |
n |
Number of items used to calculate the \(D\)-score |
p |
Proportion of passed milestones |
d |
\(D\)-score (posterior mean) |
sem |
Standard error of measurement (posterior standard deviation) |
daz |
\(D\)-score corrected for age |
The number of rows of result
is equal to the number of
rows of lf
. We save the result for later processing.
<- data.frame(lf, results) lf2
It is possible to calculate \(D\)-score for item subsets by setting the
items
argument. We do not advertise this option for
practical application, but suppose we are interested in the \(D\)-score based on items from
gs1
and gl1
for domains mo
or
gm
(motor) only. The “motor” \(D\)-score can be calculated as follows:
<- get_itemnames(instrument = c("gs1", "gl1"), domain = c("mo", "gm"))
items_motor <- dscore(lf, items = items_motor, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 12 0.5833 65.22 2.3250596 -0.419
## 2 2.4586 18 0.6111 71.28 0.9180576 0.692
## 3 0.5558 19 0.6842 35.82 1.0002527 0.325
## 4 2.6448 12 0.4167 65.91 2.1927512 -1.248
## 5 2.1081 12 0.5000 56.44 1.6829924 -2.217
## 6 0.8378 14 0.7143 43.10 1.4168986 -0.187
GSED HH V1
The GSED HH V1
instrument contains 55 items and has
instrument code gh1
.
Obtain the full list of item name for as
<- "gh1"
instrument <- get_itemnames(instrument = instrument, order = "indm")
items length(items)
## [1] 55
head(items)
## [1] "gh1sec001" "gh1sec002" "gh1lgc003" "gh1cgc004" "gh1moc005" "gh1sec006"
The order
argument is needed to sort items according to
sequence number 1 to 55. Check that you have the correct version by
comparing the labels of the first few items as:
<- get_labels(items)
labels head(cbind(items, substr(labels, 1, 50)))
## items
## gh1sec001 "gh1sec001" "Does your child smile?"
## gh1sec002 "gh1sec002" "Does your child look at your face when you speak t"
## gh1lgc003 "gh1lgc003" "Does your child cry when he/she is hungry, wet, ti"
## gh1cgc004 "gh1cgc004" "Does your child look at and focus on objects in fr"
## gh1moc005 "gh1moc005" "Does your child bring his/her hand to his/her mout"
## gh1sec006 "gh1sec006" "Does your child smile when you smile or talk with "
Suppose that you stored your data with items names hf001
to hf139
. For example,
<- dscore::sample_hf
hf head(hf[, c(1:2, 30:35)])
## subjid agedays hf028 hf029 hf030 hf031 hf032 hf033
## 1 1 811 NA NA NA NA NA NA
## 2 2 898 NA NA NA NA NA NA
## 3 3 203 1 1 0 1 0 0
## 4 4 966 NA NA NA NA NA NA
## 5 8 770 NA NA NA NA NA NA
## 6 9 306 1 1 1 1 1 1
Make sure that the items are in the correct order. Rename the columns with gsed 9-position item names.
colnames(hf)[3:57] <- items
head(hf[, c(1:2, 30:35)])
## subjid agedays gh1cgc028 gh1moc029 gh1lic030 gh1moc031 gh1moc032 gh1moc033
## 1 1 811 NA NA NA NA NA NA
## 2 2 898 NA NA NA NA NA NA
## 3 3 203 1 1 0 1 0 0
## 4 4 966 NA NA NA NA NA NA
## 5 8 770 NA NA NA NA NA NA
## 6 9 306 1 1 1 1 1 1
The data in hf
are now ready for the
dscore()
function.
Once the data are in proper shape, calculation of the \(D\)-score is straightforward. The
hf
dataset has properly named columns that identify each
item.
<- dscore(hf, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 8 0.7500 63.70 1.319931 -0.830
## 2 2.4586 8 1.0000 71.32 3.643986 0.704
## 3 0.5558 29 0.6207 37.32 1.208338 0.756
## 4 2.6448 3 1.0000 72.14 3.887905 0.503
## 5 2.1081 7 1.0000 68.94 3.345038 0.994
## 6 0.8378 30 0.7000 42.08 1.205053 -0.463
The table below provides the interpretation of the output:
Name | Interpretation |
---|---|
a |
Decimal age in years |
n |
Number of items used to calculate the \(D\)-score |
p |
Proportion of passed milestones |
d |
\(D\)-score (posterior mean) |
sem |
Standard error of measurement (posterior standard deviation) |
daz |
\(D\)-score corrected for age |
The number of rows of results
is equal to the number of
rows of hf
. We save the result for later processing.
<- data.frame(hf, results) hf2
It is possible to calculate \(D\)-score for item subsets by setting the
items
argument. We do not advertise this option for
practical application, but suppose we are interested in the \(D\)-score based on items from
gs1
, gl1
and gh1
for domains
mo
or gm
(motor) only. The “motor” \(D\)-score can be calculated as follows:
<- get_itemnames(instrument = c("gs1", "gl1", "gh1"), domain = c("mo", "gm"))
items_motor <- dscore(hf, items = items_motor, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 1 1.0000 69.17 3.681033 0.721
## 2 2.4586 1 1.0000 70.45 4.016257 0.445
## 3 0.5558 18 0.5000 36.96 1.459643 0.652
## 4 2.6448 1 1.0000 71.44 4.233367 0.293
## 5 2.1081 1 1.0000 68.57 3.506822 0.885
## 6 0.8378 18 0.6111 41.60 1.491812 -0.590
GSED SF V0
The GSED SF V0
instrument contains 139 items and has
instrument code gpa
.
Obtain the full list of item name for as
<- "gpa"
instrument <- get_itemnames(instrument = instrument, order = "indm")
items length(items)
## [1] 139
head(items)
## [1] "gpalac001" "gpacgc002" "gpafmc003" "gpasec004" "gpamoc005" "gpamoc006"
The order
argument is needed to sort items according to
sequence number 1 to 139. Check that you have the correct version by
comparing the labels of the first few items as:
<- get_labels(items)
labels head(cbind(items, substr(labels, 1, 50)))
## items
## gpalac001 "gpalac001" "Does your child cry when he/she is hungry, wet, ti"
## gpacgc002 "gpacgc002" "Does your child look at and focus on objects in fr"
## gpafmc003 "gpafmc003" "Does your child grasp your finger if you touch her"
## gpasec004 "gpasec004" "Does your child smile?"
## gpamoc005 "gpamoc005" "Does your child try to move his/her head (or eyes)"
## gpamoc006 "gpamoc006" "When lying on his/her back, does your child move h"
Suppose that you stored your data with items names sf001
to sf139
. For example,
<- dscore::sample_sf
sf head(sf[, c(1:2, 101:105)])
## subjid agedays sf099 sf100 sf101 sf102 sf103
## 1 1 811 1 1 1 1 1
## 2 2 898 1 1 1 1 1
## 3 3 203 NA NA NA NA NA
## 4 4 966 NA NA NA 1 NA
## 5 8 770 1 1 1 0 1
## 6 9 306 NA NA NA NA NA
Make sure that the items are in the correct order. Rename the columns with gsed 9-position item names.
colnames(sf)[3:141] <- items
head(sf[, c(1:2, 101:105)])
## subjid agedays gpalgc099 gpaclc100 gpaclc101 gpalgc102 gpamoc103
## 1 1 811 1 1 1 1 1
## 2 2 898 1 1 1 1 1
## 3 3 203 NA NA NA NA NA
## 4 4 966 NA NA NA 1 NA
## 5 8 770 1 1 1 0 1
## 6 9 306 NA NA NA NA NA
The data in sf
are now ready for the
dscore()
function.
Once the data are in proper shape, calculation of the \(D\)-score is straightforward. The
sf
dataset has properly named columns that identify each
item.
<- dscore(sf, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 29 0.7586 65.23 0.7338041 -0.416
## 2 2.4586 39 0.6923 68.34 0.7349870 -0.173
## 3 0.5558 50 0.6600 38.36 0.9434576 1.055
## 4 2.6448 36 0.7500 73.44 0.6608226 0.895
## 5 2.1081 50 0.5000 65.50 0.6157819 -0.009
## 6 0.8378 50 0.7000 41.56 1.0080820 -0.600
The table below provides the interpretation of the output:
Name | Interpretation |
---|---|
a |
Decimal age in years |
n |
Number of items used to calculate the \(D\)-score |
p |
Proportion of passed milestones |
d |
\(D\)-score (posterior mean) |
sem |
Standard error of measurement (posterior standard deviation) |
daz |
\(D\)-score corrected for age |
The number of rows of result
is equal to the number of
rows of sf
. We save the result for later processing.
<- data.frame(sf, results) sf3
It is possible to calculate \(D\)-score for item subsets by setting the
items
argument. We do not advertise this option for
practical application, but suppose we are interested in the \(D\)-score based on items from
gpa
and gto
for domains mo
or
gm
(motor) only. The “motor” \(D\)-score can be calculated as follows:
<- get_itemnames(instrument = c("gpa", "gto"), domain = c("mo", "gm"))
items_motor <- dscore(sf, items = items_motor, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 5 1.0000 71.56 3.032380 1.422
## 2 2.4586 5 1.0000 72.44 3.333409 1.038
## 3 0.5558 33 0.5758 38.36 1.013070 1.055
## 4 2.6448 6 0.6667 74.29 1.553734 1.151
## 5 2.1081 8 0.7500 73.86 1.608503 2.383
## 6 0.8378 32 0.6250 41.03 1.195306 -0.738
GSED LF V0
The GSED LF V0
instrument contains 155 items and has
instrument code gto
.
Obtain the full list of item name for as
<- "gto"
instrument <- get_itemnames(instrument = instrument)
items length(items)
## [1] 155
head(items)
## [1] "gtofmd001" "gtofmd002" "gtofmd003" "gtofmd004" "gtofmd005" "gtofmd006"
Reorder item names so that they corresponds to streams A, B and C, respectively.
<- items[c(55:155, 1:54)]
items head(items)
## [1] "gtogmd001" "gtogmd002" "gtogmd003" "gtogmd004" "gtogmd005" "gtogmd006"
Check that you have the correct version by comparing the labels of the first few items as:
<- get_labels(items)
labels head(cbind(items, substr(labels, 1, 50)))
## items
## gtogmd001 "gtogmd001" "A1. Lifts head in prone 45 degrees"
## gtogmd002 "gtogmd002" "A2. Frolics alone - moving body, kicking legs"
## gtogmd003 "gtogmd003" "A3. Frolics with mother or caregiver responsively"
## gtogmd004 "gtogmd004" "A4. Hands together in front of face"
## gtogmd005 "gtogmd005" "A5. Balances head well while suppported"
## gtogmd006 "gtogmd006" "A6. Pulls to sit - no head lag"
Suppose that you stored your data with items names lf001
to lf155
. For example,
<- dscore::sample_lf
lf head(lf[, c(1:2, 60:64)])
## subjid agedays lf058 lf059 lf060 lf061 lf062
## 1 1 811 NA NA NA NA NA
## 2 2 898 NA NA NA NA NA
## 3 3 203 0 0 0 NA NA
## 4 4 966 NA NA NA NA NA
## 5 8 770 0 0 0 0 0
## 6 9 306 1 1 0 1 0
Make sure that the items are in the correct order. Rename the columns with gsed 9-position item names.
colnames(lf)[3:157] <- items
head(lf[, c(1:2, 60:64)])
## subjid agedays gtolgd009 gtolgd010 gtolgd011 gtolgd012 gtolgd013
## 1 1 811 NA NA NA NA NA
## 2 2 898 NA NA NA NA NA
## 3 3 203 0 0 0 NA NA
## 4 4 966 NA NA NA NA NA
## 5 8 770 0 0 0 0 0
## 6 9 306 1 1 0 1 0
The data in lf
are now ready for the
dscore()
function.
Once the data are in proper shape, calculation of the \(D\)-score is straightforward. The
lf
dataset has properly named columns that identify each
item.
<- dscore(lf, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 45 0.5556 67.05 0.6298725 0.100
## 2 2.4586 53 0.6226 70.81 0.5687583 0.552
## 3 0.5558 34 0.5588 34.12 0.8401395 -0.153
## 4 2.6448 54 0.5185 70.82 0.5355771 0.109
## 5 2.1081 58 0.1724 37.47 1.1938151 -4.448
## 6 0.8378 32 0.5625 44.90 0.7644616 0.315
The table below provides the interpretation of the output:
Name | Interpretation |
---|---|
a |
Decimal age in years |
n |
Number of items used to calculate the \(D\)-score |
p |
Proportion of passed milestones |
d |
\(D\)-score (posterior mean) |
sem |
Standard error of measurement (posterior standard deviation) |
daz |
\(D\)-score corrected for age |
The number of rows of result
is equal to the number of
rows of lf
. We save the result for later processing.
<- data.frame(lf, results) lf3
It is possible to calculate \(D\)-score for item subsets by setting the
items
argument. We do not advertise this option for
practical application, but suppose we are interested in the \(D\)-score based on items from
gpa
and gto
for domains mo
or
gm
(motor) only. The “motor” \(D\)-score can be calculated as follows:
<- get_itemnames(instrument = c("gpa", "gto"), domain = c("mo", "gm"))
items_motor <- dscore(lf, items = items_motor, xname = "agedays", xunit = "days")
results head(results)
## a n p d sem daz
## 1 2.2204 12 0.5833 65.21 2.3290743 -0.422
## 2 2.4586 18 0.6111 71.28 0.9180576 0.692
## 3 0.5558 19 0.6842 35.72 0.9818575 0.297
## 4 2.6448 12 0.4167 65.84 2.1798200 -1.266
## 5 2.1081 12 0.5000 56.44 1.6829750 -2.217
## 6 0.8378 14 0.7143 43.12 1.4337713 -0.182
We used the GSED Phase I data to calculate age-conditional reference scores for the \(D\)-score. The references are based on about 12,000 administration of the GSED SF and GSED LF from Bangladesh, Pakistan and Tanzania. Extract the references as
library(dplyr, warn.conflicts = FALSE, quietly = TRUE)
<- builtin_references %>%
ref filter(pop == "phase1") %>%
select(pop, age, mu, sigma, nu, tau, SDM2, SD0, SDP2)
head(ref)
## pop age mu sigma nu tau SDM2 SD0 SDP2
## 1 phase1 0.0383 13.68 0.2456 1.1731 15.422 6.042690 13.68707 20.71620
## 2 phase1 0.0575 14.36 0.2324 1.2062 15.540 6.699401 14.36568 21.30880
## 3 phase1 0.0767 15.02 0.2206 1.2375 15.652 7.354450 15.02457 21.88555
## 4 phase1 0.0958 15.68 0.2100 1.2670 15.758 8.014796 15.68368 22.47481
## 5 phase1 0.1150 16.35 0.2005 1.2951 15.860 8.680976 16.35299 23.09062
## 6 phase1 0.1342 17.03 0.1917 1.3218 15.957 9.363085 17.03241 23.72268
The columns mu
, sigma
, nu
and
tau
are the age-varying parameters of a Box-Cox \(t\) (BCT) distribution.
The script below creates a figure with -2SD, 0SD and +2SD centiles
plus 20 \(D\)-scores (10 LF and 10 SF)
for the lf2
and sf2
data.
library(ggplot2)
library(patchwork)
<- builtin_references %>%
r filter(pop == "phase1" & age <= 3.5) %>%
mutate(m = age * 12)
$ins <- "lf"; lf2$m <- lf2$a * 12
lf2$ins <- "sf"; sf2$m <- sf2$a * 12
sf2<- bind_rows(lf2, sf2)
data <- ggplot(data, aes(x = m, y = d, group = ins, color = ins)) +
g1 theme_light() +
annotate("polygon", x = c(r$age, rev(r$age)),
y = c(r$SDM2, rev(r$SDP2)), alpha = 0.06, fill = "#C5EDDE") +
annotate("line", x = r$m, y = r$SDM2, lwd = 0.5, color = "#C5EDDE") +
annotate("line", x = r$m, y = r$SDP2, lwd = 0.5, color = "#C5EDDE") +
annotate("line", x = r$m, y = r$SD0, lwd = 1, color = "#C5EDDE") +
scale_x_continuous("Age (in months)",
limits = c(0, 42),
breaks = seq(0, 42, 12)) +
scale_y_continuous(
expression(paste(italic(D), "-score", sep = "")),
breaks = seq(0, 80, 20),
limits = c(0, 90)) +
geom_point(size = 2) +
theme(legend.position = "none")
<- ggplot(data, aes(x = m, y = daz, group = ins, color = ins)) +
g2 theme_light() +
scale_x_continuous("Age (in months)",
limits = c(0, 42),
breaks = seq(0, 42, 12)) +
scale_y_continuous(
"DAZ",
breaks = seq(-4, 4, 2),
limits = c(-5, 5)) +
geom_point(size = 2) +
theme(legend.position = "none")
+ g2 g1