Learn R Programming

ABCp2 (version 1.2)

ABC_P2_pois: ABC Estimation of P2 for Poisson Distribution

Description

This function fits offspring data to the Poisson distribution and estimates P2 based on that distribution and the specificed priors.

Usage

ABC_P2_pois(n, ObsMean, L_Lo, L_Hi, delta, iter)

Arguments

n
the number of observations.
ObsMean
the observed mean number of offspring sired by the second male.
L_Lo
minimum lambda value for the distribution.
L_Hi
maximum lambda value for the distribution.
delta
maximum allowed difference between the estimated mean and observed mean number of offspring produced by the second male.
iter
number of iterations used to build the posterior.

Value

posterior
Posterior distribution of P2 values.
Lambda
Vector of values for the lambda parameter.

Examples

Run this code
#Fit the Lambda hyperprior to a distribution of offspring.

data(fungus)
fit_dist_pois(fungus$Total_Offspring)

#Use hyperiors and priors calculated from the data to estimate P2. 
#Plot the saved distributions for the Lambda parameter. 
#Adjust, if necessary.

fungus_P2<-ABC_P2_pois(12, 9.9, 13.24, 15.42, 0.1, 100)
hist(fungus_P2$posterior)
hist(fungus_P2$Lambda)

Run the code above in your browser using DataLab