R/RcppExports.R

# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Density function of gamma dfe
#' @param obs, numeric, observed fitnesses
#' @param shape, numeric, shape of gamma distribution
#' @param rate, numeric, rate of gamma distribution
#' @param Ve, numeric, experimental variance
#' @param k, numeric, vector of knonw mutation counts
#' @param p_neutral numeric,proportion of all mutations that have no effect
#' @param log logical return log-liklihood (defaults to true)
#' @return numeric (log-) liklihood of the specfified model and data
#' @examples
#' set.seed(123)
#' mu <- rpois(50, 10)
#' w <- rma_known_gamma(shape=1, rate=25, Ve=0.01, k=mu,p_neutral=0.7) 
#' dma_gamma_known(w, shape=1, rate=25, Ve=0.01, k=mu, p_neutral=0.75)
#' dma_gamma_known(w, shape=1, rate=25, Ve=0.01, k=mu, p_neutral=0.65)
dma_gamma_known <- function(obs, shape, rate, Ve, k, p_neutral, log = TRUE) {
    .Call('dfe_dma_gamma_known', PACKAGE = 'dfe', obs, shape, rate, Ve, k, p_neutral, log)
}

#' Density function of gamma dfe
#' @param obs, numeric, observed fitnesses
#' @param shape, numeric, shape of gamma distribution
#' @param rate, numeric, rate of gamma distribution
#' @param Ve, numeric, experimental variance
#' @param Ut, numeric, mutation rate
#' @param log, boolean, return log-liklihood (default=TRUE)
#' @export
dma_gamma <- function(obs, shape, rate, Ve, Ut, log = TRUE) {
    .Call('dfe_dma_gamma', PACKAGE = 'dfe', obs, shape, rate, Ve, Ut, log)
}

#' Density function of gamma dfe with known mutation counts
#' @param obs, numeric, observed fitnesses
#' @param mean, numeric, rate of inverse gaussian DFE
#' @param shape, numeric, shape of inverse gaussian DFE
#' @param Ve, numeric, experimental variance
#' @param k, numeric, vector of knonw mutation counts
#' @param p_neutral numeric,proportion of all mutations that have no effect
#' @param log logical return log-liklihood (defaults to true)
#' @return numeric (log-) liklihood of the specfified model and data
#' @export
#' @examples
#' set.seed(123)
#' mu <- rpois(50, 10)
#' w <- rma_known_IG(shape=1, mean=0.1, Ve=0.01, k=mu,p_neutral=0.7) 
#' dma_IG_known(w, shape=1, mean=0.1, Ve=0.01, k=mu, p_neutral=0.75)
#' dma_IG_known(w, shape=1, mean=0.1, Ve=0.01, k=mu, p_neutral=0.65)
dma_IG_known <- function(obs, mean, shape, Ve, k, p_neutral, log = TRUE) {
    .Call('dfe_dma_IG_known', PACKAGE = 'dfe', obs, mean, shape, Ve, k, p_neutral, log)
}

#' Density function for inverse-gaussian dfe
#' @param obs numeric, observed fitnesses
#' @param mean numeric, mean effect-size of mutations
#' @param shape numeric, shape of underlying DFE
#' @param Ve numeric variance of experimental system
#' @param Ut numeric mutation rate
#' @param log boolean return log liklihood (default=TRUE)
#' @export
dma_IG <- function(obs, mean, shape, Ve, Ut, log = TRUE) {
    .Call('dfe_dma_IG', PACKAGE = 'dfe', obs, mean, shape, Ve, Ut, log)
}

#' Density function for normal dfe with known mutations
#' @param obs numeric, observed fitnesses
#' @param a numeric, mean effect-size of mutations
#' @param Va numeric variance of dfe
#' @param Ve numeric variance of experimental system
#' @param k integer, vector of mutation counts 
#' @param p_nuetral, global proportion of neutral mutations
#' @param log boolean return log liklihood (default=TRUE)
dma_normal_known <- function(obs, a, Va, Ve, k, p_neutral, log = FALSE) {
    .Call('dfe_dma_normal_known', PACKAGE = 'dfe', obs, a, Va, Ve, k, p_neutral, log)
}

#' Density function for normal dfe
#' @param obs numeric, observed fitnesses
#' @param a numeric, mean effect-size of mutations
#' @param Va numeric variance of dfe
#' @param Ve numeric variance of experimental system
#' @param Ut numeric mutation rate
#' @param log boolean return log liklihood (default=TRUE)
#' @export
dma_normal <- function(obs, a, Va, Ve, Ut, log = TRUE) {
    .Call('dfe_dma_normal', PACKAGE = 'dfe', obs, a, Va, Ve, Ut, log)
}

#' Gradient function of the normal model
#' @param obs numeric, observed fitnesses
#' @param a numeric, mean effect-size of mutations
#' @param Va numeric variance of dfe
#' @param Ve numeric variance of experimental system
#' @param Ut numeric mutation rate
#' @export
grad_normal <- function(obs, a, Va, Ve, Ut) {
    .Call('dfe_grad_normal', PACKAGE = 'dfe', obs, a, Va, Ve, Ut)
}
dwinter/dfe documentation built on May 15, 2019, 6:21 p.m.