| transmat | R Documentation |
Prints Cross-wave transition matrix and returns the vector behind the matrix. Missing values are treated as don't know responses by default. Set 'na_as = "missing"' when they instead represent structural missingness.
transmat(
pre_test_var,
pst_test_var,
subgroup = NULL,
force9 = FALSE,
na_as = c("dk", "missing"),
missing_action = c("omit", "error")
)
pre_test_var |
Required. A vector carrying pre-test scores of a particular item. Only |
pst_test_var |
Required. A vector carrying post-test scores of a particular item |
subgroup |
Optional. A Boolean vector indicating rows of the relevant subset. |
force9 |
Optional. There are cases where DK data doesn't have DK. But we need the entire matrix. By default it is FALSE. |
na_as |
Classification of NA responses: '"dk"' (the default) treats them as observed don't know responses; '"missing"' treats them as structural missingness. |
missing_action |
How to handle structural missingness: '"omit"' excludes incomplete pairs and '"error"' rejects them. |
a numeric vector. Assume 1 denotes correct, 0 incorrect, and d/DK an observed don't know. When there is no don't know option and no missing, the entries are: x00, x10, x01, x11 When there is a don't know option, the entries of the vector are: x00, x10, xd0, x01, x11, xd1, xd0, x1d, xdd
pre_test_var <- c(1, 0, 0, 1, 0, 1, 0)
pst_test_var <- c(1, 0, 1, 1, 0, 1, 1)
transmat(pre_test_var, pst_test_var)
# With NAs
pre_test_var <- c(1, 0, 0, 1, "d", "d", 0, 1, NA)
pst_test_var <- c(1, NA, 1, "d", 1, 0, 1, 1, "d")
transmat(pre_test_var, pst_test_var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.