Skip to content

Booklet sampling

tmatta edited this page Oct 9, 2017 · 4 revisions

The function booklet_sample facilitates the distribution of test booklets to examinees. The two required arguments are n_subj, the number of examinees, and book_item_design, the output from booklet_design.

The default sampling scheme makes all books equally likely but the optional argument book_prob takes a vector of probabilities to make some books more or less likely to be administered. The logical argument resample will resample booklets until the difference in booklets sampled is less than e or the booklets have been resampled iter times. The resampling functionality may be useful when n_subj is small and only one dataset is being generated.

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

For the following examples, we will be generating 15 items from a generalized partial credit model model across 4 blocks. And we administer the four books to 100 examinees. The item_gen function was described here and the block_design and booklet_design functions were described here.

item_pool <- item_gen(n_2pl = 15, thresholds = 2, b_bounds = c(-2, 2), 
                      a_bounds = c(.75, 1.25))

block_ex <- block_design(n_blocks = 4, item_parameters = item_pool)

book_ex <- booklet_design(item_block_assignment = block_ex$block_assignment)

print(book_ex)
##    B1 B2 B3 B4
## i1  1  2  3  1
## i2  5  6  7  5
## i3  9 10 11  9
## i4 13 14 15 13
## i5  2  3  4  4
## i6  6  7  8  8
## i7 10 11 12 12
## i8 14 15  0  0

Equal booklet sampling

The syntax below adminsters the four test booklets equally among the 40 examinees.

book_admin <- booklet_sample(n_subj = 100, book_item_design = book_ex)

print(book_admin[book_admin$subject==1, ])
##   subject book item
## 1       1    2    2
## 2       1    2    6
## 3       1    2   10
## 4       1    2   14
## 5       1    2    3
## 6       1    2    7
## 7       1    2   11
## 8       1    2   15

By printing all observations for subject 1 only, we see that the resulting data frame is a long format, where each subject by item is given its own observation. This is the format required by the response_gen function. We can see that subject 1 has been assigned booklet 1.

Next, we can verify the books have been equally sampled.

prop.table(table(book_admin[!duplicated(book_admin$subject), "book"]))
## 
##    1    2    3    4 
## 0.25 0.27 0.22 0.26

User-specified booklet-sampling weights

To assign sampling weights to the booklets, we must specify a vector of weights using the book_prob arguement. The length of the vector must be equal to the number of books and the sum of the vector must equal 1.

book_admin2 <- booklet_sample(n_subj = 100, book_item_design = book_ex, 
                              book_prob = c(.1, .1, .1, .7))

prop.table(table(book_admin2[!duplicated(book_admin2$subject), "book"]))
## 
##    1    2    3    4 
## 0.09 0.10 0.09 0.72
Clone this wiki locally