make_test: Creating object representing a test

Description Usage Arguments Details Value Examples

View source: R/make_test.R

Description

Function makes a list object representing test items given matrices of slopes and intercepts/thresholds parameters. Result may be used within a call to generate_test_responses.

Usage

1
2
3
4
5
6
7
8
9
make_test(
  scoringMatrix,
  slopes,
  intercepts,
  mode = c("sequential", "simultaneous"),
  scoringOnPreviousResponses = NULL,
  editResponse = NULL,
  names = paste0("i", 1:nrow(slopes))
)

Arguments

scoringMatrix

scoring matrix that should be used for items, especially one generated with make_scoring_matrix_aem

slopes

matrix of slope parameters (items in rows, traits in cols), especially generated with generate_slopes

intercepts

matrix of intercept parameters (items in rows, intercepts/thresholds in cols), especially generated with generate_intercepts

mode

a way the item should be answered - see generate_item_responses_sqn, generate_item_responses_sml

scoringOnPreviousResponses

optional function returning a column vector that will be put before first column of the scoringMatrix

editResponse

only if mode='sequential': optional function returning scoring matrix that should replace that provided by scoringMatrix after response is made at the first node; this should be function accepting two arguments: response - generated response (by the model described with the first column of the scoringMatrix) that is supposed to be edited and scoringMatrix - current scoring matrix (to be replaced)

names

optional character vector providing names of the items (by default names will be created as concatenation of the letter "i" - like "item" - and consecutive integers)

Details

Function is actually a simple wrapper around make_item - see documentation of this function for further details.

Column names of the intercepts matrix:

Value

List of objects of the rstylesItem class.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
################################################################################
# responses to 10 items using 5-point Likert scale
# with respect to the Bockenholt's IRTree (i.e. "sequential") "MAE" model
# 1) make scoring matrix
sM <- make_scoring_matrix_aem(5, "mae")
# 2) generate items' slopes:
# slopes on the 'middle" and "extreme" latent traits set to 1 for all items
# and slopes on the "acquiescence" latent trait generated from a log-normal
# distribution with expected value of about 1.02 and standard deviation of
# about 0.21
slopes <-  cbind(generate_slopes(10, sM[, 1, drop = FALSE], 1),
                 generate_slopes(10, sM[, 2, drop = FALSE], FUN = rlnorm,
                                 meanlog = 0,
                                 sdlog = 0.2),
                 generate_slopes(10, sM[, 3, drop = FALSE], 1))
# 3) generate items' intercepts:
# intercepts generated from the uniform distribution with limits set to
# -1.5 and 1.5
intercepts <- generate_intercepts(10, sM, runif,
                                  list(min = -1.5,
                                       max = 1.5))
# 4) call `make_test()`
# (for IRTree mode must be set to "sequential")
test <- make_test(sM, slopes, intercepts, "sequential")

################################################################################
# responses to 20 items using 5-point Likert scale
# with respect to the Plieninger's "simultaneous" (partialy-compensatory) model
# 1) make scoring matrix
sM <- make_scoring_matrix_aem(5, "simultaneous")
# 2) generate items' slopes:
# slopes on the 'middle", "extreme" and "acquiescence" latent traits
# set to 1 for all items and slopes on the "intensity" latent trait generated
# from a normal distribution with expected value of 1 and standard deviation
# of 0.3
slopes <-  cbind(generate_slopes(20, sM[, 1, drop = FALSE], FUN = rnorm,
                                 mean = 1, sd = 0.3),
                 generate_slopes(20, sM[, -1], 1))
# 3) generate items' thresholds:
# thresholds generated from the normal distributon of items' (general)
# diificulty wit expected value of 0 and standardo deviation of 1.5 and the
# uniform distribution with limits -1 and 1 of categories' thresholds
# relative to item's difficulty
intercepts <- generate_intercepts(20, sM, FUNd = rnorm, FUNt = runif,
                                  argsd = list(mean = 0, sd = 1.5),
                                  argst = list(min = -1, max = 1))
# 4) call `make_test()`
test <- make_test(sM, slopes, intercepts, "simultaneous")

rstyles documentation built on July 23, 2021, 5:07 p.m.