# ECON61001 代写代考 Econometric Methods 计量经济学 R语言 –

ECON61001 (Semester 1): Computer assignment 2

THE TASK

You are assigned a simulation study setup based on the last digit of your student ID number. Submitting a report for a wrong setup results in the mark of zero for this assignment. This computer assignment corresponds to 10% of your final grade. The details about individual simulation studies and models are provided on the pages below.

Your answers have to be reported in the following table. STUDENT ID NUMBER: (insert here)

Answer with 3 digits after the decimal point

Question 1 Question 2 Question 3 Question 4 Question 5 Question 6 Question 7

You have to submit a single pdf file which starts with the above table. Fill in your answers in the table. For all the numbers report the first 3 digits after the decimal point: 3.567 instead of 3.6. You then have to include your R or MATLAB code. Hint: in RStudio go to File – Knit Document and include the generated report. The code will compile if and only if it is written without mistakes. If your code does not compile you still have to include it (just copy and paste as a text after the table).

The submission deadline for this assignment is noon UK time on January 17, 2022. The report has to be submitted in the pdf format via Turnitin on Blackboard. Please use your student ID as the file name, e.g. 12345.pdf. The assignment will be marked in accordance with the general SoSS PG Marking Criteria (available on Blackboard). Please make sure you are familiar with the University’s rules and regulations regarding plagiarism.

In general your task is to produce an analysis of the Generalized Least Squares estimator for the case where the error term follows an autoregressive process.

STUDENT ID NUMBERS ENDING WITH 1 OR 2

• ID Example: 123451 or 123452.

• Use the following parameter values for the simulation study described below: T = 100, φ = 0.8, σε2 =1,β0 =1,β1 =−3,μx =5,σx2 =0.01,φ ̃=0.2

• For all the tests use the significance level α = 5%

• For all the simulation studies set the number of iterations to M C = 1000

• Do not forget to fix the random seed to the simulation iteration i as set.seed(i)

20 marks 20 marks 10 marks 10 marks 20 marks 10 marks 10 marks

Page 1 of 8

ECON61001 (Semester 1): Computer assignment 2 Due Monday, 17 January, 2022

- Loadthetimeserieslibrarylibrary(tseries).SimulateanAR(1)processut,t=1,…,T: ut =φ·ut−1 +εt, εt ∼N(0,σε2)

and conduct the Augmented Dickey-Fuller test in its standard specification, as in the Study Group Questions # 4: adf.test(u). Save the test decision. Repeat the simulation MC times and report the empirical null rejection probability of the ADF test over the MC iterations. Insert your answer in the table. - Simulate a bivariate linear regression model

yt =β0 +β1xt +ut, t=1,…,T ut =φ·ut−1 +εt, εt ∼N(0,σε2),

where xt ∼ N(μx,σx2). Compute the OLS estimate for the slope parameter, βˆ1,OLS. Compute the GLS estimate of the slope parameter, βˆ1,GLS , using Σ from the Example 4.3 in the Lecture Notes with a correctly specified φ and σε2. Repeat the simulation MC times. Compute the sample variance of OLS and GLS estimates over the simulation draws, e.g.

where βˆ(i) 1,OLS

1 MC 1 MC 2 (i) (i)

VOLS = MC βˆ1,OLS − MC βˆ1,OLS i=1 i=1

,

is the OLS estimate from a simulation iteration (i) : i = 1,…,MC. Report the ratio of

the variances: VOLS . Insert your answer in the table. VGLS - Simulate the same bivariate linear regression model and compute the OLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ1,OLS −β1 ˆ

true parameter value: √ ˆ , where V [β1,OLS ] is a correctly specified variance from equation

V [β1,OLS ]

(4.2) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model and compute the GLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ1,GLS −β1 ˆ

true parameter value: √ ˆ , where V [β1,GLS ] is a correctly specified variance from equation

V [β1,GLS ]

