Package 'qmvs'

Title: Queueing Model of Visual Search
Description: The queueing model of visual search models the accuracy and response time data in a visual search experiment using queueing models with finite customer population and stopping criteria of completing the service for finite number of customers. It implements the conceptualization of a hybrid model proposed by Moore and Wolfe (2001), in which visual stimuli enter the processing one after the other and then are identified in parallel. This package provides functions that simulate the specified queueing process and calculate the Wasserstein distance between the empirical response times and the model prediction.
Authors: Martin Schlather [aut], Yiqi Li [aut, cre]
Maintainer: Yiqi Li <[email protected]>
License: GPL (>= 3)
Version: 0.2.2
Built: 2025-03-05 03:45:56 UTC
Source: https://github.com/cran/qmvs

Help Index


Calculation of the Wasserstein metric between an empirical data set and a data set similated by the queueing model of visual search

Description

WM calculates a distance between the empirical and simulated response time on a given number of trials in an experiment using standard visual search paradigm. WMdiffresp takes both correct and incorrect response times into account. WMdiffrespweight takes both correct and incorrect response times into account and weights the distances of correct and incoreect response times with the relative frequencies of the data. WMdiffrespshift takes both correct and incorrect response times into account and assumes different non-decision times for no and yes responses. WMdiffrespshiftweight takes both correct and incorrect response times into account assuming different non-decision times for no and yes responses and weights the distances with the relative frequencies of the data.

Usage

WM(par, esterrorpar, c, k, pr, N, empRT, old=FALSE) 
WMdiffresp(par, esterrorpar, c, k, pr, N, empRT, empresp, old=FALSE,
           seed=0) 
WMdiffrespweight(par, esterrorpar, c, k, pr, N, empRT, empresp,
           old=FALSE, seed=0) 
WMdiffrespshift(par, esterrorpar, c, k, pr, N, empRT, empresp,
                old=FALSE, seed=0) 
WMdiffrespshiftweight(par, esterrorpar, c, k, pr, N, empRT, empresp,
                      old=FALSE, sep_shift = TRUE, wcorrect = NULL, seed=0)

Arguments

par

A vector of length 3 or 4, equals (miat, mst, Tres) if non-decision time is assumed to be the same for no and yes responses (as in WM, WMdiffresp and WMdiffrespweight) and (miat, mst, Tresn, Tresy) otherwise (as in WMdiffrespshift and WMdiffrespshiftweight).

esterrorpar

A vector of length 5. Estimates of the accuracy-related parameters (α\alpha, β\beta, a1a_1, a2a_2, bb)

c

A natural number representing the number of parallel servers of the system.

k

A natural number representing the total number of stimuli in the display (set size).

pr

Logical. If pr is TRUE, the function simulates data on target present trials; if pr is FALSE, it simulates data on target absent trials.

N

A natural number representing the number of simulation runs.

empRT

A vector of empirical response times collected under given target presence and set size condition.

empresp

A vector of empirical responses collected under given target presence and set size condition.

old

Logical. If old is TRUE, the simulation is implemented by R code; if old is FALSE, it is implemented by C code. Only for comparison of speed. Default option is FALSE.

sep_shift

Logical. Shall separate shifts be used for positive and negative answers?

wcorrect

Logical or NULL. Weighing of the positive responses in the convex combination of LqL_q distances between empirical and theoretical distributions for the positive and negativ answers separately.

seed

The random seed used in the simulation.

Value

A positive number. WMdiffresp returns the sum of the distances associated with correct and incorrect response times, WMdiffrespweight the sum of the weighted distances. WMdiffrespshift the sum of the distances associated with correct and incorrect response times, assuming different non-decision times for no and yes responses. WMdiffrespshiftweight the weighted sum.

Author(s)

Yiq Li, [email protected],https://www.xing.com/profile/Yiqi_Li3, Martin Schlather,[email protected],https://www.wim.uni-mannheim.de/schlather/

References

Li, Yiqi (2020) Visual search as a queueing process. Doctoral dissertation, University of Mannheim.

See Also

queue, LqDist, sim,

Examples

simdata1 <- sim.ny(par = c(30, 200, 250, 350), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, N = 10000, pr = TRUE, seed = 0)

simdata2 <- sim.ny(par = c(30, 200, 250, 350), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, N = 10000, pr = TRUE, seed =
12345)

WM(par = c(30, 200, 300), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, pr = TRUE, N = 10000, empRT =
simdata2[,1], old=FALSE)

WMdiffresp(par = c(30, 200, 300), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, pr = TRUE, N = 10000, empRT =
simdata2[,1], empresp = simdata2[,2], old=FALSE)

WMdiffrespweight(par = c(30, 200, 300), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, pr = TRUE, N = 10000, empRT =
simdata2[,1], empresp = simdata2[,2], old=FALSE)

WMdiffrespshift(par = c(30, 200, 250, 350), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, pr = TRUE, N = 10000, empRT =
simdata2[,1], empresp = simdata2[,2], old=FALSE)

WMdiffrespshiftweight(par = c(30, 200, 250, 350), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, pr = TRUE, N = 10000, empRT =
simdata2[,1], empresp = simdata2[,2], old=FALSE)

Calculation of the distance between two data sets

Description

LqDist calculates the Wasserstein metric or Kolmogorov-Smirnov distance between two data sets.

Usage

LqDist(E1, E2, q=1)

Arguments

E1, E2

Vectors of data between which a distance is to calculate.

