Gov 51: Visualizing Distributions
Matthew Blackwell
Harvard University
1 / 14
Gov 51: Visualizing Distributions Matthew Blackwell Harvard - - PowerPoint PPT Presentation
Gov 51: Visualizing Distributions Matthew Blackwell Harvard University 1 / 14 Studying political effjcacy 2002 WHO survey of people in China and Mexico. Goal: determine feelings of political effjcacy. Question: How much say do
Matthew Blackwell
Harvard University
1 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
address issues that interest you?”
2 / 14
vignettes <- read.csv(”data/vignettes.csv”) head(vignettes) ## self alison jane moses china age ## 1 1 5 5 2 31 ## 2 1 1 5 5 54 ## 3 2 3 1 1 50 ## 4 2 4 2 1 22 ## 5 2 3 3 3 52 ## 6 1 3 1 5 50
3 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
table(vignettes$self) ## ## 1 2 3 4 5 ## 327 210 130 56 58
prop.table(table(vignettes$self)) ## ## 1 2 3 4 5 ## 0.4187 0.2689 0.1665 0.0717 0.0743
4 / 14
None A little Some A lot Unlimited Self-reported political efficacy Proportion of Respodents 0.0 0.1 0.2 0.3 0.4
5 / 14
barplot(height = prop.table(table(vignettes$self)), names = c(”None”, ”A little”, ”Some”, ”A lot”, ”Unlimited”), xlab = ”Self-reported political efficacy”, ylab = ”Proportion of Respodents”)
6 / 14
barplot(height = prop.table(table(vignettes$self)), names = c(”None”, ”A little”, ”Some”, ”A lot”, ”Unlimited”), xlab = ”Self-reported political efficacy”, ylab = ”Proportion of Respodents”)
6 / 14
barplot(height = prop.table(table(vignettes$self)), names = c(”None”, ”A little”, ”Some”, ”A lot”, ”Unlimited”), xlab = ”Self-reported political efficacy”, ylab = ”Proportion of Respodents”)
6 / 14
barplot(height = prop.table(table(vignettes$self)), names = c(”None”, ”A little”, ”Some”, ”A lot”, ”Unlimited”), xlab = ”Self-reported political efficacy”, ylab = ”Proportion of Respodents”)
6 / 14
barplot(height = prop.table(table(vignettes$self)), names = c(”None”, ”A little”, ”Some”, ”A lot”, ”Unlimited”), xlab = ”Self-reported political efficacy”, ylab = ”Proportion of Respodents”)
6 / 14
barplot(height = prop.table(table(vignettes$self)), names = c(”None”, ”A little”, ”Some”, ”A lot”, ”Unlimited”), xlab = ”Self-reported political efficacy”, ylab = ”Proportion of Respodents”)
6 / 14
7 / 14
Distribution of Respondent's Age
Age Density 20 40 60 80 0.00 0.01 0.02 0.03 0.04
7 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
density = proportion of observations in bin bin width
8 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
hist(x = vignettes$age, freq = FALSE, ylim = c(0, 0.04), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
hist(vignettes$age, freq = FALSE, breaks = c(0, 18, 25, 45, 65, 100), xlab = ”Age”, main = ”Distribution of Respondent's Age”)
9 / 14
Distribution of Respondent's Age
Age Density 20 40 60 80 100 0.000 0.005 0.010 0.015 0.020 0.025
10 / 14
11 / 14
20 30 40 50 60 70 80 90
Distribution of Age
Age
11 / 14
boxplot(vignettes$age, main = ”Distribution of Age”, ylab = ”Age”)
12 / 14
boxplot(vignettes$age, main = ”Distribution of Age”, ylab = ”Age”)
12 / 14
boxplot(vignettes$age, main = ”Distribution of Age”, ylab = ”Age”)
12 / 14
boxplot(vignettes$age, main = ”Distribution of Age”, ylab = ”Age”)
12 / 14
boxplot(vignettes$age, main = ”Distribution of Age”, ylab = ”Age”)
12 / 14
boxplot(vignettes$age, main = ”Distribution of Age”, ylab = ”Age”)
12 / 14
20 30 40 50 60 70 80 90
Distribution of Age
Age median upper quartile lower quartile IQR 1.5 x IQR
13 / 14
14 / 14
14 / 14