score_on_previous_answers: Graphical patterns in careless/inattentive responding

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
4
5
6
7
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

character vector of previous responses

scoringMatrix

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

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
sM <- make_scoring_matrix_aem(1:5, "simultaneous")


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

rstyles documentation built on July 23, 2021, 5:07 p.m.