The following is a minimal example of a simple model fit.
# Load libraries
library(RColorBrewer)
library(ggplot2)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(reshape2)
library(latex2exp)
library(lddmm)
theme_set(theme_bw(base_size = 14))
<- brewer.pal(9, "Set1") cols
# Load the data
data('data')
# Descriptive plots
plot_accuracy(data)
plot_RT(data)
# Run the model
<- NULL
hypers $s_sigma_mu <- hypers$s_sigma_b <- 0.1
hypers
# Change the number of iterations when running the model
# Here the number is small so that the code can run in less than 1 minute
<- 25
Niter <- 15
burnin <- 1
thin <- (Niter - burnin) / thin
samp_size
set.seed(123)
<- LDDMM(data = data,
fit hypers = hypers,
fix_boundary = FALSE,
Niter = Niter,
burnin = burnin,
thin = thin)
# Plot the results
plot_post_pars(data, fit, par = 'drift')
plot_post_pars(data, fit, par = 'boundary')
To extract relevant posterior draws or posterior summaries instead of simply plotting them, one can use the functions extract_post_mean
or extract_post_draws
. An auxiliary function that fixes the boundary parameters can be called with the option fix_boundary = TRUE
.