R/RcppExports.R

Defines functions negllc_const negllc_expan negllc_expo negllc_log negllc_pexpan negllc_plog negllc_step

Documented in negllc_const negllc_expan negllc_expo negllc_log negllc_pexpan negllc_plog negllc_step

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Function to calculate the loglikelihood of a constant coalescent model
#' @param N0 A population size.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Simon Frost (\email{sdwfrost@@gmail.com})
#' @return Sorted sampling times, coalescent times and sampling lineages.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_const(1, x$t, x$A)
#' @export
negllc_const <- function(N0, t, A) {
    .Call('_genieR_negllc_const', PACKAGE = 'genieR', N0, t, A)
}

#' Function to calculate the loglikelihood of a expansion coalescent model
#' @param parr A parameter vector for population size, growth rate and population size at when t is infinity.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Fei Xiang (\email{xf3087@@gmail.com})
#' @return loglikelihood of a expansion coalescent model.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_expan(c(1,1,10), x$t, x$A)
#' library(minqa)
#' bobyqa(c(1,2,10),negllc_expan,lower=0,upper=Inf,t=x$t,A=x$A)
#' Geniefit(t1,Model="expan",start=c(10,2,2),upper=Inf,lower=0)
#' @export
negllc_expan <- function(parr, t, A) {
    .Call('_genieR_negllc_expan', PACKAGE = 'genieR', parr, t, A)
}

#' Function to calculate the loglikelihood of a exponential coalescent model
#' @param parr A parameter vector for population size and growth rate.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Fei Xiang (\email{xf3087@@gmail.com})
#' @return loglikelihood of a exponential coalescent model.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_expo(c(1,1), x$t, x$A)
#' library(minqa)
#' bobyqa(c(1,2),negllc_expo,lower=0,upper=Inf,t=x$t,A=x$A)
#' Geniefit(t1,Model="expo",start=c(10,2),upper=Inf,lower=0)
#' @export
negllc_expo <- function(parr, t, A) {
    .Call('_genieR_negllc_expo', PACKAGE = 'genieR', parr, t, A)
}

#' Function to calculate the logistic of a logistic coalescent model
#' @param parr A parameter vector for population size, growth rate and logistic shape parameter.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Fei Xiang (\email{xf3087@@gmail.com})
#' @return loglikelihood of a logistic coalescent model.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_log(c(1,1,10), x$t, x$A)
#' library(minqa)
#' bobyqa(c(1,2,10),negllc_log,lower=0,upper=Inf,t=x$t,A=x$A)
#' Geniefit(t1,Model="log",start=c(10,20,20),upper=Inf,lower=0)
#' library(dfoptim)
#' nmkb(c(1,2,10),negllc_log,lower=0,upper=Inf,t=x$t,A=x$A)
#' @export
negllc_log <- function(parr, t, A) {
    .Call('_genieR_negllc_log', PACKAGE = 'genieR', parr, t, A)
}

#' Function to calculate the loglikelihood of a piecewise expansion coalescent model
#' @param parr A parameter vector for population size, exponential growth rate and propotion to population size prior to change.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Fei Xiang (\email{xf3087@@gmail.com})
#' @return loglikelihood of a piecewise expansion coalescent model.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_pexpan(c(1,1,.1), x$t, x$A)
#' library(minqa)
#' bobyqa(c(1,2,1),negllc_pexpan,lower=0,upper=Inf,t=x$t,A=x$A)
#' Geniefit(t1,Model="pexpan",start=c(10,2,1),upper=Inf,lower=0)
#' library(dfoptim)
#' nmkb(c(1,2,10),negllc_pexpan,lower=0,upper=Inf,t=x$t,A=x$A)
#' @export
negllc_pexpan <- function(parr, t, A) {
    .Call('_genieR_negllc_pexpan', PACKAGE = 'genieR', parr, t, A)
}

#' Function to calculate the loglikelihood of a piecewise logistic coalescent model
#' @param parr A parameter vector for population size, exponential growth rate and change time.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Fei Xiang (\email{xf3087@@gmail.com})
#' @return loglikelihood of a piecewise logistic coalescent model.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_plog(c(1,1,.1), x$t, x$A)
#' library(minqa)
#' bobyqa(c(1,2,1),negllc_plog,lower=0,upper=Inf,t=x$t,A=x$A)
#' Geniefit(t1,Model="plog",start=c(10,2,1),upper=Inf,lower=0)
#' library(dfoptim)
#' nmkb(c(1,2,10),negllc_plog,lower=0,upper=Inf,t=x$t,A=x$A)
#' @export
negllc_plog <- function(parr, t, A) {
    .Call('_genieR_negllc_plog', PACKAGE = 'genieR', parr, t, A)
}

#' Function to calculate the loglikelihood of a step coalescent model
#' @param parr A parameter vector for population size ,change time and propotion to population size prior to change.
#' @param t A sampling and coalescent time vector.
#' @param A A lineages vector
#' @author Fei Xiang (\email{xf3087@@gmail.com})
#' @return loglikelihood of a exponential coalescent model.
#' @useDynLib genieR
#' @importFrom Rcpp sourceCpp
#' @examples
#' library(ape)
#' t1=rcoal(20)
#' x=att(t1)
#' negllc_step(c(1,1,.1), x$t, x$A)
#' library(minqa)
#' bobyqa(c(1,2,1),negllc_step,lower=0,upper=Inf,t=x$t,A=x$A)
#' Geniefit(t1,Model="step",start=c(10,2,1),upper=Inf,lower=0)
#' library(dfoptim)
#' nmkb(c(1,2,10),negllc_step,lower=0,upper=Inf,t=x$t,A=x$A)
#' @export
negllc_step <- function(parr, t, A) {
    .Call('_genieR_negllc_step', PACKAGE = 'genieR', parr, t, A)
}
xiangfstats/GenieR documentation built on May 4, 2019, 1:06 p.m.