An Introduction to Principal Surrogate Evaluation with the pseval Package

We describe a new package called pseval that implements the core methods for the evaluation of principal surrogates in a single clinical trial. It provides a flexible interface for defining models for the risk given treatment and the surrogate, the models for integration over the missing counterfactual surrogate responses, and the estimation methods. Estimated maximum likelihood and pseudo-score can be used for estimation, and the bootstrap for inference. A variety of post-estimation methods are provided, including print, summary, plot, and testing. We summarize the main statistical methods that are implemented in the package and illustrate its use from the perspective of a novice R user.


Introduction
A valid principal surrogate endpoint, also called a specific nonmechanistic correlate of protection (Plotkin and Gilbert, 2012), can be used as a target for treatment improvement in early phase trials and, in the specific setting of evaluation, for predicting individual treatment effects post-licensure.A surrogate is considered to be valid if it provides reliable predictions of treatment effects on the clinical endpoint of interest.Frangakis and Rubin (2002) introduced the concept of principal stratification and the definition of a principal surrogate (PS).Informally, a post-treatment intermediate response variable is a principal surrogate if causal effects of the treatment on the clinical outcome only exist when causal effects of the treatment on the intermediate variable exist.The criteria for a PS have been modified and extended in more recent works, with most current literature focusing on wide effect modification as the primary criterion of interest.
The goal of PS evaluation is estimation and testing of how treatment efficacy on the clinical outcome of interest varies over subgroups defined by possible treatment and surrogate combinations of interest; this is an effect modification objective.The combinations of interest are called the principal strata and they include a set of unobservable counterfactual responses: responses that would have occurred under a set of conditions counter to the observed conditions.To finesse this problem of unobservable responses, a variety of clever trial designs and estimation approaches have been proposed.Several of these have been implemented in the pseval package (Sachs and Gabriel, 2016).

Methods Notation
Let Z i be the treatment indicator for subject i, where 0 indicates the control or standard treatment, and 1 indicates the experimental treatment.We currently only allow for two levels of treatment and assume that the treatment assignments are randomized.Let S i be the observed value of the intermediate response for subject i.Since S i can be affected by treatment, there are two naturally occurring counterfactual values of S i : S i (1) under treatment, and S i (0) under control.Let s z be the realization of the random variable S(z), for z ∈ {0, 1}.The outcome of interest is denoted Y i .We consider the counterfactual values of Y i (0) and Y i (1).We allow for continous, binary, count, and time-to-event outcomes, thus Y i may be a vector containing a time variable and an event/censoring indicator, i.e.Y i = (T i , ∆ i ) where ∆ i = 1 if T i is an event time, and ∆ i = 0 if T i is a censoring time.In event driven settings, S i (z) is only defined if the event, Y i (z), does not occur before the potential surrogate S i (z) is measured at a fixed time τ after entry into the study.The data analyses only include participants who have not experienced the event outcome by time τ.

Estimands
Criteria for S to be a good surrogate are based on risk estimands that condition on the potential intermediate responses.The risk is defined as a mapping g of the cumulative distribution function of Y(z) conditional on the intermediate responses.The joint risk estimands conditions on the candidate surrogate under both level of treatment, (S(1), S(0)).
Currently we focus only on marginal risk estimands which condition only on S(1), the intermediate response or biomarker under active treatment: Neither of the joint risk estimands are indentifiable in a standard randomized trial, as either S(0) or S(1) or both will be missing for each subject.In the special case where S(0) is constant, such as the immune response to HIV antigens or Hep B in the placebo arm of a vaccine trial, the joint and marginal risk estimands are equivalent.This special case is referred to as case constant biomarker (CB) in much of the literature (Gilbert and Hudgens, 2008); i.e., S i (0) = c for subjects i.This may occur outside the vaccine setting when one considers the AUC of a treament drug as a surrogate; those recieving placebo will have no drug and therefore all placebo AUC will be 0 or undefined.Under assumptions given below, and in the case CB setting, the marginal risk estimand is indentifiable in the treatment arm; it is not indentifiable in the control arm without further assumptions or trial agumentation (Wolfson and Gilbert, 2010).
There are specific trial augmentations that allow for the measurement or imputation of the missing counterfactual Ss, in the control and treament arms.As well, Under one of these augmentations case CB can sometimes be induced by considering a function of the a candidate surrogate for evaluation.Greater detail on this point given below.Specification of the distributions of Y(z)|S(1) determines the likelihood, we will denote this as f (y|β, s 1 , z).If S(1) were fully observed, simple maximum likelihood estimation could be used.The key challenge in estimating these risk estimands is solving the problem of conditioning on counterfactual values that are not observable for at least a subset of subjects in a randomized trial.This involves integrating out missing values based on some model, and under some set of assumptions and/or trial augmentations.Frangakis and Rubin (2002) gave a single criterion for a biomarker S to be a PS: causal effects of the treatment on the clinical outcome only exist when causal effects of the treatment on the intermediate variable exist.In general this can only be evaluated using the joint risk estimands, which consider not only the counterfactual values of the biomarker under treatment, but also under control S(0).However, in the special case where all S(0) values are constant, say at level C, such as an immune response to HIV in a HIV negative population pre-vaccination this criteria, often referred to as average causal necessity (ACN), can by written in terms of the marginal risk estimands as:

Prinicipal surrogate criteria
More recently, other works Gilbert and Hudgens (2008), Wolfson and Gilbert (2010), Huang and Gilbert (2011), Huang et al. (2013), Gabriel and Gilbert (2014), and Gabriel and Follmann (2016) have suggested that this criterion is both too restrictive and in some cases can be vacuously true.Instead most current works suggest that the wide effect modification (WEM) criterion is of primary importance, ACN being of secondary importance.WEM is given formally in terms of the risk estimands and a known contrast function h satisfying h(x, y) = 0 if and only if x = y by: • Ignorable Treatment Assignment: The observed treatment assignment does not change the counterfactual clinical outcome.
• Equal individual risk up to the time of candidate surrogate measurement τ.
In time-to-event settings one more assumption is needed: • Non-informative censoring.
It should be noted that the equal individual risk assumption requires that time-to-event analysis start at time τ, rather than at randomization.Wolfson and Gilbert (2010) outlines how these assumptions are needed for identification of the risk estimands.Now to deal with the missing S(1) values among those with Z = 0, we next focus on three trial augmentations: Baseline immunogenicity predictor (BIP), closeout placebo vaccination (CPV), a concept that was extend to the setting of general treatment trials under the name of closeout control treatment (CCT) in Gabriel and Follmann (2016), and baseline surrogate measurement (BSM).For further details on these augmentations, we refer you to Follmann (2006), Gilbert and Hudgens (2008), Gabriel and Gilbert (2014), and for further augmenations not yet implemented to Gabriel and Follmann (2016).

BIP
Briefly, a BIP W is any baseline measurement or set of measurements that is highly correlated with S. It is particularly useful if W is unlikely to be associated with the clinical outcome after conditioning on S, i.e.Y ⊥ W|S(1); some of the methods leverage this assumption.The BIP W is used to integrate out the missing S(1) among those with Z = 0 based on a model for S(1)|W that is estimated among those with Z = 1.We describe how this model is used in the next section.
The assumptions needed for a BIP to be useful depend on the risk model used.If the BIP is included in the risk model, only the assumption of no interaction with treatment and the candidate surrogate are needed.However, if the BIP is not included in the risk model, the assumption that that clinical outcome is independent of the BIP given the candidate surrogate is needed.Although not a requirement for identification of the risk estimands, it has been found in most simulations studies that a correlation between the BIP and S(1) of greater than 0.7 is needed for unbiased estimation in finite samples.

CPV or CCT
Under a CPV or CCT augmented design, control recipients that do not have events, or all willing control subjects for a non-event driven clinical outcome, are given the experimental treatment at the end of the follow-up period.Then, their intermediate response is measured at some time after that treatment.This measurement is then used as a direct imputation for the missing S(1).The CPV augmentation was developed in the setting of vaccine trials, where the surrogate is an immune response and the outcome is infection.One set of conservative assumptions to use CPV as a direct imputation for S(1) in a vaccine trial are given in Wolfson and Gilbert (2010) are: • Individual time constancy of the true intermediate response under active treatment, S(1) = S CPV almost surely, for placebo recipients that are crossed over at the end of the trial, where S CPV is the measurement of the candidate surrogate after crossover treatment of the placebo subjects.
• No events (infections) during the close-out period.
In the general treatment trial setting, the CCT augmentation can be used under the same Individual time constancy assumption, and the assumption that drop-out or unwillingness to receive close-out treatment is completely at random.Gabriel and Gilbert (2014) suggested the baseline augmentation BSM, which is a pre-treatment measurement of the candidate PS, denoted S B .The BSM may be a good predictor of S(1) without any further assumptions.It can be used in the same way as a BIP.Alternatively you can transform S(1) − S B and use this as the candidate surrogate, further increasing the association with the BSM/BIP.Under the BSM assumption outlined in Gabriel and Gilbert (2014)

Estimated maximum likelihood
Let f (y|β, s 1 , z) denote the density of Y|S(1), Z with parameters β.Further let R i denote the indicator for missingness in S i (1).We proceed to estimate β by maximizing This procedure is called estimated maximum likelihood (EML) and was developed in Pepe and Fleming (1991).The key idea is that we are averaging the likelihood contributions for subjects missing S(1) with respect to the estimated distribution of S(1)|W, denoted by FS(1)|W (s|W i ).The model for this distribution is referred to as the integration model.Recall that a BIP W that is strongly associated with S( 1) is needed for adequate performance.
Closed-form inference is not available for EML estimates, thus we recommend use of the bootstrap for estimation of standard errors.It was suggested as an approach to principal surrogate evaluation by Gilbert and Hudgens (2008) and Huang and Gilbert (2011).
Pseudoscore Huang et al. (2013) suggest a different estimation procedure that does have a closed form variance estimator.Instead of numerically optimizing the estimated likelihood, the pseudoscore approach iteratively finds the solution to weighted versions of the score equations.Pseudoscore estimates were also suggested in Wolfson (2009) and implemented for several special cases in Huang et al. (2013).We have implemented here only one of the special cases: categorical BIP and binary Y (S may be continuous or categorical).In addition to having closed form variance estimators, it has been argued that the pseudo-score estimators are more efficient than the EML estimators.The closed form variance estimates are not yet implemented.

Package features
Typically, users would have to code up the likelihood, integration model, and perform the optimization themselves.This is beyond the reach of many researchers who desire to use these methods.The goal of pseval is to correctly implement these methods with a flexible and user-friendly interface, enabling researchers to implement and interpret a wide variety of models.
The pseval package allows users to specify the type of augmented design that is used in their study, specify the form of the risk model along with the distribution of Y|S(1), and specify different integration models to estimate the distribution of S(1)|W.Then the likelihood can be maximized and bootstraps run.Post-estimation summaries are available to display and analyze the treatment efficacy as a function of S(1).All of this is implemented with a flexible and familiar interface.

Package information Usage
Here we will walk through some basic analyses from the point of view of a new R user.Along the way we will highlight the main features of pseval.We support binary, continuous, count, and time-toevent outcomes, thus we will also need to load the survival package (Therneau, 2015;Therneau and Grambsch, 2000).The example data includes both a time-to-event outcome, a binary outcome, a surrogate, a BIP, CPV, and BSM, and a categorical version of the surrogate.The true model for the time is exponential, with parameters (intercept) = -1, S(1) = 0.0, Z = 0.0, S(1):Z = -0.75.The true model for binary is logistic, with the same parameter values.

