ashpen_fun              Penalty on pivec used when 'model = "ash"' in
                        'flexdog'.
compute_all_log_bb      Calculates the log-density for every individual
                        by snp by dosage level.
compute_all_phifk       Computes Phi^{-1}(F(k|K,alpha_j,rho_i)) for all
                        possible (i,j,k).
compute_all_post_prob   Computes every posterior probability for each
                        dosage level for each individual at each SNP.
convolve                Convolution between two discrete probability
                        mass functions with support on 0:K.
dbernbinom              Special case of betabinomial where the beta is
                        bernoulli mu.
dbetabinom              The Beta-Binomial Distribution
dbetabinom_alpha_beta_double
                        Density function of betabinomial with the shape
                        parameterizations
dbetabinom_double       The density function of the beta-binomial
                        distribution.
dc_dtau                 Derivative of c = (1 - tau) / tau with respect
                        to tau.
df_deps                 Derivative of f with respect to eps.
dlbeta_dc               Derivative of the log-beta density with respect
                        to c where c = (1 - tau)/tau where tau is the
                        overdispersion parameter.
dlbeta_deps             Derivative of the log-beta-binomial density
                        with respect to the sequencing error rate.
dlbeta_dh               Derivative of log-betabinomial density with
                        respect to bias parameter.
dlbeta_dtau             Derivative of the log-beta-binomial density
                        with respect to the overdispersion parameter.
dlbeta_dxi              Derivative of the log-betabinomial density with
                        respect to the mean of the underlying beta.
doutdist                The outlier distribution we use. Right now it
                        is just a beta binomial with mean 1/2 and od
                        1/3 (so underlying beta is just a uniform from
                        0 to 1).
dpen_deps               Derivative of -log(epsilon(1 - epsilon)) -
                        (logit(epsilon) - mu_{epsilon})^2 /
                        (2sigma_{epsilon}^2) with respect to epsilon.
dpen_dh                 Derivative of -log(h) - (log(h) - mu_h)^2 /
                        (2sigma_h^2) with respect to h.
dr_pen                  Penalty used in 'update_dr'.
dxi_df                  Derivative of xi with respect to f.
dxi_dh                  Derivative of xi-function with respect to bias
                        parameter.
elbo                    The evidence lower bound
eta_double              Adjusts allele dosage 'p' by the sequencing
                        error rate 'eps'.
eta_fun                 Adjusts allele dosage 'p' by the sequencing
                        error rate 'eps'.
expit                   The expit (logistic) function.
f1_obj                  Objective for mixture of known dist and uniform
                        dist.
flex_update_pivec       Update the distribution of genotypes from
                        various models.
flexdog                 Flexible genotyping for polyploids from
                        next-generation sequencing data.
flexdog_full            Flexible genotyping for polyploids from
                        next-generation sequencing data.
flexdog_obj             Log-likelihood that 'flexdog' maximizes.
flexdog_obj_out         Log-likelihood that 'flexdog' maximizes when
                        outliers are present.
get_bivalent_probs      Returns segregation probabilities, pairing
                        representation and number of ref alleles given
                        the ploidy.
get_bivalent_probs_dr   Double reduction version of
                        'get_bivalent_probs'.
get_conv_inner_weights
                        Get the inner weights used for the em update in
                        'update_pp_f1' when there are more than two
                        bivalent components for one of the parents.
get_dimname             Returns a vector character strings that are all
                        of the possible combinations of the reference
                        allele and the non-reference allele.
get_hyper_weights       Return mixture weights needed to obtain a
                        hypergeometric distribution.
get_inner_weights       Compute inner weights for updating the mixing
                        proportions when using ash model.
get_probk_vec           Obtain the genotype distribution given the
                        distribution of discrete uniforms.
get_q_array             Return the probabilities of an offspring's
                        genotype given its parental genotypes for all
                        possible combinations of parental and offspring
                        genotypes. This is for species with polysomal
                        inheritance and bivalent, non-preferential
                        pairing.
get_uni_rep             Get the representation of a discrete unimodal
                        probability distribution.
get_wik_mat             E-step in 'flexdog'.
get_wik_mat_out         E-step in 'flexdog' where we now allow an
                        outlier distribution.
grad_for_eps            Gradient for 'obj_for_eps'.
grad_for_mu_sigma2      Gradient for 'obj_for_mu_sigma2' with respect
                        for 'mu' and 'sigma2'.
grad_for_mu_sigma2_wrapper
                        Gradient for 'obj_for_mu_sigma2_wrapper' with
                        respect for 'muSigma2' and a wrapper for
                        'grad_for_mu_sigma2'
grad_for_weighted_lbb   Gradient for 'obj_for_weighted_lbb'.
grad_for_weighted_lnorm
                        Gradient for 'obj_for_weighted_lnorm'.
