Econ 103 HW1 Part 2: Coding Part Instructor: Lucas Zhang 2022 Summer Session A • This homework is due on July 25th, 11:59PM Pacific/LA Time on course website. The late homework will not be accepted as...

R language


Econ 103 HW1 Part 2: Coding Part Instructor: Lucas Zhang 2022 Summer Session A • This homework is due on July 25th, 11:59PM Pacific/LA Time on course website. The late homework will not be accepted as the solution will be shown after that time. • There will be designated sections on the course website for you to submit your homework. • You are strongly encouraged to collaborate with your classmates, but you must submit your own individual copy. • You don’t need to type your written response. You can take a picture of your handwriting, with questions’ clearly numbered. • For the codes, you can take a screenshots of your results or submit the download the notebook in .ipynb format. Alternatively, you can right click on the webpage, select print, and save as pdf. Submit the codes together with your written response. 1. Birthweight and Smoking, Continued In the first empirical study, we are going to explore further the relationship between infant’s birth weight and whether the mother is a smoker. 1. The data bw smoking.csv and the description of the data Birthweight Smoking Description.pdf are posted in the same directory as this homework on the course website. Read the description carefully. 1.1 What is the description of the variable alcohol? 1.2 What is the description of the variable nprevist? 1.3 What is the description of the variable unmarried? 2. Download the data bw smoking.csv from the course website, and upload it to the jupyter hub like we did in the lab. 3. Create a new notebook (or use the existing one). 4. Import the packages like we did in the lab. (Refer to 103 all codes.ipynb section 1) 5. Load the data bw smoking.csv (Refer to 103 all codes.ipynb section 2) 6. Run three separate regressions: (1) regress birthweight on smoker (2) regress birthweight on smoker, alcohol (3) regress birthweight on smoker, alcohol and nprevist and unmarried Refer to section 6.1 of 103 all codes.ipynb. 7. Comparing to the regression in (2), does the regression in (1) suffer from omitted variable bias? Why or why not? What is the sign of the OVB? Hint: use the following steps: 1 – Compare the coefficients on smoker from (1) and (2) – Check the coeffient on alcohol in (2) – Check the covariance between smoker and alcohol in data. To find the covariance, refer to section 4.1 of 103 all codes.ipynb. – Put these together using the OVB formula. 8. Using (3), formulate and test the joint hypotheses that alcohol, nprevist, and unmarried are not statistically significantly associated with birthweight at 5% significance level, using the reported p-value. Refer to section 6.4 of 103 all codes.ipynb. 2. Current Population Survey (CPS) In the second empirical study, we are going to explore the relationships between earnings and other population characteristics. 1. The data cps.csv and the description of the data cps description.pdf are posted in the same directory as this homework on the course website. Read the descriptions carefully. 1.1 What is the description of the variable wage? 1.2 What is the description of the variable educ? 1.3 What is the description of the variable age? 2. Download the data cps.csv from the course website, and upload it to the jupyter hub like we did in the lab. 3. In your jupyter notebook, load the data cps.csv (Refer to 103 all codes.ipynb section 2) 4. Create a new variable, potential experience, and store the variable under the name pexp as following: pexp = age − educ − 7 Refer to 103 all codes.ipynb section 6.2 5. Create a new variable, squared potential experience, and store the variable under the name pexp2 as following: pexp2 = pexp2 Refer to 103 all codes.ipynb section 6.2 6. Create a new variable, ln(wage), and store the variable under the name logwage as following: logwage = ln(wage) Refer to 103 all codes.ipynb section 6.2 7. Run three separate regressions: (1) regress logwage on educ (2) regress logwage on educ, pexp (3) regress logwage on educ, pexp and pexp2 2 Refer to section 6.1 of 103 all codes.ipynb. 8. Comparing to the regression in (2), does the regression in (1) suffer from omitted variable bias? Why or why not? What is the sign of the OVB? Hint: use the following steps: – Compare the coefficients on educ from (1) and (2) – Check the coeffient on pexp in (2) – Check the covariance between educ and pexp in data. To find the covariance, refer to section 4.1 of 103 all codes.ipynb. – Put these together using the OVB formula. 9. Using (3), formulate and test the joint hypotheses that pexpand pexp2 are not statistically significantly associated with logwage at 5% significance level, using the reported p-value. Refer to section 6.4 of 103 all codes.ipynb. 10. Now back to the baseline regression in 7-(1). We suspect that the return on education is different for white people and non-white people. We can study this by including an interaction term educ×white. Refer to section 6.3 of 103 all codes.ipynb. – Write down the model; – Run the regression; – How would you interpret the coefficient on the interaction term? – Is the coefficient on the interaction term statistically significant at 5% level? 11. Plot the regression lines of logwage on educ for white and non-white separately in one graph. Refer to section 6.3 of 103 all codes.ipynb. 3
Jul 25, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here