behav_gibbs_sampler: Internal function that runs RJMCMC on a single animal ID

Description Usage Arguments Value

View source: R/segmentation_gibbs_sampler.R

Description

This function serves as a wrapper for samp_move by running this sampler for each iteration of the MCMC chain. It is called by segment_behavior to run the RJMCMC on all animal IDs simultaneously.

Usage

1
behav_gibbs_sampler(dat, ngibbs, nbins, alpha, breakpt, p)

Arguments

dat

A data frame that only contains columns for the animal IDs and for each of the discretized movement variables.

ngibbs

numeric. The total number of iterations of the MCMC chain.

nbins

numeric. A vector of the number of bins used to discretize each movement variable. These must be in the same order as the columns within dat.

alpha

numeric. A single value used to specify the hyperparameter for the prior distribution. A standard value for alpha is typically 1, which corresponds with a vague prior on the Dirichlet distribution.

breakpt

numeric. A vector of breakpoints if pre-specifying where they may occur, otherwise NULL.

p

An object storing information from progressr::progessor to produce a progress bar.

Value

A list of the breakpoints, the number of breakpoints, and the log marginal likelihood at each MCMC iteration, as well as the time it took the model to finish running. This is only provided for the data of a single animal ID.


bayesmove documentation built on Oct. 22, 2021, 9:08 a.m.