R version 2.6.0 (2007-10-03)
Copyright (C) 2007 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(25.62,0,27.5,0,24.5,0,25.66,0,28.31,0,27.85,0,24.61,0,25.68,0,25.62,1,20.54,0,18.8,0,18.71,0,19.46,0,20.12,0,23.54,0,25.6,0,25.39,0,24.09,0,25.69,0,26.56,0,28.33,0,27.5,0,24.23,0,28.23,0,31.29,0,32.72,0,30.46,1,24.89,1,25.68,0,27.52,0,28.4,1,29.71,0,26.85,0,29.62,1,28.69,1,29.76,1,31.3,1,30.86,0,33.46,1,33.15,1,37.99,1,35.24,1,38.24,1,43.16,1,43.33,1,49.67,1,43.17,1,39.56,1,44.36,1,45.22,1,53.1,1,52.1,1,48.52,1,54.84,1,57.57,1,64.14,1,62.85,1,58.75,1,55.33,1,57.03,1,63.18,1,60.19,1,62.12,0,70.12,1,69.75,1,68.56,1,73.77,1,73.23,1,61.96,1,57.81,1,58.76,1,62.47,1,53.68,1,57.56,1,62.05,1,67.49,1,67.21,1,71.05,1,76.93,1,70.76,1),dim=c(2,80),dimnames=list(c('Brent','Irak'),1:80))
> y <- array(NA,dim=c(2,80),dimnames=list(c('Brent','Irak'),1:80))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Brent Irak M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 25.62 0 1 0 0 0 0 0 0 0 0 0 0 1
2 27.50 0 0 1 0 0 0 0 0 0 0 0 0 2
3 24.50 0 0 0 1 0 0 0 0 0 0 0 0 3
4 25.66 0 0 0 0 1 0 0 0 0 0 0 0 4
5 28.31 0 0 0 0 0 1 0 0 0 0 0 0 5
6 27.85 0 0 0 0 0 0 1 0 0 0 0 0 6
7 24.61 0 0 0 0 0 0 0 1 0 0 0 0 7
8 25.68 0 0 0 0 0 0 0 0 1 0 0 0 8
9 25.62 1 0 0 0 0 0 0 0 0 1 0 0 9
10 20.54 0 0 0 0 0 0 0 0 0 0 1 0 10
11 18.80 0 0 0 0 0 0 0 0 0 0 0 1 11
12 18.71 0 0 0 0 0 0 0 0 0 0 0 0 12
13 19.46 0 1 0 0 0 0 0 0 0 0 0 0 13
14 20.12 0 0 1 0 0 0 0 0 0 0 0 0 14
15 23.54 0 0 0 1 0 0 0 0 0 0 0 0 15
16 25.60 0 0 0 0 1 0 0 0 0 0 0 0 16
17 25.39 0 0 0 0 0 1 0 0 0 0 0 0 17
18 24.09 0 0 0 0 0 0 1 0 0 0 0 0 18
19 25.69 0 0 0 0 0 0 0 1 0 0 0 0 19
20 26.56 0 0 0 0 0 0 0 0 1 0 0 0 20
21 28.33 0 0 0 0 0 0 0 0 0 1 0 0 21
22 27.50 0 0 0 0 0 0 0 0 0 0 1 0 22
23 24.23 0 0 0 0 0 0 0 0 0 0 0 1 23
24 28.23 0 0 0 0 0 0 0 0 0 0 0 0 24
25 31.29 0 1 0 0 0 0 0 0 0 0 0 0 25
26 32.72 0 0 1 0 0 0 0 0 0 0 0 0 26
27 30.46 1 0 0 1 0 0 0 0 0 0 0 0 27
28 24.89 1 0 0 0 1 0 0 0 0 0 0 0 28
29 25.68 0 0 0 0 0 1 0 0 0 0 0 0 29
30 27.52 0 0 0 0 0 0 1 0 0 0 0 0 30
31 28.40 1 0 0 0 0 0 0 1 0 0 0 0 31
32 29.71 0 0 0 0 0 0 0 0 1 0 0 0 32
33 26.85 0 0 0 0 0 0 0 0 0 1 0 0 33
34 29.62 1 0 0 0 0 0 0 0 0 0 1 0 34
35 28.69 1 0 0 0 0 0 0 0 0 0 0 1 35
36 29.76 1 0 0 0 0 0 0 0 0 0 0 0 36
37 31.30 1 1 0 0 0 0 0 0 0 0 0 0 37
38 30.86 0 0 1 0 0 0 0 0 0 0 0 0 38
39 33.46 1 0 0 1 0 0 0 0 0 0 0 0 39
40 33.15 1 0 0 0 1 0 0 0 0 0 0 0 40
41 37.99 1 0 0 0 0 1 0 0 0 0 0 0 41
42 35.24 1 0 0 0 0 0 1 0 0 0 0 0 42
43 38.24 1 0 0 0 0 0 0 1 0 0 0 0 43
44 43.16 1 0 0 0 0 0 0 0 1 0 0 0 44
45 43.33 1 0 0 0 0 0 0 0 0 1 0 0 45
46 49.67 1 0 0 0 0 0 0 0 0 0 1 0 46
47 43.17 1 0 0 0 0 0 0 0 0 0 0 1 47
48 39.56 1 0 0 0 0 0 0 0 0 0 0 0 48
49 44.36 1 1 0 0 0 0 0 0 0 0 0 0 49
50 45.22 1 0 1 0 0 0 0 0 0 0 0 0 50
51 53.10 1 0 0 1 0 0 0 0 0 0 0 0 51
52 52.10 1 0 0 0 1 0 0 0 0 0 0 0 52
53 48.52 1 0 0 0 0 1 0 0 0 0 0 0 53
54 54.84 1 0 0 0 0 0 1 0 0 0 0 0 54
55 57.57 1 0 0 0 0 0 0 1 0 0 0 0 55
56 64.14 1 0 0 0 0 0 0 0 1 0 0 0 56
57 62.85 1 0 0 0 0 0 0 0 0 1 0 0 57
58 58.75 1 0 0 0 0 0 0 0 0 0 1 0 58
59 55.33 1 0 0 0 0 0 0 0 0 0 0 1 59
60 57.03 1 0 0 0 0 0 0 0 0 0 0 0 60
61 63.18 1 1 0 0 0 0 0 0 0 0 0 0 61
62 60.19 1 0 1 0 0 0 0 0 0 0 0 0 62
63 62.12 0 0 0 1 0 0 0 0 0 0 0 0 63
64 70.12 1 0 0 0 1 0 0 0 0 0 0 0 64
65 69.75 1 0 0 0 0 1 0 0 0 0 0 0 65
66 68.56 1 0 0 0 0 0 1 0 0 0 0 0 66
67 73.77 1 0 0 0 0 0 0 1 0 0 0 0 67
68 73.23 1 0 0 0 0 0 0 0 1 0 0 0 68
69 61.96 1 0 0 0 0 0 0 0 0 1 0 0 69
70 57.81 1 0 0 0 0 0 0 0 0 0 1 0 70
71 58.76 1 0 0 0 0 0 0 0 0 0 0 1 71
72 62.47 1 0 0 0 0 0 0 0 0 0 0 0 72
73 53.68 1 1 0 0 0 0 0 0 0 0 0 0 73
74 57.56 1 0 1 0 0 0 0 0 0 0 0 0 74
75 62.05 1 0 0 1 0 0 0 0 0 0 0 0 75
76 67.49 1 0 0 0 1 0 0 0 0 0 0 0 76
77 67.21 1 0 0 0 0 1 0 0 0 0 0 0 77
78 71.05 1 0 0 0 0 0 1 0 0 0 0 0 78
79 76.93 1 0 0 0 0 0 0 1 0 0 0 0 79
80 70.76 1 0 0 0 0 0 0 0 1 0 0 0 80
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Irak M1 M2 M3 M4
10.0700 -1.4028 2.5762 2.4120 4.0458 4.9253
M5 M6 M7 M8 M9 M10
4.5554 4.7374 6.5140 6.7427 4.3508 2.7911
M11 t
-0.4119 0.7181
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.2669 -4.5224 -0.7797 4.6206 13.5818
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.07003 3.05350 3.298 0.00157 **
Irak -1.40282 2.45497 -0.571 0.56966
M1 2.57622 3.72546 0.692 0.49167
M2 2.41204 3.74828 0.644 0.52213
M3 4.04582 3.72479 1.086 0.28135
M4 4.92530 3.72748 1.321 0.19095
M5 4.55541 3.72694 1.222 0.22594
M6 4.73735 3.72908 1.270 0.20841
M7 6.51398 3.72268 1.750 0.08480 .
M8 6.74266 3.73546 1.805 0.07563 .
M9 4.35085 3.86530 1.126 0.26440
M10 2.79112 3.86359 0.722 0.47259
M11 -0.41194 3.86257 -0.107 0.91539
t 0.71806 0.05129 14.001 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.69 on 66 degrees of freedom
Multiple R-Squared: 0.8777, Adjusted R-squared: 0.8536
F-statistic: 36.42 on 13 and 66 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1mcim1197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/2a6zw1197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/3b5b21197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/4vha41197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/5iwt91197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 80
Frequency = 1
1 2 3 4 5 6
12.25569204 13.58180911 8.22997775 7.79243211 10.09426346 8.73426346
7 8 9 10 11 12
2.99957496 3.12283489 6.13940678 0.49825393 1.24325393 0.02325393
13 14 15 16 17 18
-2.52102807 -2.41491100 -1.34674236 -0.88428800 -1.44245665 -3.64245665
19 20 21 22 23 24
-4.53714515 -4.61388522 -1.17013284 -1.15846618 -1.94346618 0.92653382
25 26 27 28 29 30
0.69225182 1.56836889 -1.64064296 -8.80818860 -9.76917676 -8.82917676
31 32 33 34 35 36
-9.04104574 -10.08060533 -11.26685295 -6.25236677 -4.69736677 -4.75736677
37 38 39 40 41 42
-6.51164878 -8.90835122 -7.25736307 -9.16490871 -4.67307735 -8.32307735
43 44 45 46 47 48
-7.81776585 -3.84450592 -2.00075355 5.18091312 1.16591312 -3.57408688
49 50 51 52 53 54
-2.06836889 -1.76225182 3.76591682 1.16837118 -2.75979746 2.66020254
55 56 57 58 59 60
2.89551404 8.51877397 8.90252634 5.64419301 4.70919301 5.27919301
61 62 63 64 65 66
8.13491100 4.59102807 2.76637720 10.57165107 9.85348243 7.76348243
67 68 69 70 71 72
10.47879393 8.99205386 -0.60419377 -3.91252710 -0.47752710 2.10247290
73 74 75 76 77 78
-9.98180911 -6.65569204 -4.51752340 -0.67506904 -1.30323768 1.63676232
79 80
5.02207382 -2.09466625
> postscript(file="/var/www/html/rcomp/tmp/6qrs31197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 80
Frequency = 1
lag(myerror, k = 1) myerror
0 12.25569204 NA
1 13.58180911 12.25569204
2 8.22997775 13.58180911
3 7.79243211 8.22997775
4 10.09426346 7.79243211
5 8.73426346 10.09426346
6 2.99957496 8.73426346
7 3.12283489 2.99957496
8 6.13940678 3.12283489
9 0.49825393 6.13940678
10 1.24325393 0.49825393
11 0.02325393 1.24325393
12 -2.52102807 0.02325393
13 -2.41491100 -2.52102807
14 -1.34674236 -2.41491100
15 -0.88428800 -1.34674236
16 -1.44245665 -0.88428800
17 -3.64245665 -1.44245665
18 -4.53714515 -3.64245665
19 -4.61388522 -4.53714515
20 -1.17013284 -4.61388522
21 -1.15846618 -1.17013284
22 -1.94346618 -1.15846618
23 0.92653382 -1.94346618
24 0.69225182 0.92653382
25 1.56836889 0.69225182
26 -1.64064296 1.56836889
27 -8.80818860 -1.64064296
28 -9.76917676 -8.80818860
29 -8.82917676 -9.76917676
30 -9.04104574 -8.82917676
31 -10.08060533 -9.04104574
32 -11.26685295 -10.08060533
33 -6.25236677 -11.26685295
34 -4.69736677 -6.25236677
35 -4.75736677 -4.69736677
36 -6.51164878 -4.75736677
37 -8.90835122 -6.51164878
38 -7.25736307 -8.90835122
39 -9.16490871 -7.25736307
40 -4.67307735 -9.16490871
41 -8.32307735 -4.67307735
42 -7.81776585 -8.32307735
43 -3.84450592 -7.81776585
44 -2.00075355 -3.84450592
45 5.18091312 -2.00075355
46 1.16591312 5.18091312
47 -3.57408688 1.16591312
48 -2.06836889 -3.57408688
49 -1.76225182 -2.06836889
50 3.76591682 -1.76225182
51 1.16837118 3.76591682
52 -2.75979746 1.16837118
53 2.66020254 -2.75979746
54 2.89551404 2.66020254
55 8.51877397 2.89551404
56 8.90252634 8.51877397
57 5.64419301 8.90252634
58 4.70919301 5.64419301
59 5.27919301 4.70919301
60 8.13491100 5.27919301
61 4.59102807 8.13491100
62 2.76637720 4.59102807
63 10.57165107 2.76637720
64 9.85348243 10.57165107
65 7.76348243 9.85348243
66 10.47879393 7.76348243
67 8.99205386 10.47879393
68 -0.60419377 8.99205386
69 -3.91252710 -0.60419377
70 -0.47752710 -3.91252710
71 2.10247290 -0.47752710
72 -9.98180911 2.10247290
73 -6.65569204 -9.98180911
74 -4.51752340 -6.65569204
75 -0.67506904 -4.51752340
76 -1.30323768 -0.67506904
77 1.63676232 -1.30323768
78 5.02207382 1.63676232
79 -2.09466625 5.02207382
80 NA -2.09466625
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 13.58180911 12.25569204
[2,] 8.22997775 13.58180911
[3,] 7.79243211 8.22997775
[4,] 10.09426346 7.79243211
[5,] 8.73426346 10.09426346
[6,] 2.99957496 8.73426346
[7,] 3.12283489 2.99957496
[8,] 6.13940678 3.12283489
[9,] 0.49825393 6.13940678
[10,] 1.24325393 0.49825393
[11,] 0.02325393 1.24325393
[12,] -2.52102807 0.02325393
[13,] -2.41491100 -2.52102807
[14,] -1.34674236 -2.41491100
[15,] -0.88428800 -1.34674236
[16,] -1.44245665 -0.88428800
[17,] -3.64245665 -1.44245665
[18,] -4.53714515 -3.64245665
[19,] -4.61388522 -4.53714515
[20,] -1.17013284 -4.61388522
[21,] -1.15846618 -1.17013284
[22,] -1.94346618 -1.15846618
[23,] 0.92653382 -1.94346618
[24,] 0.69225182 0.92653382
[25,] 1.56836889 0.69225182
[26,] -1.64064296 1.56836889
[27,] -8.80818860 -1.64064296
[28,] -9.76917676 -8.80818860
[29,] -8.82917676 -9.76917676
[30,] -9.04104574 -8.82917676
[31,] -10.08060533 -9.04104574
[32,] -11.26685295 -10.08060533
[33,] -6.25236677 -11.26685295
[34,] -4.69736677 -6.25236677
[35,] -4.75736677 -4.69736677
[36,] -6.51164878 -4.75736677
[37,] -8.90835122 -6.51164878
[38,] -7.25736307 -8.90835122
[39,] -9.16490871 -7.25736307
[40,] -4.67307735 -9.16490871
[41,] -8.32307735 -4.67307735
[42,] -7.81776585 -8.32307735
[43,] -3.84450592 -7.81776585
[44,] -2.00075355 -3.84450592
[45,] 5.18091312 -2.00075355
[46,] 1.16591312 5.18091312
[47,] -3.57408688 1.16591312
[48,] -2.06836889 -3.57408688
[49,] -1.76225182 -2.06836889
[50,] 3.76591682 -1.76225182
[51,] 1.16837118 3.76591682
[52,] -2.75979746 1.16837118
[53,] 2.66020254 -2.75979746
[54,] 2.89551404 2.66020254
[55,] 8.51877397 2.89551404
[56,] 8.90252634 8.51877397
[57,] 5.64419301 8.90252634
[58,] 4.70919301 5.64419301
[59,] 5.27919301 4.70919301
[60,] 8.13491100 5.27919301
[61,] 4.59102807 8.13491100
[62,] 2.76637720 4.59102807
[63,] 10.57165107 2.76637720
[64,] 9.85348243 10.57165107
[65,] 7.76348243 9.85348243
[66,] 10.47879393 7.76348243
[67,] 8.99205386 10.47879393
[68,] -0.60419377 8.99205386
[69,] -3.91252710 -0.60419377
[70,] -0.47752710 -3.91252710
[71,] 2.10247290 -0.47752710
[72,] -9.98180911 2.10247290
[73,] -6.65569204 -9.98180911
[74,] -4.51752340 -6.65569204
[75,] -0.67506904 -4.51752340
[76,] -1.30323768 -0.67506904
[77,] 1.63676232 -1.30323768
[78,] 5.02207382 1.63676232
[79,] -2.09466625 5.02207382
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 13.58180911 12.25569204
2 8.22997775 13.58180911
3 7.79243211 8.22997775
4 10.09426346 7.79243211
5 8.73426346 10.09426346
6 2.99957496 8.73426346
7 3.12283489 2.99957496
8 6.13940678 3.12283489
9 0.49825393 6.13940678
10 1.24325393 0.49825393
11 0.02325393 1.24325393
12 -2.52102807 0.02325393
13 -2.41491100 -2.52102807
14 -1.34674236 -2.41491100
15 -0.88428800 -1.34674236
16 -1.44245665 -0.88428800
17 -3.64245665 -1.44245665
18 -4.53714515 -3.64245665
19 -4.61388522 -4.53714515
20 -1.17013284 -4.61388522
21 -1.15846618 -1.17013284
22 -1.94346618 -1.15846618
23 0.92653382 -1.94346618
24 0.69225182 0.92653382
25 1.56836889 0.69225182
26 -1.64064296 1.56836889
27 -8.80818860 -1.64064296
28 -9.76917676 -8.80818860
29 -8.82917676 -9.76917676
30 -9.04104574 -8.82917676
31 -10.08060533 -9.04104574
32 -11.26685295 -10.08060533
33 -6.25236677 -11.26685295
34 -4.69736677 -6.25236677
35 -4.75736677 -4.69736677
36 -6.51164878 -4.75736677
37 -8.90835122 -6.51164878
38 -7.25736307 -8.90835122
39 -9.16490871 -7.25736307
40 -4.67307735 -9.16490871
41 -8.32307735 -4.67307735
42 -7.81776585 -8.32307735
43 -3.84450592 -7.81776585
44 -2.00075355 -3.84450592
45 5.18091312 -2.00075355
46 1.16591312 5.18091312
47 -3.57408688 1.16591312
48 -2.06836889 -3.57408688
49 -1.76225182 -2.06836889
50 3.76591682 -1.76225182
51 1.16837118 3.76591682
52 -2.75979746 1.16837118
53 2.66020254 -2.75979746
54 2.89551404 2.66020254
55 8.51877397 2.89551404
56 8.90252634 8.51877397
57 5.64419301 8.90252634
58 4.70919301 5.64419301
59 5.27919301 4.70919301
60 8.13491100 5.27919301
61 4.59102807 8.13491100
62 2.76637720 4.59102807
63 10.57165107 2.76637720
64 9.85348243 10.57165107
65 7.76348243 9.85348243
66 10.47879393 7.76348243
67 8.99205386 10.47879393
68 -0.60419377 8.99205386
69 -3.91252710 -0.60419377
70 -0.47752710 -3.91252710
71 2.10247290 -0.47752710
72 -9.98180911 2.10247290
73 -6.65569204 -9.98180911
74 -4.51752340 -6.65569204
75 -0.67506904 -4.51752340
76 -1.30323768 -0.67506904
77 1.63676232 -1.30323768
78 5.02207382 1.63676232
79 -2.09466625 5.02207382
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/7xkwy1197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/81h8i1197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/9oj241197899271.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> load(file='/var/www/html/rcomp/createtable')
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/10eh5y1197899272.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/11vz591197899272.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/12fyuw1197899272.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/13tu1d1197899272.tab")
>
> system("convert tmp/1mcim1197899271.ps tmp/1mcim1197899271.png")
> system("convert tmp/2a6zw1197899271.ps tmp/2a6zw1197899271.png")
> system("convert tmp/3b5b21197899271.ps tmp/3b5b21197899271.png")
> system("convert tmp/4vha41197899271.ps tmp/4vha41197899271.png")
> system("convert tmp/5iwt91197899271.ps tmp/5iwt91197899271.png")
> system("convert tmp/6qrs31197899271.ps tmp/6qrs31197899271.png")
> system("convert tmp/7xkwy1197899271.ps tmp/7xkwy1197899271.png")
> system("convert tmp/81h8i1197899271.ps tmp/81h8i1197899271.png")
> system("convert tmp/9oj241197899271.ps tmp/9oj241197899271.png")
>
>
> proc.time()
user system elapsed
2.287 1.436 2.648