(4.8) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model as in Question 2. However, assume that the researcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator. As in Question 2, compute the sample variance of OLS and GLS estimates over the simulation draws, report the ratio of the variances. Insert your answer in the table.
- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the OLS variance. Conduct a simulation study as in Question 3 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.
- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator and its variance. Conduct a simulation study as in Question 4 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.

Page 2 of 8

ECON61001 (Semester 1): Computer assignment 2 Due Monday, 17 January, 2022

STUDENT ID NUMBERS ENDING WITH 3 OR 4

• ID Example: 123453 or 123454.

• Use the following parameter values for the simulation study described below: T = 200, φ = 0.2, σε2 =4,β0 =10,β1 =4,μx =3,σx2 =1,φ ̃=0.8

• For all the tests use the significance level α = 1%

• For all the simulation studies set the number of iterations to M C = 1000

• Do not forget to fix the random seed to the simulation iteration i as set.seed(i)

- Loadthetimeserieslibrarylibrary(tseries).SimulateanAR(1)processut,t=1,…,T: ut =φ·ut−1 +εt, εt ∼N(0,σε2)

and conduct the Augmented Dickey-Fuller test in its standard specification, as in the Study Group Questions # 4: adf.test(u). Save the test decision. Repeat the simulation MC times and report the empirical null rejection probability of the ADF test over the MC iterations. Insert your answer in the table. - Simulate a bivariate linear regression model

yt =β0 +β1xt +ut, t=1,…,T ut =φ·ut−1 +εt, εt ∼N(0,σε2),

where xt ∼ N(μx,σx2). Compute the OLS estimate for the intercept, βˆ0,OLS. Compute the GLS estimate of the intercept, βˆ0,GLS , using Σ from the Example 4.3 in the Lecture Notes with a correctly specified φ and σε2. Repeat the simulation MC times. Compute the sample variance of OLS and GLS estimates over the simulation draws, e.g.

1 MC 1 MC 2 (i) (i)

VOLS = MC βˆ0,OLS − MC βˆ0,OLS i=1 i=1

,

is the OLS estimate from a simulation iteration (i) : i = 1,…,MC. Report the ratio of

the variances: VOLS . Insert your answer in the table. VGLS - Simulate the same bivariate linear regression model and compute the OLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ0,OLS −β0 ˆ

true parameter value: √ ˆ , where V [β0,OLS ] is a correctly specified variance from equation

V [β0,OLS ]

(4.2) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model and compute the GLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ0,GLS −β0 ˆ

true parameter value: √ ˆ , where V [β0,GLS ] is a correctly specified variance from equation

V [β0,GLS ]

(4.8) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model as in Question 2. However, assume that the researcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator. As in Question 2, compute the sample variance of OLS and GLS estimates over the simulation draws, report the ratio of the variances. Insert your answer in the table.

where βˆ(i) 0,OLS

Page 3 of 8

ECON61001 (Semester 1): Computer assignment 2 Due Monday, 17 January, 2022

- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the OLS variance. Conduct a simulation study as in Question 3 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.
- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator and its variance. Conduct a simulation study as in Question 4 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.

STUDENT ID NUMBERS ENDING WITH 5 OR 6

• ID Example: 123455 or 123456.

• Use the following parameter values for the simulation study described below: T = 100, φ = 0.8, σε2 =0.01,β0 =0.1,β1 =0.2,μx =1,σx2 =0.04,φ ̃=0.5

• For all the tests use the significance level α = 5%

• For all the simulation studies set the number of iterations to M C = 1000

• Do not forget to fix the random seed to the simulation iteration i as set.seed(i) - Loadthetimeserieslibrarylibrary(tseries).SimulateanAR(1)processut,t=1,…,T: ut =φ·ut−1 +εt, εt ∼N(0,σε2)

