sls_ML: sls Maximum Likelihood

Description Usage Arguments Value Examples

Description

Calculates ML.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sls_ml(
  loglik_function = sls::loglik_sls_p,
  brts,
  start_pars = c(0.5, 0.3, 0.5, 0.3),
  n_0 = 2,
  cond = 3,
  optim_ids = rep(TRUE, length(start_pars)),
  true_pars = start_pars,
  verbose = TRUE,
  max_iterations = 10000
)

Arguments

loglik_function

the loglik function you want to use

brts

branching times provided as a list of vectors, one for the main clade, one for the subclade

start_pars

parameters to start from for the search of the likelihood maximum

n_0

starting number of lineages

cond

type of conditioning:

  • cond = 0 no conditiong;

  • cond = 1 conditions on the survival of crown descendents;

  • cond = 2 conditions on the survival of subclade and on the other crown descendents in the main clade;

  • cond = 3 conditions on the survival of the subclade and both crown descendents in the main clade;

optim_ids

ids of the parameters you want to optimize.

true_pars

true parameter values when running the ml process.

verbose

set it to TRUE if you want to see the outputs on screen

max_iterations

maximum number of iterations for the optimizer

Value

best parameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 brts_m <- c(3, 2, 1)
 brts_s <- c(2.5, 1.5)
 brts <- list(brts_m, brts_s)
 start_pars <- c(0.4, 0.05, 0.3, 0.1)
 cond <- 3
 n_0 <- 2

 sls::sls_ml(
   loglik_function = sls::loglik_sls_p,
   brts = brts,
   start_pars = start_pars,
   cond = cond,
   n_0 = n_0,
   verbose = TRUE
 )

Giappo/sls documentation built on Feb. 1, 2021, 9:55 a.m.