DEPARTMENT OF ECONOMICS
ECON 4041H – RESEARCH METHODOLOGY
Fall 2021, Pete
orough
Assignment #2
Due date: November 3, 2021
Instructions: You must provide your own unique solution. You may work with others, but each of
you is responsible for submitting your own problem set solution. Each question is
20 marks and each part is of equal value. Submit solution through SafeAssign.
Submission of one file generated using RMarkdown is best. I will also accept the
submission of two files: your R command file, and a MS Word .doc (or alternative
wordprocessor) file containing graphs and comments/answers to questions. If you
cannot knit your RMarkdown file, submit the output from the parts that knit success-
fully, then submit your code that won’t knit in a separate file. Do NOT submit an
RMarkdown command file only.
Data: Use the labour force survey from Bb, “lfs21.rds”. For the analysis below, include only those
age <70 years (variable age_12).
1. Test the relationship between age (age_12) and wages (hrlyearn).
a. Generate a scatterplot between wages on the y-axis and age on the x-axis. Comment
on anything you see.
. Generate a lowess plot of wages and age using a random sample of 10,000 observations.
This command is computationally-intensive, so running it on the full sample will be
very slow. Comment on what you see.
c. Run a regression using age to explain wages, wage = α + β age+ ε . Treat age as a
cardinal variable (ie. not categorical—acceptable here because the age categories are
all equally-spaced 5-year intervals). Report the regression output, and explain what the
output means.
d. Test whether wages are a linear function of age using age as a factor variable. Supple-
ment your test using “contrast() with “poly” option. Comment on your results
2. Run a regression of wages on age_12 and age_122 (wage = α +β1 age+β2 age2 + ε).
a. Report the regression output and explain the coefficients.
. Test the residuals of this regression, and of the regression in question 1.c. above.
c. Compare the results of this regression to the regression in question 1.c., and compare
the results from the residual tests above. Can you draw a conclusion regarding which
model fits better?
ECON 4041H - Assignment 2
3. Run the regression from 2, and add in sex and educ (education). Your regression is now
wage = α +β1 age+β2 age2 +β3 sex+β4 education+ ε .
a. Report regression results and comment.
. Estimate the adjusted mean wage for:
i. a 25 year-old female.
ii. a 52 year-old male with a highschool education only.
iii. university degree (undergrad and beyond), by sex.
c. Generate a plot of estimated wages for each level of education by sex.
d. Generate a plot of estimated wages by age.
e. Generate a plot of the marginal effect of age on wages. Note: margins() is computationally-
intensive and will take some time to run.
4. Rerun the model from Question 2, and add in a third-order polynomial term on age_12
a. Discuss the coefficients, and comment on whether scaling of age variable is necessary.
Does this model fit better than the quadratic model from question 2?
. Modify the regression, adding in covariates sex and educ (wage=α+β1 age+β2 age2+
β3 age3 + β4 sex+ β5 education+ ε). Estimate the adjusted mean wage for university
degree holders, by sex. How do these results compare to those of Question 3.b.iii?
c. Using the revised model from 4.c. above, plot the estimated wages by age. Compare
esults to those from question 3.d. What is effect of adding a third-order polynomial?
d. Using the revised model from 4.c. above, plot the marginal effect of age on wages.
Compare results to those from question 3.e. What is effect of adding a third-orde
polynomial?
5. Fit a fractional polynomial explaining wages as a fractional polynomial function of age. In-
clude the sex and educ covariates in the model, but not in the fractional polynomial function.
a. Discuss the coefficients, and comment on whether scaling of age variable is necessary
. Generate a plot of estimated wages by age
c. Generate a plot of the marginal effect of age on wages
d. Estimate the adjusted mean wage for university degree holders, by sex. How do these
esults compare to those of question 3.b.iii and 4.b?
2