All functions

CumSumInv()

Internal function that calculates the inverted cumsum

SampleZAgg()

Internal function that samples z1 aggregate

StoreZ()

This function helps store z from all iterations after burn in

SummarizeDat()

Internal function that generates nmat matrix to help with multinomial draws

assign_behavior()

Assign behavior estimates to observations

assign_tseg()

Add segment numbers to observations

assign_tseg_internal()

Internal function that adds segment numbers to observations

behav_gibbs_sampler()

Internal function that runs RJMCMC on a single animal ID

behav_seg_image()

Internal function that transforms a vector of bin numbers to a presence-absence matrix

cluster_obs()

Cluster observations into behavioral states

cluster_segments()

Cluster time segments into behavioral states

df_to_list()

Convert data frame to a list by animal ID

discrete_move_var()

Discretize movement variables

expand_behavior()

Expand behavior estimates from track segments to observations

extract_prop()

Extract behavior proportion estimates for each track segment

filter_time()

Filter observations for time interval of interest

find_breaks()

Find changes for integer variable

get.llk.mixmod()

Internal function to calculate the log-likelihood for iteration of mixture model

get.theta()

Internal function to calculate theta parameter

get_MAP()

Find the maximum a posteriori (MAP) estimate of the MCMC chain

get_MAP_internal()

Internal function to find the maximum a posteriori (MAP) estimate of the MCMC chain

get_behav_hist()

Extract bin estimates from Latent Dirichlet Allocation or mixture model

get_breakpts()

Extract breakpoints for each animal ID

get_summary_stats()

Internal function that calculates the sufficient statistics for the segmentation model

insert_NAs()

Insert NA gaps to regularize a time series

log_marg_likel()

Internal function that calculates the log marginal likelihood of each model being compared

plot_breakpoints()

Plot breakpoints over a time series of each movement variable

plot_breakpoints_behav()

Internal function for plotting breakpoints over each of the data streams

prep_data()

Calculate step lengths, turning angles, net-squared displacement, and time steps

prep_data_internal()

Internal function to calculate step lengths, turning angles, and time steps

rmultinom1()

Internal function that samples z's from a categorical distribution

rmultinom2()

Internal function that samples z's from a multinomial distribution

round_track_time()

Round time to nearest interval

samp_move()

Internal function for the Gibbs sampler within the reversible-jump MCMC algorithm

sample.gamma.mixmod()

Internal function to sample the gamma hyperparameter

sample.phi()

Internal function to sample bin estimates for each movement variable

sample.phi.mixmod()

Internal function to sample bin estimates for each movement variable

sample.v()

Internal function to sample parameter for truncated stick-breaking prior

sample.v.mixmod()

Internal function to sample parameter for truncated stick-breaking prior

sample.z()

Internal function to sample latent clusters

sample.z.mixmod()

Internal function to sample latent clusters (for observations)

segment_behavior()

Segmentation model to estimate breakpoints

shiny_tracks()

Dynamically explore tracks within Shiny app

summarize1()

Internal function that summarizes bin distributions of track segments

summarize_tsegs()

Summarize observations within bins per track segment

traceplot()

View trace-plots of output from Bayesian segmentation model

tracks

Simulated set of three tracks.

tracks.list

Tracks discretized and prepared for segmentation.

tracks.seg

Segmented tracks for all IDs.