icon

Usetutoringspotscode to get 8% OFF on your first order!

Regression graphics and the Durban Watson test

This exercise is about graphics commands and the durban Watson test for ?rst -order serial
correlation.
Complete this assignment using R. Due tuesday 31
A script ?le with commands useful for the DW test is with he assignments. As usual I
would suggest setting up a script ?le and running your commands from it so that you can
repeat and improve the analysis easily. In RStudio go to ?le, new and select R Script.A
window will open Commands in the window can be run by clicking “run” in the upper
right. It is a good idea to provide comments at the beginning that explain what is in the
?le.
Durban Watson
1. Use the script ?le provided to load the two datasets for this experiment. You have
used them before.
2. Select ether the ?rst 72 or the last 89 observations in the Barro dataset with a com-
mand like this: D<-D[73:161,]
3. (1) The Barrow data is cross-sectional data. Do you expect that there will be auto-
correlation in cross-sectional data?
4. (2) Conduct a Durban-Watson test on a regression using the Barro data and show
the result. Select any set of variable you like except the exact set in this example:
lm(y.net lgdp2+mse2+fse2, data=D) (you use the command dwtest(y.net lgdp2+mse2+fse2,
data=D) .)
5. (2) Interpret the test. (What is the null hypothesis and do you reject it?)
6. (2) Plot the residuals for the regression: plot(residuals(lm()))
7. (1) The top income data is time-series data. Do you expect autocorrelation?
8. (2) Conduct a Durban-Watson test on a regression using the top income data data.
Your independent variable is year.
9. (2) Interpret the test.26 CONTENTS
Graphics
10. Get a list of colours you can use in R by downloading Rcolors.pdf. A copy is with
the assignment, but you can get it online. There are other useful documents about
using colour in R that will do as well. This page may be helpful as well.
11. (1) Select a set of ?ve colours for this exercise that you think no one else will use.
List the colours in your palette from 1 to 5
Here are a few useful commands for this exercise (you can ?nd more in the reference
pay for graphics parameters (search for par): col.axis: The color to be used for axis
annotation. Defaults to “black”.
col.lab: The color to be used for x and y labels. Defaults to “black”.
col.main: The color to be used for plot main titles. Defaults to “black”.
col.sub: The color to be used for plot sub-titles. Defaults to “black”.
12. give the following two commands to get a graphics box:
> plot.new()
> box()
13. (2) Use the text command to put you name in the centre of the box. (Since the box
is 1×1 locate your name at (.5,.5)).
14. (2) Use the colours in your palette to write your name ?ve times more each in a
different place, a different colour and a different size in the box.
15. (2) Use the title() command to put a double sized title in your second colour.
16. (1) Use the title() command to put a subtitle on in your third colour.
17. (1) Use the title() command to put a y- and x labels on the ?gure in your ?fth colour.
18. (2) Use the segments command to draw lines connecting the ?rst letter of three of
your names in the ?gure.
19. Create a new box. (You need to call (plot.new() again)0.9. ASSIGNMENT 8: REGRESSION GRAPHICS AND THE DURBAN WATSON TEST27
20. (2) Change the word “Wow” in the following command to your name and run it.
Show the result
for (i in 1:20){text(runif(1, .2,.8), runif(1, .1, .9),”Wow”,
cex=runif(1,.2, 8), col=i);readline(prompt = “hit return”)};

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes