Question

This exercise is about graphics commands and the durban Watson test for first-order serial correlation.
Complete this assignment using R.
A script file with commands useful for the DW test is with he assignments. As usual I would suggest setting up a script file and running your commands from it so that you can repeat and improve the analysis easily. In RStudio go to file, 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 file.
Durban Watson
1. Use the script file provided to load the two data sets for this experiment. You have used them before.
2. Select ether the first 72 or the last 89 observations in the Barro dataset with a command like this: D<-D[73:161,]
3. The Barrow data is cross-sectional data. Do you expect that there will be auto correlation in cross-sectional data?
4. 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. Interpret the test. (What is the null hypothesis and do you reject it?)
6. Plot the residuals for the regression: plot(residuals(lm()))
7. The top income data is time-series data. Do you expect autocorrelation?
8. Conduct a Durban-Watson test on a regression using the top income data data. Your independent variable is year.
9. Interpret the test.
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. Select a set of five 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 find 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. Use the text command to put you name in the centre of the box. (Since the box is 1x1 locate your name at (.5,.5)).
14. Use the colours in your palette to write your name five times more each in a different place, a different colour and a different size in the box.
15. Use the title() command to put a double sized title in your second colour.
16. Use the title() command to put a subtitle on in your third colour.
17. Use the title() command to put a y- and x labels on the figure in your fifth colour.
18. Use the segments command to draw lines connecting the first letter of three of your names in the figure.
19. Create a new box. (You need to call (plot.new() again)
20. 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")};

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

# 20
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")
}

text(.25,.75,"some dumb words",col="red",cex=3)
plot.new()
box()
text(.5,.5,"David")
text(.75,0.5,"David", col="red",cex=4)
for (i in 2:9) {
text(.75,i/10,"David",col="blue",cex=2)
}

for (i in 2:9) {
text(i/10,3, "Ducks", col="blue", cex=2)
}

for (i in 2:9) {
text(i/8,i/10,"Donald",col="orange",cex=i/4)
}

for (i in 2:9) {
for (j in 2:9) {
    text(i/12,j/10,"Donald",col="green",cex=i/4)
}
}...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Statistics Questions
Homework Solution
$78.00
Statistics
MLE Formula
Mathematics
Chi-Square Distribution
Degrees Of Freedom
Mean
Variance
Gene Expression
R codes
Samples
Functions
Monte Carlo Study
Parameter Values
Probability
Patterns
Linear Regression Questions
Homework Solution
$48.00
Mathematics
Statistics
Linear Regression
Samples
P-Values
Probability
Injuries
Tables
Predictors
Variances
Null Hypothesis
Significance Level
Statistics & R Programming Questions
Homework Solution
$30.00
Statistics
Mathematics
Computing
R Programming
Functions
Data
Grades
Min
Max
Average
Scores
Assessment
Points
Variables
Vectors
Statistics & R Programming Questions
Homework Solution
$80.00
Statistics
Mathematics
R Programming
Samples
Data
MSE
Functions
Residuals
Comparison
Homogeneous Variance
ANOVA
Observations
Relative Efficiency
Factors
Training The Model: Malicious Websites Detection
Homework Solution
$63.00
Mathematics
Statistics
Training
Model
Malicious Websites Detection
Regression
Calculations
Test Procedures
Classifications
KNN Method
Arguments
Functions
Data Sets
Get help from a qualified tutor
Live Chats