knitr::opts_chunk$set(echo = TRUE)
Suppose you have administered GSED SF, GSED LF [@mccray2023] or GSED HF 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 R for Data Science book by Hadley Wickham and Garrett Grolemund; 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 HF.
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") remotes::install_github("d-score/dscore")
The development version requires a local C++ compiler for building the package from source.
stopifnot(packageVersion("dscore") >= "1.8.0")
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")
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 HF 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
instrument <- "gs1" items <- get_itemnames(instrument = instrument, order = "indm") length(items) head(items)
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:
labels <- get_labels(items) head(cbind(items, substr(labels, 1, 50)))
Suppose that you stored your data with items names sf001
to sf139
. For example,
sf <- dscore::sample_sf head(sf[, c(1:2, 101:105)])
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)])
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.
results <- dscore(sf, xname = "agedays", xunit = "days") head(results)
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.
sf2 <- data.frame(sf, results)
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:
items_motor <- get_itemnames(instrument = c("gs1", "gl1"), domain = c("mo", "gm")) results <- dscore(sf, items = items_motor, xname = "agedays", xunit = "days") head(results)
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
instrument <- "gl1" items <- get_itemnames(instrument = instrument) length(items) head(items)
Reorder item names so that they corresponds to streams A, B and C, respectively.
items <- items[c(55:155, 1:54)] head(items)
Check that you have the correct version by comparing the labels of the first few items as:
labels <- get_labels(items) head(cbind(items, substr(labels, 1, 50)))
Suppose that you stored your data with items names lf001
to lf155
. For example,
lf <- dscore::sample_lf head(lf[, c(1:2, 60:64)])
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)])
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.
results <- dscore(lf, xname = "agedays", xunit = "days") head(results)
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.
lf2 <- data.frame(lf, results)
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:
items_motor <- get_itemnames(instrument = c("gs1", "gl1"), domain = c("mo", "gm")) results <- dscore(lf, items = items_motor, xname = "agedays", xunit = "days") head(results)
GSED HF V1
The GSED HF V1
instrument contains 55 items and has instrument code gh1
.
Obtain the full list of item name for as
instrument <- "gh1" items <- get_itemnames(instrument = instrument, order = "indm") length(items) head(items)
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:
labels <- get_labels(items) head(cbind(items, substr(labels, 1, 50)))
Suppose that you stored your data with items names hf001
to hf055
. For example,
hf <- dscore::sample_hf head(hf[, c(1:2, 30:35)])
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)])
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.
results <- dscore(hf, xname = "agedays", xunit = "days") head(results)
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.
hf2 <- data.frame(hf, results)
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:
items_motor <- get_itemnames(instrument = c("gs1", "gl1", "gh1"), domain = c("mo", "gm")) results <- dscore(hf, items = items_motor, xname = "agedays", xunit = "days") head(results)
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
instrument <- "gpa" items <- get_itemnames(instrument = instrument, order = "indm") length(items) head(items)
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:
labels <- get_labels(items) head(cbind(items, substr(labels, 1, 50)))
Suppose that you stored your data with items names sf001
to sf139
. For example,
sf <- dscore::sample_sf head(sf[, c(1:2, 101:105)])
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)])
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.
results <- dscore(sf, xname = "agedays", xunit = "days") head(results)
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.
sf3 <- data.frame(sf, results)
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:
items_motor <- get_itemnames(instrument = c("gpa", "gto"), domain = c("mo", "gm")) results <- dscore(sf, items = items_motor, xname = "agedays", xunit = "days") head(results)
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
instrument <- "gto" items <- get_itemnames(instrument = instrument) length(items) head(items)
Reorder item names so that they corresponds to streams A, B and C, respectively.
items <- items[c(55:155, 1:54)] head(items)
Check that you have the correct version by comparing the labels of the first few items as:
labels <- get_labels(items) head(cbind(items, substr(labels, 1, 50)))
Suppose that you stored your data with items names lf001
to lf155
. For example,
lf <- dscore::sample_lf head(lf[, c(1:2, 60:64)])
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)])
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.
results <- dscore(lf, xname = "agedays", xunit = "days") head(results)
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.
lf3 <- data.frame(lf, results)
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:
items_motor <- get_itemnames(instrument = c("gpa", "gto"), domain = c("mo", "gm")) results <- dscore(lf, items = items_motor, xname = "agedays", xunit = "days") head(results)
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) ref <- builtin_references |> filter(population == "phase1") |> select(population, age, mu, sigma, nu, tau, SDM2, SD0, SDP2) head(ref)
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) r <- builtin_references |> filter(population == "phase1" & age <= 3.5) |> mutate(m = age * 12) lf2$ins <- "lf" lf2$m <- lf2$a * 12 sf2$ins <- "sf" sf2$m <- sf2$a * 12 data <- bind_rows(lf2, sf2) g1 <- ggplot(data, aes(x = m, y = d, group = ins, color = ins)) + 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") g2 <- ggplot(data, aes(x = m, y = daz, group = ins, color = ins)) + 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") g1 + g2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.