Introduction to Medical Statistics 2026
Exercise class III
Statistical Analysis: Main Concepts and Principles; Binomial Distribution
Exercise class III
Statistical Analysis: Main Concepts and Principles; Binomial Distribution
I. Calculation of binomial probabilities
The US CDC estimates that 90% of Americans have had chickenpox by the time they reach adulthood.
- Suppose we take a random sample of 100 American adults. Is the use of the binomial distribution appropriate for calculating the probability that exactly 97 out of 100 randomly sampled American adults had chickenpox during childhood? Explain your answer.
- How many American adults that had chickenpox would you expect to observe among the 100? Wat is the variance of the number of observed cases among 100 sampled individuals? Use the
dbinomfunction to calculate the probability that exactly 97 out of 100 randomly sampled American adults had chickenpox during childhood, i.e. compute P(X=97) if X \(\sim\) B(0.9,100).
- What is the probability that exactly 3 out of a new sample of 100 American adults have not had chickenpox in their childhood?
- Plot the probability function of this binomial distribution. See whether the answer from b. corresponds with the value in the plot. Which number has the highest probability and how large is that probability?
- What’s the probability that we observe a number of adults that is at least 5 lower or higher than 90? Hint: use the
pbinomfunction to compute \(P(X \leq 85)\) and \(P(X \geq 95)\). How do you read this number from the plot that you made in b?
- We actually calculate the p-value of a test of the null hypothesis that p is 0.9 against the two-sided alternative hypothesis that there is a difference if the observed number of infected individuals is 95. Why?
II: Inference for a single proportion
A new chemotherapy has entered phase 2 in drug development. A tumour response is defined as a decrease in tumour size by at least 50% within 6 months after therapy initiation. According to experts, the tumour response probability of the drug should be more than 20% in order to proceed to a phase 3 study.
The statistical test of interest is the test for the tumour response probability \(\pi\) with the null hypothesis \(H_0: \pi=0.2\) (or \(H_0: \pi \leq 0.2\)) versus the alternative \(H_A: \pi >0.2\). The phase 2 trial consists of 50 patients. We observe the tumour response for each patient and then perform the statistical test.
- Assume that 16/50 patients show a tumour response. Calculate the corresponding one-sided p-value and describe the result and your conclusion in words. Hint: You can either calculate the p-value yourself using the binomial distribution (as in Exercise I.b or I.e) or you can use the
prop.testorbinom.testfunction. (Note that these two functions use different methods; onlybinom.testgives the same answer as the direct calculation.)
- The experts expected a tumour response of 40%. Suppose that the true tumour response probability is indeed 0.4. We reject the null hypothesis if we get a one-sided p-value smaller than 0.025. What is the probability that we reject the null hypothesis if we have a sample of 50 patients (not the current sample, but an arbitrary new sample)? This is the basis of the so-called power or sample size calculation. Hint: First show that for an observed number of tumour responses of 16 the test does not reject the null hypothesis, while for 17 it does. Then calculate the probability of \(P(X\geq 17)\) if the alternative is true, i.e. if p=0.4.
III: Analysis of a diagnostic test
A diagnostic study evaluated the Platelia NS1 ELISA assay for diagnosis of dengue. The study participants consisted of 853 children admitted to Children’s Hospital #1, Children’s Hospital #2, or HTD from August 2006 to March 2007. Participants were eligible for entry to the study if they had a history of fever of less than seven days and there was a clinical suspicion of dengue. A patient was classified as having dengue by the reference test (gold standard) if there was RT-PCR detection of DENV RNA in plasma, and/or viral culture and/or serological changes in DENV reactive IgM or IgG levels in paired plasma specimens. The data is stored in dengueNS1.csv, the file dengueNS1_description.txt describes the variables in the data set.
Import the dataset and use the summary function for a data summary.
- Use the
tablefunction to create a cross-table of NS1 result and “true” dengue status; you can add column and row totals via theaddmarginsfunction. Calculate the prevalence (proportion) of children with dengue.
- Calculate the proportion of children with dengue that test positive in the NS1 assay. This quantity is called the sensitivity “SENS” of the NS1 test. Also calculate the proportion of children without dengue that test negative (the specificity “SPEC” of the test). Write the calculation in the blank below. What do you think of the performance of the test?
- Calculate the proportion of children that have dengue amongst the ones that test positive in the NS1 assay. This is called the positive predictive value (PPV). Also calculate the proportion of children that do not have dengue amongst the ones that test negative in the NS1 assay. Which characteristic of the test is more clinically relevant, SENS and SPEC or PPV and NPV? Write the function to answer that in the blank below.
- Is there evidence for a difference in sensitivity of the NS1 ELISA assay between DENV serotypes? Use the
tbl_summaryfunction from the gtsummary package (No statistical test is required, just an exploratory data analysis.)
IV: difference in proportions
The dataset bmData.csv contains selected variables from 300 patients with confirmed bacterial meningitis. They were randomized to either adjunctive dexamethasone therapy or placebo. Import the dataset and use the summary function for a data summary.
- Create a 2x2 table that compares the number of deaths at 6 months between the two treatment arms, using the function
xtabsortable. Is there a difference in the survival status at 6 months of follow-up between the two randomized groups?
- Perform a formal test for a difference in survival status. Formulate the null hypothesis and the alternative hypothesis. Use the
chisq.testfunction.
- Use the
prop.testfunction as alternative. Look at the difference in the way the results are shown compared to the chi-squared test.