About this document

This document covers the foundations of quantitative data analysis. You will work with a real dataset in R and move through six sections, step by step:

  1. Importing and preparing the data
  2. Basic statistical concepts
  3. Descriptive statistics and tables
  4. Graphs
  5. The normal distribution
  6. Standard score transformations

How it works. Each section starts with a short explanation and some R code. Copy the code into R, run it, and answer the questions at the end of the section. When all answers in a section are correct, the next section opens. If an answer is wrong, you will get a hint that sends you back to the part you should review. You can try as many times as you need.

Answer rules

👤 Your information (optional)
All fields are optional, and the date is filled in automatically. They are saved in this browser and appear on your results page. They are sent only if you press Submit at the end of the document.
🔑 Solutions

Solutions are locked. When you receive the password, enter it here to open every section and see all solutions.

Section 1: Importing and preparing the data

In this document we use the sat.act dataset from the psych package. It contains self-reported test scores of 700 people on the ACT and the SAT, together with their gender, education level and age.

Variable Description
gender 1 = male, 2 = female
education Self-reported education, coded 0 to 5 (higher codes mean more education)
age Age in years
ACT ACT composite score
SATV SAT Verbal score
SATQ SAT Quantitative score

Step 1. Install the psych package (only once) and load it.

install.packages("psych")
library(psych)

Step 2. Load the data and make a working copy called dat.

data(sat.act)
dat <- sat.act
head(dat)

Step 3. Prepare the categorical variables. gender becomes a factor with labels, and education becomes an ordered factor.

dat$gender    <- factor(dat$gender, levels = c(1, 2), labels = c("male", "female"))
dat$education <- factor(dat$education, levels = 0:5, ordered = TRUE)
str(dat)

Step 4. Check the size of the data and the missing values.

dim(dat)
table(dat$gender)
colSums(is.na(dat))
which(is.na(dat$SATQ))

Questions for Section 1

Q1How many observations (rows) are there in dat?
Q2How many female students are in the data?
Q3How many missing values does SATQ have?
Q4In which row number is the first missing value of SATQ?
Q5What is the ACT score of the student in the 10th row of dat (that is, dat[10, ])?
🔒 Solution (locked)

Section 2: Basic statistical concepts

🔒 This part is locked. Answer all questions in the previous section correctly to open it.

Section 3: Descriptive statistics and tables

🔒 This part is locked. Answer all questions in the previous section correctly to open it.

Section 4: Graphs

🔒 This part is locked. Answer all questions in the previous section correctly to open it.

Section 5: The normal distribution

🔒 This part is locked. Answer all questions in the previous section correctly to open it.

Section 6: Standard score transformations

🔒 This part is locked. Answer all questions in the previous section correctly to open it.

Results and feedback

🔒 This part is locked. Answer all questions in the previous section correctly to open it.