Index
Written by Becky Wei Lin & Xiao Le Li for Simon Fraser University.
Welcome to the online textbook for Data Science for the Social Sciences! In this website, you’ll find many resources for writing and executing your own code, and performing data analysis on programming languages such as R and Python.
These resources are written with newcomers to statistics and data science in mind, and should be referred to when looking for a step-by-step process in understanding the workflow in creating plots, models, and assessing them.
Lab 1: Programming in R
An introduction to working with R and datasets. These chapters will go through tutorials on writing your first code in R, navigating datasets, and generating plots.
Lab 2: Libraries & Linear Regression
The chapters in lab 2 go over the intrincacies of utilizing libraries in R, and provides tutorials on creating custom functions. Additionally, linear regression models are introduced, as we’ll learn how to build and read them, and the role that predictors play in model performance.
Lab 3: Model Selection & Introduction to Classification
A section on model selection using a variety of benchmarks to determine which models fit the data best, as well as an introduction to classification models with the K-Nearest Neighbours algorithm.
Lab 4: Binary Classification
In lab 4, we delve deeper into classification - namely, binary classification in scenarios where we want to predict one of two outcomes. We’ll explore what a logistic regression model is, as well as the logic behind discriminant analysis in binary classification.
Lab 5: Trees, More Trees, & Forests
The decision tree is a rudimentary, yet effective method of data analysis, which we can use technology to generate. In these chapters, we’ll explore the uses of decision trees in different types of data, as well as the pitfalls that may occur in one.
Lab 6: Clustering & Classification
A return to the concepts reviewed in K-Nearest Neighbours, examined in-depth. These chapters highlight the usage of spacial differences in data to identify groups. We’ll learn the differences choices made when building a clustering model, and how to estimate the number of clusters in a dataset.
Lab 7: Neural Networks
In the final chapters, we’ll explore a model that functions similarly to the human brain. Here, the structure of the neural network is explained, and examples of code to build these models are provided in both R and Python.
Acknowledgement
I would like to extend my sincere gratitude to Xiao Le Li for her exceptional assistance in producing the online version of the lab material for STAT311 at SFU using Quarto. Xiao Le’s dedication, creativity, and technical expertise were instrumental in transforming the lab content into an engaging and accessible format for our students.