Attempt each exercise in order.
In each code chunk, if you see “# INSERT CODE HERE”, then you are expected to add some code to create the intended output (Make sure to erase “# INSERT CODE HERE” and place your code in its place).
If my instructions say to “Run the code below…” then you do not need to add any code to the chunk.
Many exercises may require you to type some text below the code chunk, interpreting the output and answering the questions.
Please follow the rules from the course syllabus regarding seeking help with this assignment.
When you are finished, click the “Knit” button at the top of this panel. If there are no errors, an HTML file should pop up after a few seconds.
Take a look at the resulting HTML file that pops up. Make sure everything looks correct, your name is listed at the top, and that there is no ‘junk’ code or output.
Save the HTML file (to your local computer, and/or to a cloud location) as: Lab 1 “Insert Your Name”.
Upload the lab HTML to HuskyCT. Do not upload the original .Rmd version.
This assignment is due Thursday, February 8, 2023, no later than 11:00 am Eastern. Points will be deducted for late submissions.
TIP: Start early so that you can troubleshoot any issues with knitting to HTML.
There are 5 possible points on this assignment.
Baseline (C level work)
Average (B level work)
Advanced (A level work)
Do Women Promote Different Policies than Men?
(Based on Raghabendra Chattopadhyay and Esther Duflo. 2004. “Women as Policy Makers: Evidence from a Randomized Policy Experiment in India.” Econometrica, 72 (5): 1409–43.)
In a few problem sets, we will estimate the average causal effect of having a female politician on two different policy outcomes. For this purpose, we will analyze data from an experiment conducted in India, where villages were randomly assigned to have a female council head. The dataset we will use is in a file called “india.csv”. Table 1 shows the names and descriptions of the variables in this dataset, where the unit of observation is villages.
tidyverse package, (c) load the
data and assign the name “india” to it (0.625 points)tidyverse() package.
(0.625 points)library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readr)
india <- read_csv("india.csv")
## Rows: 322 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): village
## dbl (3): female, water, irrigation
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View(india)
head() or
glimpse() view the first few rows of the dataset.
Substantively describe what these functions do. (0.625
points)head(india)
## # A tibble: 6 × 4
## village female water irrigation
## <chr> <dbl> <dbl> <dbl>
## 1 GP1_village2 1 10 0
## 2 GP1_village1 1 0 5
## 3 GP2_village2 1 2 2
## 4 GP2_village1 1 31 4
## 5 GP3_village2 0 0 0
## 6 GP3_village1 0 0 0
ANSWER: head() is primarily used for viewing the first few rows of a dataset, glimpse() offers a more comprehensive overview by providing information about the structure and types of variables within the dataset.
ANSWER: Village: Nominal (unordered categorical) Female: Nominal (binary categorical) Water: Discrete numerical Irrigation: Discrete numerical
ANSWER:
the first observation is GP1_village2 so that means the value in gram panchayat 1 and in village number 2
ANSWER: Village: Character (identifier for each village) Female: Numeric binary (indicating presence or absence of a female politician) Water: Numeric non-binary (number of drinking water facilities) Irrigation: Numeric non-binary (number of irrigation facilities)
dim() might be helpful here.) Additionally,
provide a substantive answer. (0.625 points)dim(india)
## [1] 322 4
ANSWER: there are 322 villages