randompairs: generate random data of pairwise preference ratings

Description Usage Arguments Details Value Author(s) Examples

Description

generate random data of pairwise preference ratings

Usage

1
randompairs(nstim = 10, nint = 100, reverse = 0.1, skew = FALSE)

Arguments

nstim

numeric, number of stimuli, must be less than 2,602

nint

numeric, number of paired ratings to be created

reverse

numeric, proportion of ratings that go against the default preference, see below for details

skew

logical, by default FALSE, see below for details

Details

The default preference for a given pair is given by their alphanumerical order. E.g. A is preferred over M, and kf over kz. The reverse= argument specifies the proportion of ratings that go against this default order.

The number of appearances of a given stimulus in the data set is by default determined by uniform sampling of individual stimuli, i.e. all stimuli will roughly appear equally often in a data set. If a somewhat more realistic (i.e. unbalanced) distribution is desired, the argument skew=TRUE will achieve sampling based on a negative binomial distribution.

Value

data.frame with winner and loser column. An additional column (index) serves as an index for the sequence in which the trials occurred.

Author(s)

Christof Neumann

Examples

1
2
3
4
5
6
7
8
9
# a relatively balanced data set
xdata <- randompairs(20, 500, skew=FALSE)
table(c(as.character(xdata$winner), as.character(xdata$loser)))
range(table(c(as.character(xdata$winner), as.character(xdata$loser))))

# and a less balanced data set
xdata <- randompairs(20, 500, skew=TRUE)
table(c(as.character(xdata$winner), as.character(xdata$loser)))
range(table(c(as.character(xdata$winner), as.character(xdata$loser))))

Example output

 b  c  d  e  f  g  h  i  j  k  n  p  s  t  u  v  w  x  y  z 
54 48 55 58 48 59 39 46 67 52 44 52 49 41 41 45 52 53 52 45 
[1] 39 67

 a  b  c  e  f  g  h  i  j  k  l  m  n  o  r  s  t  u  w  z 
50 28 34 74 77 59 35 44 12 51 18 41 51 17 64 24 88 69 65 99 
[1] 12 99

EloChoice documentation built on July 4, 2019, 5:04 p.m.