Learn R Programming

rstyles (version 0.4.0)

expand_responses: Helper functions for manipulating generated responses

Description

Using scoring matrix provided as its second argument function expands (recodes) responses to each item (column) in a provided matrix of responses into a set of variables that may be put into model estimation.

Usage

expand_responses(responses, scoringMatrix)

Arguments

responses

matrix of responses with items in columns and observations in rows

scoringMatrix

matrix describing scoring patterns on each latent trait

Value

matrix (of integers)

Examples

Run this code
# NOT RUN {
sM <- make_scoring_matrix_aem(5, "mae")
responses <- matrix(sample(1L:5L, 20, replace = TRUE), ncol = 4,
                    dimnames = list(NULL, paste0("item", 1:4)))
responses
sM
expand_responses(responses, sM)
# }

Run the code above in your browser using DataLab