MyNixOS website logo
Description

Identify Distributions that Match Reported Sample Parameters (SPRITE).

The SPRITE algorithm creates possible distributions of discrete responses based on reported sample parameters, such as mean, standard deviation and range (Heathers et al., 2018, <doi:10.7287/peerj.preprints.26968v1>). This package implements it, drawing heavily on the code for Nick Brown's 'rSPRITE' Shiny app <https://shiny.ieis.tue.nl/sprite/>. In addition, it supports the modeling of distributions based on multi-item (Likert-type) scales and the use of restrictions on the frequency of particular responses.

rsprite2 - Identify Distributions that Match Reported Sample Parameters

R-CMD-check Codecov test coverage R badge R-CMD-check

This package creates possible distributions based on reported sample parameters, using the SPRITE algorithm. This can be used to check what the original sample might have looked like, and thus to understand the data generation process better. This can help with the identification of fabricated data or misreported parameters, but also with checking whether sample characteristics such as floor/ceiling effects might suggest that findings are spurious.

For that, it implements the SPRITE algorithm proposed by Heathers et al. (2018). Much of the code for is based on Nick Brown's rSPRITE shiny app, with some extensions. If you are just interested in interactive use and do not need these extensions (see advanced usage below) that Shiny online app (see https://shiny.ieis.tue.nl/sprite/) might be better for you.

The package also includes dedicated functions to run the GRIM and GRIMMER tests. GRIM_test() checks whether a reported mean based on integers is consistent with a given sample size, while GRIMMER_test() checks whether a reported standard deviation is consistent with a reported mean and sample size. They can help catch impossible distributions and reporting errors without running any simulations.

Installation

rsprite2 can be installed from CRAN with:

install.packages("rsprite2")

Or you might want to install the development version from GitHub:

install.packages("remotes")
remotes::install_github('LukasWallrich/rsprite2')

Simple example

To create possible distributions, SPRITE needs the reported mean, standard deviation, sample size and range of values.

For instance, what distribution of 20 responses on a 1 to 5 scale might result in a mean of 2.2 and a standard deviation of 1.3?

library(rsprite2)
sprite_parameters <- set_parameters(mean = 2.2, sd = 1.3, n_obs = 20, min_val = 1, max_val = 5)
find_possible_distribution(sprite_parameters)

If these means and standard deviations had been reported to two decimal places, they might be 2.20 and 1.33. NB: Given that trailing zeroes are ignored by R, you need to specify the precision if mean or standard deviation ends in 0.

sprite_parameters <- set_parameters(mean = 2.20, m_prec = 2, sd = 1.32, 
                                    n_obs = 20, min_val = 1, max_val = 5)
find_possible_distribution(sprite_parameters)

To find more than one distribution that matches the parameters, you can use find_possible_distributions()

find_possible_distributions(sprite_parameters, 10)

They can then be plotted to identify features that are shared across distributions.

res <- find_possible_distributions(sprite_parameters, 10)
plot_distributions(res)

Advanced features

Multi-item scales

Often, several Likert-type items are averaged to measure a single construct (e.g., participants might be asked how happy, satisfied and fulfilled they are, with the results averaged into a measure of well-being). Possible resulting distribution can be explored by rsprite2 by specifying the n_items parameter.

sprite_parameters <- set_parameters(mean = 1.95, sd = 1.55, n_obs = 20, 
                                    min_val = 1, max_val = 5, n_items = 3)
find_possible_distribution(sprite_parameters)

Restrictions

Sometimes, you might know how often certain values should appear in the distribution. Such restrictions need to be passed to the set_parameters() function as a named list. They can either specify the exact number of occurrences (restrictions_exact) or the minimum number of occurrences (restrictions_minimum) of a specific value.

sprite_parameters <- set_parameters(mean = 1.95, sd = 1.55, n_obs = 20, 
                                    min_val = 1, max_val = 5, n_items = 3,
                                    restrictions_exact = list("3"=0, "3.67" = 2),
                                    restrictions_minimum = list("1" = 1, "5" = 1))
find_possible_distribution(sprite_parameters)
Metadata

Version

0.2.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows