mlskygrid: Maximum likelihood non-parametric estimation of effective...

View source: R/mlesky.R

mlskygridR Documentation

Maximum likelihood non-parametric estimation of effective population size through time

Description

Maximum likelihood non-parametric estimation of effective population size through time

Usage

mlskygrid(
  tre,
  sampleTimes = NULL,
  res = 25,
  tau = 1,
  tau_lower = NULL,
  tau_upper = NULL,
  tau_tol = 0.001,
  ncross = 5,
  ncpu = 1,
  quiet = TRUE,
  NeStartTimeBeforePresent = Inf,
  ne0 = NULL,
  adapt_time_axis = FALSE,
  model = 1,
  formula = NULL,
  data = NULL
)

Arguments

tre

A dated phylogeny in ape::phylo or treedater format (see documentation for ape). This can also be a multiPhylo or list of trees, in which case each is treated as a clade sampled from within the same population. In this case the sampleTimes vector should be supplied so that clades can be aligned in time.

sampleTimes

An optional named vector of sample times for each taxon. Names should correspond to tip labels in trees. This is required if providing a list of trees or covariates.

res

Length of time axis over which to estimate Ne(t) (integer). If NULL, will heuristically search for a good value

tau

Precision parameter. Larger values generate smoother trajectories of Ne(t). If NULL, will optimize using cross-validation.

tau_lower

Lower bound for precision parameter if estimating

tau_upper

Upper bound for precision parameter if estimating

tau_tol

Optimization tolerance when optimizing tau by cross-validation

ncross

Number of folds in cross-validation

ncpu

If doing cross-validation, each fold will be handled in parallel if ncpu > 1 (see parallel package)

quiet

Provide verbose output from optimizer?

NeStartTimeBeforePresent

If <Inf, will only estimate Ne(t) between the most recent sample and this time before the most recent sample

ne0

Vector of length *res* giving starting conditions of Ne(t) for optimization, or a single value which will be used as rep(ne0,res)

adapt_time_axis

If TRUE will choose Ne(t) change points in periods with high frequency of phylogenetic branching

model

Model to use, can be 1 (=skykappa model), 2 (=skygrid model) or 3 (=skygrowth model)

formula

Formula for use of covariates. The left hand side should be one of 'diffLogNe', 'logNe' or 'diffDiffLogNe'. For example, if modeling the effect of a single covariate x on growth of Ne, an appropriate formula may be ‘diffLogNe ~ x - 1' where ’-1' specifies that an intercept is not estimated.

data

For use of covariates, data.frame must include 'time'

Value

A fitted model including effective size through time


emvolz-phylodynamics/mlesky documentation built on Feb. 13, 2025, 1:47 p.m.