Package 'ForagingOrg'

Title: Organization Measures for Visual Foraging
Description: Several functions to compute indicators for organization and efficiency in visual foraging, multi-target visual search, and cancellation tasks. The current version of this package includes the following indicators: best-r, mean Inter-target Distance, Percentage Above Optimal (PAO) scan path, and intersections in the scan path. For more detailed descriptions, see Mark et al. (2004) <doi:10.1212/01.WNL.0000131947.08670.D4>.
Authors: Marcos Bella-Fernández
Maintainer: Marcos Bella-Fernández <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-02-21 03:14:04 UTC
Source: https://github.com/cran/ForagingOrg

Help Index


Best-r index for foraging organization

Description

Calculates best-r indicator from a set of x and y coordinates. Best-r is defined as the best Pearson correlation (in absolute value) between the order in which targets are collected and their respective x and y coordinates (Ólafsdóttir et al., 2021; Woods et al., 2013).

Usage

best.r(x,y)

Arguments

x

A vector containing the x coordinates from the target locations.

y

A vector containing the y coordinates from the target locations.

Value

Returns the best-r as a numeric value.

Author(s)

Marcos Bella-Fernández

References

Ólafsdóttir, I. M., Gestdóttir, S., & Kristjánsson, Á. (2021) The development of foraging organization. Attention, Perception, & Psychophysics, 83, 2891-2904.

Woods, A. J., Göksun, T., Chatterjee, A., & Zelonis, S. (2013) The development of organized visual search. Acta Psychologica, 143, 191-199.

Examples

#Simulating target coordinates

n<-20 #Number of targets collected in the simulation.

X<-runif(n,0,150) #Simulating x coordinates.
Y<-runif(n,0,100) #Simulating y coordinates.

best.r(X,Y)

Mean Intertarget Distance (ITD) from x and y coordinates for target positions.

Description

Every pair of consecutively collected targets are at a certain Euclidean distance, which can be calculated from their respective x and y coordinates. The mean ITD is simply the mean of all these distances (Ólafsdóttir et al., 2021; Woods et al., 2013).

Usage

meanITD(x, y)

Arguments

x

A vector containing the x coordinates from the target locations.

y

A vector containing the y coordinates from the target locations.

Value

A numeric value with the Mean ITD.

Author(s)

Marcos Bella-Fernández

References

Ólafsdóttir, I. M., Gestdóttir, S., & Kristjánsson, Á. (2021) The development of foraging organization. Attention, Perception, & Psychophysics, 83, 2891-2904.

Woods, A. J., Göksun, T., Chatterjee, A., & Zelonis, S. (2013) The development of organized visual search. Acta Psychologica, 143, 191-199.

Examples

#Simulating target coordinates

n<-20 #Number of targets collected in the simulation.

X<-runif(n,0,150) #Simulating x coordinates.
Y<-runif(n,0,100) #Simulating y coordinates.

meanITD(X,Y)

Counter for the number of intersections of non-consecutive trajectories between targets among a scanpath in a foraging task.

Description

This function counts the number and rate of intersections between non-consecutive targets in a scanpath.

Usage

number.intersections(x, y)

Arguments

x

A vector with the x coordinates of the targets collected in a foraging task.

y

A vector with the y coordinates of the targets collected in a foraging task.

Details

The number of intersections between non-consecutives scanpaths in a foraging task is taken as a foraging organization measure (Ólafsdóttir et al., 2021; Woods et al., 2013). Here we developed an algorithm based on function analysis and Bolzano's Theorem (e. g. Apostol, 1974) to calculate the number of intersections.

Value

A numeric value with the number of intersections in a scanpath.

Author(s)

Marcos Bella-Fernández

References

Apostol, T. M. (1974) Mathematical Analysis (2nd Edition). Addison Wesley Longman.

Ólafsdóttir, I. M., Gestdóttir, S., & Kristjánsson, Á. (2021) The development of foraging organization. Attention, Perception, & Psychophysics, 83, 2891-2904.

Woods, A. J., Göksun, T., Chatterjee, A., & Zelonis, S. (2013) The development of organized visual search. Acta Psychologica, 143, 191-199.


Percentage Above Optimal (PAO) path as a measure of organization in a foraging task.

Description

The function calculates the PAO (Ólafsdóttir et al., 2021) based on the actual scanpath trough targets and the optimal path, the shortest Hamiltonian path between the targets locations.

Usage

PAO(x, y)

Arguments

x

A vector containing the x coordinates of the locations of the collected targets.

y

A vector containing the y coordinates of the locations of the collected targets.

Details

The function estimates the Shortest Hamiltonian path among the locations of the targets collected. This shortest Hamiltonian path is the shortest (optimal) path which passes through the locations of all targets collected. The function also calculates the actual pathlength taking into account the order in which the targets were collected. The difference between the actual and the optimal paths is expressed in terms of a percentage: 0%\ above optimal correspond to the optimal path, 100%\ bove optimal path is the double of the optimal, and so forth.

To calculate the shortest Hamiltonian path, this functions uses two other functions: TSP from TSP (Hashler & Hornik, 2021) package, and order_tsp from PairViz package (Harley & Oldford, 2022).

Value

A numeric value with the Percentag Above Optimal path.

Author(s)

Marcos Bella-Fernández

References

Hahsler, M., and Hornik, K. (2021). TSP: Traveling Salesperson Problem (TSP). R package version 1.1-11. https://CRAN.R-project.org/package=TSP.

Hurley, C. B., and Oldford, R. W. (2022). PairViz: Visualization using Graph Traversal. R package version 1.3.5. https://CRAN.R-project.org/package=PairViz

Ólafsdóttir, I. M., Gestdóttir, S., & Kristjánsson, Á. (2021) The development of foraging organization. Attention, Perception, & Psychophysics, 83, 2891-2904.


Q score for foraging efficiency.

Description

Q score is an indicator of visual search efficiency which accounts for speed and accuracy (Geldmacher & Hills, 1997).

Usage

Q.score(n.collected.targets,n.total.targets,rt)

Arguments

n.collected.targets

A numeric value with the number of targets collected in a trial.

n.total.targets

A numeric value with the total number of targets present in a trial.

rt

A numeric value with the total time spent on a display or patch.

Value

A numeric value with the Q score.

Author(s)

Marcos Bella-Fernández

References

Geldmacher, D. S. & Hills, E. C. (1997) Effect of stimulus number, target-to-distractor ratio, and motor speed visual spatial search quality following traumatic brain injury. Brain Injury, 11(1), 59-66.