The "psdesign" object
We begin by creating a "psdesign" object with the synonymous function.This is the object that combines the raw dataset with information about the study design and the structure of the data.Subsequent analysis will operate on this psdesign object.It is designed to be analogous to the svydesign function in the survey package (Lumley, 2014(Lumley, , 2004)).The first argument is the data frame where the data are stored.All subsequent arguments describe the mappings from the variable names in the data frame to important variables in the PS analysis, using the same notation as above.Other covariates or variables can be mapped to arbitrary variable names using the same syntax.An optional weights argument describes the sampling weights, if present.Our first analysis will use the binary version of the outcome, with continuous S.1 and the BIP labeled BIP.The object has a print method, so we can inspect the result.The printout displays a brief description of the data, including the empirical treatment efficacy estimate, the variables used in the analysis and their corresponding variables in the original dataset.Finally the printout invites the user to see the help page for add_integration, in order to add an integration model to the psdesign object, the next step in the analysis.
Missing values in the S variable are allowed.Note that any cases where S(1) is missing will be integrated over in the likelihood or score equations.Thus any cases that experienced an event prior to the time τ when the surrogate was measured should be excluded from the dataset.The equal individual risk assumption allows us to make causal inferences even after excluding such cases.
psdesign easily accommodates case-control or case-cohort sampling.In this case, the surrogate S is only measured on a subset of the data, inducing missingness in S by design.Let's modify the fake dataset to see how it works.We're going to sample all of the cases, and 20% of the controls for measurement of S. The other augmentation types can be defined by mapping variables to the names BIP, CPV, and/or BSM.The augmentations are handled as described in the previous section: CPV is used as a direct imputation for S(1), and BSM is used as a direct imputation for S(0).BIPs and BSMs are made available in the augmented dataset for use in the integration models which we describe in the next subsection.
For survival outcomes, a key assumption is that the potential surrogate is measured at a fixed time τ after entry into the study.Any subjects who have a clinical outcome prior to τ will be removed from the analysis, with a warning.If tau is not specified in the psdesign object, then it is assumed to be 0. Survival outcomes are specified by mapping Y to a Surv object, which requires the survival package: surv.ps<-psdesign(data = fakedata, Z = Z, Y = Surv(time.obs,event.obs),S = S.obs, BIP = BIP, CPV = CPV, BSM = BSM) ## Warning in psdesign(data = fakedata, Z = Z, Y = Surv(time.obs,## event.obs),: tau missing in psdesign: assuming that the ## surrogate S was measured at time 0.

Integration models
The EML procedure requires an estimate of F S(1)|W , and we refer to this as the integration model.Details are available in the help page for add_integration.Several integration models are implemented, including a parametric model that uses a formula interface to define a regression model, a semiparametric model that specifies a location and a scale model is robust to the specification of the distribution, and a non-parametric model that uses empirical conditional probability estimates for discrete W and S(1).
For this first example, let's use the parametric integration model.We specify the mean model for S(1)|W as a formula.The predictor is generally a function of the BIP and the BSM, if available.We can add the integration model directly to the psdesign object and inspect the results.Note that in the formula, we refer to the variable names in the augmented dataset.In a future version of the package, we will allow for estimation of the joint risk estimands that depend on both S(0) and S(1).We can also use splines, other transformations, and other variables in the formula: library(splines) binary.ps+ integrate_parametric(S.1 ~BIP^2) binary.ps+ integrate_parametric(S.1 ~bs(BIP, df = 3)) binary.ps+ integrate_parametric(S.1 ~BIP + BSM + BSM^2) The R Journal Vol.8/2, December 2016 ISSN 2073-4859 To include additional baseline covariates in the model for S(1), such as age or gender, these variables that are present in the data frame must be mapped in the psdesign function call so that they are visible in the subsequent functions: binary.ps<-psdesign(data = fakedata, Z = Z, Y = Y.obs, S = S.obs, BIP = BIP, BSM = BSM, age = age) binary.ps+ integrate_parametric(S.1 ~BIP + age) These are shown as examples, we will proceed with the simple linear model for integration.The other integration models are called integrate_bivnorm, integrate_nonparametric, and integrate_semiparametric.See their help files for details on the models and their specification.The next step is to define the risk model.

Risk models and likelihoods
The risk model is the specification of the distribution for the outcome Y given S(1) and Z.We accommodate a variety of flexible specifications for this model, for continous, binary, time-to-event, and count outcomes.We have implemented exponential and weibull survival models, and a flexible specification for binary models, allowing for standard or custom link functions.See the help file for add_riskmodel for more details.
Let's add a simple binary risk model using the logit link.The argument D specifies the number of samples to use for the simulated annealing, also known as empirical integration, in the EML procedure.In general, D should be set to something reasonably large, like 2 or 3 times the sample size.

