From 43e37e19fed04efbd9253019685318977d3a33e0 Mon Sep 17 00:00:00 2001 From: rsetienne Date: Wed, 23 Oct 2024 16:38:08 +0200 Subject: [PATCH] Make DAISIE_ML1 flexible to allow another loglik function to be optimized. --- R/DAISIE_ML1.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/DAISIE_ML1.R b/R/DAISIE_ML1.R index 2fb1edb9..3bc01e1c 100644 --- a/R/DAISIE_ML1.R +++ b/R/DAISIE_ML1.R @@ -107,7 +107,8 @@ DAISIE_ML1 <- function( tolint = c(1E-16, 1E-10), island_ontogeny = NA, jitter = 0, - num_cycles = 1) { + num_cycles = 1, + function_to_optimize = DAISIE_loglik_all_choosepar) { # datalist = list of all data: branching times, status of clade, and numnber of missing species # datalist[[,]][1] = list of branching times (positive, from present to past) # - max(brts) = age of the island @@ -288,7 +289,7 @@ DAISIE_ML1 <- function( ) optimpars <- c(tol, maxiter) - initloglik <- DAISIE_loglik_all_choosepar( + initloglik <- function_to_optimize( trparsopt = trparsopt, trparsfix = trparsfix, idparsopt = idparsopt,