This function fits offspring data to the Poisson distribution and estimates P2 based on that distribution and the specificed priors.
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.
Returns
posterior: Posterior distribution of P2 values.
Lambda: Vector of values for the lambda parameter.
Author(s)
M. Catherine Duryea, Andrew D. Kern, Robert M. Cox, and Ryan Calsbeek
Examples
#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)