Data Analysis
1
Preface
2
Introduction
2.1
Overview
2.2
R and RStudio
2.2.1
Preparation for R/RStudio
2.2.2
Installing R and RStudio
2.2.3
Locating Files on your Computer
3
Introduction to R
3.1
R Resources and Help
3.2
Opening RStudio
3.2.1
In-class Exercise 1
3.3
Functions
3.4
Data in R
3.4.1
Using R as a Calculator
3.4.2
Creating a Data Frame from Scratch
3.4.3
In-class Exercise 2
3.4.4
Indexing
3.4.5
Importing Data into R
3.4.6
Sub-setting a Data Frame
3.4.7
In-class Exercises 3
3.4.8
Aggregating Data
3.4.9
Writing Data Frame to .csv-File
3.4.10
Reshaping Data from Long to Wide and Viceversa
3.4.11
Extending the Basic
table()
Function
3.4.12
Merging Datasets
4
Summarizing Data
4.1
Measures of Central Tendency
4.2
Measures of Dispersion
4.3
Histograms
4.4
Empirical Cumulative Distribution Function
4.5
Boxplots
4.6
Covariance and Correlation Coefficicent
4.7
Exercises
5
Probability
5.1
Sample Spaces, Outcomes, Events, and Set Operations
5.2
Probability of a Union
5.3
Probability of an Intersection
5.4
Conditional Probability
5.5
Independence
5.5.1
Birthday Problem
5.6
Law of Total Probability and Bayes Rule
5.7
Combinatorial Methods
5.7.1
Permutations
5.7.2
Combinations
5.8
Exercises
6
Probability Distributions
6.1
Random Variables
6.1.1
Expected Value and Variance
6.2
Discrete Probability Distributions
6.2.1
Bernoulli distribution
6.2.2
Binomial distribution
6.2.3
Poisson Distribution
6.3
Continuous distributions
6.3.1
Uniform distribution
6.3.2
Normal distribution
6.3.3
t
-Distribution
6.4
Distribution Fitting
6.5
Exercises
7
Basic Statistics and Sampling
7.1
Law of Large Numbers
7.2
Central Limit Theorem
7.3
Estimation and Estimators
7.4
Exercises
8
Confidence Intervals
8.1
Confidence Interval for a Proportion
8.2
Confidence Interval for the Mean
8.3
Sample Size Calculation for a Proportion
8.4
Exercises
9
Hypothesis Testing
9.1
One-Group: Proportions
9.2
One-Group: Mean
9.3
Two-Groups: Proportion
9.4
Two-Groups: Mean
9.5
Exercises
10
Additional Topics in Statistics
10.1
Chi-Square Test (
\(\chi^2\)
-Test)
10.2
Binomial Test
10.3
Wilcoxon Signed-Rank Test
10.4
Exercises
11
Bivariate Regression
11.1
Measuring the Strength of the Relationship
11.2
Hypothesis Testing
11.2.1
Numeric Example using Used Car Data
11.3
Functional Forms
11.4
About the Importance of the Assumptions
11.5
Exercises
12
Basic Multivariate Regression
12.1
Introduction
12.2
Dummy Variables
12.3
Natural Logarithm
12.4
Functional Form
12.5
Interaction Effects
12.6
Exercises
13
ANOVA
13.1
Exercises
14
Violating Assumptions
14.1
Heteroscedasticity
14.1.1
Detecting Heteroscedasticity
14.1.2
Correcting Heteroscedasticity
14.2
Multicollinearity
14.2.1
Variance Inflated Factors (VIF)
14.2.2
Examples
14.3
Other Issues and Problems with Data
14.4
Autocorrelation
14.4.1
Durbin Watson d-Test
14.4.2
Breusch-Godfrey Test
14.5
Exercises
15
Binary Choice
15.1
Binary Choice Estimation in R
15.2
Exercises
16
Qualitative Choice Models
16.1
Ordered Logit Model
16.1.1
Ordered Logit Example: Organic Food Purchase
16.1.2
Predicted Probability and Marginal Effects
16.2
Multinomial Logit and Multinomial Probit Models
16.2.1
Theoretical Aspects
16.2.2
Data Managment
16.2.3
Fishing Data
16.2.4
Travel Data
16.2.5
Electric Vehicle Data
16.3
Exercises
17
Limited Dependent Variable Models
17.1
Truncation
17.2
Censoring
17.3
Count Regression Models
17.3.1
Poisson Regression Model
17.3.2
Quasi-Poisson Regression Model
17.3.3
Negative Binomial Regression Model
17.4
Hurdle and Zero-Inflation Models
17.5
Survival Analysis
17.6
Exercises
18
Panel Data
18.1
Overview
18.2
Pooled Ordinary Least Square model
18.3
Fixed Effects Panel Data Model
18.4
Exercises
19
Time Series
19.1
Trend and Seasonality
19.1.1
Practice Exercise
19.2
Finite Distributed Lag Models
19.3
Basic Theoretical Aspects of Time Series
19.4
Autoregressive Model
19.5
Moving Average Models
19.6
Random Walk
19.7
Forecasting Japanense Car Production
19.8
Exercises
20
Data Sources
Published with bookdown
Data Analysis for Public Affairs with R
6.4
Distribution Fitting
There is a YouTube video and slides associated with this chapter:
Probability Distributions - Video
Probability Distributions - Slides