In: Math
Problem 1: Oil Production Data: The Data in the following are the annual world crude oil production in millions of barrels for the period 1880-1988. The data are taken from Moore and McCabe( 1993, p. 147).
Here is the code help you to paste the data into your R.
data5<-'year barrels
1880 30
1890 77
1900 149
1905 215
1910 328
1915 432
1920 689
1925 1069
1930 1412
1935 1655
1940 2150
1945 2595
1950 3803
1955 5626
1960 7674
1962 8882
1964 10310
1966 12016
1968 14104
1970 16690
1972 18584
1974 20389
1976 20188
1978 21922
1980 21722
1982 19411
1984 19837
1986 20246
1988 21388
'
data5n<-read.table(textConnection(object=data5),
header=TRUE,
sep="",
stringsAsFactors = FALSE)
Code:
#Data
Year=c(1880,1890,1900,1905,1910,1915,1920,1925,1930,1935,1940,1945,1950,1955,1960,1962,1964,1966,1968,1970,1972,1974,1976,1978,1980,1982,1984,1986,1988)
Oil=c(30,77,149,215,328,432,689,1069,1412,1655,2150,2595,3803,5626,7674,8882,10310,12016,14104,16690,18584,20389,20188,21922,21722,19411,19837,20246,21388)
data5<-data.frame(Year=c(1880,1890,1900,1905,1910,1915,1920,1925,1930,1935,1940,1945,1950,1955,1960,1962,1964,1966,1968,1970,1972,1974,1976,1978,1980,1982,1984,1986,1988),
Oil=c(30,77,149,215,328,432,689,1069,1412,1655,2150,2595,3803,5626,7674,8882,10310,12016,14104,16690,18584,20389,20188,21922,21722,19411,19837,20246,21388))
#Fitting regression model
LR<-lm(log(Oil)~Year,data = data5)
summary(LR)
#Plot Regression line
plot(Year,Oil)
abline(LR)
#std residuals plot
oil.stdres <-rstandard(LR)
plot(data5$Year, oil.stdres,
ylab="Standardized Residuals",
xlab="Year")
abline(0, 0)
Answer:
summary(LR)
Call:
lm(formula = log(Oil) ~ Year, data = data5)
Residuals:
Min 1Q Median 3Q Max
-0.58645 -0.07824 0.07245 0.16625 0.29754
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.119e+02 2.994e+00 -37.37 <2e-16 ***
Year 6.159e-02 1.536e-03 40.09 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.2564 on 27 degrees of freedom
Multiple R-squared: 0.9835, Adjusted R-squared: 0.9829
F-statistic: 1607 on 1 and 27 DF, p-value: < 2.2e-16
a. As the adjusted R squared is 0.9829 is high , this is regression model is good fit.
b. This graph shows that assumption of independence of error term is violated. This shows there is dependent positive correlation exist.