Could you just confirm that I am using splines in a correct way.
After adjusting for age, my model (below) lognormal part started to show unrealistic (not matching with explanatory data analysis) y variable values.
`brm(bf(y ~ age + sex + (1 | county), hu ~ age + sex + (1 | county)), data = dataforhospitalcaremodels, family = hurdle_lognormal(), cores = 3, chains = 3, control = list(adapt_delta = 0.99))`
Plotting showed that y-variable and age had non-linear relationship, varying between the counties. Using the binning of age variable also solved the problem, but statisticians would not look well on that approach. Thus, I read that I should use splines (mgcv package). I tried the following:
`brm(bf(y ~ s(age) + sex + (1 | county), hu ~ s(age) + sex + (1 | county)), data = dataforhospitalcaremodels, family = hurdle_lognormal(), cores = 3, chains = 3, control = list(adapt_delta = 0.99))`
And y-variable conditional means were matching explanatory data analysis. And now the age is adjusted between the counties?