<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Calculates the proportion of treatment effect explained</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>

<table width="100%" summary="page for R.s.estimate"><tr><td>R.s.estimate</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>

Calculates the proportion of treatment effect explained
</h2>

<h3>Description</h3>


<p>This function calculates the proportion of treatment effect on the primary outcome explained by the treatment effect on the surrogate marker(s). This function is intended to be used for a fully observed continuous outcome. The user can also request a variance estimate and a 95% confidence interval, both estimated using perturbating-resampling. If a confidence interval is requested three versions are provided: a normal approximation based interval, a quantile based interval, and Fieller's confidence interval.
</p>


<h3>Usage</h3>

<pre>
R.s.estimate(sone, szero, yone, yzero, var = FALSE, conf.int = FALSE, 
weight.perturb = NULL, number = "single", type = "robust",extrapolate = FALSE, 
transform = FALSE,warn.te = FALSE, warn.support = FALSE)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>sone</code></td>
<td>


<p>numeric vector or matrix; surrogate marker for treated observations, assumed to be continuous. If there are multiple surrogates then this should be a matrix with <i>n_1</i> (number of treated observations) rows and n.s (number of surrogate markers) columns.
</p>
</td></tr>
<tr valign="top"><td><code>szero</code></td>
<td>


<p>numeric vector; surrogate marker for control observations, assumed to be continuous.If there are multiple surrogates then this should be a matrix with <i>n_0</i> (number of control observations) rows and n.s (number of surrogate markers) columns. 
</p>
</td></tr>
<tr valign="top"><td><code>yone</code></td>
<td>


<p>numeric vector; primary outcome for treated observations, assumed to be continuous.
</p>
</td></tr>
<tr valign="top"><td><code>yzero</code></td>
<td>


<p>numeric vector; primary outcome for control observations, assumed to be continuous.
</p>
</td></tr>
<tr valign="top"><td><code>var</code></td>
<td>


<p>TRUE or FALSE; indicates whether a variance estimate is requested, default is FALSE.
</p>
</td></tr>
<tr valign="top"><td><code>conf.int</code></td>
<td>


<p>TRUE or FALSE; indicates whether a 95% confidence interval is requested, default is FALSE
</p>
</td></tr>
<tr valign="top"><td><code>weight.perturb</code></td>
<td>


<p>a <i>n_1+n_0</i> by <i>x</i> matrix of weights where <i>n_1 = </i> length of yone and <i>n_0 = </i>  length of yzero; used for perturbation-resampling, default is null.
</p>
</td></tr>
<tr valign="top"><td><code>number</code></td>
<td>


<p>specifies the number of surrogate markers; choices are &quot;multiple&quot; or &quot;single&quot;, default is &quot;single&quot; 
</p>
</td></tr>
<tr valign="top"><td><code>type</code></td>
<td>


<p>specifies the type of estimation; choices are &quot;robust&quot; or &quot;model&quot; or &quot;freedman&quot;, default is &quot;robust&quot;
</p>
</td></tr>
<tr valign="top"><td><code>extrapolate</code></td>
<td>


<p>TRUE or FALSE; indicates whether the user wants to use extrapolation.
</p>
</td></tr>
<tr valign="top"><td><code>transform</code></td>
<td>


<p>TRUE or FALSE; indicates whether the user wants to use a transformation for the surrogate marker. 
</p>
</td></tr>
<tr valign="top"><td><code>warn.te</code></td>
<td>


<p>value to control warnings; user does not need to specify.
</p>
</td></tr>
<tr valign="top"><td><code>warn.support</code></td>
<td>


<p>value to control warnings; user does not need to specify.
</p>
</td></tr>
</table>


<h3>Details</h3>


<p>Let <i>Y^{(1)}</i> and <i>Y^{(0)}</i> denote the primary outcome under the treatment and primary outcome under the control,respectively. Let <i>S^{(1)}</i> and <i>S^{(0)}</i> denote the surrogate marker under the treatment and the surrogate marker under the control,respectively. The residual treatment effect is defined as
</p>
<p style="text-align: center;"><i> &Delta;_S=\int_{-&infin;}^{&infin;}  E(Y^{(1)}|S^{(1)}=s) dF_0(s)  - \int_{-&infin;}^{&infin;} E(Y^{(0)}|S^{(0)}=s) dF_0(s),</i></p>

