Skip to contents

booklet_sample randomly assigns test booklets to test takers.

Usage

booklet_sample(
  n_subj,
  book_item_design,
  book_prob = NULL,
  resample = FALSE,
  e = 0.1,
  iter = 20
)

Arguments

n_subj

an integer, the number of subjects (test takers).

book_item_design

a data frame containing the items that belong to each booklet with booklets as columns and booklet item numbers as rows. See 'Details'.

book_prob

a vector of probability weights for obtaining the booklets being sampled. The default equally weights all books.

resample

logical indicating if booklets should be re-sampled to minimize differences. Can only be used when book_prob = NULL.

e

a number between 0 and 1 exclusive, re-sampling stopping criteria, :w the difference between the most sampled and least sampled booklets.

iter

an integer defining the number of iterations to reach e.

Details

If using booklet_sample in tandem with booklet_design, book_item_design is the the first element of the returned list of block_design.

Examples

it_bk <- matrix(
  c(1, 2, 1, 4, 5, 4, 7, 8, 7, 10, 3, 10, 2, 6, 3, 5, 9, 6, 8, 0, 9),
  ncol = 3, byrow = TRUE
)
booklet_sample(
  n_subj = 10, book_item_design = it_bk, book_prob = c(.2, .5, .3)
)
#>    subject book item
#> 1        1    1    1
#> 2        1    1    4
#> 3        1    1    7
#> 4        1    1   10
#> 5        1    1    2
#> 6        1    1    5
#> 7        1    1    8
#> 8        2    3    1
#> 9        2    3    4
#> 10       2    3    7
#> 11       2    3   10
#> 12       2    3    3
#> 13       2    3    6
#> 14       2    3    9
#> 15       3    2    2
#> 16       3    2    5
#> 17       3    2    8
#> 18       3    2    3
#> 19       3    2    6
#> 20       3    2    9
#> 22       4    3    1
#> 23       4    3    4
#> 24       4    3    7
#> 25       4    3   10
#> 26       4    3    3
#> 27       4    3    6
#> 28       4    3    9
#> 29       5    2    2
#> 30       5    2    5
#> 31       5    2    8
#> 32       5    2    3
#> 33       5    2    6
#> 34       5    2    9
#> 36       6    2    2
#> 37       6    2    5
#> 38       6    2    8
#> 39       6    2    3
#> 40       6    2    6
#> 41       6    2    9
#> 43       7    2    2
#> 44       7    2    5
#> 45       7    2    8
#> 46       7    2    3
#> 47       7    2    6
#> 48       7    2    9
#> 50       8    2    2
#> 51       8    2    5
#> 52       8    2    8
#> 53       8    2    3
#> 54       8    2    6
#> 55       8    2    9
#> 57       9    2    2
#> 58       9    2    5
#> 59       9    2    8
#> 60       9    2    3
#> 61       9    2    6
#> 62       9    2    9
#> 64      10    3    1
#> 65      10    3    4
#> 66      10    3    7
#> 67      10    3   10
#> 68      10    3    3
#> 69      10    3    6
#> 70      10    3    9