Learn R Programming

phylodyn (version 0.9.0)

BNPR: Bayesian nonparametric phylodynamic reconstruction.

Description

Bayesian nonparametric phylodynamic reconstruction.

Usage

BNPR(data, lengthout = 100, pref = FALSE, prec_alpha = 0.01,
  prec_beta = 0.01, beta1_prec = 0.001, fns = NULL, log_fns = TRUE,
  simplify = TRUE, derivative = FALSE, forward = TRUE)

BNPR_PS(data, lengthout = 100, prec_alpha = 0.01, prec_beta = 0.01, beta1_prec = 0.001, fns = NULL, log_fns = TRUE, simplify = TRUE, derivative = FALSE, forward = TRUE)

Arguments

data
phylo object or list containing vectors of coalescent times coal_times, sampling times samp_times, and number sampled per sampling time n_sampled.
lengthout
numeric specifying number of grid points.
pref
logical. Should the preferential sampling model be used?
prec_alpha, prec_beta
numerics specifying gamma prior for precision \(\tau\).
beta1_prec
numeric specifying precision for normal prior on \(\beta_1\).
fns
list containing functions of covariates.
log_fns
logical whether or not to to apply a log-transformation to the output of the functions in fns.
simplify
logical whether to fully bucket all Poisson points.
derivative
logical whether to calculate estimates of the log-derivative.
forward
logical whether to use the finite difference approximations of the log-derivative as a forward or backward derivative.

Value

Phylodynamic reconstruction of effective population size at grid points. result contains the INLA output, data contains the information passed to INLA, grid contains the grid end points, x contains the grid point centers, effpop contains a vector of the posterior median effective population size estimates, effpop025 and effpop975 contain the 2.5th and 97.5th posterior percentiles, summary contains a data.frame of the estimates, and derivative (if derivative = TRUE) contains a data.frame summarizing the log-derivative.

Functions

  • BNPR_PS: Uses preferential sampling model.

Examples

Run this code
data("NY_flu")
if (requireNamespace("INLA", quietly = TRUE)) {
 res = BNPR(NY_flu)
 plot_BNPR(res)
}

Run the code above in your browser using DataLab