Computes the treatment efficacy (TE) and other functions of the risk in each treatment arm over the range of surrogate values observed in the data. TE(s) is defined as 1 - risk(s, z = 1)/risk(s, z = 0), where z is the treatment indicator. If any other variables are present in the risk model, then the risk is computed at their median value.
Usage
calc_risk(
psdesign,
contrast = "TE",
t,
sig.level = 0.05,
CI.type = "band",
n.samps = 5000,
bootstraps = TRUE,
newdata = NULL
)
Arguments
- psdesign
A psdesign object. It must contain a risk model, an integration model, and estimated parameters. Bootstrapped parameters are optional
- contrast
The contrast function, or the name of the contrast function. See details.
- t
For time to event outcomes, a fixed time
t
may be provided to compute the cumulative distribution function. If not, the restricted mean survival time is used. Omit for binary outcomes.- sig.level
Significance level for bootstrap confidence intervals
- CI.type
Character string, "pointwise" for pointwise confidence intervals, and "band" for simultaneous confidence band.
- n.samps
The number of samples to take over the range of S.1 at which the contrast is calculated
- bootstraps
If true, and bootstrapped estimates are present, will calculate bootstrap standard errors and confidence bands.
- newdata
Vector of S values. If present, will calculate the contrast function at values of newdata instead of the observed S.1
Value
A data frame containing columns for the S values, the computed contrast function at S, R0, and R1 at those S values, and optionally standard errors and confidence intervals computed using bootstrapped estimates.
Details
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).