sim_dist: Approximate the distribution of number of detections of a...

View source: R/p_value.R

sim_distR Documentation

Approximate the distribution of number of detections of a lineup with simulation

Description

This function approximate the distribution of number of detections of a lineup for given number of evaluations, selections in each evaluation and plots in a lineup.

Usage

sim_dist(n_sel, n_plot = 20, n_sim = 50000, dist = "uniform", alpha = 1)

Arguments

n_sel

Integer. A vector of the number of selections.

n_plot

Integer. Number of plots in the lineup.

n_sim

Integer. Number of simulations draws. More simulation draws will result in more accurate results.

dist

Character. Name of the distribution used for the attractiveness simulation. One of "uniform" and "dirichlet".

alpha

Numeric. A single parameter value used by the Dirichlet distribution.

Details

For a given lineup, plots are assumed to have weights W_i, i = 1, ..., M, where M is the number of plots, and W_i follows a attractiveness distribution independently. For each draw, weights for a lineup will be simulated. Then, for each evaluation of a draw, the function will sample same number of plots as the number of selection in the evaluation using the simulated weights without replacement. Finally, the distribution of the occurrences of plot 1 in a draw is the approximated distribution of number of detections of a lineup.

There are two attractiveness distribution available, one is uniform distribution, another is Dirichlet distribution. Uniform distribution ensures the marginal distribution of the probability of every plot being selected is uniform. When \alpha = 1, Dirichlet distribution ensures the probability of every plot being selected is evenly distributed in a standard M - 1 simplex.

Value

A named vector representing the probability mass function of the distribution.

Examples


# The first person select 2 plots, the second one select 2 plots and
# the third one select 3 plots.
sim_dist(c(2, 2, 3))

# There is only one observer and it selects one plot from the lineup.
sim_dist(1)

# Dirichlet distribution will be better if you want to take into account the
# possible dependencies between responses due to the same lineup is
# presented to multiple observers.
# There is no need to use this distribution if there is only one observer.
sim_dist(c(2, 2, 3), dist = "dirichlet")


TengMCing/visage documentation built on Aug. 28, 2024, 3:27 p.m.