Hi there - I’m new to Bayesian modelling and am using the Richard McElreath rethinking package in R.
My datadf.csv (222.2 KB) is attached (hopefully!) and code below. I’ve got the model to run fine, but I have very low effective sample sizes on the coefficients I’m most interested in - an interaction effect of time (pre/post) and treatment (TMS area).
Any suggestions how I can get this to converge or do I just not have enough data to model the interaction effect?
# Set up model 1: amplitude depends on wing type, plus interaction between session and TMS area - all fixed effects
# List of data
dat <- list(A = df$ampl, tid = df$TMS_id, wid = df$wing_id, sid = df$session_id)
flist <- alist (A ~ dnorm(mu, sigma),
# amplitude is expected to be normally distributed
mu <- a[wid] + b[tid]*c[sid],
# the mean depends on wing type, plus interaction of session and TMS area
a[wid] ~ dnorm(0,1),
b[tid] ~ dnorm(0,1),
c[sid] ~ dnorm(0,1),
# these are all fixed effects, with weak priors
sigma ~ dexp(1)
# weak prior for standard deviation of amplitude distribution
)
# fit model: (saved under m1.Rds)
m1 <- ulam(flist, data = dat, chains = 4, cores = 2, iter = 10000, file = "m1")
precis(m1, 2)