q

Option for the distance measure. If q equals 11, the Wasserstein metric will be calculated. If q equals Inf, the Kolmogorov-Smirnov distance will be calculated. Default option is 1.

Value

A positive number.

Author(s)

Yiq Li, [email protected],https://www.xing.com/profile/Yiqi_Li3, Martin Schlather,[email protected],https://www.wim.uni-mannheim.de/schlather/

References

Li, Yiqi (2020) Visual search as a queueing process. Doctoral dissertation, University of Mannheim.

See Also

distance,

Examples

simdata1 <- sim.ny(par = c(30, 200, 250, 350), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, N = 10000, pr = TRUE, seed = 0)

simdata2 <- sim.ny(par = c(30, 200, 250, 350), esterrorpar = c(-2.67, 0.0094,
0.0299, 0.0020, 1.13), c = 4, k = 12, N = 10000, pr = TRUE, seed =
12345)

simcorrectRT1 <- subset(simdata1, simdata1[,2] == TRUE, select = 1)

simcorrectRT2 <- subset(simdata2, simdata2[,2] == TRUE, select = 1)

LqDist(simcorrectRT1, simcorrectRT2, q=1)

Simulation of the queueing model of visual search

Description

queue simulates the response and response time on a single trial in an experiment using standard visual search paradigm.

Usage

queue(miat, mst, c, pr, L, misidd, misidt, arrival, serving, tposition,
      old=FALSE)

Arguments

miat

A positive number representing the scale parameter of the exponential distribution of interarrival times, i.e., the mean interarrival time.

mst

A positive number representing the scale parameter of the exponential distribution of service times, i.e., the mean service time.

c

A natural number representing the number of parallel servers of the system.

pr

Logical. If pr is TRUE, the function simulates data on target present trials; if pr is FALSE, it simulates data on target absent trials.

L

A natural number representing the number of stimuli that have been identified to terminate the queueing process.

misidd

Logical vector of length k. Here, FALSE means correct identification and TRUETRUE misidentification of a distractor.

misidt

Logical. Here, FALSE means correct identification and TRUE misidentification of the target.

arrival

A vector of length set size. Elements must be exponentially distributed random numbers with rate 1.

serving

A vector of length set size. Elements must be exponentially distributed random numbers with rate 1.

tposition

A natural number representing the position of the target in the queue, in target present case less or equal to set size, in target absent case equal to set size +1.

old

Logical. If old is TRUE, the simulation is implemented by R code; if old is FALSE, it is implemented by C code. Only for comparison of speed. Default option is FALSE.

Value

A numeric vector of length 5 indicating the number of visual items processed, the mean processing time of a single item, the maximum of processing time of a single item, the system response time and the response.

Author(s)

Yiq Li, [email protected],https://www.xing.com/profile/Yiqi_Li3, Martin Schlather,[email protected],https://www.wim.uni-mannheim.de/schlather/

References

Li, Yiqi (2020) Visual search as a queueing process. Doctoral dissertation, University of Mannheim.

Moore C. M.,and Wolfe J. M. (2001) Getting beyond the serial/parallel debate in visual search: A hybrid approach. In Shapiro, K.L. The Limits of Attention: Temporal Constraints on Human Information Processing. Oxford University Press doi:10.1093/acprof:oso/9780198505150.003.0009

See Also

sim, distance,

Examples

queue(miat = 30, mst = 200, c = 4, pr = TRUE, L = 12,
      misidd = rep(0L, 12), misidt = 0, arrival = rexp(12),
      serving = rexp(12), tposition = 7, old=FALSE)

Simulation of the queueing model of visual search

Description

sim.ny simulates a data set containing the responses and response times on either target present or target absent trials under specified set size level in an experiment using standard visual search paradigm, whereby the non-decision time for yes and no options are represented by two different parameters.

Usage

sim.ny(par, esterrorpar, c, k, pr, N, empRT, seed=0)

Arguments

par

A vector of length 3 or 4, equals (miat, mst, Tres) if non-decision time is assumed to be the same for no and yes responses (as in WM, WMdiffresp and WMdiffrespweight) and (miat, mst, Tresn, Tresy) otherwise (as in WMdiffrespshift and WMdiffrespshiftweight).

esterrorpar

A vector of length 5. Estimates of the accuracy-related parameters (α\alpha, β\beta, a1a_1, a2a_2, bb)

c

A natural number representing the number of parallel servers of the system.

k

A natural number representing the total number of stimuli in the display (set size).

pr

Logical. If pr is TRUE, the function simulates data on target present trials; if pr is FALSE, it simulates data on target absent trials.

N

A natural number representing the number of simulation runs.

empRT

A vector of empirical response times collected under given target presence and set size condition.

seed

The random seed used in the simulation.

Value

A N×2N \times 2 matrix. The first column contains the simulated response times and the second colum the corresponding simulated responses.

Author(s)

Yiq Li, [email protected],https://www.xing.com/profile/Yiqi_Li3, Martin Schlather,[email protected],https://www.wim.uni-mannheim.de/schlather/

References

Li, Yiqi (2020) Visual search as a queueing process. Doctoral dissertation, University of Mannheim.

See Also

queue

Examples

sim.ny(par = c(30, 200, 250, 350),
       esterrorpar = c(-2.67, 0.0094, 0.0299, 0.0020, 1.13),
       c = 4,
       k = 12,
       pr = TRUE, 
       N = 10000, seed = 0)