# Big Assignment 3

## Background

The data for this exercise were used in Ebonya Washington's paper: "Female Socialization: How Daughters Affect Their Legislator Fathers' Voting on Women's Issues."  published in the American Economic Review in 2008. The paper asks whether having daughters influences the voting behavior of members of the US Congress. The hypothesis is that having (more) daughters makes legislators more likely to vote liberally on issues concerning women.

For this exercise, we will focus on votes that took place in the 108th Congress, which held session in 2003/04. As a measure of a liberal voting record, we use scores assigned by the American Association of University Women (AAUW), a liberal group that concerns itself with issues of interest to women. For the 108th Congress, the AAUW selected 9 pieces of legislation in the areas of education, equality and reproductive rights. The AAUW then assigned a score to each member of Congress. The scores range from 0 to 100 and measure the percentage of times the legislator voted in favor of the position held by the AAUW.

 The dataset `legislators.dta` contains the following characteristics for 320 members of the 108th Congress:
 
 * $ngirls$ number of daughters
 * $totchi$ number of children
 * $age$ Age
 * $female$ indicator for being female
 * $repub$ indicator for being a Republican
 *  $moredef$ proportion of people in the legislator's district who are in favor of "more spending on
defense" 
 *  $aauw$ AAUW score

### (a) Estimate and report results for the following regression models:

Load in the data set `legislators.dta`. Remember, you will first need to call the `haven` package to do so.

Generate a variable `ngirls2` $=\text{ngirls}^2$

Generate an interaction variable `repubngirls` $= \text{repub}*\text{ngirls}$

Generate an interaction variable `repubngirls2` $=\text{repub}*\text{ngirls2}$

Estimate the following three regression models:

\begin{align}
aauw&=\beta_0 +\beta_1female+\beta_2repub+\beta_3ngirls+u  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (1) \\
aauw&=\beta_0 +\beta_1female+\beta_2repub+\beta_3ngirls+\beta_4 ngirls2+u ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(2)  \\
aauw&=\beta_0 + \beta_1female+\beta_2repub+\beta_3ngirls+\beta_4 ngirls2+\beta_5 repubngirls+\beta_6 repubngirls2+\beta_7 totchi + \beta_8 moredef + u\ \ \ (3) 
\end{align}


```R
# Add Code for part (a) here.
```

### (b) Suggest which model is the best fit to the data

Write your answer here.

### (c) Interpret the effect of `ngirls` on `aauw` in each model


```R
# Add code for part (c) here if needed
```

Write your answer here.

### (d) Test whether there is an effect of the number of daughters on aauw scores using the second model. Be sure to describe carefully the null and alternative hypothesis.

Step 1: Estimate the restricted model.

Step 2: Calculate the sum of squared residuals from the restricted and unrestricted models.

Step 3: Apply the F-stat formula.

Alternative (easier):

Step 2 (alternative): Find the $R^2$ in the summary of the restricted and unrestricted models.

Step 3 (alternative): Apply the $R^2$ version of the F-stat formula.




Using model 2, the null hypothesis is that $\beta_3 = \beta_4 = 0$. The alternative hypothesis is that either $\beta_3$ or $\beta_4$ (or both) are not zero.


```R
#Write code for part (d) here

```

Write your answer here.

### (e) Using the third model, predict the aauw score for a male democrat who has 1 daughter and 1 son, and who has 20% of constituents who want more spending on defense. Suggest a $95\%$ CI for that predicted value.

Hint: See part 2-A of section notes 7.


```R
#Write code for part (e) here.
```

Add your written answer for part (e) here.

### (f) Suppose a male Democrat with 1 daughter and 1 son defeats the incumbent Senator in a state where 20% of constituents want more spending on defense. Generate a $95\%$ CI for his particular AAUW score, continuing to use the third model.

Hint: See part 2-B of Section Notes 7. 


```R
#Write any code you need for this part here
```

Write your answer here.

### (g) Interpret the coeffcient $\beta_2$ from model (3).

Write your answer here

### (h) Suppose you think Republicans and non-Republicans may have different gender patterns in voting. That is, republican men may vote differently than Republican women, who may vote differently than Democratic women who may vote differently than Democratic men. Write down an estimation equaiton to test whether republican women, Democratic women, and Democratic men each vote differently than Republican men.

Write your answer here.

### (i) Implement your test. Interpret each coeffcient.



```R
#Write your code here
```

Write your answer here.

### (j) Adapt your regression to test whether democratic women vote differently than republican women. Please report your results (write out the estimating equations).


```R
#Add your code for part j here
```

Write your answer here.

## Downloading your Notebook

Download a PDF copy of your notebook by using __File > Print Preview. 

Once you have generated the print preview, use Print > Save as PDF to create the PDF.

3db84937bb89a35bafa7a53ef5c26247f98ef972
ipynb
Jupyter Notebook
Assignments/Assignment 3/Assignment 3.ipynb
ds-modules/ENVECON-118-FA20
c4cbba63063ef0aeeb685b2ef67340deaa7b4cc4
BSD-3-Clause
Assignments/Assignment 3/Assignment 3.ipynb
ds-modules/ENVECON-118-FA20
c4cbba63063ef0aeeb685b2ef67340deaa7b4cc4
BSD-3-Clause
Assignments/Assignment 3/Assignment 3.ipynb
ds-modules/ENVECON-118-FA20
c4cbba63063ef0aeeb685b2ef67340deaa7b4cc4
BSD-3-Clause
2020-11-01T07:28:53.000Z
2020-11-01T07:28:53.000Z
Qwen/Qwen-72B
1. YES
2. YES