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,
  population = NULL,
  transform = NULL,
  itembank = dscore::builtin_itembank,
  xunit = c("decimal", "days", "months"),
  verbose = FALSE
)

Arguments

items

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.

pct

Numeric vector with requested percentiles (0-100). The default is pct = c(10, 50, 90).

key

String. They key identifies 1) the difficulty estimates pertaining to a particular Rasch model, and 2) the prior mean and standard deviation of the prior distribution for calculating the D-score. The default key NULL sets key = "gsed2406". View builtin_keys for an overview of the available keys.

population

String. The name of the reference population to calculate DAZ. Use with(builtin_references, table(key, population)) to see which built-in references are available for key - population combinations. If not specified, the function set the default population as builtin_keys$base_population[key == builtin_keys$key].

transform

Numeric vector, length 2, containing the intercept and slope of the linear transform from the logit scale into the the D-score scale. The default (NULL) searches builtin_keys for intercept and slope values.

itembank

A data.frame with at least three columns named key, item and tau. By default, the function uses dscore::builtin_itembank. If you specify your own itembank, then you should also provide the relevant transform and qp arguments.

xunit

A string specifying the unit in which age is measured (either "decimal", "days" or "months"). The default "decimal" corresponds to decimal age in years.

verbose

Logical. Print settings.

Value

data.frame with four columns: item, d (D-score), pct (percentile), and a (age-equivalent, in xunit units).

Note

The function internally defines a scale factor given the key.

Examples

get_age_equivalent(c("gpagmc018", "gtogmd026", "ddicmm050"))
#>                    item       d pct          a
#> gpagmc018...1 gpagmc018 14.4799  10 0.06732101
#> gpagmc018...2 gpagmc018 23.4100  50 0.26673721
#> gpagmc018...3 gpagmc018 32.3401  90 0.47420503
#> gtogmd026...4 gtogmd026 31.0699  10 0.44343758
#> gtogmd026...5 gtogmd026 40.0000  50 0.67855937
#> gtogmd026...6 gtogmd026 48.9301  90 0.98540403
#> ddicmm050...7 ddicmm050 68.7399  10 2.30253365
#> ddicmm050...8 ddicmm050 77.6700  50         NA
#> ddicmm050...9 ddicmm050 86.6001  90         NA