Skip to contents

This function fits a growth model that accounts for two populations within a bipod object. The fitting can be done using either Variational Inference or Markov Chain Monte Carlo (MCMC) sampling.

Usage

fit_two_pop_model(
  x,
  variational = FALSE,
  factor_size = 1,
  chains = 4,
  iter = 5000,
  cores = 4
)

Arguments

x

A bipod object.

variational

A logical value indicating whether to use Variational Inference instead of MCMC sampling. If TRUE, the model will be fitted using Variational Inference; otherwise, MCMC sampling will be used. (default is FALSE)

factor_size

A numeric value representing the factor by which to divide the counts in the bipod object. This value must be positive and appropriate for the data scale. (default is 1)

chains

An integer specifying the number of chains to run in the MCMC algorithm. This parameter is ignored if variational = TRUE. (default is 4)

iter

An integer specifying the number of iterations to run in the MCMC algorithm. This parameter is ignored if variational = TRUE. (default is 5000)

cores

An integer specifying the number of cores to use for parallel processing during model fitting. (default is 4)

Value

The input bipod object with added slots:

  • 'two_pop_fit': Contains the fitted two-population growth model.

  • 'two_pop_fit_info': Contains information about the fitting process, including metadata such as sampling type and factor size.