A question about bayesian credible interval of an interaction fit in brms

plot cno. id canopy leaf_age date area cage
43 RB122-2 RB122 ho old may 67.71 three
19 RB45-2 RB45 ho old may 66.18 three
19 RB45-1 RB45 ho old may 74.53 three
19 E58-1 E58 ho old may 50.05 two
19 E58-1 E58 ho old may 65.81 two
20 E42-2 E42 ho old may 66.22 two
44 D399-2 D399 ho old may 66.11 three
20 E42-1 E42 ho old may 75.73 two
20 D350-2 D350 ho old may 51.36 three
44 D399-1 D399 ho old may 63.35 three
20 RB44-1 RB44 ho old may 49.32 three
20 D350-1 D350 ho old may 44.67 three
20 RB44-2 RB44 ho old may 43.96 three
43 G677-1 G677 ho old may 50.12 three
43 G677-2 G677 ho old may 55.51 three
33 E241-1 E241 bu old may 62.52 two
33 E241-2 E241 bu old may 48.57 two
43 RB122-1 RB122 ho old may 46.65 three
19 G449-2-o G449 ho old oct 126.84 three
19 G445-1-o G445 ho old oct 137.13 three
32 RB109_1 RB109 bu old aug 43.19 two
20 D367-2-o D367 ho old oct 99.05 three
34 G758-1-o G758 bu old oct 59.82 three
43 E207-2 E207 ho old may 59.92 two
34 G777-1 G777 bu old may 34.17 three
19 G460-2-o G460 ho old oct 81.86 three
34 G758-2-o G758 bu old oct 53.62 three
19 G457_1 G457 ho old aug 82.60 three
43 E207-1 E207 ho old may 53.33 two
19 RB45-1-o RB45 ho old oct 109.71 two
19 RB52_1 RB52 ho old aug 67.39 two
19 G449-1-o G449 ho old oct 114.96 three
43 RB22-1-o RB22 ho old oct 74.42 two
19 G460-1-o G460 ho old oct 100.64 three
34 G777-2 G777 bu old may 42.58 three
19 G445-2-o G445 ho old oct 111.50 three
33 RB113-2 RB113 bu old may 54.02 three
34 711_1 711 bu old aug 67.09 three
19 760_1 760 ho old aug 76.67 three
33 E247-1 E247 bu old may 26.74 two
33 E237-2 E237 bu old may 61.20 two
33 E885-2 E885 bu old may 28.82 three
34 711_2 711 bu old aug 67.07 three
19 760_2 760 ho old aug 83.98 three
20 D350-2-o D350-2 ho old oct 52.69 three
43 RB22-2-o RB22 ho old oct 78.49 two
19 G460_1 G460 ho old aug 76.92 three
19 RB45-2-o RB45 ho old oct 87.26 two
43 677_2 677 ho old aug 35.29 three
33 E885-1 E885 bu old may 31.45 three
43 677_1 677 ho old aug 49.66 three
33 E237-1 E237 bu old may 51.19 two
34 G772-1-o G772 bu old oct 49.23 three
19 G460-2-n G460 ho new oct 42.01 three
34 G773-1 G773 bu old may 39.63 three
34 G777-2-o G777-2 bu old oct 57.86 three
19 G460_2 G460 ho old aug 79.01 three
20 D367-1-n D367 ho new oct 97.50 three
20 D367-1-o D367 ho old oct 73.40 three
19 RB52_2 RB52 ho old aug 68.07 two
33 E247-2 E247 bu old may 35.17 two
20 D362-1-o D362 ho old oct 62.49 three
34 G774_1 G774 bu old aug 56.49 three
33 RB113-1 RB113 bu old may 43.27 three
20 RB43-2-o RB43 ho old oct 56.73 two
19 G457_2 G457 ho old aug 71.22 three
34 G773-2 G773 bu old may 32.55 three
32 RB109-1-o RB109 bu old oct 48.13 two
20 D350-2-n D350-2 ho new oct 59.70 three
19 G445-1-n G445 ho new oct 119.05 three
34 G777-1-o G777-1 bu old oct 48.51 three
19 G449-2-n G449 ho new oct 88.12 three
20 RB43-1-o RB43 ho old oct 58.36 two
43 RB123_2 RB123 ho old aug 62.74 two
33 886_1 886 bu old aug 44.47 three
43 RB124_1 RB124 ho old aug 54.47 two
33 G794_1 G794 bu old aug 66.57 three
19 G460-1-n G460 ho new oct 47.99 three
34 G774_2 G774 bu old aug 56.12 three
20 D367-2-n D367 ho new oct 84.80 three
43 G701_2 G701 ho old aug 64.30 three
43 RB124_2 RB124 ho old aug 64.55 two
20 RB43-2-n RB43 ho new oct 84.56 two
19 758_1 758 ho old aug 49.75 three
20 D350-1-n D350-1 ho new oct 58.38 three
32 RB109-2-o RB109 bu old oct 51.28 two
33 886_2 886 bu old aug 46.41 three
43 G701_1 G701 ho old aug 72.90 three
33 RB112-1 RB112 bu old may 17.74 three
10 RB60-1 RB60 bu old may 14.42 three
33 885-2-o 885 bu old oct 31.15 three
19 RB45-2-n RB45 ho new oct 77.90 two
33 RB112-2 RB112 bu old may 15.71 three
33 885-1-o 885 bu old oct 27.88 three
20 RB43-1-n RB43 ho new oct 96.43 two
34 G758-1-n G758 bu new oct 27.38 three
33 G795-1-o G795 bu old oct 23.66 three
19 758_2 758 ho old aug 36.91 three
19 G445-2-n G445 ho new oct 101.83 three
34 706_1 706 bu old aug 56.63 three
33 G794_2 G794 bu old aug 57.94 three
33 G795-2-o G795 bu old oct 22.48 three
33 G792-2-o G792 bu old oct 66.28 three
20 D362-2-n D362 ho new oct 70.47 three
20 D350-1-o D350-1 ho old oct 53.86 three
33 RB110_2 RB110 bu old aug 14.27 two
19 G449-1-n G449 ho new oct 54.05 three
19 RB45-1-n RB45 ho new oct 106.44 two
33 G792-1-o G792 bu old oct 54.77 three
20 D362-2-o D362 ho old oct 55.41 three
10 RB60-2 RB60 bu old may 16.34 three
43 RB22-1-n RB22 ho new oct 86.71 two
19 760_2 760 ho new aug 112.07 three
19 G460_2 G460 ho new aug 131.32 three
34 706_2 706 bu old aug 44.76 three
43 RB123_1 RB123 ho old aug 66.47 two
20 D362-1-n D362 ho new oct 60.21 three
33 G789_1 G789 bu old aug 30.01 three
43 RB22-2-n RB22 ho new oct 79.11 two
33 RB113_2 RB113 bu old aug 38.75 two
19 G460_1 G460 ho new aug 113.27 three
33 RB110_1 RB110 bu old aug 17.49 two
12 RB60-1-n RB60 bu new oct 11.75 two
34 G777-1-n G777-1 bu new oct 66.50 three
32 RB109_2 RB109 bu old aug 49.48 two
34 G777-2-n G777-2 bu new oct 55.00 three
33 G789_2 G789 bu old aug 35.44 three
12 RB62-2-o RB62 bu old oct 15.40 two
19 760_1 760 ho new aug 131.57 three
33 G795-1-n G795 bu new oct 14.40 three
33 885-2-n 885 bu new oct 29.45 three
19 G457_1 G457 ho new aug 122.19 three
43 RB124_1 RB124 ho new aug 20.51 two
12 RB60-1-o RB60 bu old oct 16.25 two
12 RB62-1-n RB62 bu new oct 30.20 two
43 RB124_2 RB124 ho new aug 40.52 two
33 RB113_1 RB113 bu old aug 42.69 two
33 G792-2-n G792 bu new oct 50.32 three
12 RB62-1-o RB62 bu old oct 15.85 two
34 G758-2-n G758 bu new oct 25.58 three
34 G772-2-n G772 bu new oct 33.48 three
33 G792-1-n G792 bu new oct 58.03 three
32 RB109-1-n RB109 bu new oct 32.66 two
34 G772-1-n G772 bu new oct 20.94 three
19 G457_2 G457 ho new aug 111.57 three
32 RB109-2-n RB109 bu new oct 28.16 two
12 RB60-2-o RB60 bu old oct 17.87 two
43 677_1 677 ho new aug 63.57 three
33 885-1-n 885 bu new oct 24.20 three
12 RB62-2-n RB62 bu new oct 23.00 two
43 677_2 677 ho new aug 63.58 three
33 G795-2-n G795 bu new oct 13.00 three
19 RB52_1 RB52 ho new aug 25.93 two
32 RB109_1 RB109 bu new aug 64.87 two
19 758_2 758 ho new aug 35.90 three
19 RB52_2 RB52 ho new aug 28.87 two
34 G774_2 G774 bu new aug 43.90 three
43 G701_2 G701 ho new aug 49.97 three
33 886_1 886 bu new aug 25.78 three
34 G774_1 G774 bu new aug 64.00 three
33 RB110_2 RB110 bu new aug 27.45 two
19 758_1 758 ho new aug 41.25 three
12 RB60-2-n RB60 bu new oct 10.59 two
33 RB110_1 RB110 bu new aug 30.39 two
34 711_2 711 bu new aug 42.04 three
43 G701_1 G701 ho new aug 56.88 three
32 RB109_2 RB109 bu new aug 62.28 two
43 RB123_2 RB123 ho new aug 68.30 two
33 RB113_1 RB113 bu new aug 75.86 two
34 706_2 706 bu new aug 29.05 three
33 G794_1 G794 bu new aug 54.92 three
33 RB113_2 RB113 bu new aug 80.24 two
34 706_1 706 bu new aug 33.34 three
33 G789_1 G789 bu new aug 31.78 three
33 886_2 886 bu new aug 27.30 three
43 RB123_1 RB123 ho new aug 70.25 two
33 G794_2 G794 bu new aug 57.50 three
34 711_1 711 bu new aug 38.25 three
34 G772-2-o G772 bu old oct 57.86 three
33 G789_2 G789 bu new aug 34.07 three