<p>where <i>&Delta;_S(s)= E(Y^{(1)}|S^{(1)}=s)-E(Y^{(0)}|S^{(0)}=s)</i>  and <i>F_0(\cdot)</i> is the marginal cumulative distribution function of <i>S^{(0)}</i>, the surrogate marker measure under the control. The proportion of treatment effect explained by the surrogate marker, which we denote by <i>R_S</i>, can be expressed using a contrast between <i>&Delta;_S</i> and <i>&Delta;</i>:
</p>
<p style="text-align: center;"><i>R_S=\{&Delta;-&Delta;_S\}/&Delta;=1-&Delta;_S/&Delta;.</i></p>
<p>   The definition and estimation of <i>&Delta;</i> is described in the delta.estimate documentation.
</p>
<p>A flexible model-based approach to estimate <i>&Delta;_S</i> in the single marker setting is to specify:
</p>
<p style="text-align: center;"><i>E(S^{(0)})=&alpha;_0 \quad\mbox{and}\quad E(S^{(1)})-E(S^{(0)}) = &alpha;_1,</i></p>

<p style="text-align: center;"><i> E(Y^{(0)} | S^{(0)}) = &beta;_0 + &beta;_1 S^{(0)}  \quad \mbox{and} \quad  E(Y^{(1)} | S^{(1)}) = (&beta;_0 +&beta;_2)+ (&beta;_1+&beta;_3) S^{(1)}. </i></p>

<p>It can be shown that when these models hold, <i>&Delta;_S = &beta;_2 + &beta;_3 &alpha;_0</i>. Thus, reasonable estimates for <i>&Delta;_S</i> and <i>R_S</i> using this approach would be <i>\hat{&Delta;}_S =  \hat{&beta;}_2 + \hat{&beta;}_3 \hat{&alpha;}_0</i> and <i>\hat{R}_S = 1-\hat{&Delta;}_S / \hat{&Delta;}.</i> 
</p>
<p>For robust estimation of <i>&Delta;_S</i> in the single marker setting, we estimate <i>&mu;_1(s) = E(Y^{(1)}|S^{(1)}=s)</i> nonparametrically using kernel smoothing: 
</p>
<p style="text-align: center;"><i>\hat{&mu;}_1(s) = \frac{&sum;_{i=1}^{n_1} K_h&le;ft (S_{1i}-s \right ) Y_{1i} }{&sum;_{i=1}^{n_1} K_h&le;ft (S_{1i}-s \right )}</i></p>

<p>where <i>S_{1i}</i> is the observed <i>S^{(1)}</i> for person <i>i</i>, <i>Y_{1i}</i> is the observed <i>Y^{(1)}</i> for person <i>i</i>, <i>K(\cdot)</i> is a smooth symmetric density function with finite support, <i>K_h(\cdot)=K(\cdot/h)/h</i> and <i>h</i> is a specified bandwidth. As in most nonparametric functional estimation procedures, the choice of the smoothing parameter <i>h</i>  is critical. To eliminate the impact of the bias of the conditional mean function on the resulting estimator, we require the standard undersmoothing assumption of <i>h=O(n_1^{-&delta;})</i> with <i>&delta; \in (1/4,1/3).</i>  To obtain an appropriate <i>h</i> we first use bw.nrd to obtain <i>h_{opt}</i>; and then we let <i>h = h_{opt}n_1^{-c_0}</i>  with <i>c_0 = 0.25</i>. We then estimate <i>&Delta;_S</i> as
</p>
<p style="text-align: center;"><i> \hat{&Delta;}_S= &sum;_{i=1}^{n_0} \frac{\hat{&mu;}_1(S_{0i})- Y_{0i}}{n_0}</i></p>
<p> where <i>S_{0i}</i> is the observed <i>S^{(0)}</i> for person <i>i</i> and <i>Y_{0i}</i> is the observed <i>Y^{(0)}</i> for person <i>i</i>. Lastly, we estimate <i>R_S</i> as <i>\hat{R}_S = 1-\hat{&Delta;}_S/\hat{&Delta;}</i>.
</p>
<p>This function also allows for estimation of <i>R_S</i> using Freedman's approach.  Let <i>Y</i> denote the primary outcome, <i>S</i> denote the surrogate marker, and <i>G</i> denote the treatment group (0 for control, 1 for treatment). Freedman's approach to calculating the proportion of treatment effect explained by the surrogate marker is to fit the following two regression models:
</p>
<p style="text-align: center;"><i>E(Y|G) = &gamma;_0 + &gamma;_1 I(G=1) \quad \mbox{and} \quad E(Y|G, S) = &gamma;_{0S} + &gamma;_{1S}I(G=1) + &gamma;_{2S} S </i></p>

