Closed torkar closed 3 years ago
Hi Richard,
we applied this in https://www.nature.com/articles/s41559-019-0908-0, the code is available with the paper as an example.
It should definitely be possible to run this with brms as well.
I have slightly extended the help in a recent push to the development branch of BT, maybe this further clarifies the issues.
Feel free to post your brms example here, this could also be useful for other brms users.
Best, Florian
Dear Florian,
I am planning to use Bayesian Tools package in R to calibrate a model for my PhD research project. I have read useful and applicable examples you have prepared in the below website: https://cran.r-project.org/web/packages/BayesianTools/vignettes/BayesianTools.html
I follow the instructions in Bayesian Tools package in my codes but have some problems:
Kind regards, Nastaran
`My_Data=read.csv('example.csv')
library(Metrics) library(ie2misc) library(BayesianTools)
likelihood1 <- function(param){ pred = param[1]+param[2](My_Data$A/((My_Data$C-My_Data$T)(1+(My_Data$V/(param[3])))))
singlelikelihoods = dnorm(My_Data$G, mean = pred, sd = 1/(param[4]^2), log = T) return(sum(singlelikelihoods)) } setUp1 <- createBayesianSetup(likelihood1, lower = c(-10,-10,-5,0.01), upper = c(20,20,10,30)) settings = list(nrChains = 4,iterations = 15000, message = FALSE) out1 <- runMCMC(bayesianSetup = setUp1, sampler = "Metropolis", settings = settings) #sampler: SMC,Metropolis,DEzs,DREAM,Twalk M1 = marginalLikelihood(out1) M1 print(out1) plot(out1) summary(out1) correlationPlot(out1) marginalPlot(out1, prior = TRUE) marginalLikelihood(out1) DIC(out1) Matrix_out1=getSample(out1, start = 100, end = NULL, thin = 5, whichParameters = 1:4) MAP(out1)`
Hi Nastaran-ch,
this doesn't seem to fit here, I will open a separate issue.
Florian, do you have an example somewhere on how to use
calibrationTest()
(in particular if one can use it withbrms
)?