29 Sample survivorships study

esurvival <- 0.70
type1pval = 0.05
  • The expected survival rate for the selected patient population is 70%.
  • The survivorship outcome follows a binomial distribution.
  • The patient safety monitoring team will evaluate survivorship after every cohort of 5 patients.
  • The study will be suspended if there exists less than 5% likelihood that the observed number of mortalities occurred by chance (given the expected survivorship).
  • The minimum number of patient survivals for continuation is to be determined.

The binomial distribution is a discrete probability distribution. It describes the outcome of n independent trials in an experiment. Each trial is assumed to have only two outcomes, either success or failure. If the probability of a successful trial is p, then the probability of having x successful outcomes in an experiment of n independent trials is as follows.

The probability of getting exactly ‘’k’’ successes in ‘’n’’ independent Bernoulli trials is given by the [[probability mass function]]:

\[f(k,n,p) = \Pr(k;n,p) = \Pr(X = k) = \binom{n}{k}p^k(1-p)^{n-k}\]

for ‘’k’‘ = 0, 1, 2, …, ’‘n’’, where

\[\binom{n}{k} =\frac{n!}{k!(n-k)!}\]

is the [[binomial coefficient]], hence the name of the distribution. The formula can be understood as follows. ‘’k’’ successes occur with probability ‘’p’‘’‘k’‘ and’‘n’‘ − ’‘k’’ failures occur with probability (1 − ‘’p’‘)’‘n’‘ − ’‘k’‘. However, the’‘k’’ successes can occur anywhere among the ‘’n’’ trials, and there are different ways of distributing ‘’k’’ successes in a sequence of ‘’n’’ trials.



Create some empty lists:

Mortalities <- NULL
Survivals <- NULL
Study.Patients <- NULL
Cumulative <- NULL
CumVal <- NULL
Type1.P.Value <- NULL
Type2.P.Value <- NULL

Fill in the lists based on the binomial distribution.

## Loop over groups of patience of a give size
for (i in 1:10){
    n=i*50 ## Number of patience at the conclusion of this group
    pdist <- pbinom(0:n, n, esurvival) ## Calculated the cumulative binomial distribution of survival
    Cumulative <- (pdist > type1pval) ## Cumulative survival is acceptable risk
    Survivals[i] <-  min(which (Cumulative))-1 ## Minimum survivals acceptable risk
    CumVal[i] <- pdist[Survivals[i]] ## Cumulative probability at that number of survivals
    Mortalities[i] <- n-Survivals[i] ## Number of mortalities at that number of survivals
    Study.Patients[i] <- n ## The number of patients having gone through the study
    ## 95% confindence interval that the identified number of survivals differs from random at the assumed survival rate
    bt <- binom.test(x=Survivals[i], n=n, p = esurvival, alternative = "less", conf.level = 0.95)  
    Type1.P.Value[i] <- (bt$p.value)
    ## 95% confindence interval that the identified number of mortalities differs from random at the assumed survival rate
    bt <- binom.test(x=(Survivals[i]-1), n=n, p = esurvival, alternative = "less", conf.level = 0.95)
    Type2.P.Value[i] <- (bt$p.value)
}

Make sure the lists are treated appropriately

Study.Patients <- as.integer(Study.Patients)
Survivals <- as.integer(Survivals)
Mortalities <- as.integer(Mortalities)

CumVal = CumVal*100
Suspension <- as.integer(Mortalities+1)

result <- data.frame(Study.Patients, Suspension, Type1.P.Value, Type2.P.Value)
colnames(result) <- c("# of Patients", 
                      "# of Mortalities Requiring Suspension",
                      "Likelihood of Error (Type 1)",
                      "Likelihood of Error (Type 2)")