<p>and estimating the proportion of treatment effect explained, denoted by <i>R_S</i>, as <i> 1-\hat{&gamma;}_{1S}/\hat{&gamma;}_1</i>.
</p>
<p>This function also estimates <i>R_S</i> in a multiple marking setting. A flexible model-based approach to estimate <i>&Delta;_S</i> in the multiple marker setting is to specify models for <i>E(Y|G, S)</i> and <i>E(S_j | G)</i> for each <i>S_j</i> in <i>S = \{S_1,...S_p\}</i> (where p is the number of surrogate markers). Without loss of generality, consider the case where there are three surrogate markers, <i>S = \{S_1, S_2, S_3\}</i> and one specifies the following linear models:
</p>
<p style="text-align: center;"><i>E(Y^{(0)} | S^{(0)}) = &beta;_0 + &beta;_1 S_1^{(0)} + &beta;_2 S_2^{(0)} +  &beta;_3 S_3^{(0)}</i></p>

<p style="text-align: center;"><i>E(Y^{(1)} | S^{(1)}) = (&beta;_0+&beta;_4) + (&beta;_1+&beta;_5) S_1^{(1)} + (&beta;_2+&beta;_6) S_2^{(1)} +  (&beta;_3+&beta;_7) S_3^{(1)}</i></p>

<p style="text-align: center;"><i> E(S_j^{(0)}) = &alpha;_j, ~~~~j=1,2,3.</i></p>
 
<p>It can be shown that when these models hold 
</p>
<p style="text-align: center;"><i>&Delta;_{S} = &beta;_4 + &beta;_5&alpha;_1 + &beta;_6 &alpha;_2 + &beta;_7 &alpha;_3.</i></p>
<p> Thus, reasonable estimates for <i>&Delta;_{S}</i> and <i>R_{S}</i> here would be easily obtained by replacing the unknown regression coefficients in the models above by their consistent estimators. 
</p>
<p>For robust estimation of S <i>&Delta;_S</i> in the multiple marker setting, we use a two-stage procedure combining the model-based approach and the nonparametric estimation procedure from the single marker setting. Specifically, we use a working semiparametric  model: </p>
<p style="text-align: center;"><i>E(Y^{(1)}|S^{(1)}=S)=&beta;_0 + &beta;_1 S_1^{(1)} + &beta;_2 S_2^{(1)} +  &beta;_3 S_3^{(1)}</i></p>
 
