Skip to content

Commit

Permalink
version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Rihacek authored and cran-robot committed Aug 15, 2023
1 parent 184ace2 commit 9d57927
Show file tree
Hide file tree
Showing 30 changed files with 1,299 additions and 1,298 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: responsePatterns
Title: Screening for Careless Responding Patterns
Version: 0.1.0
Version: 0.1.1
Authors@R: c(
person(given = "Tomas",
family = "Rihacek",
Expand All @@ -13,18 +13,18 @@ Authors@R: c(
email = "jaroslav.gottfried@mail.muni.cz",
comment = c(ORCID = "0000-0002-6076-1632"))
)
Description: Some survey participants tend to respond carelessly which complicates data analysis. This package provides functions that make it easier to explore responses and identify those that may be problematic.
Description: Some survey participants tend to respond carelessly which complicates data analysis. This package provides functions that make it easier to explore responses and identify those that may be problematic. See Gottfried et al. (2022) <doi:10.7275/vyxb-gt24> for more information.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
Depends: R (>= 3.5.0)
Imports: graphics, grDevices, methods, stats, utils
Suggests: magrittr
NeedsCompilation: no
Packaged: 2021-11-23 01:55:43 UTC; 21252
Packaged: 2023-08-15 09:30:09 UTC; tomas
Author: Tomas Rihacek [aut, cre] (<https://orcid.org/0000-0001-5893-9289>),
Jaroslav Gottfried [aut] (<https://orcid.org/0000-0002-6076-1632>)
Maintainer: Tomas Rihacek <rihacek@fss.muni.cz>
Repository: CRAN
Date/Publication: 2021-11-24 08:30:02 UTC
Date/Publication: 2023-08-15 10:20:02 UTC
4 changes: 2 additions & 2 deletions LICENSE
@@ -1,2 +1,2 @@
YEAR: 2021
COPYRIGHT HOLDER: Tomas Rihacek, Jaroslav Gottfried
YEAR: 2021
COPYRIGHT HOLDER: Tomas Rihacek, Jaroslav Gottfried
58 changes: 29 additions & 29 deletions MD5
@@ -1,32 +1,32 @@
e21a4e772cba78022d94c7eb61717b44 *DESCRIPTION
40bbea38f4a531d5be7bb792a621f71a *LICENSE
a087023a3aa560d997fb230fd6838c1d *NAMESPACE
6349a82ad24ed72d423a123b2c609c3a *R/classes.R
99348051aa3573a90e994536fc6845e1 *R/data.R
3a92f30be58725cf4099200c9a3c4552 *R/responsePatterns.R
2a1c4113f940f067d2bb6eeb952c828a *R/rp.summary.R
28d8393ce5c77d3f3ab2227ac0215f8f *R/rp_acors.R
4cae1baae77fcd9707284bb0d2200b0e *R/rp_hist.R
d4de7507705ac080ad1fe52fd65dd5a5 *R/rp_indices.R
4d0f20be6eb40a66987940e166abb89b *R/rp_patterns.R
3b656a88f1a6379b32d5fb660850fb94 *R/rp_plot.R
d534a19a3565b4d1c2c71b18a7d59aa9 *R/rp_plots2pdf.R
02af4e6a052aaf71ee05118bcddbace3 *R/rp_save2csv.R
ae3cbe880ac99b94abdb158b3e189ab1 *R/rp_select.R
befc6ab0961983dd08b09aa9a9ff6e90 *README.md
838ac33e1c5ed73f510a0a159fd568df *DESCRIPTION
0bbbc0fb9ae352e2bee8450f58107402 *LICENSE
83c7bd2290e56f0751f0220c592f7179 *NAMESPACE
2b9465b99833c74cee74badd4171f320 *R/classes.R
ad051850d1e536846a4e0c300dc86b91 *R/data.R
8ce64755a6fade35681037e35d5f67d9 *R/responsePatterns.R
2854c2275ca38d64a985499e3d746454 *R/rp.summary.R
35babffc54adf5d5f9290c1ad77222e9 *R/rp_acors.R
83fa0c25eacdbcb6a00a311d0a775e80 *R/rp_hist.R
aba5076e60bd657620f551aba7d410e1 *R/rp_indices.R
01ee208f1cd33580e953c4eeee909559 *R/rp_patterns.R
f7057e294cd684df2c43c3c9b7e20a50 *R/rp_plot.R
2453b2650827b33510b93ccacf9092fc *R/rp_plots2pdf.R
8ab51271e3df9c96cc859735371b9cf3 *R/rp_save2csv.R
9ea1cb612ddbbe0786549992290a1e72 *R/rp_select.R
79ff1cb0b5e15031adf5334e205a9493 *README.md
f0379a22b1a104c935e89c7505610fab *data/rp_simdata.RData
c47ad0c6d7132f8059ce9651a1c21cab *inst/CITATION
08f3c35fd470dc660c5003d9909302b7 *man/ResponsePatterns-class.Rd
e2fe7468b2288ef7c23a5ebf946574ec *inst/CITATION
485cf60d7aa620aaf3330f675b6e71dc *man/ResponsePatterns-class.Rd
73333f284eb88465b64a0eaa3e309959 *man/figures/Rplot_01.png
b88068562cabd1943e4f855e5b418ce0 *man/figures/Rplot_02.png
570a5cd95115d6dbf7f0bb32ad5454bd *man/responsePatterns.Rd
966709f5dd3bbba397a2869e368706df *man/rp.acors.Rd
8948a716207cc9930f0d034b094d27ca *man/rp.hist.Rd
a7f62bd9748e53e4e9b00ab8badc461a *man/rp.indices.Rd
4078fc7afa82c254ebe5a53355fe9605 *man/rp.patterns.Rd
4fe717aa0e1cef66bd3d7e0f93d76410 *man/rp.plot.Rd
01d681c79d25a1f94684ae69ef18ab86 *man/rp.plots2pdf.Rd
5bff25dad3ce48bab1b3e50640c78607 *man/rp.save2csv.Rd
d9644a00c6fc5782a4f1d07fd9ba2a8a *man/rp.select.Rd
a2e446fc5e84126ea7644c1d70cb41f0 *man/rp.simdata.Rd
957d30a76b9ff9a4ffae4104fcc90a5a *man/rp.summary.Rd
5f24bf9581a5001feeb52d385d71f2fd *man/responsePatterns.Rd
89a17f8cb9a8099c096fc7b971a1b660 *man/rp.acors.Rd
3c956a5eaa6a449316ea006edf75bb2d *man/rp.hist.Rd
1d98c207b74e59a235e45e56728c17d2 *man/rp.indices.Rd
1b0e8632a76d27da600a9cdd2c86a873 *man/rp.patterns.Rd
25fb3a86ba7b24445ddcd04758ae3fbf *man/rp.plot.Rd
76e7e4e73a2e4003b4610b3785c83987 *man/rp.plots2pdf.Rd
7e29be982686dfa2f5537d82ca4a6843 *man/rp.save2csv.Rd
754d8fea8081b3ccd2f78ceaf98a9d14 *man/rp.select.Rd
65e80136398793e491b38b28d078a89d *man/rp.simdata.Rd
25d1353b27dfb3d8fae2873dbc74e0db *man/rp.summary.Rd
24 changes: 12 additions & 12 deletions NAMESPACE
@@ -1,12 +1,12 @@
# Generated by roxygen2: do not edit by hand

export(rp.acors)
export(rp.hist)
export(rp.indices)
export(rp.patterns)
export(rp.plot)
export(rp.plots2pdf)
export(rp.save2csv)
export(rp.select)
export(rp.summary)
importFrom(methods,new)
# Generated by roxygen2: do not edit by hand
export(rp.acors)
export(rp.hist)
export(rp.indices)
export(rp.patterns)
export(rp.plot)
export(rp.plots2pdf)
export(rp.save2csv)
export(rp.select)
export(rp.summary)
importFrom(methods,new)
76 changes: 38 additions & 38 deletions R/classes.R
@@ -1,38 +1,38 @@
#' An S4 class to represent the results of response patterns analysis.
#'
#' @slot id A vector. Contains the ID variable (if declared by the user) or NAs (if not).
#' @slot n.obs An integer. Number of observations (responses) in the data set.
#' @slot n.vars An integer. Number of variables (excluding the ID variable, if declared).
#' @slot options A list. Contains diverse options set by the user.
#' @slot percentile An integer. If the rp.select() function is used to select a subsample, this keeps the information about the chosen percentile. Defaults to zero.
#' @slot data A data frame. Stores the data.
#' @slot coefficients A data frame. Stores the intermediate products of the analysis.
#' @slot indices A data frame. Stores the final products of the analysis.
ResponsePatterns <- setClass("ResponsePatterns", slots=c(
id="vector",
n.obs="numeric",
n.vars="numeric",
options="list",
percentile="numeric",
data="data.frame",
coefficients="data.frame",
indices="data.frame"
), prototype=c(
id="",
n.obs=0,
n.vars=0,
options=list(),
percentile=0,
data=data.frame(),
coefficients=data.frame(),
indices=data.frame()
))

setMethod("summary",signature(object="ResponsePatterns"),function(object) {rp.summary(object)})

# Copied from Psychonetrics:
.onAttach <- function(libname, pkgname) {
version <- read.dcf(file=system.file("DESCRIPTION", package=pkgname),
fields="Version")
packageStartupMessage("This is ",paste(pkgname, version),". Note: this is BETA software! Please mind that the package may not be stable and report any bugs! For questions and issues, please see github.com/trihacek/responsePatterns.")
}
#' An S4 class to represent the results of response patterns analysis.
#'
#' @slot id A vector. Contains the ID variable (if declared by the user) or NAs (if not).
#' @slot n.obs An integer. Number of observations (responses) in the data set.
#' @slot n.vars An integer. Number of variables (excluding the ID variable, if declared).
#' @slot options A list. Contains diverse options set by the user.
#' @slot percentile An integer. If the rp.select() function is used to select a subsample, this keeps the information about the chosen percentile. Defaults to zero.
#' @slot data A data frame. Stores the data.
#' @slot coefficients A data frame. Stores the intermediate products of the analysis.
#' @slot indices A data frame. Stores the final products of the analysis.
ResponsePatterns <- setClass("ResponsePatterns", slots=c(
id="vector",
n.obs="numeric",
n.vars="numeric",
options="list",
percentile="numeric",
data="data.frame",
coefficients="data.frame",
indices="data.frame"
), prototype=c(
id="",
n.obs=0,
n.vars=0,
options=list(),
percentile=0,
data=data.frame(),
coefficients=data.frame(),
indices=data.frame()
))

setMethod("summary",signature(object="ResponsePatterns"),function(object) {rp.summary(object)})

# Copied from Psychonetrics:
.onAttach <- function(libname, pkgname) {
version <- read.dcf(file=system.file("DESCRIPTION", package=pkgname),
fields="Version")
packageStartupMessage("This is ",paste(pkgname, version),". Note: this is BETA software! Please mind that the package may not be stable and report any bugs! For questions and issues, please see github.com/trihacek/responsePatterns.")
}
56 changes: 28 additions & 28 deletions R/data.R
@@ -1,28 +1,28 @@
#' A simulated data set of survey responses.
#'
#' @format A data frame with 100 rows and 21 variables:
#' \describe{
#' \item{optional_ID}{fictive participants' names}
#' \item{Q_01}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_02}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_03}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_04}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_05}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_06}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_07}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_08}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_09}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_10}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_11}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_12}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_13}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_14}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_15}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_16}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_17}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_18}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_19}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_20}{a survey item on a Likert-type scale from 1 to 5}
#' }
#' @source A simulated data set.
"rp.simdata"
#' A simulated data set of survey responses.
#'
#' @format A data frame with 100 rows and 21 variables:
#' \describe{
#' \item{optional_ID}{fictive participants' names}
#' \item{Q_01}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_02}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_03}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_04}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_05}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_06}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_07}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_08}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_09}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_10}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_11}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_12}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_13}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_14}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_15}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_16}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_17}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_18}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_19}{a survey item on a Likert-type scale from 1 to 5}
#' \item{Q_20}{a survey item on a Likert-type scale from 1 to 5}
#' }
#' @source A simulated data set.
"rp.simdata"
30 changes: 15 additions & 15 deletions R/responsePatterns.R
@@ -1,15 +1,15 @@
#' responsePatterns: A package for finding instances of careless responding
#'
#' Some survey participants tend to respond carelessly, which complicates data analysis. This package provides functions that make it easier to find repeated patterns in data and identify responses that may be problematic. This package implements two approaches to the problem of careless responses detection: one based on the auto-correlation approach and one based on a mechanistic approach. Both approaches yield scores that serve as estimates of how problematic the observations potentially are ("suspicion" scores). However, no conclusions should be made without a closer inspection of the problematic responses. Any decision about removing or downweighing an observation should be based on visual inspection of the responses, the specifics of the instrument used to collect the data, researchers' familiarity with the whole data set and the context of the data collection process.
#' @section Auto-correlation approach:
#' The \code{\link{rp.acors}} function allows for a probabilistic detection of repetitive patterns in data. This function calculates auto-correlation coefficients for all lags up to a value defined by the max.lag parameter for each observation (respondent). Subsequently, it assigns a percentile value to each observation (respondent) based either on the highest absolute auto-correlation or the sum of absolute auto-correlations.
#' @section Mechanistic approach:
#'The \code{\link{rp.patterns}} function searches for repetitive patterns in the data using an iterative algorithm. Patterns are defined based on the data themselves: if a sequence of values occurs more than once within an observation, it is considered a repetition. The algorithm counts the number of repetitions for different lengths of patterns and then weighs this sum by the length of the pattern (longer patterns are assigned higher weight). The total score for each respondent is determined as the sum of scores achieved for each pattern length and is standardized to a value between 0 and 1.
#' @section Auxiliary functions:
#' The package provides auxiliary functions to summarize the responsePatterns object (\code{\link{rp.summary}}), extract indices (\code{\link{rp.indices}}, \code{\link{rp.hist}}, \code{\link{rp.save2csv}}) and to visually inspect individual responses (\code{\link{rp.plot}}, \code{\link{rp.plots2pdf}}).
#' @references Gottfried, J., Jezek, S., & Kralova, M. (2021). *Autocorrelation screening: A potentially efficient method for detecting repetitive response patterns in questionnaire data.* Manuscript submitted for review.
#'
#' @docType package
#' @name responsePatterns
NULL
#> NULL
#' responsePatterns: A package for finding instances of careless responding
#'
#' Some survey participants tend to respond carelessly, which complicates data analysis. This package provides functions that make it easier to find repeated patterns in data and identify responses that may be problematic. This package implements two approaches to the problem of careless responses detection: one based on the auto-correlation approach and one based on a mechanistic approach. Both approaches yield scores that serve as estimates of how problematic the observations potentially are ("suspicion" scores). However, no conclusions should be made without a closer inspection of the problematic responses. Any decision about removing or downweighing an observation should be based on visual inspection of the responses, the specifics of the instrument used to collect the data, researchers' familiarity with the whole data set and the context of the data collection process.
#' @section Auto-correlation approach:
#' The \code{\link{rp.acors}} function allows for a probabilistic detection of repetitive patterns in data. This function calculates auto-correlation coefficients for all lags up to a value defined by the max.lag parameter for each observation (respondent). Subsequently, it assigns a percentile value to each observation (respondent) based either on the highest absolute auto-correlation or the sum of absolute auto-correlations.
#' @section Mechanistic approach:
#'The \code{\link{rp.patterns}} function searches for repetitive patterns in the data using an iterative algorithm. Patterns are defined based on the data themselves: if a sequence of values occurs more than once within an observation, it is considered a repetition. The algorithm counts the number of repetitions for different lengths of patterns and then weighs this sum by the length of the pattern (longer patterns are assigned higher weight). The total score for each respondent is determined as the sum of scores achieved for each pattern length and is standardized to a value between 0 and 1.
#' @section Auxiliary functions:
#' The package provides auxiliary functions to summarize the responsePatterns object (\code{\link{rp.summary}}), extract indices (\code{\link{rp.indices}}, \code{\link{rp.hist}}, \code{\link{rp.save2csv}}) and to visually inspect individual responses (\code{\link{rp.plot}}, \code{\link{rp.plots2pdf}}).
#' @references Gottfried, J., Jezek, S., & Kralova, M. (2022). Autocorrelation screening: A potentially efficient method for detecting repetitive response patterns in questionnaire data. *Practical Assessment, Research, and Evaluation, 27*, Article 2. https://doi.org/10.7275/vyxb-gt24
#'
#' @docType package
#' @name responsePatterns
NULL
#> NULL

0 comments on commit 9d57927

Please sign in to comment.