and conduct the Augmented Dickey-Fuller test in its standard specification, as in the Study Group Questions # 4: adf.test(u). Save the test decision. Repeat the simulation MC times and report the empirical null rejection probability of the ADF test over the MC iterations. Insert your answer in the table. - Simulate a bivariate linear regression model

yt =β0 +β1xt +ut, t=1,…,T ut =φ·ut−1 +εt, εt ∼N(0,σε2),

where xt ∼ N(μx,σx2). Compute the OLS estimate for the intercept, βˆ0,OLS. Compute the GLS estimate of the intercept, βˆ0,GLS , using Σ from the Example 4.3 in the Lecture Notes with a correctly specified φ and σε2. Repeat the simulation MC times. Compute the sample variance of OLS and GLS estimates over the simulation draws, e.g.

1 MC 1 MC 2 (i) (i)

VOLS = MC βˆ0,OLS − MC βˆ0,OLS i=1 i=1

,

is the OLS estimate from a simulation iteration (i) : i = 1,…,MC. Report the ratio of

the variances: VOLS . Insert your answer in the table. VGLS

where βˆ(i) 0,OLS

Page 4 of 8

ECON61001 (Semester 1): Computer assignment 2 Due Monday, 17 January, 2022

- Simulate the same bivariate linear regression model and compute the OLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ0,OLS −β0 ˆ

true parameter value: √ ˆ , where V [β0,OLS ] is a correctly specified variance from equation

V [β0,OLS ]

(4.2) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model and compute the GLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ0,GLS −β0 ˆ

true parameter value: √ ˆ , where V [β0,GLS ] is a correctly specified variance from equation

V [β0,GLS ]

(4.8) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model as in Question 2. However, assume that the researcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator. As in Question 2, compute the sample variance of OLS and GLS estimates over the simulation draws, report the ratio of the variances. Insert your answer in the table.
- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the OLS variance. Conduct a simulation study as in Question 3 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.
- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator and its variance. Conduct a simulation study as in Question 4 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.

STUDENT ID NUMBERS ENDING WITH 7 OR 8

• ID Example: 123457 or 123458.

• Use the following parameter values for the simulation study described below: T = 200, φ = 0.1, σε2 =0.25,β0 =7,β1 =−0.5,μx =2,σx2 =9,φ ̃=0.9

• For all the tests use the significance level α = 1%

• For all the simulation studies set the number of iterations to M C = 1000

• Do not forget to fix the random seed to the simulation iteration i as set.seed(i) - Loadthetimeserieslibrarylibrary(tseries).SimulateanAR(1)processut,t=1,…,T: ut =φ·ut−1 +εt, εt ∼N(0,σε2)

and conduct the Augmented Dickey-Fuller test in its standard specification, as in the Study Group Questions # 4: adf.test(u). Save the test decision. Repeat the simulation MC times and report the empirical null rejection probability of the ADF test over the MC iterations. Insert your answer in the table.

Page 5 of 8

ECON61001 (Semester 1): Computer assignment 2

Due Monday, 17 January, 2022

- Simulate a bivariate linear regression model

yt =β0 +β1xt +ut, ut =φ·ut−1 +εt,

t=1,…,T εt ∼N(0,σε2),

where xt ∼ N(μx,σx2). Compute the OLS estimate for the slope parameter, βˆ1,OLS. Compute the GLS estimate of the slope parameter, βˆ1,GLS , using Σ from the Example 4.3 in the Lecture Notes with a correctly specified φ and σε2. Repeat the simulation MC times. Compute the sample variance of OLS and GLS estimates over the simulation draws, e.g.

1 MC 1 MC 2 (i) (i)

VOLS = MC βˆ1,OLS − MC βˆ1,OLS i=1 i=1

,

is the OLS estimate from a simulation iteration (i) : i = 1,…,MC. Report the ratio of

the variances: VOLS . Insert your answer in the table. VGLS - Simulate the same bivariate linear regression model and compute the OLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ1,OLS −β1 ˆ

