Description Usage Arguments Value Examples
View source: R/segmentation_helper_functions.R
Visualize trace-plots of the number of breakpoints estimated by the model as well as the log marginal likelihood (LML) for each animal ID.
1 |
data |
A list of model results that is returned as output from |
type |
character. The type of data that are being plotted from the Bayesian segmentation model results. Takes either 'nbrks' for the number of breakpoints or 'LML' for the log marginal likelihood. |
Trace-plots for the number of breakpoints or the log marginal likelihood are displayed for each of the animal IDs that were analyzed by the segmentation model.
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 27 | #load data
data(tracks.list)
#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, workers = 3) #run all MCMC chains in parallel
dat.res<- segment_behavior(data = tracks.list2, ngibbs = ngibbs, nbins = nbins,
alpha = alpha)
future::plan(future::sequential) #return to single core
#run function
traceplot(data = dat.res, type = "nbrks")
traceplot(data = dat.res, type = "LML")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.