This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
Your Name: Jackson Muenster
Your Collaborators:
Let’s continue working with the data from the experiment in India. As a reminder, the table below shows the names and descriptions of the variables in this dataset, where the unit of observation is villages.
| Variable | Description |
|---|---|
| village | village identifier (“Gram Panchayat number _ village number”) |
| female | whether village was assigned a female politician: 1=yes, 0=no |
| water | number of new (or repaired) drinking water facilities in the village since random assignment |
| irrigation | number of new (or repaired) irrigation facilities in the village since random assignment |
Table: Variables in “india.csv”
In this problem set, we practice how to compute and interpret means, among other things.
As always, we start by loading and looking at the data. Set your working directory and then load india.csv into an object in R:
setwd ("/Users/jacksonmuenster/Desktop/Political Inquiry/Problem Sets")
india<- read.csv("india.csv")
R code:
``` r
mean(india$female)
```
```
## [1] 0.3354037
```
(Recall: We use $ to access a variable within a dataframe. To its left, we specify the name of the object where the dataframe is stored, india in this case; to its right, we specify the name of the variable, female in this case. Also, we do not use quotes around the names of functions, the names of objects, or the names of elements within an object such as variables.)
Answer: In this case the mean of 0.3354037 represents the percentage of villages that have a female politician. This means that 33.5% of the villages have a female politician.
Use the function `mean()’ to calculate the average of the variable water. Please provide a full substantive interpretation of what this average means. Make sure to provide the unit of measurement. (10 points) R code:
mean(india$water)
## [1] 17.84161Answer: The mean of 17.84161 represents the average amount of water facilities that each village has. This means that the average village has 17.84161 water facilities
Answer for 3a: Feamale politician Answer for 3b: number of drinking water facilities
Answer for 4a: female politician Answer for 4b: Amount of irrigation facilities
Answer for 5a: Villages with a female politician Answer for 5b: Villages without a female politician