I am trying to model growth of bird chicks over two seasons. The idea is to run the model on all data then to use post-hoc comparisons to contrast the growth rates between the two years. I am including a grouping variable (nestID) at the individual level because there are multiple samples from each individual. I have managed to get the model to converge but I am unsure if I have the formula structured correctly to answer the above question.
I interpret the Gompertz function as follows
y(t) = A * exp(-B * exp(-C * t))
where:
y(t) represents the value of the curve at time t (note: time is morphometric data in this case i.e. length of head and culmen which grows at a consistent rate)
A is the assymptote
B is a constant that determines displacement on the x axis (intercept)
C is a constant that determines the rate of change of the curve (growth rate)
y in this case is the weight of the chick
My two concerns here are:
- Do my linear formulas that are used to estimate each of the Gompertz function’s parameters accurately represent the question I am asking and the structure of the data? Particularly, does the grouping term (1|nestID) make sense for just the linear formula pertaining to the intercept parameter (B) or should it be calculated for all parameters? Similarly, do I need to include the categorical variable for year in just the parameter of interest (C, growth rate) or should it too be included in all linear predictors for the Gompertz function’s parameters?
So for the linear predictors, replace my current code with something like:
A ~ year + (1|nestID),
B ~ year + (1|nestID) ,
C ~ year + (1|nestID)
- My ultimate goal is to contrast the change in growth rate between years. Does the linear model convention work the same for non-linear models in BRMS?
E.g. something like hypothesis(model, “year2022 > year2021”)?
library(brms)
# Formula
form <- bf(finalBrdWt ~ A * exp( B * exp( C * head.culmen ) ),
A ~ 1 ,
B ~ 1 + (1 | nestID),
C ~ year ,
nl = TRUE)
# Priors
priors <- c(
prior(normal(0.5, 2), nlpar = "A", lb=0.1),
prior(normal(-5.6, 0.5), nlpar = "B", lb=-7, ub=-5.5),
prior(normal(-2, 1), nlpar = "C", ub=0),
prior(normal(0, 1), class = "sigma"))
brm.headcul<- brm(
formula = form,
data = wts,
prior = priors,
seed = 9987,
family = lognormal(link = "identity", link_sigma = "identity"),
chains = 3,
#warmup = 100,
cores = 3,
iter = 3000,
sample_prior = "yes")