Description Usage Arguments Value Examples
View source: R/segmentation_helper_functions.R
Identify the MCMC iteration that holds the MAP estimate. This will be used to
inform get_breakpts
as to which breakpoints should be retained
on which to assign track segments to the observations of each animal ID.
1 | get_MAP(dat, nburn)
|
dat |
A data frame where each row holds the log marginal likelihood values at each iteration of the MCMC chain. |
nburn |
numeric. The size of the burn-in phase after which the MAP estimate will be identified. |
A numeric vector of iterations at which the MAP estimate was found for each animal ID.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #load data
data(tracks.list)
#subset only first track
tracks.list<- tracks.list[1]
#only retain id and discretized step length (SL) and turning angle (TA) columns
tracks.list2<- purrr::map(tracks.list,
subset,
select = c(id, SL, TA))
set.seed(1)
# Define model params
alpha<- 1
ngibbs<- 1000
nbins<- c(5,8)
#future::plan(future::multisession) #run all MCMC chains in parallel
dat.res<- segment_behavior(data = tracks.list2, ngibbs = ngibbs, nbins = nbins,
alpha = alpha)
# Determine MAP iteration for selecting breakpoints and store breakpoints
MAP.est<- get_MAP(dat = dat.res$LML, nburn = ngibbs/2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.