R/get_age_equivalent.R
get_age_equivalent.Rd
This function calculates the ages at which a certain percent in the reference population passes the items.
get_age_equivalent(
items,
pct = c(10, 50, 90),
key = NULL,
itembank = dscore::builtin_itembank,
population = NULL,
xunit = c("decimal", "days", "months")
)
A character vector containing names of items to be
included into the D-score calculation. Milestone scores are coded
numerically as 1
(pass) and 0
(fail). By default,
D-score calculation is done on all items found in the data
that have a difficulty parameter under the specified key
.
Numeric vector with requested percentiles (0-100). The
default is pct = c(10, 50, 90)
.
A string that selects a subset in the itembank that
makes up the key, the set of difficulty
estimates from a fitted Rasch model.
The built-in keys are: "gsed2212"
(default), "gsed2208"
(deprecated),
"gsed2206"
(deprecated), "gsed1912"
, "lf2206"
, "sf2206"
, "gcdg"
,
and "dutch"
. Since version 1.5.0, the key = "gsed"
selects the latest key starting with the string "gsed".
Use key = ""
to use all item names,
which should only be done if there are no duplicate itemnames
in the itembank.
A data.frame
with columns
key
, item
, tau
, instrument
, domain
,
mode
, number
and label
. Only columns item
and tau
are required.
The function uses dscore::builtin_itembank
by
default.
A string describing the population. Currently
supported are "phase1"
(default), "dutch"
, "gcdg"
.
A string specifying the unit in which age is measured
(either "decimal"
, "days"
or "months"
).
The default ("decimal"
) means decimal age in years.
Tibble with four columns: item
, d
(D-score),
pct
(percentile), and a
(age-equivalent, in xunit
units).
The function internally defines a scale factor given the key.
get_age_equivalent(c("gpagmc018", "gtogmd026", "ddicmm050"))
#> # A tibble: 9 × 4
#> item d pct a
#> <chr> <dbl> <dbl> <dbl>
#> 1 gpagmc018 14.5 10 0.0610
#> 2 gpagmc018 23.4 50 0.295
#> 3 gpagmc018 32.3 90 0.501
#> 4 gtogmd026 31.1 10 0.473
#> 5 gtogmd026 40 50 0.708
#> 6 gtogmd026 48.9 90 1.04
#> 7 ddicmm050 68.7 10 2.44
#> 8 ddicmm050 77.7 50 4.25
#> 9 ddicmm050 86.6 90 NA