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", key = "gsed2406")
head(results)
## a n p d sem daz
## 1 2.2204 8 0.7500 66.46 3.099626 -0.365
## 2 2.4586 8 1.0000 73.55 3.959115 0.862
## 3 0.5558 29 0.6207 37.36 2.190590 0.552
## 4 2.6448 3 1.0000 74.12 4.231796 0.528
## 5 2.1081 7 1.0000 70.72 3.841959 1.149
## 6 0.8378 30 0.7000 42.55 2.182150 -0.731
The key = "gsed2406" argument is needed here because
GSED HH is not yet supported by the default key
"gsed2510".
The table below provides the interpretation of the output:
anpdsemdazThe 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",
key = "gsed2406"
)
head(results)
## a n p d sem daz
## 1 2.2204 1 1.0000 69.63 4.504147 0.491
## 2 2.4586 1 1.0000 71.52 4.583980 0.306
## 3 0.5558 18 0.5000 36.65 2.506216 0.331
## 4 2.6448 1 1.0000 72.86 4.642396 0.189
## 5 2.1081 1 1.0000 68.67 4.467450 0.577
## 6 0.8378 18 0.6111 42.29 2.508751 -0.807
:::