Department of Economics San Diego State University ECON 650 - Problem Set 2 Fall 2021 1 Part I For the following exercise, please use the dataset uploaded to Canvas with the name Happy_2015.csv,...

Problem Set Stata, log and do file


Department of Economics San Diego State University ECON 650 - Problem Set 2 Fall 2021 1 Part I For the following exercise, please use the dataset uploaded to Canvas with the name Happy_2015.csv, Happy_2016.csv, and Happy_2017.csv. The three datasets provide survey results for self-reported happiness by country for the given year in the title. For this assignment, write a do-file that ac- complishes the following set of operations. Be sure to clearly annotate your code and turn in your do-file, log-file, and associated graphs upon completion. Where I ask explicit questions, make sure you have written the code that will answer it, and then annotate your response accordingly. 1. Import and append all the happiness datasets. Be sure to create a variable called ‘year’ and fill it with the corresponding year in the final dataset. 2. Write a nested loop that displays “The average X for region Y is Z”, where X are the variables happinessscore, economygdppercapita, trustgovernmentcorruption in turn. Y is one of the 10 regions in the dataset. Z is the average value of X in region Y. In other words, there are 3 by 10 combinations of X and Y. Hint: first deal with missing values. 3. Provide twoway scatter plots of happiness score v.s. health life expectancy, and happiness score v.s. the economy measure (GDP per capita) at the region level. This will be much easier if you collapse the data to the region level first. Be sure to add horizontal and vertical titles and include these plots when you turn in your problem set. Hint: use -help twoway scatter- if you need syntax information. 2 Part II For the following exercise, you will use the dataset wage2 available using the -bcuse wage2- com- mand. In this excersize, we will examine the differences in returns to education among urban and rural populations. Please include a word document or PDF containing all output and graphs. 1. Begin by creating three histograms. The first should show the distribution of wages, the second should show the distribution of wages among urban individuals and the third should show the distribution of wages among rural individuals. The choice of bin width, y-axis scale and labels is up to you, but choose them to make the graphs as informative as possible. 1 2. Estimate the following models via OLS and create a table that presents the estimates side-by- side: wagei = β0 + β1educi + ui wagei = β0 + β1educi + β2urbani + β3educi × urbani + ui Where educi × urbani is an interaction term. Are the returns to education significantly higher in urban areas than in rural areas? Provide support for your answer. Use the -lincom- com- mand to test the returns to education for those living in urban areas are zero. Remember to use -help lincom- if you need syntax help. 3. We may be worried that the variance of the error term in the first regression may actually depend on the level of education of an individual. Look for evidence of this by predicting residuals from the first regression, creating a new variable equal to the square of the residuals and regressing this variable on education. Is the coefficient significant? 4. Create a scatter plot whereby the x-axis is education and the y-axis is the squared residuals. Overlay a line of best fit with 95% confidence intervals. Be sure to informatively label both axis and add a title (using code in the do-file, not the graph editor). 2
Oct 07, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here