score_on_previous_answers: Graphical patterns in careless/inattentive responding

score_on_last_answer_straightR Documentation

Graphical patterns in careless/inattentive responding

Description

Functions that allows to model careless/inattentive responding in a form of creating various graphical patterns of responses:

  • score_on_last_answer_straight - straightlining, i.e. tendency to choose the same answer as in the previous item;

  • score_on_last_answer_next - tendency to choose answer that is directly to the right side/below of the answer to the previous item; if there are no answers farther right/below, than turn to the first (most left/top) available answer;

  • score_on_last_answer_previous - tendency to choose answer that is directly to the left side/up of the answer to the previous item; if there are no answers farther left/up, than turn to the last (most right/bottom) available answer;

  • score_on_previous_answers_bounce - tendency to choose answer that is either directly to the right side/below or directly to the left side/up of the answer to the previous item in such a way to continue a pattern of the last two responses; if there are no more answers in a given direction, than change direction (bounce).

Usage

score_on_last_answer_straight(previousResponses, scoringMatrix)

score_on_last_answer_next(previousResponses, scoringMatrix)

score_on_last_answer_previous(previousResponses, scoringMatrix)

score_on_previous_answers_bounce(previousResponses, scoringMatrix)

Arguments

previousResponses

a character vector of previous responses

scoringMatrix

a matrix describing how responses (described in rownames of the matrix) map on scores of latent traits (described in columns of the matrix)

Value

a one-column matrix of 0 and 1 with the same number of rows (and rownames) as scoringMatrix with column name ci

Examples

sM <- make_scoring_matrix_aem(1:5, "gpcm")


answersStraigth <- t(sapply(c(1:5, rep(3, 5)), score_on_last_answer_straight,
                            scoringMatrix = sM))
dimnames(answersStraigth) <- list(paste0("previous answer: '",
                                         c(1:5, rep(3, 5)), "'"),
                                  paste0("'", 1:ncol(answersStraigth), "'"))
answersStraigth

answersNext <- t(sapply(rep(1:5, 2), score_on_last_answer_next,
                        scoringMatrix = sM))
dimnames(answersNext) <- list(paste0("previous answer: '",
                                     1:nrow(answersNext), "'"),
                              paste0("'", 1:ncol(answersNext), "'"))
answersNext

answersPrev <- t(sapply(rep(1:5, 2), score_on_last_answer_previous,
                        scoringMatrix = sM))
dimnames(answersPrev) <- list(paste0("previous answer: '",
                                     1:nrow(answersPrev), "'"),
                              paste0("'", 1:ncol(answersNext), "'"))
answersPrev

bounceMatrix <- matrix(c(3:1, 2:5, 4:2, 2:1, 2:5, 4:1), ncol = 2)
answersBounce <- t(apply(bounceMatrix, 1, score_on_previous_answers_bounce,
                         scoringMatrix = sM))
dimnames(answersBounce) <- list(paste0("previous answers: '",
                                       apply(bounceMatrix, 1, paste,
                                             collapse = "', '"), "'"),
                                paste0("'", 1:ncol(answersBounce), "'"))
answersBounce

tzoltak/rstyles documentation built on Dec. 4, 2024, 5:16 p.m.