Clinical Trial data - request help on variable number of comparisons per trial

I’m going to try your code tomorrow morning. In the code I’m only reading the first two arms, my next step is to read all three arms, e.g. trials=data[[“n1”,“n2”,“n3”]] and deal with the fact that in most cases n3 has Nans

By the way, in this sort of problem performance is nice, but not so important. I’m working on aggregate data reported mostly in academic journals. So I will always be using small datasets. The focus is to, knock on wood, being correct in the analysis. I don’t think the source I’m trying to replicate is the last word, but is provided by regulators in the UK, so I would like to be able to do what they did before suggesting any changes.

Also, in this problem we are mostly interested in the differences between treatments. In the model the differences are a fixed effect. Each trial has it’s own mean to try to pick differences between clinical trials or studies (trials). In each individual study or trail, the patients are randomized, so they should have similar characteristics. However, when you compare study 1 with study 2, they would have had different rules for randomization and drawn from a pool of patients that are different. Hopefully, not too different.