##### Here is some survey data concerning the recent shooting in Ferguson, MO
##### You will be asked a few stats and probability questions
## You can access the data, questionnaire, and this starter code from my web site...
data = read.csv(url("http://kyledropp.weebly.com/uploads/1/2/0/9/12094568/ferguson_data.csv"))
## Here are some basic commands for visualizing and summarizing the data
head(data,n=20)
tail(data,n=5)
names(data)
dim(data)
summary(data)
## Awareness of Ferguson is very high
table(data$fr1) #frequency
prop.table(table(data$fr1)) #proportion
## Q1 ##
## Here is a table with awareness based on racial background
## What percent of black respondents have seen, read or heard a lot about the protests in Ferguson?
## What percent of white respondents have seen, read or heard nothing at all about the protests in Ferguson?
table(data$fr1,data$demRace)
prop.table(table(data$fr1,data$demRace),2) #note the 2 for column proportions
prop.table(table(data$fr1,data$demRace),1) #note the 1 for row proportions
## Q2 ##
## Is the relationship between awareness and race independent or dependent?
table(data$fr1)
table(data$demRace)
## Q3 ##
## what is the probability of approving (somewhat or strongly approve) of President's Obama handling of the protests given that you are black?
table(data$fr2)
## Q4 ##
## what is the probability of approving of President's Obama handling of the protests given that you are white?
## Q5 ##
## what is the probability of approving of President's Obama handling of the protests given that you say police over-reacted?
## Q6 ##
## What proportion of Republicans say these police over-reacted? What proportion of Democrats say these police over-reacted?
## Q7 ##
## What proportion of respondents are Democrats who say the policy over-reacted? What proportion of respondents are independents who say police did not over-react?
## Q8 ##
## Overall, are your party and whether you believe police over-reacted independent or dependent?