R version 2.7.0 (2008-04-22)
Copyright (C) 2008 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(3030.29
+ ,0
+ ,2803.47
+ ,0
+ ,2767.63
+ ,0
+ ,2882.6
+ ,0
+ ,2863.36
+ ,0
+ ,2897.06
+ ,0
+ ,3012.61
+ ,0
+ ,3142.95
+ ,0
+ ,3032.93
+ ,0
+ ,3045.78
+ ,0
+ ,3110.52
+ ,0
+ ,3013.24
+ ,0
+ ,2987.1
+ ,0
+ ,2995.55
+ ,0
+ ,2833.18
+ ,0
+ ,2848.96
+ ,0
+ ,2794.83
+ ,0
+ ,2845.26
+ ,0
+ ,2915.02
+ ,0
+ ,2892.63
+ ,0
+ ,2604.42
+ ,0
+ ,2641.65
+ ,0
+ ,2659.81
+ ,0
+ ,2638.53
+ ,0
+ ,2720.25
+ ,0
+ ,2745.88
+ ,0
+ ,2735.7
+ ,0
+ ,2811.7
+ ,0
+ ,2799.43
+ ,0
+ ,2555.28
+ ,0
+ ,2304.98
+ ,0
+ ,2214.95
+ ,0
+ ,2065.81
+ ,0
+ ,1940.49
+ ,0
+ ,2042
+ ,0
+ ,1995.37
+ ,0
+ ,1946.81
+ ,0
+ ,1765.9
+ ,0
+ ,1635.25
+ ,0
+ ,1833.42
+ ,0
+ ,1910.43
+ ,0
+ ,1959.67
+ ,0
+ ,1969.6
+ ,0
+ ,2061.41
+ ,0
+ ,2093.48
+ ,0
+ ,2120.88
+ ,0
+ ,2174.56
+ ,0
+ ,2196.72
+ ,0
+ ,2350.44
+ ,0
+ ,2440.25
+ ,0
+ ,2408.64
+ ,0
+ ,2472.81
+ ,0
+ ,2407.6
+ ,0
+ ,2454.62
+ ,0
+ ,2448.05
+ ,0
+ ,2497.84
+ ,0
+ ,2645.64
+ ,0
+ ,2756.76
+ ,0
+ ,2849.27
+ ,0
+ ,2921.44
+ ,0
+ ,2981.85
+ ,0
+ ,3080.58
+ ,0
+ ,3106.22
+ ,0
+ ,3119.31
+ ,0
+ ,3061.26
+ ,0
+ ,3097.31
+ ,0
+ ,3161.69
+ ,0
+ ,3257.16
+ ,0
+ ,3277.01
+ ,0
+ ,3295.32
+ ,0
+ ,3363.99
+ ,0
+ ,3494.17
+ ,0
+ ,3667.03
+ ,0
+ ,3813.06
+ ,0
+ ,3917.96
+ ,0
+ ,3895.51
+ ,0
+ ,3801.06
+ ,0
+ ,3570.12
+ ,0
+ ,3701.61
+ ,0
+ ,3862.27
+ ,0
+ ,3970.1
+ ,0
+ ,4138.52
+ ,0
+ ,4199.75
+ ,0
+ ,4290.89
+ ,0
+ ,4443.91
+ ,0
+ ,4502.64
+ ,0
+ ,4356.98
+ ,0
+ ,4591.27
+ ,0
+ ,4696.96
+ ,0
+ ,4621.4
+ ,0
+ ,4562.84
+ ,0
+ ,4202.52
+ ,0
+ ,4296.49
+ ,0
+ ,4435.23
+ ,0
+ ,4105.18
+ ,0
+ ,4116.68
+ ,0
+ ,3844.49
+ ,1
+ ,3720.98
+ ,1
+ ,3674.4
+ ,1
+ ,3857.62
+ ,1
+ ,3801.06
+ ,1
+ ,3504.37
+ ,1
+ ,3032.6
+ ,1
+ ,3047.03
+ ,1
+ ,2962.34
+ ,1
+ ,2197.82
+ ,1
+ ,2014.45
+ ,1)
+ ,dim=c(2
+ ,107)
+ ,dimnames=list(c('BEL-20'
+ ,'Wel(1)_geen(0)_financiële_crisis')
+ ,1:107))
> y <- array(NA,dim=c(2,107),dimnames=list(c('BEL-20','Wel(1)_geen(0)_financiële_crisis'),1:107))
> 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
BEL-20 Wel(1)_geen(0)_financi\353le_crisis M1 M2 M3 M4 M5 M6 M7 M8 M9 M10
1 3030.29 0 1 0 0 0 0 0 0 0 0 0
2 2803.47 0 0 1 0 0 0 0 0 0 0 0
3 2767.63 0 0 0 1 0 0 0 0 0 0 0
4 2882.60 0 0 0 0 1 0 0 0 0 0 0
5 2863.36 0 0 0 0 0 1 0 0 0 0 0
6 2897.06 0 0 0 0 0 0 1 0 0 0 0
7 3012.61 0 0 0 0 0 0 0 1 0 0 0
8 3142.95 0 0 0 0 0 0 0 0 1 0 0
9 3032.93 0 0 0 0 0 0 0 0 0 1 0
10 3045.78 0 0 0 0 0 0 0 0 0 0 1
11 3110.52 0 0 0 0 0 0 0 0 0 0 0
12 3013.24 0 0 0 0 0 0 0 0 0 0 0
13 2987.10 0 1 0 0 0 0 0 0 0 0 0
14 2995.55 0 0 1 0 0 0 0 0 0 0 0
15 2833.18 0 0 0 1 0 0 0 0 0 0 0
16 2848.96 0 0 0 0 1 0 0 0 0 0 0
17 2794.83 0 0 0 0 0 1 0 0 0 0 0
18 2845.26 0 0 0 0 0 0 1 0 0 0 0
19 2915.02 0 0 0 0 0 0 0 1 0 0 0
20 2892.63 0 0 0 0 0 0 0 0 1 0 0
21 2604.42 0 0 0 0 0 0 0 0 0 1 0
22 2641.65 0 0 0 0 0 0 0 0 0 0 1
23 2659.81 0 0 0 0 0 0 0 0 0 0 0
24 2638.53 0 0 0 0 0 0 0 0 0 0 0
25 2720.25 0 1 0 0 0 0 0 0 0 0 0
26 2745.88 0 0 1 0 0 0 0 0 0 0 0
27 2735.70 0 0 0 1 0 0 0 0 0 0 0
28 2811.70 0 0 0 0 1 0 0 0 0 0 0
29 2799.43 0 0 0 0 0 1 0 0 0 0 0
30 2555.28 0 0 0 0 0 0 1 0 0 0 0
31 2304.98 0 0 0 0 0 0 0 1 0 0 0
32 2214.95 0 0 0 0 0 0 0 0 1 0 0
33 2065.81 0 0 0 0 0 0 0 0 0 1 0
34 1940.49 0 0 0 0 0 0 0 0 0 0 1
35 2042.00 0 0 0 0 0 0 0 0 0 0 0
36 1995.37 0 0 0 0 0 0 0 0 0 0 0
37 1946.81 0 1 0 0 0 0 0 0 0 0 0
38 1765.90 0 0 1 0 0 0 0 0 0 0 0
39 1635.25 0 0 0 1 0 0 0 0 0 0 0
40 1833.42 0 0 0 0 1 0 0 0 0 0 0
41 1910.43 0 0 0 0 0 1 0 0 0 0 0
42 1959.67 0 0 0 0 0 0 1 0 0 0 0
43 1969.60 0 0 0 0 0 0 0 1 0 0 0
44 2061.41 0 0 0 0 0 0 0 0 1 0 0
45 2093.48 0 0 0 0 0 0 0 0 0 1 0
46 2120.88 0 0 0 0 0 0 0 0 0 0 1
47 2174.56 0 0 0 0 0 0 0 0 0 0 0
48 2196.72 0 0 0 0 0 0 0 0 0 0 0
49 2350.44 0 1 0 0 0 0 0 0 0 0 0
50 2440.25 0 0 1 0 0 0 0 0 0 0 0
51 2408.64 0 0 0 1 0 0 0 0 0 0 0
52 2472.81 0 0 0 0 1 0 0 0 0 0 0
53 2407.60 0 0 0 0 0 1 0 0 0 0 0
54 2454.62 0 0 0 0 0 0 1 0 0 0 0
55 2448.05 0 0 0 0 0 0 0 1 0 0 0
56 2497.84 0 0 0 0 0 0 0 0 1 0 0
57 2645.64 0 0 0 0 0 0 0 0 0 1 0
58 2756.76 0 0 0 0 0 0 0 0 0 0 1
59 2849.27 0 0 0 0 0 0 0 0 0 0 0
60 2921.44 0 0 0 0 0 0 0 0 0 0 0
61 2981.85 0 1 0 0 0 0 0 0 0 0 0
62 3080.58 0 0 1 0 0 0 0 0 0 0 0
63 3106.22 0 0 0 1 0 0 0 0 0 0 0
64 3119.31 0 0 0 0 1 0 0 0 0 0 0
65 3061.26 0 0 0 0 0 1 0 0 0 0 0
66 3097.31 0 0 0 0 0 0 1 0 0 0 0
67 3161.69 0 0 0 0 0 0 0 1 0 0 0
68 3257.16 0 0 0 0 0 0 0 0 1 0 0
69 3277.01 0 0 0 0 0 0 0 0 0 1 0
70 3295.32 0 0 0 0 0 0 0 0 0 0 1
71 3363.99 0 0 0 0 0 0 0 0 0 0 0
72 3494.17 0 0 0 0 0 0 0 0 0 0 0
73 3667.03 0 1 0 0 0 0 0 0 0 0 0
74 3813.06 0 0 1 0 0 0 0 0 0 0 0
75 3917.96 0 0 0 1 0 0 0 0 0 0 0
76 3895.51 0 0 0 0 1 0 0 0 0 0 0
77 3801.06 0 0 0 0 0 1 0 0 0 0 0
78 3570.12 0 0 0 0 0 0 1 0 0 0 0
79 3701.61 0 0 0 0 0 0 0 1 0 0 0
80 3862.27 0 0 0 0 0 0 0 0 1 0 0
81 3970.10 0 0 0 0 0 0 0 0 0 1 0
82 4138.52 0 0 0 0 0 0 0 0 0 0 1
83 4199.75 0 0 0 0 0 0 0 0 0 0 0
84 4290.89 0 0 0 0 0 0 0 0 0 0 0
85 4443.91 0 1 0 0 0 0 0 0 0 0 0
86 4502.64 0 0 1 0 0 0 0 0 0 0 0
87 4356.98 0 0 0 1 0 0 0 0 0 0 0
88 4591.27 0 0 0 0 1 0 0 0 0 0 0
89 4696.96 0 0 0 0 0 1 0 0 0 0 0
90 4621.40 0 0 0 0 0 0 1 0 0 0 0
91 4562.84 0 0 0 0 0 0 0 1 0 0 0
92 4202.52 0 0 0 0 0 0 0 0 1 0 0
93 4296.49 0 0 0 0 0 0 0 0 0 1 0
94 4435.23 0 0 0 0 0 0 0 0 0 0 1
95 4105.18 0 0 0 0 0 0 0 0 0 0 0
96 4116.68 0 0 0 0 0 0 0 0 0 0 0
97 3844.49 1 1 0 0 0 0 0 0 0 0 0
98 3720.98 1 0 1 0 0 0 0 0 0 0 0
99 3674.40 1 0 0 1 0 0 0 0 0 0 0
100 3857.62 1 0 0 0 1 0 0 0 0 0 0
101 3801.06 1 0 0 0 0 1 0 0 0 0 0
102 3504.37 1 0 0 0 0 0 1 0 0 0 0
103 3032.60 1 0 0 0 0 0 0 1 0 0 0
104 3047.03 1 0 0 0 0 0 0 0 1 0 0
105 2962.34 1 0 0 0 0 0 0 0 0 1 0
106 2197.82 1 0 0 0 0 0 0 0 0 0 1
107 2014.45 1 0 0 0 0 0 0 0 0 0 0
M11 t
1 0 1
2 0 2
3 0 3
4 0 4
5 0 5
6 0 6
7 0 7
8 0 8
9 0 9
10 0 10
11 1 11
12 0 12
13 0 13
14 0 14
15 0 15
16 0 16
17 0 17
18 0 18
19 0 19
20 0 20
21 0 21
22 0 22
23 1 23
24 0 24
25 0 25
26 0 26
27 0 27
28 0 28
29 0 29
30 0 30
31 0 31
32 0 32
33 0 33
34 0 34
35 1 35
36 0 36
37 0 37
38 0 38
39 0 39
40 0 40
41 0 41
42 0 42
43 0 43
44 0 44
45 0 45
46 0 46
47 1 47
48 0 48
49 0 49
50 0 50
51 0 51
52 0 52
53 0 53
54 0 54
55 0 55
56 0 56
57 0 57
58 0 58
59 1 59
60 0 60
61 0 61
62 0 62
63 0 63
64 0 64
65 0 65
66 0 66
67 0 67
68 0 68
69 0 69
70 0 70
71 1 71
72 0 72
73 0 73
74 0 74
75 0 75
76 0 76
77 0 77
78 0 78
79 0 79
80 0 80
81 0 81
82 0 82
83 1 83
84 0 84
85 0 85
86 0 86
87 0 87
88 0 88
89 0 89
90 0 90
91 0 91
92 0 92
93 0 93
94 0 94
95 1 95
96 0 96
97 0 97
98 0 98
99 0 99
100 0 100
101 0 101
102 0 102
103 0 103
104 0 104
105 0 105
106 0 106
107 1 107
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Wel(1)_geen(0)_financi\353le_crisis`
2091.239 -772.189
M1 M2
202.303 172.390
M3 M4
105.978 185.076
M5 M6
147.013 58.540
M7 M8
-3.843 -14.465
M9 M10
-58.453 -118.579
M11 t
-142.832 18.373
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1278.51 -442.08 80.08 478.93 960.01
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2091.239 255.318 8.191 1.35e-12 ***
`Wel(1)_geen(0)_financi\353le_crisis` -772.189 237.103 -3.257 0.00157 **
M1 202.303 307.143 0.659 0.51174
M2 172.390 306.957 0.562 0.57573
M3 105.978 306.789 0.345 0.73054
M4 185.076 306.638 0.604 0.54760
M5 147.013 306.505 0.480 0.63261
M6 58.540 306.390 0.191 0.84889
M7 -3.843 306.292 -0.013 0.99002
M8 -14.465 306.212 -0.047 0.96242
M9 -58.453 306.150 -0.191 0.84900
M10 -118.579 306.105 -0.387 0.69936
M11 -142.832 306.079 -0.467 0.64184
t 18.373 2.332 7.879 6.06e-12 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 628.2 on 93 degrees of freedom
Multiple R-squared: 0.409, Adjusted R-squared: 0.3264
F-statistic: 4.95 on 13 and 93 DF, p-value: 1.557e-06
> postscript(file="/var/www/html/rcomp/tmp/1pusy1229005467.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/2zo8g1229005467.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/31wrc1229005467.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/4sbf31229005467.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/57d6i1229005467.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 = 107
Frequency = 1
1 2 3 4 5 6
718.375619 503.095619 515.294508 532.793396 533.243396 637.043396
7 8 9 10 11 12
796.603396 919.192285 834.787841 889.390063 960.010063 701.525417
13 14 15 16 17 18
454.709785 474.699785 360.368674 278.677563 244.237563 364.767563
19 20 21 22 23 24
478.537563 448.396452 185.802008 264.784230 288.824230 106.339583
25 26 27 28 29 30
-32.616048 4.553952 42.412841 20.941730 28.361730 -145.688270
31 32 33 34 35 36
-351.978270 -449.759381 -573.283826 -656.851604 -549.461604 -757.296250
37 38 39 40 41 42
-1026.531881 -1195.901881 -1278.512992 -1177.814104 -1081.114104 -961.774104
43 44 45 46 47 48
-907.834104 -823.775215 -766.089659 -696.937437 -637.377437 -776.422083
49 50 51 52 53 54
-843.377715 -742.027715 -725.598826 -758.899937 -804.419937 -687.299937
55 56 57 58 59 60
-649.859937 -607.821048 -434.405492 -281.533270 -183.143270 -272.177917
61 62 63 64 65 66
-432.443548 -322.173548 -248.494659 -332.875770 -371.235770 -265.085770
67 68 69 70 71 72
-156.695770 -68.976881 -23.511326 36.550896 111.100896 80.076250
73 74 75 76 77 78
32.260619 189.830619 342.769508 222.848396 148.088396 -12.751604
79 80 81 82 83 84
162.748396 315.657285 449.102841 659.275063 726.385063 656.320417
85 86 87 88 89 90
588.664785 658.934785 561.313674 698.132563 823.512563 818.052563
91 92 93 94 95 96
803.502563 435.431452 555.017008 735.509230 411.339230 261.634583
97 98 99 100 101 102
540.958384 428.988384 430.447273 516.196162 479.326162 252.736162
103 104 105 106 107
-175.023838 -168.344949 -227.419394 -950.187172 -1127.677172
> postscript(file="/var/www/html/rcomp/tmp/6wqu21229005467.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 = 107
Frequency = 1
lag(myerror, k = 1) myerror
0 718.375619 NA
1 503.095619 718.375619
2 515.294508 503.095619
3 532.793396 515.294508
4 533.243396 532.793396
5 637.043396 533.243396
6 796.603396 637.043396
7 919.192285 796.603396
8 834.787841 919.192285
9 889.390063 834.787841
10 960.010063 889.390063
11 701.525417 960.010063
12 454.709785 701.525417
13 474.699785 454.709785
14 360.368674 474.699785
15 278.677563 360.368674
16 244.237563 278.677563
17 364.767563 244.237563
18 478.537563 364.767563
19 448.396452 478.537563
20 185.802008 448.396452
21 264.784230 185.802008
22 288.824230 264.784230
23 106.339583 288.824230
24 -32.616048 106.339583
25 4.553952 -32.616048
26 42.412841 4.553952
27 20.941730 42.412841
28 28.361730 20.941730
29 -145.688270 28.361730
30 -351.978270 -145.688270
31 -449.759381 -351.978270
32 -573.283826 -449.759381
33 -656.851604 -573.283826
34 -549.461604 -656.851604
35 -757.296250 -549.461604
36 -1026.531881 -757.296250
37 -1195.901881 -1026.531881
38 -1278.512992 -1195.901881
39 -1177.814104 -1278.512992
40 -1081.114104 -1177.814104
41 -961.774104 -1081.114104
42 -907.834104 -961.774104
43 -823.775215 -907.834104
44 -766.089659 -823.775215
45 -696.937437 -766.089659
46 -637.377437 -696.937437
47 -776.422083 -637.377437
48 -843.377715 -776.422083
49 -742.027715 -843.377715
50 -725.598826 -742.027715
51 -758.899937 -725.598826
52 -804.419937 -758.899937
53 -687.299937 -804.419937
54 -649.859937 -687.299937
55 -607.821048 -649.859937
56 -434.405492 -607.821048
57 -281.533270 -434.405492
58 -183.143270 -281.533270
59 -272.177917 -183.143270
60 -432.443548 -272.177917
61 -322.173548 -432.443548
62 -248.494659 -322.173548
63 -332.875770 -248.494659
64 -371.235770 -332.875770
65 -265.085770 -371.235770
66 -156.695770 -265.085770
67 -68.976881 -156.695770
68 -23.511326 -68.976881
69 36.550896 -23.511326
70 111.100896 36.550896
71 80.076250 111.100896
72 32.260619 80.076250
73 189.830619 32.260619
74 342.769508 189.830619
75 222.848396 342.769508
76 148.088396 222.848396
77 -12.751604 148.088396
78 162.748396 -12.751604
79 315.657285 162.748396
80 449.102841 315.657285
81 659.275063 449.102841
82 726.385063 659.275063
83 656.320417 726.385063
84 588.664785 656.320417
85 658.934785 588.664785
86 561.313674 658.934785
87 698.132563 561.313674
88 823.512563 698.132563
89 818.052563 823.512563
90 803.502563 818.052563
91 435.431452 803.502563
92 555.017008 435.431452
93 735.509230 555.017008
94 411.339230 735.509230
95 261.634583 411.339230
96 540.958384 261.634583
97 428.988384 540.958384
98 430.447273 428.988384
99 516.196162 430.447273
100 479.326162 516.196162
101 252.736162 479.326162
102 -175.023838 252.736162
103 -168.344949 -175.023838
104 -227.419394 -168.344949
105 -950.187172 -227.419394
106 -1127.677172 -950.187172
107 NA -1127.677172
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 503.095619 718.375619
[2,] 515.294508 503.095619
[3,] 532.793396 515.294508
[4,] 533.243396 532.793396
[5,] 637.043396 533.243396
[6,] 796.603396 637.043396
[7,] 919.192285 796.603396
[8,] 834.787841 919.192285
[9,] 889.390063 834.787841
[10,] 960.010063 889.390063
[11,] 701.525417 960.010063
[12,] 454.709785 701.525417
[13,] 474.699785 454.709785
[14,] 360.368674 474.699785
[15,] 278.677563 360.368674
[16,] 244.237563 278.677563
[17,] 364.767563 244.237563
[18,] 478.537563 364.767563
[19,] 448.396452 478.537563
[20,] 185.802008 448.396452
[21,] 264.784230 185.802008
[22,] 288.824230 264.784230
[23,] 106.339583 288.824230
[24,] -32.616048 106.339583
[25,] 4.553952 -32.616048
[26,] 42.412841 4.553952
[27,] 20.941730 42.412841
[28,] 28.361730 20.941730
[29,] -145.688270 28.361730
[30,] -351.978270 -145.688270
[31,] -449.759381 -351.978270
[32,] -573.283826 -449.759381
[33,] -656.851604 -573.283826
[34,] -549.461604 -656.851604
[35,] -757.296250 -549.461604
[36,] -1026.531881 -757.296250
[37,] -1195.901881 -1026.531881
[38,] -1278.512992 -1195.901881
[39,] -1177.814104 -1278.512992
[40,] -1081.114104 -1177.814104
[41,] -961.774104 -1081.114104
[42,] -907.834104 -961.774104
[43,] -823.775215 -907.834104
[44,] -766.089659 -823.775215
[45,] -696.937437 -766.089659
[46,] -637.377437 -696.937437
[47,] -776.422083 -637.377437
[48,] -843.377715 -776.422083
[49,] -742.027715 -843.377715
[50,] -725.598826 -742.027715
[51,] -758.899937 -725.598826
[52,] -804.419937 -758.899937
[53,] -687.299937 -804.419937
[54,] -649.859937 -687.299937
[55,] -607.821048 -649.859937
[56,] -434.405492 -607.821048
[57,] -281.533270 -434.405492
[58,] -183.143270 -281.533270
[59,] -272.177917 -183.143270
[60,] -432.443548 -272.177917
[61,] -322.173548 -432.443548
[62,] -248.494659 -322.173548
[63,] -332.875770 -248.494659
[64,] -371.235770 -332.875770
[65,] -265.085770 -371.235770
[66,] -156.695770 -265.085770
[67,] -68.976881 -156.695770
[68,] -23.511326 -68.976881
[69,] 36.550896 -23.511326
[70,] 111.100896 36.550896
[71,] 80.076250 111.100896
[72,] 32.260619 80.076250
[73,] 189.830619 32.260619
[74,] 342.769508 189.830619
[75,] 222.848396 342.769508
[76,] 148.088396 222.848396
[77,] -12.751604 148.088396
[78,] 162.748396 -12.751604
[79,] 315.657285 162.748396
[80,] 449.102841 315.657285
[81,] 659.275063 449.102841
[82,] 726.385063 659.275063
[83,] 656.320417 726.385063
[84,] 588.664785 656.320417
[85,] 658.934785 588.664785
[86,] 561.313674 658.934785
[87,] 698.132563 561.313674
[88,] 823.512563 698.132563
[89,] 818.052563 823.512563
[90,] 803.502563 818.052563
[91,] 435.431452 803.502563
[92,] 555.017008 435.431452
[93,] 735.509230 555.017008
[94,] 411.339230 735.509230
[95,] 261.634583 411.339230
[96,] 540.958384 261.634583
[97,] 428.988384 540.958384
[98,] 430.447273 428.988384
[99,] 516.196162 430.447273
[100,] 479.326162 516.196162
[101,] 252.736162 479.326162
[102,] -175.023838 252.736162
[103,] -168.344949 -175.023838
[104,] -227.419394 -168.344949
[105,] -950.187172 -227.419394
[106,] -1127.677172 -950.187172
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 503.095619 718.375619
2 515.294508 503.095619
3 532.793396 515.294508
4 533.243396 532.793396
5 637.043396 533.243396
6 796.603396 637.043396
7 919.192285 796.603396
8 834.787841 919.192285
9 889.390063 834.787841
10 960.010063 889.390063
11 701.525417 960.010063
12 454.709785 701.525417
13 474.699785 454.709785
14 360.368674 474.699785
15 278.677563 360.368674
16 244.237563 278.677563
17 364.767563 244.237563
18 478.537563 364.767563
19 448.396452 478.537563
20 185.802008 448.396452
21 264.784230 185.802008
22 288.824230 264.784230
23 106.339583 288.824230
24 -32.616048 106.339583
25 4.553952 -32.616048
26 42.412841 4.553952
27 20.941730 42.412841
28 28.361730 20.941730
29 -145.688270 28.361730
30 -351.978270 -145.688270
31 -449.759381 -351.978270
32 -573.283826 -449.759381
33 -656.851604 -573.283826
34 -549.461604 -656.851604
35 -757.296250 -549.461604
36 -1026.531881 -757.296250
37 -1195.901881 -1026.531881
38 -1278.512992 -1195.901881
39 -1177.814104 -1278.512992
40 -1081.114104 -1177.814104
41 -961.774104 -1081.114104
42 -907.834104 -961.774104
43 -823.775215 -907.834104
44 -766.089659 -823.775215
45 -696.937437 -766.089659
46 -637.377437 -696.937437
47 -776.422083 -637.377437
48 -843.377715 -776.422083
49 -742.027715 -843.377715
50 -725.598826 -742.027715
51 -758.899937 -725.598826
52 -804.419937 -758.899937
53 -687.299937 -804.419937
54 -649.859937 -687.299937
55 -607.821048 -649.859937
56 -434.405492 -607.821048
57 -281.533270 -434.405492
58 -183.143270 -281.533270
59 -272.177917 -183.143270
60 -432.443548 -272.177917
61 -322.173548 -432.443548
62 -248.494659 -322.173548
63 -332.875770 -248.494659
64 -371.235770 -332.875770
65 -265.085770 -371.235770
66 -156.695770 -265.085770
67 -68.976881 -156.695770
68 -23.511326 -68.976881
69 36.550896 -23.511326
70 111.100896 36.550896
71 80.076250 111.100896
72 32.260619 80.076250
73 189.830619 32.260619
74 342.769508 189.830619
75 222.848396 342.769508
76 148.088396 222.848396
77 -12.751604 148.088396
78 162.748396 -12.751604
79 315.657285 162.748396
80 449.102841 315.657285
81 659.275063 449.102841
82 726.385063 659.275063
83 656.320417 726.385063
84 588.664785 656.320417
85 658.934785 588.664785
86 561.313674 658.934785
87 698.132563 561.313674
88 823.512563 698.132563
89 818.052563 823.512563
90 803.502563 818.052563
91 435.431452 803.502563
92 555.017008 435.431452
93 735.509230 555.017008
94 411.339230 735.509230
95 261.634583 411.339230
96 540.958384 261.634583
97 428.988384 540.958384
98 430.447273 428.988384
99 516.196162 430.447273
100 479.326162 516.196162
101 252.736162 479.326162
102 -175.023838 252.736162
103 -168.344949 -175.023838
104 -227.419394 -168.344949
105 -950.187172 -227.419394
106 -1127.677172 -950.187172
> 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/7maxi1229005467.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/83e0j1229005467.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/9oe5s1229005467.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
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> 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/10ewes1229005467.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/116b121229005467.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/12c6l11229005467.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/132v191229005467.tab")
>
> system("convert tmp/1pusy1229005467.ps tmp/1pusy1229005467.png")
> system("convert tmp/2zo8g1229005467.ps tmp/2zo8g1229005467.png")
> system("convert tmp/31wrc1229005467.ps tmp/31wrc1229005467.png")
> system("convert tmp/4sbf31229005467.ps tmp/4sbf31229005467.png")
> system("convert tmp/57d6i1229005467.ps tmp/57d6i1229005467.png")
> system("convert tmp/6wqu21229005467.ps tmp/6wqu21229005467.png")
> system("convert tmp/7maxi1229005467.ps tmp/7maxi1229005467.png")
> system("convert tmp/83e0j1229005467.ps tmp/83e0j1229005467.png")
> system("convert tmp/9oe5s1229005467.ps tmp/9oe5s1229005467.png")
>
>
> proc.time()
user system elapsed
4.232 2.542 4.590