Model description
The longitudinal meta-analysis model estimates how the treatment effect evolves over time across studies. Studies contribute multiple time-point observations; a parametric trajectory describes the population-level effect at each time, with study-level random intercepts capturing between-study heterogeneity.
This vignette documents the linear trajectory implementation. See Longitudinal meta-analysis for the statistical rationale and alternative trajectory forms.
Mathematical specification
Likelihood:
Trajectory:
Priors:
Stan code (linear trajectory)
data {
int<lower=1> N;
int<lower=1> K;
vector[N] y;
vector<lower=0>[N] se;
vector[N] time;
array[N] int<lower=1> study;
}
parameters {
real mu0;
real mu1;
real<lower=0> tau_u;
real<lower=0> tau_v;
vector[K] z_u;
vector[N] z_v;
}
transformed parameters {
vector[K] u = tau_u * z_u;
vector[N] v = tau_v * z_v;
}
model {
target += normal_lpdf(mu0 | 0, 1);
target += normal_lpdf(mu1 | 0, 0.5);
target += cauchy_lpdf(tau_u | 0, 0.5);
target += cauchy_lpdf(tau_v | 0, 0.5);
target += std_normal_lpdf(z_u);
target += std_normal_lpdf(z_v);
target += normal_lpdf(y | (mu0 + u[study]) + mu1 * time + v, se);
}
generated quantities {
real b_Intercept = mu0;
real b_time = mu1;
}How bayesma calls this model
bayesma(
data,
model_type = "random_effect",
time_col = "weeks",
trajectory = "linear"
)The time vector in the Stan data is constructed from data[[time_col]], centred at the median observation time for interpretability.
Parameterisation notes
- is a study-level random intercept (deviation from at ).
- is a study-by-time residual capturing deviations from the linear trajectory within studies.
- For the exponential decay trajectory, an additional parameter is required with a prior.
-
b_timereports the posterior for the rate of change per unit of the centred time variable.
Known sampling difficulties
The residual term can be weakly identified when each study contributes only one or two time-points. In this case, fix (drop the term) to improve mixing. The model then reduces to a random-intercept longitudinal meta-analysis.
