Approximate the distribution of number of detections of a lineup with simulation
Source:R/p_value.R
sim_dist.Rd
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.
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.
- 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.
Examples
sim_dist(c(2,2,3))
#> 0 1 2 3
#> 0.69686 0.25592 0.04408 0.00314
sim_dist(1)
#> 0 1
#> 0.94726 0.05274