initialize_pivec        Initialize 'pivec' for 'flexdog' EM algorithm.
is.flexdog              Tests if an argument is a 'flexdog' object.
is.mupdog               Tests if its argument is a mupdog object.
log_sum_exp             Log-sum-exponential trick.
log_sum_exp_2           Log-sum-exponential trick using just two
                        doubles.
logit                   The logit function.
mupdog                  Multi-SNP updog.
mupout                  A mupdog fit of the 'uitdewilligen' data.
obj_for_alpha           Objective function when updating alpha
obj_for_eps             Objective function for updating sequencing
                        error rate, bias, and overdispersion
                        parameters.
obj_for_mu_sigma2       Objective function when updating mu and sigma2.
obj_for_mu_sigma2_wrapper
                        Wrapper for 'obj_for_mu_sigma2' so that I can
                        use it in 'optim'.
obj_for_rho             Objective function when updating a single
                        inbreeding coefficient.
obj_for_weighted_lbb    Objective function for updating the
                        beta-binomial genotype distribution when 'model
                        = "bb"' in 'flex_update_pivec'.
obj_for_weighted_lnorm
                        Objective funtion for updating discrete normal
                        genotype distribution when 'model = "normal"'
                        in 'flex_update_pivec'.
oracle_cor              Calculates the correlation between the true
                        genotype and an oracle estimator.
oracle_cor_from_joint   Calculate the correlation of the oracle
                        estimator with the true genotype from the joint
                        distribution matrix.
oracle_joint            The joint probability of the genotype and the
                        genotype estimate of an oracle estimator.
oracle_mis              Calculate oracle misclassification error rate.
oracle_mis_from_joint   Get the oracle misclassification error rate
                        directly from the joint distribution of the
                        genotype and the oracle estimator.
oracle_mis_vec          Returns the oracle misclassification rates for
                        each genotype.
oracle_mis_vec_from_joint
                        Get the oracle misclassification error rates
                        (conditional on true genotype) directly from
                        the joint distribution of the genotype and the
                        oracle estimator.
oracle_plot             Construct an oracle plot from the output of
                        'oracle_joint'.
pbetabinom_double       The distribution function of the betabinomial.
                        This is generally only adviseable if q is
                        relatively small.
pen_bias                Penalty on bias parameter.
pen_seq_error           Penalty on sequencing error rate.
pivec_from_segmats      Function to get the segregation probabilities
                        from the distributions of each component and
                        the weights of each component.
plot.flexdog            Draw a genotype plot from the output of
                        'flexdog'.
plot.mupdog             Draw a genotype plot from the output of
                        'mupdog'.
plot_geno               Make a genotype plot.
post_prob               Variational posterior probability of having
                        'dosage' A alleles when the ploidy is 'ploidy',
                        the allele frequency is 'alpha', the
                        individual-specific overdispersion parameter is
                        'rho', the variational mean is 'mu', and the
                        variational variance is 'sigma2'.
pp_brent_obj            Objective function when doing Brent's method in
                        'update_pp_f1' when one parent only has two
                        mixing components.
qbetabinom_double       The quantile function of the beta-binomial
                        distribution parameterized by mean and
                        overdispersion parameter.
rbetabinom_int          One draw from the beta-binomial distribution
                        parameterized by mean and overdispersion
                        parameter.
rflexdog                Simulate GBS data from the 'flexdog'
                        likelihood.
rgeno                   Simulate individual genotypes from one of the
                        supported 'flexdog' models.
snpdat                  GBS data from Shirasawa et al (2017)
summary.mupdog          Provides some summaries from the output of
                        'mupdog'.
uitdewilligen           Subset of individuals and SNPs from
                        Uitdewilligen et al (2013).
uni_em                  EM algorithm to fit weighted ash objective.
uni_em_const            EM algorithm to fit weighted ash objective with
                        a uniform mixing component.
uni_obj                 Objective function optimized by 'uni_em'.
uni_obj_const           Objective function optimized by 'uni_em_const'.
update_R                Update the underlying correlation matrix.
update_dr               Same as 'update_pp_f1' but I exclusively use
                        the EM (instead of also Brent's method), and I
                        allow for priors on the mixing proportions.
update_pp_f1            Function to update the parameters in the
                        preferential pairing F1 model.
update_pp_s1            Same as 'update_pp_f1' but only allow s1.
updog                   'updog' Flexible Genotyping for Polyploids
wem                     Generalized version of 'uni_em'.
xi_double               Adjusts allele dosage 'p' by the sequencing
                        error rate 'eps' and the allele bias 'h'.
xi_fun                  Adjusts allele dosage 'p' by the sequencing
                        error rate 'eps' and the allele bias 'h'.