I fitted a mode like this:

fit_area_august<-brm(formula=area~canopy*leaf_age+(canopy+leaf_age|id),
family = gaussian(link=“identity”),
data=data_shape_august,
seed=1,
prior=c(set_prior("",class=“Intercept”),
set_prior("",class=“sigma”)),
chains=4,
iter=50000,
warmup=20000,
thin=1,
control = list(adapt_delta=0.99,max_treedepth = 15,stepsize=0.001))

then results in figure like this:

figure code:
fit<-conditional_effects(fit_october_area,effect=“leaf_age:canopy”,re_formula = NULL)
est_area_october ← as.data.frame(fit[[1]])
fig_october_area<-ggplot(data=data_shape_october,mapping=aes(x = leaf_age, y = area))+scale_color_grey(start=0, end=0.5)+scale_fill_grey()+ theme_bw()+
geom_jitter(aes(color = canopy), shape=79,alpha = 0.6,size=4,
position = position_jitterdodge(jitter.width = 0.05,jitter.height = 0),
show.legend = FALSE) +geom_pointrange(data=est_area_october,mapping=aes(x=leaf_age,y=estimate__, ymin = lower__, ymax = upper__,
color = canopy),size=1,position = position_dodge(width = 0.75))+
labs(color=“Canopy species”)+
theme(legend.position="",
legend.text=element_text(size=20,family=“serif”,colour = “black”),
legend.title=element_text(size=20,family=“serif”,colour = “black”),
plot.title = element_text(size = 20,family=“serif”,colour = “black”),
text=element_text(size=20,family=“serif”,colour = “black”),
axis.text = element_text(size = 20, family=“serif”,colour = “black”),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
strip.background = element_rect(fill = “lightblue”),
strip.text = element_text(size = 20))+
coord_cartesian(ylim = c(0, 150))+
labs(x=“Leaf age”,y=expression(“Leaf area (”~cm^2~")"),title="")

My quesions:

  1. Why 95% credible interval outside the observed values, was my model wrong?

  2. In my understanding, the random term (canopy+leaf_age|id) means the random effect id is affected by canopy and leaf_age, and the effects showed in my figure when I uesd re_formula = NULL in conditional_effects(), Is my understanding correct?

Thank you very much!

help me ~

First thing would be to plot your raw data. Can you drop a plot of that in here?

Second,
The thing that stands out to me is that your iters, warmup, and adapt delta are way to high. I would run the model with 2000 iters and whatever the default warmup is (500?). Same with adapt_delta, max_treedepth, and stepsize. If you get errors with those as the default that tells you something is likely wrong with your data or model.

leaf area data.csv (7.0 KB)

This is my row data, do you have other better models for my data? I want to compare the area under two canopy species (bu and ho)

and I think you are quite right, I will test the model in a low setting.

1 Like

Oh and you don’t need to set the seed value in them model right now either.

I see, thank you!