 This talk is about using the personalized package to individualize or personalize treatment decisions. Now, many interventions, treatments or policies have heterogeneous effects across the population, wherein patients with different characteristics, you know, either benefit from the treatment or patients with different yet characteristics are either, you know, maybe potentially harmed by the treatment or have no benefit. In these cases, we should leverage treatment effect heterogeneity to try to match each patient with the right treatment or intervention. And so the personalized package is designed to be a data driven approach for understanding what factors impact the effect of a treatment and further you know what patients benefit from the treatment based off of those factors. There's a lot of challenges in doing so. Often data are observational so there's selection bias. If there are a lot of covariates which might modify the impact of a treatment you might run into issues of multiplicity and further understanding heterogeneity of treatment effect involves estimating interactions of variables with a treatment. And so it's really important to make best use of the data. Furthermore, in understanding or leveraging treatment effect heterogeneity. We're often going to go about this by estimating decision rules which input patient characteristics and output a treatment decision. And in order to make sure that these treatment rules work we need to validate them very carefully. So we want to carefully test whether or not the estimated subgroups really do have enhanced treatment effects. The personalized package has a lot of built in functionality for doing so. So here we're going to let this treatment indicator take the value one for patients who are treated in negative one for patients who are not. The treatment can have multiple levels but we're going to keep it simple here. X is going to be a length P vector of pre treatment variables which contains all confounders and the potential treatment effect modifiers of interest. So these treatment effect modifiers and effect modifiers don't need to completely overlap, but just for simplicity will assume they do. Here we're going to have why is our observed observed outcome, where we view larger values as being better. Now in understanding who benefits from a treatment, when there's treatment effect heterogeneity it's important to distinguish between prognostic and prescriptive variables. These are the ones that only impact or that impact the outcome but may not interact with the treatment. It's not needed. You know if you want to identify the prognostic factors it's not needed to include the treatment in a model. They're inherently not of interest when we're are interested in understanding heterogeneity of effect. So heterogeneity of effect is completely driven by so called prescriptive variables or ones that interact with the treatment. So prescriptive variables may impact who or what kind of patients benefit from a treatment to the ones that interact with it. So here we can see that X two and X three are prescriptive variables because they interact with the treatment. X one is prognostic but not prescriptive because it does not interact and X three is prognostic in addition to being prescriptive so variables can take multiple roles. So we're interested in identifying these prescriptive variables. Okay, so we're going to generalize this a bit. Let's say we're interested in in the conditional mean of the response. So the conditional mean of the response given the treatment and covariates can always be written as some function of X five X, plus the treatment times some delta of X divided by a constant. Delta of X are main effects. And so this would contain this would be this would kind of correspond to prognostic variables, and this delta of X under certain causal assumptions can be interpreted as a conditional average treatment effect. So this delta of X is really what guides who benefits from the treatment. As you can see down here this delta of X is actually equal to the conditional mean of people who are treated at a certain level of covariates minus the conditional mean of people who are not treated given that same value. Our goal is to estimate or construct some sort of scoring function that indicates to us how much someone with a given level of covariates is expected to benefit from a treatment. And in doing so it's going to need to align somehow with this conditional average treatment effect. So this F is going to be designed to rank patients according to the magnitude of their conditional average treatment effects. We want larger values of this F scoring function to indicate larger values of that conditional treatment effect. We also want positive values of F to indicate positive values of the conditional average treatment effect. Positive values for this conditional average treatment effect means that a treatment is beneficial on average for someone with values covariate values X. And so we want F to be able to indicate to us whether or not someone has positive benefit or is harmed. And so, if we have such an F, we would recommend the treatment for all patients with covariate values X such that this scoring function is positive. Okay, so the personalized package is really aiming at estimating these scoring functions. So here's an example data set the outcome here is a yes or no outcome. And just indicating that someone's income improved from one year to the next, the treatment is participation in a job training program. And there are several covariates available here. I'm just going to show how to set up the data for the personalized package. So here I'm going to indicate the names of all covariates which potentially modify the treatment effect. And then I'll construct a design matrix I'll pull out the outcome and the treatment assignment vector. And we'll go through this data set later, and we'll see how the personalized package can be used for that. The personalized package implements a general framework for treatment scoring under the approach or the framework of Chen, Tian, Tsai and you. This framework is is the one that we choose using the personalized package because it is quite general and encompasses a very large range of different methods for estimating individualized treatment rules or understanding the treatment effect that exists in the literature. So this framework is lost function based. And has two classes of estimators one class is a waiting class other classes and a learning class. Each of these classes can utilize a wide range of loss functions where different loss functions correspond to different methods that exist in the literature. The defining feature of this framework is that it directly estimates the scoring function F, which we talked about. And it does so in a way that does not require us to estimate the main effects in the outcome regression model, and by avoiding having to model main effects it can be a bit more robust. Then simply modeling and outcome regression. Okay, framework is the following I'll talk in a little bit of detail about the waiting framework and then I'll talk about the learning framework as well. It requires us to specify a propensity score, so the propensity scores is the probability of receiving the treatment given covariates. And the waiting loss function is the following. So it's a function of the scoring the scoring function F. So we can set up overall values in our data and apply this loss function M. So the last function here can be any number of different loss functions so you can use the squared error loss. The logistic loss for binary outcomes. You can use a so called outcome waiting logistic loss. And each loss is going to correspond to a different estimator. And then denominator what we're doing is we're just inverse waiting by the propensity score. The loss should generally align with the outcome type. So, so a continuous outcome. It's nice to pair with a squared error loss. There are a loss functions that are motivated for count outcomes, binary outcomes and time to event outcomes. For all the loss choices that are available. We have it listed out in our JSS paper that came out quite recently. So, this, the propensity score here controls for measured confounding. So that's its role. So if you have a randomized control trial you can just replace this with a constant half. And the optimizer of this of the population version of this loss function does have the property that larger values of the scoring function f indicate larger values of the conditional average treatment effect. And it is also properly centered at zero so positive values indicate a positive value for the conditional treatment effect. So some losses actually do estimate that conditional average treatment effect. You can see that the, the scoring function is often some monotone function of, of the conditional average treatment effect here. So in the case of the squared error loss, for example, two times the scoring function is just the conditional average treatment effect. The learning approaches very similar, but instead of waiting the treatment is centered by the density score. So in this package we often parameterize the scoring function as being linear, having some other simple form. And we often penalize the parametric terms in that in that form to help deal with high dimensionality. So now I'll go a bit into the basic usage of the personalized package. So step one is always in defining our propensity score model. We need to define a function in our which inputs are covariates in our treatment vector and outputs the estimated propensities. So, in the case of a logistic model for the propensity score that would look like the following. If you have a randomized controlled trial you can just define a function that returns a constant half. The second step is then to actually estimate that scoring function. And we do so with the fit dot subgroup function. So here are outcomes binary so I'm going to use the logistic loss. I'm going to apply a lasso penalty here to help select effect modifiers. And I'm passing this fit dot subgroup function, or the propensity function that we defined on the previous page. And then look at the out the estimated conditional average treatment effects with this treatment effects function. And the summary function gives us a lot of output here so in particular tells us what choices we made when we fit the scoring function. It tells us the functional form of recommending patients treatments so here. A function that says patients are recommended the treatment. If their scoring estimated scoring function is greater than this constant C that constant C is just zero. At the bottom if we use the lasso it tells us what variables were selected by the lasso as being effect modifiers. In this case we can see that those who are married benefited from this benefit from the job training program, and those who are Hispanic do not. We can get predictions of subgroup membership with the predict function. So if we want to see, you know, for a new set of patients, who is predicted to benefit from the treatment can just use this predict function and specify type equals treat dot subgroup and it'll tell us what patients have a positive scoring function, or we can just re score return the estimated scoring function for those patients as well. So we can also instead of just estimating getting predictions of the treatment scoring function, we can obtain estimates of the conditional average treatment effect with this treat dot effects function. All right, so that's what we can do with our estimated or the fit dot subgroup function and what we can, we can obtain predictions with it but what we also need to do is to validate that the estimated scoring function actually results in improved outcomes. And so that is the validation piece on that step three. So we want to know what would happen to patient outcomes, if an estimated scoring function we're actually used to assign patients treatments. This kept this question is counterfactual. So it's impacted by confounding. And we also use the data to estimate this treatment scoring function. So evaluating outcomes, you know conditional on on subgroups involves double dipping. And so it can provide a severely overly optimistic assessment of the impact of the scoring function on outcomes, especially with high dimensional data. And so the personalized package addresses both of these problems. So that's about what we mean by benefiting subgroups. So, let's say we have some estimated scoring function. That scoring function will recommend patients treatments. So recommend patients either to be treated or untreated. And patients will either receive in reality, the treatment or potentially not receive the treatment in reality. What we can look for is among patients who are recommended the treatment patients in this column. What are the average outcomes among those who are actually treated versus those who were not treated. And so if the treatment has a very large effect among the subgroup of patients who are actually recommended the treatment that would indicate to us that our scoring rule is actually effective. And obviously, you know among people who are recommended the control, are their outcomes similar or is the control clearly better than treatment in that subgroup. So inverse propensity score waiting as an approach to estimating these average outcomes helps solve problem one. And if we had new data. We could solve the double dipping problem or problem two. And so the personalized package does both of these things. So it does so by, you know, inverse propensity score waiting these estimated outcome averages. And then it uses data splitting methods to mimic the idea of having a new data set. So data are randomly split into training and testing portions scoring functions are estimating on the training portions, and then outcomes are evaluated within these estimated subgroups by treatment group on the testing data. So we can just simply the personalized packages set up to do this very easily. We just pass it are the returned model object from fit dot subgroup and pass that to this function called validate dot subgroup. Here I specify the number of replications of 10 but you should ideally set this to be a very large number. So this would be the number of training and testing splits. This is the training fraction so the fraction of the data that's used for training. Here is 80%, which means that 20% of the data is used for testing. It gives some output here. It gives us output corresponding to that table I showed in the previous page so this table here is displayed here. The recommended the treatment here we can see are in this column, and so patients who actually received the control have lower outcomes on average than patients who are recommended the treatment, which indicates among people who are recommended the treatment. This treatment seems to have improved outcomes. Conversely among people who are recommended the control. The treatment had a worse outcome. Essentially that conditional effect. This is a this first number here is a contrast of these, and then the second number is a contrast of these two. Overall we can look at the estimated improvement of outcomes if the treatment were used to, or the scoring function were used to assign treatments. And what this is telling us is that the outcome would be improved a little bit if we use this estimated F to assign people to this job training program. This is not the same results. This is that two by two table but in platform. I won't talk about about too much about efficiency augmentation, but the personalized package allows incorporation of main effect models to help improve efficiency without impacting bias. But again I won't talk about that. We can see it in the documentation of the package. We're going to kind of reiterate the workflow of the personalized package. The first step is is sort of pre processing or the design stage where we're constructing our propensity score model we're investigating our propensity score model. Or if we want to use efficiency augmentation we're constructing this augmentation function. The second step is actually estimating our scoring function and using it to estimate subgroups. There are also some plotting functions available to look at those subgroups. And the final step is in validating our estimated scoring function and understanding whether or not there really are enhanced treatment effects within the estimated subgroups. There's quite extensive documentation at this at the website for the package. And then there's a paper in the Journal of Statistical Software that came out recently, which goes into detail about the statistical methods underlying the personalized package, and in addition to the implementation. So yeah, so thank you for for listening.