Description Usage Arguments Details Value Examples
MCMC sampling from a DirichletMultinomial model using stan
.
1 
nsamples 
Number of posterior samples 
X 
4column or 5column matrix of observations in the correct format. See 
popId 
Optional vector of population identifiers. See 
rhoId 
Populations for which posterior samples of the genotype probability vector 
full.stan.out 
Logical. Whether or not to return the full 
... 
Further arguments to be passed to the 
The hierarchical DirichletMultinomial model is given by
Y_k  ρ_k ~ind Multinomial(ρ_k, N_k),
ρ_k ~iid Dirichlet(α).
where α_0 = ∑_{i=1}^C α_i and α_bar = α/α_0. MCMC sampling is achieved with the rstan package, which is listed as a dependency for MADPop so as to expose rstan's sophisticated tuning mechanism and convergence diagnostics.
A list with elements
A
: The unique allele names.
G
: The 4column matrix Package libcurl was not found in the pkgconfig search path.of unique genotype combinations.
rho
: A matrix with ncol(rho) == nrow(G)
, where each row is a draw from the posterior distribution of inheritance probabilities.
sfit
: If full.stan.out = TRUE
, the fitted stan
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  # fit hierarchical model to fish215 data
# only output posterior samples for lake Simcoe
rhoId < "Simcoe"
nsamples < 500
hUM.fit < hUM.post(nsamples = nsamples, X = fish215,
rhoId = rhoId,
chains = 1) # number of MCMC chains
# plot first 20 posterior probabilities in lake Simcoe
rho.post < hUM.fit$rho[,1,]
boxplot(rho.post[,1:20], las = 2,
xlab = "Genotype", ylab = "Posterior Probability",
pch = ".", col = "grey")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.