Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Partial pooling of response rates across basket trial baskets

p_tilde_j = w_j * p_hat_j + (1 - w_j) * mu

Maps the responders and evaluable patients in each basket of a basket trial, together with a common mean response and a between-basket variance, to a response estimate for each basket that borrows information from the other baskets. The result lies between analysing each basket separately and pooling every patient. The basket estimates can then be reweighted to the mix of tumour types expected in practice before they enter a response-based economic model. A full hierarchical model does the same jointly on the log-odds scale.

  • Partially pooled basket response under a normal approximation

    p_hat_j = y_j / n_j; s2_j = mu * (1 - mu) / n_j; w_j = tau2 / (tau2 + s2_j); p_tilde_j = w_j * p_hat_j + (1 - w_j) * mu

    Shrinks the observed response proportion of basket j towards a common mean mu. The weight w_j on the basket's own data is the between-basket variance tau2 divided by the sum of tau2 and the sampling variance s2_j of a proportion near the common mean in a basket of n_j patients. Because s2_j uses the common mean rather than the basket's own proportion, the weight depends only on basket size, so small baskets receive low weight and move furthest towards the mean. This is the simplified approximation in the article; a full hierarchical model estimates mu and tau2 jointly on the log-odds scale.

  • Expected response for a tumour-type mix from basket estimates

    R = sum_(j=1)^J [pi_j * p_est_j]

    Weights each basket's response estimate by the share of that tumour type in the population expected to be treated, rather than by its share of trial enrolment. With enrolment shares and the observed proportions the result equals the pooled trial response, which reflects whoever was easiest to recruit. The same weighting applies to separate or partially pooled basket estimates.

  • Basket response probability from log-odds in a hierarchical model

    p_j = exp(theta_j) / (1 + exp(theta_j))

    Converts the log-odds of response theta_j back to a response probability. The hierarchical model for a basket trial links the baskets on this scale, with each theta_j drawn from a normal distribution with mean mu and variance tau2, so its estimates and priors are stated as log-odds. The function exp is the exponential function; the reverse step is theta_j equal to the natural log of p_j divided by one minus p_j.