I am currently trying to perform a bayesian analysis using the following code, with the brms library:
library(brms)
mymodel <- brms::bf(tau ~ a + b*(gmm^c),
a ~ 1,
b ~ 1,
c ~ 1,
nl = TRUE)
myprior <- c(prior(uniform(10^-6, 3000), class = 'b', nlpar = 'a', lb = 10^-6, ub = 3000),
prior(uniform(10^-6, 1000), class = 'b', nlpar = 'b', lb = 10^-6, ub = 1000),
prior(uniform(10^-6, 1), class = 'b', nlpar = 'c', lb = 10^-6, ub = 1))
myprior$prior
myfit <- brm(formula = mymodel,
data = dat,
family = brmsfamily('Gamma'),
prior = myprior,
control = list(adapt_delta = 0.95),
iter = 10000,
warmup = 5000,
thin = 5,
chains = 1,
cores = 6,
refresh = 0)
The dat dataframe has four columns, and multiple lines:
> print(dat, n=45)
# A tibble: 14,456 × 4
fase ts gmm tau
<fct> <fct> <dbl> <dbl>
1 1 30 0.00316 19.3
2 1 30 0.0153 45.0
3 1 30 0.0336 55.9
4 1 30 0.0654 60.5
5 1 30 0.124 61.7
6 1 30 0.234 62.4
7 1 30 0.440 64.0
8 1 30 0.828 65.2
9 1 30 1.56 67.3
10 1 30 2.93 71.6
11 1 30 5.51 78.7
12 1 30 10.4 84.6
13 1 30 19.5 91.1
14 1 30 36.8 99.7
15 1 30 69.2 113.
16 1 30 0.00558 13.8
17 1 30 0.0172 26.4
18 1 30 0.0342 31.5
19 1 30 0.0657 34.3
20 1 30 0.124 34.9
21 1 30 0.234 35.7
22 1 30 0.440 36.7
23 1 30 0.828 38.4
24 1 30 1.56 41.4
25 1 30 2.93 44.0
26 1 30 5.51 49.1
27 1 30 10.4 53.3
28 1 30 19.5 58.2
29 1 30 36.8 65.3
30 1 30 69.2 77.8
31 1 30 0.000369 24.4
32 1 30 0.00252 91.4
33 1 30 0.0194 175.
34 1 30 0.0599 229
35 1 30 0.124 240.
36 1 30 0.232 244.
37 1 30 0.439 254.
38 1 30 0.829 256.
39 1 30 1.56 258.
40 1 30 2.93 273.
41 1 30 5.52 289.
42 1 30 10.4 311.
43 1 30 19.5 333.
44 1 30 36.8 346.
45 1 30 69.2 349.
When running the code, I get the following error:
[1] "Error : Initialization failed."
[1] "error occurred during calling the sampler; sampling not done"
Does anyone know what could be causing this? Thanks in advance!