Book contents

STATHARBOR ANALYTICS · INTRODUCTION TO STATISTICS · CHAPTER 30

Comprehensive Exercises

This final chapter provides comprehensive exercises integrating the concepts from throughout the book. These problems encourage synthesis of ideas and the application of statistical methods using R, Python or Julia.

Project 1: Epidemiology Study

Design and analyse an epidemiological study investigating the association between an exposure and a health outcome. Steps:

  1. Formulate a clear research question and choose a suitable study design (cohort, case–control, cross–sectional). Justify your choice.

  2. Simulate or obtain a dataset with at least two categorical variables, one continuous variable and a binary outcome. Clean the data, handle missing values and perform exploratory analysis.

  3. Estimate measures of association (risk ratio, odds ratio), construct confidence intervals and perform hypothesis tests. Fit logistic regression models adjusting for confounders.

  4. Write a report summarising methods, results and interpretation. Include code used for analysis.

Project 2: Predictive Modelling

Using a dataset with multiple predictors and a continuous response (e.g., housing prices, car mileage, gene expression), perform the following:

  1. Split the data into training and testing sets. Fit linear and multiple regression models, assessing assumptions via residual plots.

  2. Use cross–validation to compare models of different complexity (e.g., polynomial terms, variable selection). Select the best model based on prediction error.

  3. Evaluate the model on the test set and interpret the coefficients. Discuss potential overfitting and multicollinearity.

  4. Consider using regularisation techniques (ridge, lasso) and compare results.

Project 3: Time Series Forecasting

Choose a univariate time series (e.g., stock prices, weather data, website traffic) and:

  1. Visualise the series and identify trend and seasonality. Apply transformations or differencing as needed to achieve stationarity.

  2. Fit ARIMA and exponential smoothing models. Use cross–validation to assess forecast accuracy.

  3. Generate forecasts for future periods and construct prediction intervals. Compare forecasts from different models.

  4. Discuss limitations and potential improvements (e.g., incorporating external variables).

Project 4: Multivariate Analysis

Using a multivariate dataset (e.g., gene expression, customer segmentation, socioeconomic indicators):

  1. Perform principal component analysis to reduce dimensionality. Plot the first two principal components and interpret loadings.

  2. Apply k–means clustering to the data. Determine the optimal number of clusters using the elbow method or silhouette analysis.

  3. Use hierarchical clustering with different linkage methods and compare dendrograms.

  4. Relate the clustering results to external information (if available) and discuss insights.

References