top of page

Bayesian Model of Subjective Pain Experience

Dan Acosta-Kane developed the models used in Hoskin et al. (2019) Cognition paper. He has now revised them to make them more accessible.


To Run the code:

devtools::install_github("dan-ak/bayesian-pain")

library(BayesianPain)


data_loc <- system.file("extdata", "exp_1_data.csv", package="BayesianPain")

exp_data <- BayesianPain::center_scale(data.frame(read.csv( data_loc , header = TRUE)))

stan_data <- BayesianPain::create_stan_data(exp_data)

models <- BayesianPain::get_models(c(1,3,4,5,6))

output <- BayesianPain::fit_models(models, stan_data, iter=700, chains = 4)


output['DICs']

BayesianPain::get_parameters(output['fits'])


The code is available to download from here.

Comments


Commenting has been turned off.
bottom of page