<p>and define <i>Q^{(1)} = \hat{&beta;}_0 + \hat{&beta;}_1 S_1^{(1)} + \hat{&beta;}_2 S_2^{(1)} +  \hat{&beta;}_3 S_3^{(1)}</i> and <i>Q^{(0)} = \hat{&beta;}_0 + \hat{&beta;}_1 S_1^{(0)} + \hat{&beta;}_2 S_2^{(0)} +  \hat{&beta;}_3 S_3^{(0)}</i> to reduce the dimension of <i>S</i> in the first stage  and in the second stage, we apply the robust approach used in the single marker setting to  estimate its surrogacy. 
</p>
<p>To use Freedman's approach in the presence of multiple markers, the markers are simply additively entered into the second regression model.
</p>
<p>Variance estimation and confidence interval construction are performed using perturbation-resampling. Specifically, let <i>&le;ft \{ V^{(b)} = (V_{11}^{(b)}, ...V_{1n_1}^{(b)}, V_{01}^{(b)}, ...V_{0n_0}^{(b)})^T, b=1,....,D \right \}</i> be <i>n \times D</i> independent copies of a positive random variables <i>V</i> from a known distribution with unit mean and unit variance. Let
</p>
<p style="text-align: center;"><i>\hat{&Delta;}^{(b)}  = \frac{  &sum;_{i=1}^{n_1} V_{1i}^{(b)} Y_{1i}}{ &sum;_{i=1}^{n_1} V_{1i}^{(b)}}  - \frac{  &sum;_{i=1}^{n_0} V_{0i}^{(b)} Y_{0i}}{ &sum;_{i=1}^{n_0} V_{0i}^{(b)}}.</i></p>
<p> The variance of <i>\hat{&Delta;}</i> is obtained as the empirical variance of <i>\{\hat{&Delta;}^{(b)}, b = 1,...,D\}.</i> In this package, we use weights generated from an Exponential(1) distribution and use <i>D=500</i>. Variance estimates for <i>\hat{&Delta;}_S</i> and <i>\hat{R}_S</i> are calculated similarly. We construct two versions of the <i>95\%</i> confidence interval for each estimate: one based on a normal approximation confidence interval using the estimated variance and another taking the 2.5th and 97.5th empirical percentile of the perturbed quantities.  In addition, we use Fieller's method to obtain a third confidence interval for <i>R_S</i> as
</p>
<p style="text-align: center;"><i>&le;ft\{1-r:  \frac{(\hat{&Delta;}_S-r\hat{&Delta;})^2}{\hat{&sigma;}_{11}-2r\hat&sigma;_{12}+r^2\hat&sigma;_{22}} &le; c_{&alpha;}\right\},</i></p>

<p>where <i>\hat{&Sigma;}=(\hat&sigma;_{ij})_{1&le; i,j&le; 2}</i> and <i>c_&alpha;</i> is the <i>(1-&alpha;)</i>th percentile of
</p>
<p style="text-align: center;"><i>&le;ft\{\frac{\{\hat{&Delta;}^{(b)}_S-(1-\hat R_S)\hat{&Delta;}^{(b)}\}^2}{\hat{&sigma;}_{11}-2(1-\hat R_S)\hat&sigma;_{12}+(1-\hat R_S)^2\hat&sigma;_{22}}, b=1, \cdots, C\right\}</i></p>

<p>where <i>&alpha;=0.05</i>.
</p>
<p>Note that if the observed supports for S are not the same, then <i>\hat{&mu;}_1(s)</i> for <i>S_{0i} = s</i> outside the support of <i>S_{1i}</i> may return NA (depending on the bandwidth). If extrapolation = TRUE, then the   <i>\hat{&mu;}_1(s)</i> values for these surrogate values are set to the closest non-NA value. If transform = TRUE, then <i>S_{1i}</i> and <i>S_{0i}</i> are transformed such that the new transformed values, <i>S^{tr}_{1i}</i> and <i>S^{tr}_{0i}</i> are defined as: <i>S^{tr}_{gi} = F([S_{gi} - &mu;]/&sigma;)</i> for <i>g=0,1</i> where <i>F(\cdot)</i> is the cumulative distribution function for a standard normal random variable, and <i>&mu;</i> and <i>&sigma;</i> are the sample mean and standard deviation, respectively, of <i>(S_{1i}, S_{0i})^T</i>.
</p>


<h3>Value</h3>






