<jupyter_start><jupyter_text>Problem Set 4, Spring 2021, Villas-Boas Due As posted on bCourses Assignments pageThis problem set is to be done using R. To receive full credit, answers must include a correct answer, demonstrate all steps (codes and corresponding output) used to obtain the answer, and be uploaded to [Gradescope](https://www.gradescope.com/courses/226571), correctly indicating on which pages your answers to each question can be found.  DataThe data set `Pset4_2021.dta` contains state-level data on the percent of children born with low birth-weight, infant mortality, and the percent of population on AFDC (Aid to Families with Dependent Children). AFDC was an entitlement program that guaranteed benefits to all recipients whose income and resources were below state-determined eligibility levels. The data set also contains variables describing additional state characteristics, including per-capita income, per-capita number of doctors, etc. for the year 1987.|Variable Name	|	Description |	| :----------- | :----------------------- ||lowbrth  | percent low weight births ||infmort  | infant mortality rate (unit: deaths per 1,000 live births) ||afdcprt  |  participants in AFDC (unit: 1000 persons) ||popul    | population (unit: 1000 persons) ||pcinc    | per capita income (unit: \$ per capita) ||afdcprc  | percent of population on AFDC ||afdcpay  | average monthly AFDC payment (unit: \$) ||afdcinc  | afdcpay as % per capita income ||stateabb | state postal code ||state    | name of state ||bedspc   | hospital beds per capita ||povrate  | % population below poverty line ||physicpc | physicians per capita ||GovDem   | = 1 if the state had a democratic governor in 1986, = 0 otherwise (i.e. Republican) \*| \* Source: https://en.wikipedia.org/wiki/1986 United States gubernatorial elections  PreambleUse the following code cell to load the dataset and any packages you plan to use (at least **tidyverse** and **haven**).<jupyter_code># Add your preamble code here<jupyter_output><empty_output><jupyter_text>Exercise 1 **1.** Please provide a table of summary statistics (mean, median, std, min and max) for percent low birth weight, infant mortality rate, physicians per capita, average AFDC monthly payment, hospital beds per capita, percent population below the poverty line, and the indicator for Democratic Governor.*(Hint: See [Coding Bootcamp Part 5](https://r.datahub.berkeley.edu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fds-modules%2FENVECON-118&urlpath=tree%2FENVECON-118%2FSpring2021-J%2FSections%2FCoding+Bootcamps) for how to do this using the `stargazer` package.)* ➡️ Type your written work for and answer to part Exercise 1 - Q1 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**2.** Please graph the histogram of percent low birthweight for all the states. Then, plot another histogram for states with average monthly AFDC payment (afdcpay) larger than the median. Finally, plot the same graph for states with average monthly AFDC payment (afdcpay) less than or equal to the median. What is the average low birthweight percentage for each group? ➡️ Type your written work for and answer to part Exercise 1 - Q2 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**3.** Produce a new plot that overlaps the histograms for the below and above median groups. What do you conclude in terms of similarities and differences in the two histograms? (Keep answers brief: max 2-4 sentences)(Hint: see the Histograms section of [Coding Bootcamp Part 4](https://r.datahub.berkeley.edu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fds-modules%2FENVECON-118&urlpath=tree%2FENVECON-118%2FSpring2021-J%2FSections%2FCoding+Bootcamps) for help overlapping histograms) ➡️ Type your written work for and answer to part Exercise 1 - Q3 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**4.** Estimate the model of low percent birth weight as a linear function of a constant, average monthly AFDC payment, and physicians per capita. Comment on the estimated intercept and each of the right hand side variables' estimated parameters in terms of Sign, Size, and Significance (SSS). ➡️ Type your written work for and answer to part Exercise 1 - Q4 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**5.** In absolute terms, does the average monthly AFDC payment or the per capita number of physicians matter more in predicting the percent low birth weight in a state? (Use standardized approach) ➡️ Type your written work for and answer to part Exercise 1 - Q5 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**6.** Estimate the model of low percent birth weight as a linear function of a constant, average monthly AFDC payment, hospital beds per capita, physicians per capita, and the percent below poverty rate. Test the joint significance of the hospital beds per capita and physicians per capita variables at the 10% significance level. ➡️ Type your written work for and answer to part Exercise 1 - Q6 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**7.** Specify a model to predict the **average low percent birthweight** of a state with a monthly average AFDC payment equal to \$550, 0.008 hospital beds per capita, and 0.092 physicians per capita. ➡️ Type your written work for and answer to part Exercise 1 - Q7 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**8.** Run that same regression model specified in 7 that allows you to easily obtain "inputs" for a confidence interval for that average prediction and report the 99% confidence interval.(Hint for 7 and 8: Generate the new x variables such that when you regress y on newx1 newx2 newx3 the constant is what you need, as we did in lecture 14.) ➡️ Type your written work for and answer to part Exercise 1 - Q8 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**9.** Estimate the model that allows you to easy obtain the 99% confidence interval for the average predicted **infant mortality rate** for a state with a monthly average AFDC payment equal to \$550, 0.008 hospital beds per capita, and 0.092 physicians per capita. ➡️ Type your written work for and answer to part Exercise 1 - Q9 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**10.** Suppose I told you I want you to construct the 99% confidence interval for a specific state's predicted **infant mortality rate** according to the model you estimated in 9 above. **True or False?** "The 99% confidence interval for a specific state's predicted infant mortality rate is wider than the CI you obtained in 9 for the predicted average infant mortality rate?" Explain briefly. (Hint: See lectures 14 / 15) ➡️ Type your written work for and answer to part Exercise 1 - Q10 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**11.** First, estimate the model (A) of infant mortality rate as a linear function of a constant, monthly average AFDC payment, per capita hospital beds, per capita hospital beds squared, per capita physicians, and the poverty rate. Next, consider and estimate an alternative model (B) of infant mortality rate as a linear function of a constant, the monthly average AFDC payment, the log of per capita hospital beds, per capita physicians, and the poverty rate. Which one do you prefer,model (A) or (B)? (Hint: See lecture 13) ➡️ Type your written work for and answer to part Exercise 1 - Q11 here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>Exercise 2 Consider two models below:\begin{align*}lowbrth &= \beta_0 + \beta_1 AFDC + \beta_2 bedspc + \beta_3 physicpc + u           & (\text{model 2.A}) \\log(lowbrth) &= \alpha_0 + \alpha_1 AFDC + \alpha_2 bedspc + \alpha_3 physicpc + v  & (\text{model 2.B})\end{align*} **(a)** Predict the average percent low birth-weight for a state with afdcpay = 400, bedspc = 0.001 and physicpc = 0.1 using model 2.B.(Hint: See lectures 14/15) ➡️ Type your written work for and answer to part Exercise 2 - Part (a) here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**(b)** Which of the models do you prefer? Show all the calculations and the required values obtained via R to answer this question. (Hint: See lecture 15) ➡️ Type your written work for and answer to part Exercise 2 - Part (b) here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>Exercise 3 **(a)** Estimate model 2.B separately for states with a democratic governor and for those with a republican governor in 1986. Formally test at the 10% significance level whether the estimation regression should be done separately or whether we can pool the data. (Hint: See lecture 17 slide 37 onward) ➡️ Type your written work for and answer to part Exercise 3 - Part (a) here.<jupyter_code># insert code here<jupyter_output><empty_output><jupyter_text>**(b)** I would like to know whether the effect of the monthly AFDC payments on the log of percent low birthweight (in model 2.B) differs depending on whether the governor is democrat or not (republican in that case). Estimate a model that enables you to test this and please interpret your findings. Compare the p value for the estimated coefficient of interest to the 10 percent significance level to conclude whether you reject the null of no heterogeneity in the effect of monthly AFDC payments on the percent low birth weight due to the governor's party affliation, against a two sided alternative, holding all else equal. (Hint: Generate the interaction you need and add it to the regression.) ➡️ Type your written work for and answer to part Exercise 3 - Part (b) here.<jupyter_code># insert code here<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07721851627248838, 'fraction_numerical': 0.021831412977562158, 'mean_word_length': 5.074278698588091, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 65, 'https://': 4, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '16', 'dir': 'jupyter-structured-clean-dedup', 'id': '48281', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2905, 'n_tokens_neox': 2661, 'n_words': 1342, 'path': 'Spring2021-J/Problem-Sets/ProblemSet4/ProblemSet4_2021.ipynb', 'repo_name': 'ds-modules/ENVECON-118', 'size': '9894'}