R/lik_gen.R

Defines functions lik_gen

#' @import ape

# input: n - number of species, par.n - which parameter has been updated, pars - c(sig1, ..., sigN, the0), tree and map
# does: calculate log-likelihood; 
lik_gen <- function(phy, f.prior){
  eval(parse(text = sprintf("f.prior <- %s", paste0(deparse(f.prior), collapse = " "))))  
  foo <- function(x, n, pars, Pi, par.n, data, map){
    data <- NULL
    loglik <- f.prior(phy, x, pars)
    return(list(loglik = loglik, data = data))
  }
}

Try the bite package in your browser

Any scripts or data that you put into this service are public.

bite documentation built on April 22, 2020, 5:09 p.m.