python-ECON4060H

ECON4060H Take Home Exam, 2022 Winter 19 April 2022 Trent University ECON4060H Take Home Exam 2022Winter DUE BY 8:00PM EASTERN TIME ON APRIL 20TH. UPLOAD YOUR ANSWERS TO BLACKBOARD. Total points: 50. Instructions 1. This exam is open book. References allowed include lecture slides, course handouts, personal notes, and the reading list of the course. 2. Any form of collaboration or asking help from anyone is prohibited. Answers that appear very close to each other will be inspected for possible collaboration. 3. If answers are hand written, writing must be legible. 4. You can use any programming languages. Python and/or R are recommended. 5. All computer programs must be submitted in their original formats that are used to obtain an swers. Computer programs submitted in the PDF format or as images will be discarded and result in zero marks. Original formats of programs can be plain text files with suffix .py or .R, they can be also saved in Jupyter notebooks. 6. If there are multiple files to submit, please consider to compress them into one zip file for sub mission. 7. Write your name and student ID number in all files you submit. 8. For full credit, show necessary steps and necessary explanation. Question 1 Consider the intertemporal decisions of an individual. The individual is born in period 0, lives for +1 periods, and dies at the end of period . At the beginning of any period , the individual’s asset level is , which is used for production. The amount of production is with 0 < < 1. Produced output is used for consumption and for asset in the future. The budget constraint is + +1 = , for = 0, 1, 2, , . The initial asset value 0 > 0 is given. When the individual dies, she/he leaves no bequest, that is, +1 = 0. The utility flow from consumption in period is given by () = ln(). The discount factor is with 0 < < 1. 1. (4 points) Formulate the individual’s dynamic optimization problem. You can use the Bellman equation, but do not have to. Be thorough in describing the problemmathematically. Shutao Cao 1 ECON4060H Take Home Exam, 2022 Winter 19 April 2022 2. (6 points) Suppose that the individual lives for 3 periods, i.e., = 2. Solve for the optimal consumption in all periods. Do not use programming, solve the problemwith algebra using the backward induction and optimal conditions. Show necessary steps. 3. (5 points) Suppose that the individual lives for 11 periods, i.e., = 10. Write a program to numerically solve for the individual’s life cycle choices. Plot the optimal consumption and the asset level over the life cycle. In doing so, you can use these values = 0.5, 0 = 1, = 0.7, or set them to values of your own choice. Hint: you can either program by extending the pattern displayed in the second part above, or solve for the value function with backward induction. Question 2 This question asks you to train a classification model and make prediction, using data from the Labor Force Survey (LFS) 2021. Data files and codebook are linked in Blackboard together with this exam. There are two data files, LFS2021TrainingSample.csv is the training sample, and LFS2021TestSample.csv is the testing sample. The training sample is used to train the models, and the testing sample is used for prediction. The dependent variable is the employment type. = 1 if an individual is a permanent (regular) worker, and = 1 if an individual is a temporaryworkerwhoseemployment is a fixed termcontract. Employment type in the provided data is the variable permemploywhich is coded with 0 and 1. If you use Python, the package scikit-learn is sufficient, you may want to reference the user guide https://scikit learn.org/stable/user_guide.html. 1. (5 points) Preprocess the data. This includes properly coding all variables, creating categorical variables where necessary, allowing for interactions of variables, choosing the set of indepen dent variables. For the independent variables, you should use as many variables as possible provided in the data files. Please explain to justify if a variable is not used as an independent variable. 2. (6 points) Using the processed training sample to train a regularized Logistic regression model. Show the training steps and report the training results. Use the trained model to make predic tion in the processed testing sample. Report the prediction results (mainly the MSE). In report ing training and prediction results, briefly write them up by either using print function in your program or writing them as comments in your program. 3. (6 points) Using the processed training sample to train a support vectormachines (SVM)model. Show the training steps and report the training results. Use the trained model to make predic tion in the processed testing sample. Report the prediction results (mainly the test error rate or similar). In reporting training and prediction results, briefly write them up by either using print function in your program or writing them as comments in your program. Hint: you can choose just one SVMmodel, for example, support vector classifier (SVC), or linearSVC. In training each model, you should make a choice on the specific model you use. For example, you can choose which regularization you use for the regularized Logistic regression. Shutao Cao 2 ECON4060H Take Home Exam, 2022 Winter 19 April 2022 Question 3 This question concerns issues in estimating empirical models of households and firms. Wage equation. Consider the empirical wage equation as follows: ln() = 0 + 1 Educ + 2 Exper + 3 Tenure + 4 ln() + 5 + . In this equation, ln() is the natural logarithm of hourly labor earnings of individual at time , Educ is educational attainment, Exper is the number of years of working experience, Tenure is the number of years that individual has worked in the current employer, and includes social demographic variables such as individual’s age, gender and race. Finally, ln() is the natural log arithm of minimumwage in province where individual works. 1. (6) Point out and discuss potential problems of using the Ordinary Least Squares (OLS) to esti mate the wage equation above. 2. (4) If not using the OLS estimation, how would you estimate the determinants of individual wages Estimating wages may be not limited to use the equation above. Regression. Consider the regression of investment as follows: / = 0 + 1E+1 + 2/ + . In this equation, / is the investment to capital ratio in firm at year , E+1 is the expected average value of firm in year , and / is the ratio of cash flow to capital in firm at year . 1. (4 points) Estimating the equation above shows that 2 is positive and statistically significant. Explain the implications of this result. 2. (4 points) Suppose that firms are possibly constrained by external credit which may limit firms’ ability to invest a desirable amount. Howwould you estimate firm level investment in the pres ence of credit constraint Shutao Cao 3