# 3SMFE4课程辅导、辅导c++/Python语言程序

- 首页 >> Database作业 3SMFE4 LM Statistical Methods in Finance and Economics

Additional Tasks for Year 4 and PGT students

This will be assessed as 10% of course mark.

________________________________________________________________________

Before you work on this additional task sheet, please make sure you read the following information:

1. Download the data; attach your R code to your solution.

2. With R codes and all your solutions including figures together, it should not go more than 9 pages.

3. I am responsible for clarification (NOT responsible for running programs nor explaining results for you).

______________________________________________________________________

The dataset cps4_small.csv contains the following information:

Variables: wage educ exper hrswk married female metro midwest south west black asian

Obs: 1000 observations

wage earnings per hour

educ years of education

exper post education years experience

hrswk usual hours worked per week

married = 1 if married

female = 1 if female

metro = 1 if lives in metropolitan area

midwest = 1 if lives in midwest

south = 1 if lives in south

west = 1 if lives in west

black = 1 if black

asian = 1 if asian

Note on education variable. CPS reports educational attainment by category for numerical

values for "educ"

00 .Less than 1st grade

03 .1st,2nd,3rd,or 4th grade

03 .5th or 6th grade

08 .7th and 8th grade

09 .9th grade

10 .10th grade

11 .11th grade

12 .12th grade no diploma

12 .High school graduate – high school diploma or equivalent

13 .Some college but no degree

14 .Associate degree in college - occupation/vocation program

14 .Associate degree in college - academic program

16 .Bachelor's degree (for example: BA,AB,BS)

18 .Master's degree (for example:MA,MS,MENG,MED,MSW, MBA)

21 .Professional school degree (for example: MD,DDS,DVM,LLB,JD)

21 .Doctorate degree (for example: PHD,EDD)

Variable | Obs Mean Std. Dev. Min Max

-------------+--------------------------------------------------------

wage | 1000 20.61566 12.83472 1.97 76.39

educ | 1000 13.799 2.711079 0 21

exper | 1000 26.508 12.85446 2 65

hrswk | 1000 39.952 10.3353 0 90

married | 1000 .581 .4936423 0 1

female | 1000 .514 .5000541 0 1

metro | 1000 .78 .4144536 0 1

midwest | 1000 .24 .4272968 0 1

south | 1000 .296 .4567194 0 1

west | 1000 .24 .4272968 0 1

black | 1000 .112 .3155243 0 1

asian | 1000 .043 .2029586 0 1

- 2 -

Using the data in cps4_small.csv answer the following questions. Provide R code to support your

answer.

1. Estimate the following wage equation with least squares and heteroskedasticity-robust

standard errors, and report the results.

ln(WAGE) EDUC EXPER EXPER (EXPER *EDUC) e 5

2

1 2 3 4

2. Add MARRIED to the equation and re-estimate. Holding education and experience constant,

do married workers get higher wages? Using a 1% significance level, test a null hypothesis

that wages of married workers are less than or equal to those of unmarried workers against

the alternative that wages of married workers are higher.

3. Plot the residuals from part (1) against MARRIED. Is there evidence of heteroskedasticity?

4. Estimate the model in part (1) twice---once using observations on only married workers and

once using observations on only unmarried workers. Use the Goldfeld-Quandt test and a 1%

significance level to test whether the error variances for married and unmarried workers are

different.

5. Find generalized least squares of the model in part (1). Compare the estimates and standard

errors with those obtained in part (1) using traditional OLS with the White’s correction.

6. Find two 95% interval estimates for the marginal effect

E(ln(WAGE))/EDUC

for a worker

with 12 years of education and 25 years of experience. Use the results from part (1) with the

White’s correction for one interval and the results from part (5) GLS results for the other

interval. Comment on any differences.

7. Plot the least squares residuals against EDUC and against EXPER. What do they suggest?

8. Test for heteroskedasticity using a Breusch-Pagan test where the variance depends on EDUC,

EXPER and MARRIED. What do you conclude at a 5% significance level?

9. Estimate a variance function that includes EDUC, EXPER, and MARRIED and use it to

estimate the standard deviation for each observation and list the first ten estimates. Hint:

Don’t take log of EDUC, EXPER, and MARRIED.

10. Find generalized least squares estimates of the wage equation based on findings in (9).

Compare the GLS estimates and standard errors with those obtained from least squares

estimation with heteroskedasticity-robust standard errors.

11. Find two 95% interval estimates for the marginal effect

E EXPER (ln(WAGE))/

for a worker

with 16 years of education and 20 years of experience. Use least squares with

heteroskedasticity-robust standard errors for one interval and the results from part (10) for the

other. Comment on any difference.

12. Forecast the wage of a married worker with 18 years of education and 16 years of experience.

Use both the natural predictor and the corrected predictor.

13. Find a 95% forecast interval for the wage of a married worker with 18 years of education and

16 years of experience. Ignore the uncertainty and sampling error.

