vmulti: Simulation based density and distribution functions of visual...

Description Usage Arguments Value Examples

Description

Simulation based p value to observe x or more picks of the data plot in K evaluations of a multiple choice lineup test under the assumption that the data plot is consistent with the null hypothesis. We distinguish between three different scenarios:

Usage

1
2
3
4
5
dmulti(x, K, k, m = 20, type = "scenario3", N = 5000)

pmulti(x, K, k, m = 20, type = "scenario3", N = 5000)

qmulti(q, K, k, m = 20, type = "scenario3", N = 5000)

Arguments

x

(vector) of the number of observed data picks

K

integer value, specifying the number of participants/evaluations

k

(vector) of integer values of the number of observed picks in a multiple choice lineup evaluation

m

lineup size, defaults to m=20

type

character, one of "scenario1", "scenario2", or "scenario3"

N

integer value, number of simulations.

q

(vector) of the number of observed data picks

Value

list consisting of two named items:

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
33
k=rpois(5,lambda=1)+1
m=20
dmulti(0:5,K=5,k=k, type="scenario1", m)
## compare to Poisson Binomial:
library(poibin)
dpoibin(0:5, pp=k/m)

qmulti(c(0.95, 0.99), K=5, k=2)

## Not run: 
(k <- rpois(5, lambda=1.5)+1)
reps1 <- plyr::ldply(1:10, function(x) dmulti(0:5, 5, k, type="scenario1")$density)
reps2 <- plyr::ldply(1:10, function(x) dmulti(0:5, 5, k, type="scenario2")$density)
reps3 <- plyr::ldply(1:10, function(x) dmulti(0:5, 5, k, type="scenario3")$density)
reps1$type <- "I"
reps2$type <- "II"
reps3$type <- "III"
reps <- rbind(reps1, reps2, reps3)
library(reshape2)
library(RColorBrewer)
cols <- brewer.pal(8, "Paired")

mr <- melt(reps, measure.vars=1:6)
mr$variable <- as.numeric(gsub("V", "", mr$variable))
mr$type <- factor(mr$type)
mr$offset <- with(mr, 0.1*c(0,-1,1)[as.numeric(type)])
qplot(variable+offset, value, data=mr, alpha=I(0.75), colour=type) +
  geom_point(aes(x=1:6, y=dpoibin(0:5, pp=k*1/m)), pch=1, size=4,
    inherit.aes=FALSE)+
  xlab("x")+ylab("P(X=x)")+ggtitle(paste(k, collapse=",")) +
  theme_bw() + scale_colour_manual(values=cols[-c(1,3,5,6,7)])
 
## End(Not run)

heike/vinference documentation built on Oct. 17, 2020, 7:08 a.m.