run_optim: Run maximum likelihood optimisation of a model on simulated...

Description Usage Arguments Author(s)

View source: R/run_optim.R

Description

Read a set of simulated trees as created by run_sim(), set up initial parameter values, call DDD::dd_ML() or DDD::bd_ML() to run the optimisation and format output.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
run_optim(
  sim,
  optim,
  para,
  custom_pars = NULL,
  outputfile = paste0("sim", sim, "_optim", optim, "_", para, "_true_k.rds"),
  rangemc = 1:1000,
  methode = "ode45",
  optimmethod = "subplex",
  tol = rep(1e-06, 3),
  save_results = TRUE,
  return_results = FALSE,
  jobID = NA,
  num_cycles = 1,
  cond = 1
)

Arguments

sim

character, name of the simulation model, either "DD" or "TD".

optim

character, name of the optimisation model, either "DD" or "TD".

para

numeric, a four-digits number coding for a set of four parameter values. Refer to arg_para() doc for details, and call arg_para() to see possible inputs.

custom_pars

numeric vector, user-specified initial values for the parameters to be optimized. If NULL (default), values are initialized using true values used to simulate the trees.

outputfile

character, the name of the file to save the output data frame in. The default follows the structure expected by read_optim_results.

rangemc

numeric vector, a set of tree indices ranging from 1 to 1000.

methode

likelihood solving methode, passed to DDD::dd_loglik() / DDD::bd_loglik().

optimmethod

optimisation algorithm, passed to DDD::dd_ML() / DDD::bd_ML().

tol

optimisation tolerance, passed to DDD::dd_ML() / DDD::bd_ML().

save_results

logical. Should the results be saved to outputfile?

return_results

logical. Should the results be returned?

jobID

SLURM job ID passed when the function is called from a cluster script.

num_cycles

number of cycles of optimisation, passed to DDD::dd_ML() / DDD::bd_ML().

cond

code specifying how the likelihood is conditioned. Passed to DDD::dd_loglik() / DDD::bd_loglik().

Author(s)

Théo Pannetier


TheoPannetier/DDvTDtools documentation built on Oct. 22, 2020, 2:31 p.m.