The calculator can be used to solve for the hazard rate (or survival probability) for each subgroup in prognostic marker study where the overall combined or overall survival probability, the marker frequency, and the hazard ratio between the prognostic groups are specified.

Surv(t) = mark.prob * exp(-t * haz.markpos) + (1 - mark.prob * exp(-t * haz.markneg / HR))

Therefore, this function assumes that the outcome distribution in each of the prognostic groups is exponentially distributed and that the overall survival distribution is a mixture of the those two subpopulation models.

**Overall Survival**: Combined or overall survival at Time**Time**: Time point the overall average survival is specified**Output Time**: Time point for survival output results**Biomarker Probability**: The fraction of patients that are marker positive**Hazard Ratio (HR)**: The hazard ratio between marker positive and marker negative patient subgroups. The maximum hazard ratio permitted is 100.

**Hazard Rate Marker positive**: Hazard rate for marker positive patients**Hazard Rate Marker negative**: Hazard rate for marker negative patients**Survival (at Output Time) for Marker positive**: As specified**Survival (at Output Time) for Marker negative**: As specified

The program is written in **R**. The nonlinear solver used to calculate subgroup survival functions is R base uniroot().

```
function(Surv_average = .5, mark_fract = .5, HR = 2, at_time = 1, at_time_output = 1) {
# function to solve for hazards in prognostic marker study with fixed overall survival and assuming exponential sub-populations
# this function assumes that the outcome distribution in each of the prognostic groups is exponetially distributed
# and that the overall survival distribution is a mixture of the those two subpopulation models.
#
# Surv(t) = marker.frac*exp(-t*hazard.rate1)+(1-marker.frac*exp(-t*hazard.rate1/HR))
#
# Surv_average - overall survival at at_time
# at_time - time point the overall average survival is given
# mark_fract - the fraction of patients that are marker positive
# HR - the hazard ratio between marker postive and marker negative patients
# OUTPUT
# hazard.rate1 - hazard rate for marker positive patients
# hazard.rate2 - hazard rate for marker negative patients
# at_time_output - the time for the output for survival for marker postive and marker negative patient
# Note in the root solve it only finds hazard rates as high as 100
#---------------------------------------------------------------------------------
ff=function(x, tt = at_time, hazard.ratio = HR, s.average = Surv_average, frac = mark_fract) {
y = s.average - (frac * exp(-x * tt) + (1 - frac) * exp(-x * tt / hazard.ratio))
y
}
aa = uniroot(ff, lower = 0, upper = 100, tol = 1e-9)$root # solves for the hazard rate in marker + group
tolerance = Surv_average - (mark_fract * exp(-aa * at_time) + (1 - mark_fract) * exp(-aa * at_time / HR))
hazard.rate1 = aa
hazard.rate2 = aa / HR
surv1 = exp(-at_time_output * hazard.rate1)
surv2 = exp(-at_time_output * hazard.rate2)
result = list(mark_fract = mark_fract,
Surv_average = Surv_average,
at_time = at_time,
hazard_rate1 = hazard.rate1,
hazard_rate2 = hazard.rate2,
survival1 = surv1,
survival2 = surv2,
at_time_output = at_time_output,
survivaltarget_difference = tolerance)
return(jsonlite::toJSON(result, pretty = TRUE))
}
```