 Hello, everyone. Thanks very much for coming to my tutorial video on Metapack, which is an R package that helps you run Bayesian meta regression and network meta regression. In this tutorial, I will give you a brief overview of the models that Metapack covers, introduce you to two datasets included in Metapack, and walk you through the modeling options available and how to use Metapack to fit the models. Before we dive into it, here is my GitHub link down here, github.com. If you'd like to take a look at the implementation or open an issue, I very much appreciate that. If you'd like to directly contact me about Metapack, my email address is my first name, dot last name at uconn.edu. What is Metapack? R already has a large supply of meta analysis packages, notably meta, R meta, MV meta, Bayes meta, MetaStan, MetaTest, etc. However, even with all these R packages, meta analysis is still regarded as a niche field that interests a narrow group of researchers. And most importantly, I would say a discouraging aspect of having so many R packages is that you have to comb through them to find the one that suits your needs, which is extremely cumbersome because the packages are all implemented differently and have different user interfaces, which brings me to the next point. The narrow interest that meta analysis garners is partially attributable to the lack of a unified user interface. What's interesting about Metapack is that even though the packages can find to a few models with varying modeling options, it's based on the idea that R packages should maximize the use of R formulas that our users are familiar with. To that end, Metapack uses the formula package with a capital F, and in later slides, I will showcase how to use it. It's not so different from the basic R formula interface. The main function is B meta analyze, whose first argument is an R formula. The following table lists some of the available functions and the two data sets included in the package. Aside from B meta analyze, all the other functions take the output from B meta analyze and perform some sort of output analysis. So remember to run B meta analyze first, save the output as a variable and pass that variable as the first argument of these functions, HPD, Model Comp, Print Summary, Plot Fitted. I will be explaining what's in these data sets in greater detail in a later section. So Metapack is a model-specific package. By that I mean there are specific models that Metapack has in mind and you cannot specify your own model outside of what's been implemented. So let me briefly and very broadly explain the models. There are largely two umbrella arm-based models, multivariate meta regression based on Yao et al 2015 paper and univariate network meta regression based on Li et al 2021 paper. Now I specifically say arm-based because a lot of the existing R packages are contrast-based. This distinction is less important for meta regression models where there's only two treatments in all trials but this becomes pertinent in network meta regression models because contrast-based models regress the differences between a treatment and a control or baseline treatment. So if there's no baseline treatment because not all trials have to have the same treatments in network meta regression then it's impossible to model contrast directly. So I emphasize that Metapack does not have such restrictions. Also we're planning to implement univariate meta regression and multivariate network meta regression in the future so stay tuned. Anyway, moving forward Metapack takes arm-level aggregate data and the related model becomes like this. I will not be describing the models in detail so if you'd like to pause the video and take a look at the model, please do so or if you'd like to read more about the models please read Yao et al 2015 and Li et al 2021 paper. Now let's take a look at the data format that Metapack requires because Metapack relies on the formula interface and internally constructs the necessary data structures. The initial data frame containing all relevant variables is required to be formatted as follows. Of course the variables don't have to be in this exact order outcome SD standard deviations design matrix one design matrix two trial treatment N but for the teeth treatment of the case trial the outcome variables they're corresponding standard deviations covariates for fixed effects and random effects treatment trial and treatment indicators should be separate columns. The bold-faced ones such as Y's or X's they just mean that if there are there's more than one response endpoint then each of them should be a column. For example, if age and sex are included in the fixed effects then in bold-faced XKT age should be one column and sex should be another and the data set should include trial and treatment indicators as well as the sample size of each arm of a given trial. I will now introduce you to the formula interface that Metapack uses. The general form is given as follows. The tilde in the middle is the most important divider left of which is collectively referred to as left-hand side. So this part is collectively left-hand side and the right side of which is collectively called the right-hand side. Both left-hand side and right-hand side have parts which are separated by vertical bars. So here there's a vertical, oh, sorry. Here there's a vertical bar, here another one, here another one. So there are two parts in the left-hand side and there are three parts in the right-hand side. So let's go through them separately. The first left-hand side Y1 plus Y2 represents the responses. So Y1 and Y2 we have two primary endpoints. And the corresponding standard deviations come in the second part of the left-hand side. The first right-hand side defines the fixed effect covariates, X1, X2. And we've implemented this NS function to incorporate the sample size information. This N variable contains the sample sizes. So don't forget to add NS function at the end of the first right-hand side. And the second right-hand side W1 plus W2 defines either the random effect covariates or the variance-related covariates, which I'll explain more later. And the last part of the right-hand side is the treatment and trial indicators. And optionally, if there is grouping variable that contains information about first line and second line therapy, then the grouping variable can be added at the end. So for the third part of the right-hand side, the order of these two variables or three if there's grouping is important. So it must come in this order, treatment, trial, and if there is grouping, grouping at the end. Let's move on to look at some modeling options available in Metapack. I'll explain multivariate meta-regression first, then univariate network meta-regression, and data sets last. Multivariate meta-regression means multivariate. So there's more than one endpoint as a response variable. And meta-regression means there's only, there's two treatments for all trials. Even though y's are vectors, multivariate meta-regression assumes that SKT matrices are partially observed and the covariances are missing. A boilerplate code template is as follows. We first define the formula y1 plus y2. These are the endpoints and the vertical bar that separates the two parts in the left-hand side, corresponding standard deviations till D, the important divider. And the first right-hand side is the fixed-effects covariates and the second is the random-effects covariates and the last is the treatment indicators and trial indicators. So once the formula is set up, that formula is passed to be meta-analysed as the first argument. Because we saved f as a string, it will be, we have to convert it to a formula by passing it to the formula function. And meta-analysed has three other important arguments, prior, control and MCMC, they're pretty self-explanatory. Prior is a list of hyperparameters. Control, this pertains to the tuning parameters of the MCMC algorithm. And there is additionally this model parameter which I will be explaining soon. MCMC is how many burning iterations and how many thinning iterations and how many posterior samples at the end. For multivariate meta-regression and meta-pack, the modeling assumptions for a sigma KTR are a key factor. I'm not going to explain in detail. If you want to read more about this, please refer to Yaudel 2015 JASA paper. But pure are the model options. First, no recovery. This means that we're not going to attempt any covariance recovery. So the sigma KT is assumed to be a diagonal matrix. Then the second one is equicovariance. This means that a sigma KT can be a matrix, not a diagonal matrix. But it will be the same covariance matrix for all KTs. And the third one is equi-within treatment, which relaxes the homogeneity assumption in model two a bit and assumes that the covariance matrices can be different for different treatments. The fourth is equi-correlation, which tries to get the boost of both worlds. We know that variances are identifiable, but the covariance is might not be. So each sigma KT matrix is decomposed into a delta KT, which is the diagonal matrix of standard deviations, and rho, which is the correlation matrix. So rho doesn't have subscripts, so it's the same for all KT, but the identifiable standard deviations have KT as subscripts. The last one is hierarchical, which allows sigma KTs to be different for every KT, but by imposing this hierarchical structure, the sigma's borrow information from each other. The conditional mean of sigma KT is sigma, and the amount of borrowing is controlled by the hyperparameter nu-naught. And users can specify the model, this model and the control parameter. You go back, this control parameter has this model variable, so you can specify the model here. All right, in multivariate meta-aggression, the modeling effort was focused on how to recover the missing covariances and what assumptions to make to do exactly that. In univariate network meta-aggression, Metapack focuses on modeling between trial variances of the random effects. So I would encourage you to pause your video and read this slide. We'd like to relax both of the assumptions in the previous slide, but the problem is in evidence synthesis, it's not rare to encounter treatments that are involved in very few trials, or even only one trial. So that's a limitation that we want to overcome. And Lee et al. 2018 paper developed a new strategy of grouping variances of random effects. So we first set up a group of treatments based on their clinical mechanisms of action, and then we pass that to the variance modeling option and be meta-analyzed. And then we try a lot of different sets of grouping and use Bayesian comparison criteria to select the best set of groups. This approach is especially useful when some treatment arms are involved in only a single trial. So there are three modeling options for network meta-aggression, but I would like to mention that unlike multivariate meta-aggression, these modeling options are not specified by a single input parameter, like model equals something, a string. The first modeling option is no variance modeling. So there are no covariate information is available for the variances to achieve this, simply omit the second part of the right-hand side. The second and the third options are about the random effects. Random effects by default follow a multivariate t-distribution, but you can assume multivariate normal distribution by setting this Df in prior and set it to infinity. Also, you can directly specify the degrees of fit-in for the t-distribution for the random effects, but if you'd like to pursue a more data-driven route, you can also set the sample underscore Df variable in the control parameter as true. Usually this is by default false, but if you set this to true, then this Df variable in prior will be ignored and the MCMC algorithm will start sampling new. And this is the prior distribution assumed. Before I show you the code examples to use B meta-analyze, I would like to go over the two data sets briefly. Cholesterol data set consists of 26 Merck sponsor double-blind randomized active or placebo-controlled clinical trials on patients with primary hypercholesterolemia. This contains two treatments. The treatments are statin or statin plus azinomib and the three primary endpoints are PLDLC, PHDLC, PTG and the corresponding standard deviations are SDLDL, SDHDL, and SDTG. And the other variables are for our extra attributes of the patients. Likewise, the TNM data set, which stands for tri-glycerides network metadata has 11 treatments total. So placebo, simvastatin, atorvastatin, lovastatin, rosupastatin, these are the treatments and these are 11, including the placebo. And the primary endpoint was PTG, percent change from baseline and triglycerides. SDTG is the corresponding standard deviation and BLDC, PHDLC, PTG are the baselines of LDL, CHDLC, and triglycerides. And the rest are extra attributes of the patients that can be included in the fixed effects covariates. So this is an example code for multivariate meta regression. I'm not going to actually run it because it typically takes quite a bit of time to get the output, but the gist is to correctly specify or model as a formula. So we've seen this before. The first part is the endpoints, the second standard deviations. The first part of the right-hand side is the fixed effects and at the end, don't forget to add this NS and then treat as the random effects. Also there is this one, so the intercept and the last is treatment indicators, trial indicators and on-status the grouping variable. And past that F as the first argument of B meta analyzed, prior has this model, no recovery, but you can change this to whatever model of sigma kT as you see fit for your data. And MCMC and discard and skip and keep control. There's two variables, scale X verbose, scale equals true means B meta analyzed will automatically standardize all the fixed effects covariates. One advantage of setting this to true instead of standardizing your variables outside B meta analyzed is that if you set this to true and then get the output and B meta and then pass this output to some other functions like HPD or summarized or summary or print, then the summary printed or the output analysis will be done using the original units. So B meta analyzed will remember to put them to back to their original units before performing output analysis. And then verbose is by default set to false but if you set this to true you can see the progress bar while the MCMC algorithm is running. And the same way we specified the formula for multivariate meta regression in univariate network meta regression, we do the same but instead we have one primary endpoint and one standard deviation variable but the rest is the same. The right hand side, the first is the fixed effects and at the end it has the NS function to provide the sample size information. The second one is not the random effects it's the variance structure modeling. So the variances of the treatments and the random effects will have these covariates is a log linear model of these covariates scaled BLDLC, scaled BTG and the group which is whether the treatment is placebo or robusted in or other. So it's three different indicator variables. And then the last part of the right hand side is the treatment indicators and the trial indicators. And the rest is the same. So that is the end of my tutorial. These are the references. The network meta regression model is based on this paper the Bayesian inference for network meta regression using multivariate random effects as well as this paper. Bayesian network meta regression hierarchical models using heavy-tailed multivariate random effects with covariate dependent variances. So if you'd like to read more about that please check that paper out. And for the multivariate meta regression model it's based on this paper. Bayesian inference for multivariate meta regression with partially observed within study sample covariance matrix. So if you'd like to read more about that please check this paper out as well. So that's it for the tutorial. If you have any questions or feedback or additional features you'd like to see implemented in MetaPak please don't hesitate to shoot me an email at dayon.lim at uconn.edu. I may not be able to respond right away but I promise I will within a reasonable amount of time. So yeah, all right, thanks for listening and I hope you have a great rest of your day.