View source: R/friedsIndexBMM.R
friedsIndexBMM | R Documentation |
friedsIndexBMM
uses a two component binomial mixture model (BMM) to analyse the data from insect mating competitiveness experiments conducted in cages. All cages should contain the same numbers of females, wildtype males and sterilised males. The method uses only mixed mating cages and does not use the compatible and incompatible control cages that are used in traditional estimates of Frieds Index.
friedsIndexBMM(dataset, alpha_sterile = 1, beta_sterile = 1, alpha_wildtype = 1, beta_wildtype = 1, numChains = 1, control = list(adapt_delta = 0.99, max_treedepth = 20), iter = 2000, warmup = 1000)
|
is a matrix containing columns named "NumEggs", "NumViable" and "Cage". Each row in |
|
the parameter alpha of the beta distribution to be used for the prior on the hatch probability of eggs produced from matings between wildtype females and sterilised males (alpha and beta default to 1.0 which is a uniform prior). |
|
the parameter beta of the beta distribution to be used for the prior on the hatch probability of eggs produced from matings between wildtype females and sterilised males (alpha and beta default to 1.0 which is a uniform prior). |
|
the parameter alpha of the beta distribution to be used for the prior on the hatch probability of eggs produced from matings between wildtype females and wildtype males (alpha and beta default to 1.0 which is a uniform prior). |
|
the parameter beta of the beta distribution to be used for the prior on the hatch probability of eggs produced from matings between wildtype females and wildtype males (alpha and beta default to 1.0 which is a uniform prior). |
|
the number of chains to use when sampling from the posterior distribution (defaults to 1). |
|
a list of control parameters that is passed to the |
|
the number of samples to draw from the posterior distribution (defaults to 2000). |
|
the number of initial samples to discard from the analysis to allow the chain(s) to warms-up/burn-in (defaults to 1000). |
The function returns a list containing the posterior samples from the BMM analysis (which can be passed to credibleIntevals
for summarisation). The list item named p
is a two column matrix, with the first column containing posterior samples of the sterile-mating egg hatch probability and the second column the posterior samples of the wildtype egg hatch probability. The list item named pi_global
contains the posterior samples for the proportion of matings that were between a wildtype female and a sterilised male. Samples of pi_global
can be used to obtain posterior samples of Fried's index as pi_global*wildtypeSterileRatio/(1 - pi_global)
, where wildtypeSterileRatio
is the ratio of wildtype to sterile males that was used in the mixed mating cages. This calculation of Fried's index is performed for the user in the function credibleIntervals
.
data(dataset_multiRep) samples <- friedsIndexBMM(dataset_multiRep) credibleIntervals(samples, wildToSterileRatio = 1) data(dataset_singleRep) samples <- friedsIndexBMM(dataset_singleRep) credibleIntervals(samples, wildToSterileRatio = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.