About this book
Conventions of this book
Organization
Typography
Boxes
About the author
Fundamentals
1
Introduction
1.1
Course context
1.2
Expectations
1.3
Computer resources
1.3.1
Installing Microsoft Excel
1.3.2
Installing R and RStudio
1.3.3
Installing the Tidyverse
2
Basic data cleaning with Excel
2.1
Introduction to Excel
2.1.1
Terminology and interface
2.1.2
Application: Canadian employment data
2.2
Data cleaning principles
2.2.1
Reproducibility
2.2.2
Tidy data
2.2.3
Observations and identifiers
2.2.4
Planning
2.3
Cleaning data in Excel
2.3.1
Cell formatting
2.3.2
Inserting and deleting cells
2.3.3
Data entry
2.3.4
Fill and series
2.3.5
Formulas
2.3.6
Functions
2.3.7
Cell ranges
2.3.8
Copying formulas
2.3.9
Relative and absolute references
2.4
Excel data types
2.4.1
Numeric data
2.4.2
Text data
2.4.3
Logical data
2.4.4
Dates and times
2.5
Saving and exporting data
2.5.1
Text files and text editors
2.5.2
CSV files
2.6
Finishing up
Chapter review
Practice problems
3
Probability and random events
3.1
Randomness and uncertainty
3.2
Outcomes and events
3.3
Probabilities
3.3.1
The axioms of probability
3.3.2
Additional rules for probabilities
3.3.3
Calculating probabilities
3.4
Joint and conditional probabilities
3.4.1
Joint probabilities
3.4.2
Conditional probabilities
3.4.3
Independent events
3.4.4
Law of total probability
3.4.5
Bayes’ law
Chapter review
Practice problems
4
Random variables
4.1
Defining a random variable
4.1.1
Implied distribution
4.1.2
The support
4.1.3
The PDF
4.1.4
The CDF
4.1.5
Interval probabilities
4.1.6
Functions of a random variable
4.2
The expected value
4.2.1
Linearity of expectations
4.3
Quantiles and their relatives
4.3.1
Range
4.3.2
Quantiles and percentiles
4.3.3
Median
4.4
Variance and standard deviation
4.4.1
Variance
4.4.2
Standard deviation
4.4.3
Standardization
4.5
Standard discrete distributions
4.5.1
Bernoulli
4.5.2
Binomial
4.5.3
Discrete uniform
Chapter review
Practice problems
5
Basic data analysis with Excel
5.1
Viewing large data files
5.1.1
Sorting
5.1.2
Filtering
5.1.3
Freezing panes
5.2
Summary statistics
5.2.1
Constructing the table
5.2.2
Cleaning up the table
5.3
Frequency tables
5.3.1
Simple frequency tables
5.3.2
Binned frequency tables
5.4
Univariate graphs in Excel
5.4.1
Charts in Excel
5.4.2
Time series (line) graphs
5.4.3
Creating presentation-quality graphs
5.4.4
Frequency (bar/column) graphs
5.4.5
Histograms
5.5
Finishing up
Chapter review
Practice problems
Statistical Theory
6
More on random variables
6.1
Continuous random variables
6.1.1
General properties
6.1.2
The continuous CDF
6.1.3
The continuous PDF
6.1.4
Quantiles
6.1.5
Expected values
6.2
The uniform distribution
6.2.1
The uniform PDF
6.2.2
The uniform CDF
6.2.3
Quantiles
6.2.4
Expected values
6.2.5
Functions of a uniform
6.3
The normal distribution
6.3.1
The normal PDF
6.3.2
The normal CDF
6.3.3
Quantiles
6.3.4
Expected values
6.3.5
Functions of a normal
6.3.6
Standardization
6.4
Multiple random variables
6.4.1
Joint distribution
6.4.2
Marginal distributions
6.4.3
Conditional distribution
6.4.4
Functions of multiple random variables
6.4.5
Covariance
6.4.6
Correlation
6.4.7
Independence
Chapter review
Practice problems
7
Statistics
7.1
Using statistics
7.2
Data and the data generating process
7.2.1
Simple random sampling
7.2.2
Time series data
7.2.3
Other sampling models
7.2.4
Sample selection and representativeness
7.3
Statistics and their properties
7.3.1
Summary statistics
7.3.2
The sampling distribution
7.3.3
The mean of a statistic
7.3.4
The variance
7.4
Estimation
7.4.1
Parameters
7.4.2
Estimators
7.4.3
Sampling error
7.4.4
Bias
7.4.5
Variance and the MVUE
7.4.6
Mean squared error
7.4.7
Standard errors
7.5
The law of large numbers
7.5.1
Defining the LLN
7.5.2
Consistent estimation
Chapter review
Practice problems
8
Statistical inference
8.1
Questions and evidence
8.2
Hypothesis tests
8.2.1
Data and DGP
8.2.2
The null and alternative hypotheses
8.2.3
The test statistic
8.2.4
Critical values
8.2.5
Size and power
8.2.6
Implementing and interpreting
8.3
The central limit theorem
8.4
Inference on the mean
8.4.1
The null and alternative hypotheses
8.4.2
The T statistic
8.4.3
Exact and approximate tests
8.4.4
Asymptotic critical values
8.4.5
Parametric critical values
8.4.6
Choosing a test
8.5
Confidence intervals
8.5.1
Confidence intervals for the mean
Chapter review
Practice problems
Working with Data
9
Advanced Excel
9.1
More on data files
9.1.1
Fixed-width files
9.1.2
Delimited formats
9.1.3
Other formats
9.1.4
Text to columns
9.1.5
Combining Excel files
9.2
Linking observations
9.3
Aggregating observations
9.4
Managing data problems
9.4.1
Error codes
9.4.2
Protecting data
9.4.3
Data validation
9.5
Pivot tables
9.5.1
Simple frequencies
9.5.2
Cross tabulations
9.5.3
Conditional averages
9.5.4
Modifying a Pivot Table
9.6
Finishing up
Chapter review
Practice problems
10
An introduction to R
10.1
A brief tour of RStudio
10.1.1
The console window
10.1.2
Scripts
10.1.3
R Markdown
10.1.4
Other RStudio features
10.2
The R language
10.2.1
Comments
10.2.2
Expressions
10.2.3
Variables and assignment
10.2.4
Vectors
10.2.5
Lists
10.2.6
Functions and operators
10.2.7
Classes and attributes
10.3
Packages and the Tidyverse
10.4
Reading and viewing data in R
10.4.1
Reading CSV files
10.4.2
Viewing a data table
10.4.3
Data table properties
10.5
Basic statistics in R
10.5.1
The summary function
10.5.2
Introduction to ggplot
Chapter review
Practice problems
11
Using R
11.1
Data cleaning in R
11.1.1
The pipe operator
11.1.2
Mutate
11.1.3
Filter, select, and arrange
11.1.4
Saving code and data
11.2
Data analysis in R
11.2.1
Univariate statistics
11.2.2
Tables of statistics
11.2.3
Frequency tables
11.2.4
Covariance and correlation
11.2.5
Probability distributions in R
11.3
Using ggplot
11.3.1
Syntax
11.3.2
Modifying a graph
11.3.3
Adding graph elements
11.4
Visualization and prediction
11.4.1
Scatter plots
11.4.2
Binned averages
11.4.3
Smoothing
11.4.4
Linear regression
Chapter review
Practice problems
12
To be deleted
Appendix
A
Math review
A.1
Sets
A.1.1
Defining a set
A.1.2
Characteristics of a set
A.1.3
Set algebra
A.2
Functions
A.2.1
Definition of a function
A.2.2
Linear functions
A.2.3
The indicator function
A.3
Sequences and summations
A.3.1
Cartesian products
A.3.2
Sequences
A.3.3
Summations
A.4
Limits
Chapter review
Practice problems
B
Solutions to practice problems
2
Basic data cleaning with Excel
3
Probability and random events
4
Introduction to random variables
5
Basic data analysis with Excel
6
More on random variables
7
Statistics
8
Statistical inference
9
Advanced data cleaning
10
An introduction to R
11
Using R
Appendix A
Math review
Published with bookdown
Introductory Statistics for Economics
Chapter 12
To be deleted
To be deleted.