cluster_segments {bayesmove} | R Documentation |
This function performs a Gibbs sampler within the Latent Dirichlet Allocation
(LDA) model to estimate proportions of each behavioral state for all time
segments generated by segment_behavior
. This is the second
stage of the two-stage Bayesian model that estimates proportions of
behavioral states by first segmenting individual tracks into relatively
homogeneous segments of movement.
cluster_segments(dat, gamma1, alpha, ngibbs, nmaxclust, nburn, ndata.types)
dat |
A data frame returned by |
gamma1 |
numeric. A hyperparameter for the truncated stick-breaking
prior for estimating the |
alpha |
numeric. A hyperparameter for the Dirichlet distribution when
estimating the |
ngibbs |
numeric. The total number of iterations of the MCMC chain. |
nmaxclust |
numeric. A single number indicating the maximum number of clusters to test. |
nburn |
numeric. The length of the burn-in phase. |
ndata.types |
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 |
The LDA model analyzes all animal IDs pooled together, thereby providing population-level estimates of behavioral states.
A list of model results is returned where elements include the
phi
matrix for each data stream, theta
matrix, log likelihood
estimates for each iteration of the MCMC chain loglikel
, and
matrices of the latent cluster estimates for each data stream z.agg
.
#load data data(tracks.seg) #select only id, tseg, SL, and TA columns tracks.seg2<- tracks.seg[,c("id","tseg","SL","TA")] #summarize data by track segment obs<- summarize_tsegs(dat = tracks.seg2, nbins = c(5,8)) #cluster data with LDA res<- cluster_segments(dat = obs, gamma1 = 0.1, alpha = 0.1, ngibbs = 1000, nburn = 500, nmaxclust = 7, ndata.types = 2)