14. Are you happy about the above model? Do you have any other ideas to improve the model?

Additional Tasks for Year 4 and PGT students

This will be assessed as 10% of course mark.

________________________________________________________________________

Before you work on this additional task sheet, please make sure you read the following information:

1. Download the data; attach your R code to your solution.

2. With R codes and all your solutions including figures together, it should not go more than 9 pages.

3. I am responsible for clarification (NOT responsible for running programs nor explaining results for you).

______________________________________________________________________

The dataset cps4_small.csv contains the following information:

Variables: wage educ exper hrswk married female metro midwest south west black asian

Obs: 1000 observations

wage earnings per hour

educ years of education

exper post education years experience

hrswk usual hours worked per week

married = 1 if married

female = 1 if female

metro = 1 if lives in metropolitan area

midwest = 1 if lives in midwest

south = 1 if lives in south

west = 1 if lives in west

black = 1 if black

asian = 1 if asian

Note on education variable. CPS reports educational attainment by category for numerical

values for "educ"

00 .Less than 1st grade

03 .1st,2nd,3rd,or 4th grade

03 .5th or 6th grade

08 .7th and 8th grade

09 .9th grade

10 .10th grade

11 .11th grade

12 .12th grade no diploma

12 .High school graduate – high school diploma or equivalent

13 .Some college but no degree

14 .Associate degree in college - occupation/vocation program

14 .Associate degree in college - academic program

16 .Bachelor's degree (for example: BA,AB,BS)

18 .Master's degree (for example:MA,MS,MENG,MED,MSW, MBA)

21 .Professional school degree (for example: MD,DDS,DVM,LLB,JD)

21 .Doctorate degree (for example: PHD,EDD)

Variable | Obs Mean Std. Dev. Min Max

-------------+--------------------------------------------------------

wage | 1000 20.61566 12.83472 1.97 76.39

educ | 1000 13.799 2.711079 0 21

exper | 1000 26.508 12.85446 2 65

hrswk | 1000 39.952 10.3353 0 90

married | 1000 .581 .4936423 0 1

female | 1000 .514 .5000541 0 1

metro | 1000 .78 .4144536 0 1

midwest | 1000 .24 .4272968 0 1

south | 1000 .296 .4567194 0 1

west | 1000 .24 .4272968 0 1

black | 1000 .112 .3155243 0 1

asian | 1000 .043 .2029586 0 1

- 2 -

Using the data in cps4_small.csv answer the following questions. Provide R code to support your

answer.

1. Estimate the following wage equation with least squares and heteroskedasticity-robust

standard errors, and report the results.

ln(WAGE) EDUC EXPER EXPER (EXPER *EDUC) e 5

2

1 2 3 4

2. Add MARRIED to the equation and re-estimate. Holding education and experience constant,

do married workers get higher wages? Using a 1% significance level, test a null hypothesis

that wages of married workers are less than or equal to those of unmarried workers against

the alternative that wages of married workers are higher.

3. Plot the residuals from part (1) against MARRIED. Is there evidence of heteroskedasticity?

4. Estimate the model in part (1) twice---once using observations on only married workers and

once using observations on only unmarried workers. Use the Goldfeld-Quandt test and a 1%

significance level to test whether the error variances for married and unmarried workers are

different.

5. Find generalized least squares of the model in part (1). Compare the estimates and standard

errors with those obtained in part (1) using traditional OLS with the White’s correction.

6. Find two 95% interval estimates for the marginal effect

E(ln(WAGE))/EDUC

for a worker

with 12 years of education and 25 years of experience. Use the results from part (1) with the

White’s correction for one interval and the results from part (5) GLS results for the other

interval. Comment on any differences.

7. Plot the least squares residuals against EDUC and against EXPER. What do they suggest?

8. Test for heteroskedasticity using a Breusch-Pagan test where the variance depends on EDUC,

EXPER and MARRIED. What do you conclude at a 5% significance level?

9. Estimate a variance function that includes EDUC, EXPER, and MARRIED and use it to

estimate the standard deviation for each observation and list the first ten estimates. Hint:

Don’t take log of EDUC, EXPER, and MARRIED.

10. Find generalized least squares estimates of the wage equation based on findings in (9).

Compare the GLS estimates and standard errors with those obtained from least squares

estimation with heteroskedasticity-robust standard errors.

11. Find two 95% interval estimates for the marginal effect

E EXPER (ln(WAGE))/

for a worker

with 16 years of education and 20 years of experience. Use least squares with

heteroskedasticity-robust standard errors for one interval and the results from part (10) for the

other. Comment on any difference.

12. Forecast the wage of a married worker with 18 years of education and 16 years of experience.

Use both the natural predictor and the corrected predictor.

13. Find a 95% forecast interval for the wage of a married worker with 18 years of education and

16 years of experience. Ignore the uncertainty and sampling error.

14. Are you happy about the above model? Do you have any other ideas to improve the model?