Needs an 'interleaved' dataframe (see interleave function). Pre-test item should be followed by corresponding post-item item etc. Don't knows may be coded as d/DK or, by default, NA. Function handles items without don't know responses. The function is used internally. It calls transmat.
Required. data.frame carrying responses to pre-test questions.
Required. data.frame carrying responses to post-test questions.
a Boolean vector identifying the subset. Default is NULL.
Optional. There are cases where DK data doesn't have DK. But we need the entire matrix. By default it is FALSE.
Optional. Boolean. Whether or not to add a row of aggregate transitions at the end of the matrix. Default is FALSE.
Classification of NA responses: `"dk"` (the default) treats them as observed don't know responses; `"missing"` treats them as structural missingness.
How to handle structural missingness: `"omit"` excludes incomplete pairs and `"error"` rejects them.
matrix with rows = total number of items + 1 (last row contains aggregate distribution across items) number of columns = 4 when no don't know, and 9 when there is a don't know option
multi_transmat: transition matrix of all the items
pre_test <- data.frame(pre_item1 = c(1, 0, 0, 1, 0), pre_item2 = c(1, NA, 0, 1, 0))
pst_test <- data.frame(
pst_item1 = pre_test[, 1] + c(0, 1, 1, 0, 0),
pst_item2 = pre_test[, 2] + c(0, 1, 0, 0, 1)
)
multi_transmat(pre_test, pst_test)