Estimation and bootstrap
We estimate the parameters and bootstrap using the same type of syntax.We can add a "ps_estimate" object, which takes optional arguments start for starting values, and other arguments that are passed to the optim function in base R. The method argument determines the optimization method, we have found that "BFGS" works well in these types of problems and it is the default.Use "pseudo-score" as the method argument for pseudo-score estimation for binary risk models with categorical BIPs.
The ps_bootstrap function takes the additional arguments n.boots for the number of bootstrap replicates, and progress.barwhich is a logical that displays a progress bar in the R console if true.
The R Journal Vol.8/2, December 2016 ISSN 2073-4859 It is helpful to pass the estimates as starting values in the bootstrap resampling.With estimates and bootstrap replicates present, printing the psdesign object displays additional information.

Do it all at once
The next code chunk shows how the model can be defined and estimated all at once.The R Journal Vol.8/2, December 2016 ISSN 2073-4859

Plots and summaries
We provide summary and plotting methods for the psdesign object.If bootstrap replicates are present, the summary method does a test for wide effect modification.Under the parametric risk models implemented in this package, the test for wide effect modification is equivalent to a test of the null hypothesis that the S(1) : Z coefficient is equal to 0. This is implemented using a Wald test using the bootstrap estimate of the variance.
Another way to assess wide effect modification is to compute the standardized total gain (STG) (Huang and Gilbert, 2011) and (Gabriel et al., 2015).This is implemented in the calc_STG function.The standardized total gain can be interpreted as the area sandwiched between the risk difference curve and the horizontal line at the marginal risk difference.It is a measure of the spread of the distribution of the risk difference, and is a less parametric way to test for wide effect modification.The calc_STG function computes the STG at the estimated parameters and at the bootstrap samples, if present.The function prints the results and invisibly returns a list containing the observed STG, and the bootstrapped STGS.The summary method also computes the marginal treatment efficacy marginalized over S(1) and compares it to the average treatment efficacy conditional on S(1).This is an assessment of model fit.A warning will be given if the two estimates are dramatically different.These estimates are presented in the summary along with the empirical TE and the model-based marginal treatment efficacy that does not condition on S(1).The calc_risk function computes the risk in each treatment arm, and contrasts of the risks.By default it computes the treatment efficacy, but there are other contrast functions available.The contrast function is a function that takes 2 inputs, the risk 0 and risk 1 , and returns some one dimensional function of those two inputs.It must be vectorized.Some built-in functions are "TE" for treatment efficacy = 1 − risk 1 (s)/risk 0 (s), "RR" for relative risk = risk 1 (s)/risk 0 (s), "logRR" for log of the relative risk, and "RD" for the risk difference = risk 1 (s) − risk 0 (s).You can pass the name of the function, or the function itself to calc_risk.See ?calc_risk for more information about contrast functions.
Other arguments of the calc_risk function include t, the time at which to calculate the risk for time-to-event outcomes, n.samps which is the number of samples over the range of S.1 at which the risk will be calculated, and CI.type, which can be set to "pointwise" for pointwise confidence intervals or "band" for a simultaneous confidence band.sig.level is the significance level for the bootstrap confidence intervals.If the outcome is time-to-event and t is not present, then it will use the restricted mean survival time.

Figure 1 :
Figure 1: Plot showing the estimates using the example data, along with confidence bands (CB), and the true treatment efficacy (TE) curve.

Figure 2 :
Figure 2: Plot illustrating ways that different risk contrast functions can be plotted.
S BSM almost surely.You do not need this assumption to use a BSM, but if it holds then it induces the CB case, thus the joint and marginal risk estimands are equivalent.
; • Time constancy of the true intermediate response under control, The R Journal Vol.8/2, December 2016 ISSN 2073-4859 then S(0) = First let's create an example dataset.The pseval package provides the function generate_example_data which takes a single argument: the sample size.