compute_item_expected_scores: Generating expected distribution of item scores

View source: R/compute_item_expected_scores.R

compute_item_expected_scoresR Documentation

Generating expected distribution of item scores

Description

Function generates expected distribution of item scores given item object constructed using make_item or test (i.e. list of items) object constructed using make_test and covariance matrix of latent traits, assuming multivariate-normal distribution of latent traits.

Usage

compute_item_expected_scores(x, vcov)

## S3 method for class 'rstylesTest'
compute_item_expected_scores(x, vcov)

## S3 method for class 'rstylesItem'
compute_item_expected_scores(x, vcov = diag(ncol(x$scoringMatrix)))

Arguments

x

an object of class rstylesItem or rstylesTest

vcov

a covariance matrix of latent traits (in line with item's scoring matrix); if not provided uncorrelated standard normal is used

Value

A table

See Also

make_item

Examples

itemGPCM <- make_item(scoringMatrix = make_scoring_matrix_aem(1:5, "gpcm")[, -4],
                      slopes = c(i = 1, m = 2, e = 3),
                      intercepts = cumsum(c(0, seq(-0.5, 0.5, length.out = 4))),
                      mode = "gpcm")
vcov <- matrix(c( 1,    0.5, -0.5,
                  0.5,  1,   -0.25,
                 -0.5, -0.25, 1),
               nrow = 3, dimnames = list(c("i", "m", "e"), c("i", "m", "e")))
compute_item_expected_scores(itemGPCM) # orthogonal, standard-normal latent traits
compute_item_expected_scores(itemGPCM, vcov)

itemIRTree <- make_item(scoringMatrix = make_scoring_matrix_aem(1:5, "mae"),
                        slopes = c(m = 1, a = 1, e = 1),
                        intercepts = c(m1 = 0, a1 = 0, e1 = 0),
                        mode = "irtree")
vcovIRTree <- vcov
colnames(vcovIRTree) <- rownames(vcovIRTree) <- c("a", "m", "e")
compute_item_expected_scores(itemIRTree) # orthogonal, standard-normal latent traits
compute_item_expected_scores(itemIRTree, vcovIRTree)

sM <- make_scoring_matrix_aem(1:5, "gpcm")[, -4]
test <- make_test(sM,
                  generate_slopes(11, sM, c(1, 2, 3)),
                  generate_intercepts(11, sM,
                                      FUNd = seq,
                                      argsd = list(from = -1.5, to = 1.5,
                                      length.out = 11),
                                      FUNt = seq,
                                      argst = list(from = -1.5, to = 1.5,
                                      length.out = 4)),
                  "gpcm")
sapply(compute_item_expected_scores(test, vcov), identity)

tzoltak/rstyles documentation built on Dec. 4, 2024, 5:16 p.m.