<p>A list is returned:
</p>
<table summary="R valueblock">
<tr valign="top"><td><code>R.s </code></td>
<td>
<p>the estimate, <i>\hat{R}_S</i>, described above.</p>
</td></tr>
<tr valign="top"><td><code>R.s.var </code></td>
<td>
<p>the variance estimate of <i>\hat{R}_S</i>; if var = TRUE or conf.int = TRUE.</p>
</td></tr>
<tr valign="top"><td><code>conf.int.normal.R.s</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{R}_S</i> based on a normal approximation; if conf.int = TRUE.</p>
</td></tr>
<tr valign="top"><td><code>conf.int.quantile.R.s</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{R}_S</i> based on sample quantiles of the perturbed values, described above; if conf.int = TRUE.</p>
</td></tr> 
<tr valign="top"><td><code>conf.int.fieller.R.s</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{R}_S</i> based on Fieller's approach, described above; if conf.int = TRUE.</p>
</td></tr> 
</table>
<p>For all options other then &quot;freedman&quot;, the following are also returned:
</p>
<table summary="R valueblock">
<tr valign="top"><td><code>delta </code></td>
<td>
<p>the estimate, <i>\hat{&Delta;}</i>, described in delta.estimate documentation.</p>
</td></tr>
<tr valign="top"><td><code>delta.s </code></td>
<td>
<p>the estimate, <i>\hat{&Delta;}_S</i>, described above.</p>
</td></tr>
<tr valign="top"><td><code>delta.var </code></td>
<td>
<p>the variance estimate of <i>\hat{&Delta;}</i>; if var = TRUE or conf.int = TRUE.</p>
</td></tr>
<tr valign="top"><td><code>delta.s.var </code></td>
<td>
<p>the variance estimate of <i>\hat{&Delta;}_S</i>; if var = TRUE or conf.int = TRUE.</p>
</td></tr>
<tr valign="top"><td><code>conf.int.normal.delta</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{&Delta;}</i> based on a normal approximation; if conf.int = TRUE.</p>
</td></tr>
<tr valign="top"><td><code>conf.int.quantile.delta</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{&Delta;}</i> based on sample quantiles of the perturbed values, described above; if conf.int = TRUE.</p>
</td></tr> 
<tr valign="top"><td><code>conf.int.normal.delta.s</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{&Delta;}_S</i> based on a normal approximation; if conf.int = TRUE.</p>
</td></tr>
<tr valign="top"><td><code>conf.int.quantile.delta.s</code></td>
<td>
<p>a vector of size 2; the 95% confidence interval for <i>\hat{&Delta;}_S</i> based on sample quantiles of the perturbed values, described above; if conf.int = TRUE.</p>
</td></tr> 
</table>


<h3>Note</h3>

<p> If the treatment effect is not significant, the user will receive the following message: &quot;Warning: it looks like the treatment effect is not significant; may be difficult to interpret the proportion of treatment effect explained in this setting&quot;. In the single marker case with the robust estimation approach, if the observed support of the surrogate marker for the control group is outside the observed support of the surrogate marker for the treatment group, the user will receive the following message: &quot;Warning: observed supports do not appear equal, may need to consider a transformation or extrapolation&quot;</p>


<h3>Author(s)</h3>


<p>Layla Parast
</p>


<h3>References</h3>


<p>Freedman, L. S., Graubard, B. I., &amp; Schatzkin, A. (1992). Statistical validation of intermediate endpoints for chronic diseases. Statistics in medicine, 11(2), 167-178.
</p>
<p>Parast, L., McDermott, M., Tian, L. (2016). Robust estimation of the proportion of treatment effect explained by surrogate marker information. Statistics in Medicine, 35(10):1637-1653.
</p>
<p>Wang, Y., &amp; Taylor, J. M. (2002). A measure of the proportion of treatment effect explained by a surrogate marker. Biometrics, 58(4), 803-812.
</p>
<p>Fieller, Edgar C. (1954). Some problems in interval estimation. Journal of the Royal Statistical Society. Series B (Methodological), 175-185.
</p>
<p>Fieller, E. C. (1940). The biological standardization of insulin. Supplement to the Journal of the Royal Statistical Society, 1-64.
</p>


<h3>Examples</h3>

<pre>
data(d_example)
names(d_example)
R.s.estimate(yone=d_example$y1, yzero=d_example$y0, sone=d_example$s1.a, szero=d_example$s0.a, 
number = "single", type = "robust")
R.s.estimate(yone=d_example$y1, yzero=d_example$y0, sone=cbind(d_example$s1.a,d_example$s1.b, 
d_example$s1.c), szero=cbind(d_example$s0.a, d_example$s0.b, d_example$s0.c), 
number = "multiple", type = "model")
</pre>


</body></html>