true parameter value: √ ˆ , where V [β1,OLS ] is a correctly specified variance from equation

V [β1,OLS ]

(4.2) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model and compute the GLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ1,GLS −β1 ˆ

true parameter value: √ ˆ , where V [β1,GLS ] is a correctly specified variance from equation

V [β1,GLS ]

(4.8) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model as in Question 2. However, assume that the researcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator. As in Question 2, compute the sample variance of OLS and GLS estimates over the simulation draws, report the ratio of the variances. Insert your answer in the table.
- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator and its variance. Conduct a simulation study as in Question 4 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.

where βˆ(i) 1,OLS

Page 6 of 8

ECON61001 (Semester 1): Computer assignment 2 Due Monday, 17 January, 2022

STUDENT ID NUMBERS ENDING WITH 9 OR 0

• ID Example: 123459 or 123450.

• Use the following parameter values for the simulation study described below: T = 100, φ = 0.9, σε2 =4,β0 =5,β1 =14,μx =32,σx2 =0.16,φ ̃=0.1

• For all the tests use the significance level α = 5%

• For all the simulation studies set the number of iterations to M C = 1000

• Do not forget to fix the random seed to the simulation iteration i as set.seed(i)

- Loadthetimeserieslibrarylibrary(tseries).SimulateanAR(1)processut,t=1,…,T: ut =φ·ut−1 +εt, εt ∼N(0,σε2)

and conduct the Augmented Dickey-Fuller test in its standard specification, as in the Study Group Questions # 4: adf.test(u). Save the test decision. Repeat the simulation MC times and report the empirical null rejection probability of the ADF test over the MC iterations. Insert your answer in the table. - Simulate a bivariate linear regression model

yt =β0 +β1xt +ut, t=1,…,T ut =φ·ut−1 +εt, εt ∼N(0,σε2),

where xt ∼ N(μx,σx2). Compute the OLS estimate for the intercept, βˆ0,OLS. Compute the GLS estimate of the intercept, βˆ0,GLS , using Σ from the Example 4.3 in the Lecture Notes with a correctly specified φ and σε2. Repeat the simulation MC times. Compute the sample variance of OLS and GLS estimates over the simulation draws, e.g.

1 MC 1 MC 2 (i) (i)

VOLS = MC βˆ0,OLS − MC βˆ0,OLS i=1 i=1

,

is the OLS estimate from a simulation iteration (i) : i = 1,…,MC. Report the ratio of

the variances: VOLS . Insert your answer in the table. VGLS - Simulate the same bivariate linear regression model and compute the OLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ0,OLS −β0 ˆ

true parameter value: √ ˆ , where V [β0,OLS ] is a correctly specified variance from equation

V [β0,OLS ]

(4.2) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model and compute the GLS solution as in Question 2. For each simulation iteration compute the test statistic for the 2-sided null hypothesis against the

βˆ0,GLS −β0 ˆ

true parameter value: √ ˆ , where V [β0,GLS ] is a correctly specified variance from equation

V [β0,GLS ]

(4.8) in the Lecture Notes. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table. - Simulate the same bivariate linear regression model as in Question 2. However, assume that the researcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator. As in Question 2, compute the sample variance of OLS and GLS estimates over the simulation draws, report the ratio of the variances. Insert your answer in the table.

where βˆ(i) 0,OLS

Page 7 of 8

ECON61001 (Semester 1): Computer assignment 2 Due Monday, 17 January, 2022

- Simulate the same bivariate linear regression model as in Question 2. Assume that that the re- searcher does not have the correct value for φ and uses φ ̃ instead to compute the GLS estimator and its variance. Conduct a simulation study as in Question 4 to examine the empirical null rejection probability of the 2-sided test against the true parameter value. Repeat the simulation MC times and report the empirical null rejection probability of the test. Insert your answer in the table.

Page 8 of 8