R version 2.8.0 (2008-10-20)
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.
Natural language support but running in an English locale
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(27951
+ ,6.4
+ ,29781
+ ,7.7
+ ,32914
+ ,9.2
+ ,33488
+ ,8.6
+ ,35652
+ ,7.4
+ ,36488
+ ,8.6
+ ,35387
+ ,6.2
+ ,35676
+ ,6
+ ,34844
+ ,6.6
+ ,32447
+ ,5.1
+ ,31068
+ ,4.7
+ ,29010
+ ,5
+ ,29812
+ ,3.6
+ ,30951
+ ,1.9
+ ,32974
+ ,-0.1
+ ,32936
+ ,-5.7
+ ,34012
+ ,-5.6
+ ,32946
+ ,-6.4
+ ,31948
+ ,-7.7
+ ,30599
+ ,-8
+ ,27691
+ ,-11.9
+ ,25073
+ ,-15.4
+ ,23406
+ ,-15.5
+ ,22248
+ ,-13.4
+ ,22896
+ ,-10.9
+ ,25317
+ ,-10.8
+ ,26558
+ ,-7.3
+ ,26471
+ ,-6.5
+ ,27543
+ ,-5.1
+ ,26198
+ ,-5.3
+ ,24725
+ ,-6.8
+ ,25005
+ ,-8.4
+ ,23462
+ ,-8.4
+ ,20780
+ ,-9.7
+ ,19815
+ ,-8.8
+ ,19761
+ ,-9.6
+ ,21454
+ ,-11.5
+ ,23899
+ ,-11
+ ,24939
+ ,-14.9
+ ,23580
+ ,-16.2
+ ,24562
+ ,-14.4
+ ,24696
+ ,-17.3
+ ,23785
+ ,-15.7
+ ,23812
+ ,-12.6
+ ,21917
+ ,-9.4
+ ,19713
+ ,-8.1
+ ,19282
+ ,-5.4
+ ,18788
+ ,-4.6
+ ,21453
+ ,-4.9
+ ,24482
+ ,-4
+ ,27474
+ ,-3.1
+ ,27264
+ ,-1.3
+ ,27349
+ ,0
+ ,30632
+ ,-0.4
+ ,29429
+ ,3
+ ,30084
+ ,0.4
+ ,26290
+ ,1.2
+ ,24379
+ ,0.6
+ ,23335
+ ,-1.3
+ ,21346
+ ,-3.2
+ ,21106
+ ,-1.8
+ ,24514
+ ,-3.6
+ ,28353
+ ,-4.2
+ ,30805
+ ,-6.9
+ ,31348
+ ,-8
+ ,34556
+ ,-7.5
+ ,33855
+ ,-8.2
+ ,34787
+ ,-7.6
+ ,32529
+ ,-3.7
+ ,29998
+ ,-1.7
+ ,29257
+ ,-0.7
+ ,28155
+ ,0.2
+ ,30466
+ ,0.6
+ ,35704
+ ,2.2
+ ,39327
+ ,3.3
+ ,39351
+ ,5.3
+ ,42234
+ ,5.5
+ ,43630
+ ,6.3
+ ,43722
+ ,7.7
+ ,43121
+ ,6.5
+ ,37985
+ ,5.5
+ ,37135
+ ,6.9
+ ,34646
+ ,5.7
+ ,33026
+ ,6.9
+ ,35087
+ ,6.1
+ ,38846
+ ,4.8
+ ,42013
+ ,3.7
+ ,43908
+ ,5.8
+ ,42868
+ ,6.8
+ ,44423
+ ,8.5
+ ,44167
+ ,7.2
+ ,43636
+ ,5
+ ,44382
+ ,4.7
+ ,42142
+ ,2.3
+ ,43452
+ ,2.4
+ ,36912
+ ,0.1
+ ,42413
+ ,1.9
+ ,45344
+ ,1.7
+ ,44873
+ ,2
+ ,47510
+ ,-1.9
+ ,49554
+ ,0.5
+ ,47369
+ ,-1.3
+ ,45998
+ ,-3.3
+ ,48140
+ ,-2.8
+ ,48441
+ ,-8
+ ,44928
+ ,-13.9
+ ,40454
+ ,-21.9
+ ,38661
+ ,-28.8
+ ,37246
+ ,-27.6
+ ,36843
+ ,-31.4
+ ,36424
+ ,-31.8
+ ,37594
+ ,-29.4
+ ,38144
+ ,-27.6
+ ,38737
+ ,-23.6
+ ,34560
+ ,-22.8
+ ,36080
+ ,-18.2
+ ,33508
+ ,-17.8
+ ,35462
+ ,-14.2
+ ,33374
+ ,-8.8
+ ,32110
+ ,-7.9
+ ,35533
+ ,-7
+ ,35532
+ ,-7
+ ,37903
+ ,-3.6
+ ,36763
+ ,-2.4
+ ,40399
+ ,-4.9
+ ,44164
+ ,-7.7
+ ,44496
+ ,-6.5
+ ,43110
+ ,-5.1
+ ,43880
+ ,-3.4)
+ ,dim=c(2
+ ,129)
+ ,dimnames=list(c('Vacatures'
+ ,'Ondernemersvertrouwen')
+ ,1:129))
> y <- array(NA,dim=c(2,129),dimnames=list(c('Vacatures','Ondernemersvertrouwen'),1:129))
> 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
Vacatures Ondernemersvertrouwen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 27951 6.4 1 0 0 0 0 0 0 0 0 0 0 1
2 29781 7.7 0 1 0 0 0 0 0 0 0 0 0 2
3 32914 9.2 0 0 1 0 0 0 0 0 0 0 0 3
4 33488 8.6 0 0 0 1 0 0 0 0 0 0 0 4
5 35652 7.4 0 0 0 0 1 0 0 0 0 0 0 5
6 36488 8.6 0 0 0 0 0 1 0 0 0 0 0 6
7 35387 6.2 0 0 0 0 0 0 1 0 0 0 0 7
8 35676 6.0 0 0 0 0 0 0 0 1 0 0 0 8
9 34844 6.6 0 0 0 0 0 0 0 0 1 0 0 9
10 32447 5.1 0 0 0 0 0 0 0 0 0 1 0 10
11 31068 4.7 0 0 0 0 0 0 0 0 0 0 1 11
12 29010 5.0 0 0 0 0 0 0 0 0 0 0 0 12
13 29812 3.6 1 0 0 0 0 0 0 0 0 0 0 13
14 30951 1.9 0 1 0 0 0 0 0 0 0 0 0 14
15 32974 -0.1 0 0 1 0 0 0 0 0 0 0 0 15
16 32936 -5.7 0 0 0 1 0 0 0 0 0 0 0 16
17 34012 -5.6 0 0 0 0 1 0 0 0 0 0 0 17
18 32946 -6.4 0 0 0 0 0 1 0 0 0 0 0 18
19 31948 -7.7 0 0 0 0 0 0 1 0 0 0 0 19
20 30599 -8.0 0 0 0 0 0 0 0 1 0 0 0 20
21 27691 -11.9 0 0 0 0 0 0 0 0 1 0 0 21
22 25073 -15.4 0 0 0 0 0 0 0 0 0 1 0 22
23 23406 -15.5 0 0 0 0 0 0 0 0 0 0 1 23
24 22248 -13.4 0 0 0 0 0 0 0 0 0 0 0 24
25 22896 -10.9 1 0 0 0 0 0 0 0 0 0 0 25
26 25317 -10.8 0 1 0 0 0 0 0 0 0 0 0 26
27 26558 -7.3 0 0 1 0 0 0 0 0 0 0 0 27
28 26471 -6.5 0 0 0 1 0 0 0 0 0 0 0 28
29 27543 -5.1 0 0 0 0 1 0 0 0 0 0 0 29
30 26198 -5.3 0 0 0 0 0 1 0 0 0 0 0 30
31 24725 -6.8 0 0 0 0 0 0 1 0 0 0 0 31
32 25005 -8.4 0 0 0 0 0 0 0 1 0 0 0 32
33 23462 -8.4 0 0 0 0 0 0 0 0 1 0 0 33
34 20780 -9.7 0 0 0 0 0 0 0 0 0 1 0 34
35 19815 -8.8 0 0 0 0 0 0 0 0 0 0 1 35
36 19761 -9.6 0 0 0 0 0 0 0 0 0 0 0 36
37 21454 -11.5 1 0 0 0 0 0 0 0 0 0 0 37
38 23899 -11.0 0 1 0 0 0 0 0 0 0 0 0 38
39 24939 -14.9 0 0 1 0 0 0 0 0 0 0 0 39
40 23580 -16.2 0 0 0 1 0 0 0 0 0 0 0 40
41 24562 -14.4 0 0 0 0 1 0 0 0 0 0 0 41
42 24696 -17.3 0 0 0 0 0 1 0 0 0 0 0 42
43 23785 -15.7 0 0 0 0 0 0 1 0 0 0 0 43
44 23812 -12.6 0 0 0 0 0 0 0 1 0 0 0 44
45 21917 -9.4 0 0 0 0 0 0 0 0 1 0 0 45
46 19713 -8.1 0 0 0 0 0 0 0 0 0 1 0 46
47 19282 -5.4 0 0 0 0 0 0 0 0 0 0 1 47
48 18788 -4.6 0 0 0 0 0 0 0 0 0 0 0 48
49 21453 -4.9 1 0 0 0 0 0 0 0 0 0 0 49
50 24482 -4.0 0 1 0 0 0 0 0 0 0 0 0 50
51 27474 -3.1 0 0 1 0 0 0 0 0 0 0 0 51
52 27264 -1.3 0 0 0 1 0 0 0 0 0 0 0 52
53 27349 0.0 0 0 0 0 1 0 0 0 0 0 0 53
54 30632 -0.4 0 0 0 0 0 1 0 0 0 0 0 54
55 29429 3.0 0 0 0 0 0 0 1 0 0 0 0 55
56 30084 0.4 0 0 0 0 0 0 0 1 0 0 0 56
57 26290 1.2 0 0 0 0 0 0 0 0 1 0 0 57
58 24379 0.6 0 0 0 0 0 0 0 0 0 1 0 58
59 23335 -1.3 0 0 0 0 0 0 0 0 0 0 1 59
60 21346 -3.2 0 0 0 0 0 0 0 0 0 0 0 60
61 21106 -1.8 1 0 0 0 0 0 0 0 0 0 0 61
62 24514 -3.6 0 1 0 0 0 0 0 0 0 0 0 62
63 28353 -4.2 0 0 1 0 0 0 0 0 0 0 0 63
64 30805 -6.9 0 0 0 1 0 0 0 0 0 0 0 64
65 31348 -8.0 0 0 0 0 1 0 0 0 0 0 0 65
66 34556 -7.5 0 0 0 0 0 1 0 0 0 0 0 66
67 33855 -8.2 0 0 0 0 0 0 1 0 0 0 0 67
68 34787 -7.6 0 0 0 0 0 0 0 1 0 0 0 68
69 32529 -3.7 0 0 0 0 0 0 0 0 1 0 0 69
70 29998 -1.7 0 0 0 0 0 0 0 0 0 1 0 70
71 29257 -0.7 0 0 0 0 0 0 0 0 0 0 1 71
72 28155 0.2 0 0 0 0 0 0 0 0 0 0 0 72
73 30466 0.6 1 0 0 0 0 0 0 0 0 0 0 73
74 35704 2.2 0 1 0 0 0 0 0 0 0 0 0 74
75 39327 3.3 0 0 1 0 0 0 0 0 0 0 0 75
76 39351 5.3 0 0 0 1 0 0 0 0 0 0 0 76
77 42234 5.5 0 0 0 0 1 0 0 0 0 0 0 77
78 43630 6.3 0 0 0 0 0 1 0 0 0 0 0 78
79 43722 7.7 0 0 0 0 0 0 1 0 0 0 0 79
80 43121 6.5 0 0 0 0 0 0 0 1 0 0 0 80
81 37985 5.5 0 0 0 0 0 0 0 0 1 0 0 81
82 37135 6.9 0 0 0 0 0 0 0 0 0 1 0 82
83 34646 5.7 0 0 0 0 0 0 0 0 0 0 1 83
84 33026 6.9 0 0 0 0 0 0 0 0 0 0 0 84
85 35087 6.1 1 0 0 0 0 0 0 0 0 0 0 85
86 38846 4.8 0 1 0 0 0 0 0 0 0 0 0 86
87 42013 3.7 0 0 1 0 0 0 0 0 0 0 0 87
88 43908 5.8 0 0 0 1 0 0 0 0 0 0 0 88
89 42868 6.8 0 0 0 0 1 0 0 0 0 0 0 89
90 44423 8.5 0 0 0 0 0 1 0 0 0 0 0 90
91 44167 7.2 0 0 0 0 0 0 1 0 0 0 0 91
92 43636 5.0 0 0 0 0 0 0 0 1 0 0 0 92
93 44382 4.7 0 0 0 0 0 0 0 0 1 0 0 93
94 42142 2.3 0 0 0 0 0 0 0 0 0 1 0 94
95 43452 2.4 0 0 0 0 0 0 0 0 0 0 1 95
96 36912 0.1 0 0 0 0 0 0 0 0 0 0 0 96
97 42413 1.9 1 0 0 0 0 0 0 0 0 0 0 97
98 45344 1.7 0 1 0 0 0 0 0 0 0 0 0 98
99 44873 2.0 0 0 1 0 0 0 0 0 0 0 0 99
100 47510 -1.9 0 0 0 1 0 0 0 0 0 0 0 100
101 49554 0.5 0 0 0 0 1 0 0 0 0 0 0 101
102 47369 -1.3 0 0 0 0 0 1 0 0 0 0 0 102
103 45998 -3.3 0 0 0 0 0 0 1 0 0 0 0 103
104 48140 -2.8 0 0 0 0 0 0 0 1 0 0 0 104
105 48441 -8.0 0 0 0 0 0 0 0 0 1 0 0 105
106 44928 -13.9 0 0 0 0 0 0 0 0 0 1 0 106
107 40454 -21.9 0 0 0 0 0 0 0 0 0 0 1 107
108 38661 -28.8 0 0 0 0 0 0 0 0 0 0 0 108
109 37246 -27.6 1 0 0 0 0 0 0 0 0 0 0 109
110 36843 -31.4 0 1 0 0 0 0 0 0 0 0 0 110
111 36424 -31.8 0 0 1 0 0 0 0 0 0 0 0 111
112 37594 -29.4 0 0 0 1 0 0 0 0 0 0 0 112
113 38144 -27.6 0 0 0 0 1 0 0 0 0 0 0 113
114 38737 -23.6 0 0 0 0 0 1 0 0 0 0 0 114
115 34560 -22.8 0 0 0 0 0 0 1 0 0 0 0 115
116 36080 -18.2 0 0 0 0 0 0 0 1 0 0 0 116
117 33508 -17.8 0 0 0 0 0 0 0 0 1 0 0 117
118 35462 -14.2 0 0 0 0 0 0 0 0 0 1 0 118
119 33374 -8.8 0 0 0 0 0 0 0 0 0 0 1 119
120 32110 -7.9 0 0 0 0 0 0 0 0 0 0 0 120
121 35533 -7.0 1 0 0 0 0 0 0 0 0 0 0 121
122 35532 -7.0 0 1 0 0 0 0 0 0 0 0 0 122
123 37903 -3.6 0 0 1 0 0 0 0 0 0 0 0 123
124 36763 -2.4 0 0 0 1 0 0 0 0 0 0 0 124
125 40399 -4.9 0 0 0 0 1 0 0 0 0 0 0 125
126 44164 -7.7 0 0 0 0 0 1 0 0 0 0 0 126
127 44496 -6.5 0 0 0 0 0 0 1 0 0 0 0 127
128 43110 -5.1 0 0 0 0 0 0 0 1 0 0 0 128
129 43880 -3.4 0 0 0 0 0 0 0 0 1 0 0 129
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Ondernemersvertrouwen M1
19808.2 323.4 1875.5
M2 M3 M4
4198.6 6017.0 6515.5
M5 M6 M7
7483.7 8277.9 7080.5
M8 M9 M10
7047.3 5151.9 3273.7
M11 t
1774.1 151.2
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9221.1 -3772.8 -205.8 3838.3 11831.8
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 19808.19 1768.27 11.202 < 2e-16 ***
Ondernemersvertrouwen 323.35 48.73 6.636 1.11e-09 ***
M1 1875.45 2189.61 0.857 0.393489
M2 4198.65 2188.97 1.918 0.057578 .
M3 6017.04 2189.05 2.749 0.006950 **
M4 6515.51 2188.60 2.977 0.003550 **
M5 7483.69 2189.12 3.419 0.000872 ***
M6 8277.94 2189.09 3.781 0.000249 ***
M7 7080.49 2189.10 3.234 0.001591 **
M8 7047.34 2189.59 3.219 0.001674 **
M9 5151.95 2189.89 2.353 0.020342 *
M10 3273.66 2239.92 1.462 0.146604
M11 1774.13 2239.77 0.792 0.429933
t 151.24 12.22 12.377 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5008 on 115 degrees of freedom
Multiple R-squared: 0.642, Adjusted R-squared: 0.6015
F-statistic: 15.86 on 13 and 115 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/freestat/rcomp/tmp/1bree1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/2livz1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/3livz1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/4livz1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/5esc21291137004.ps",horizontal=F,onefile=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 = 129
Frequency = 1
1 2 3 4 5 6
4046.65424 2981.86206 3660.20016 3778.50837 5211.11818 4713.60761
7 8 9 10 11 12
5434.86710 5670.45081 6388.59049 6203.67339 6302.31181 5770.19410
13 14 15 16 17 18
4998.19824 4212.46713 4912.54313 6035.61978 5959.86979 4207.06660
19 20 21 22 23 24
4675.63703 3305.55611 3402.78738 3643.57766 3357.20997 3143.05563
25 26 27 28 29 30
955.98039 870.21264 -990.15664 -1985.54359 -2485.65337 -4711.46878
31 32 33 34 35 36
-4653.22760 -3973.94873 -3772.79684 -4307.38468 -4215.10605 -2387.53470
37 38 39 40 41 42
-2106.85372 -2297.96294 -1966.51493 -3554.85914 -4274.31040 -4148.07085
43 44 45 46 47 48
-4530.22611 -5623.70956 -6809.28947 -7706.59689 -7662.35490 -6792.14945
49 50 51 52 53 54
-6056.83437 -5793.28507 -5061.93476 -6503.67540 -7958.44981 -5491.59448
55 56 57 58 59 60
-6747.78637 -5370.15381 -7678.68487 -7668.62029 -6749.95134 -6501.69093
61 62 63 64 65 66
-9221.07712 -7705.47286 -5642.09202 -2966.74107 -3187.46663 -1086.62962
67 68 69 70 71 72
-515.07140 104.82937 -1670.09813 -3120.75313 -2836.80987 -2606.93979
73 74 75 76 77 78
-2451.97228 -205.77057 1091.90901 -180.50237 1518.41228 1710.24318
79 80 81 82 83 84
2395.75866 2064.69606 -1003.79836 -579.44115 -1332.11978 -1717.25581
85 86 87 88 89 90
-1424.26388 280.66353 1833.72122 2399.97447 -82.79383 -22.98125
91 92 93 94 95 96
1187.58919 1249.88028 3837.03827 4100.13949 6726.10107 2552.70295
97 98 99 100 101 102
5444.97529 5966.21364 3428.57617 6676.95155 6825.48808 4277.03857
103 104 105 106 107 108
4598.95658 6461.19272 10187.78378 10309.62290 9770.74935 11831.77819
109 110 111 112 113 114
8002.06274 6353.37437 4094.08447 3838.33162 2686.88037 1040.97947
115 116 117 118 119 120
-2348.49283 -2434.00682 -3391.19641 -874.21731 -3360.03027 -3292.16019
121 122 123 124 125 126
-2186.86953 -4662.30192 -5360.33582 -7538.06425 -4213.09465 -488.19047
127 128 129
501.99575 -1454.78644 509.66418
> postscript(file="/var/www/html/freestat/rcomp/tmp/6esc21291137004.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 129
Frequency = 1
lag(myerror, k = 1) myerror
0 4046.65424 NA
1 2981.86206 4046.65424
2 3660.20016 2981.86206
3 3778.50837 3660.20016
4 5211.11818 3778.50837
5 4713.60761 5211.11818
6 5434.86710 4713.60761
7 5670.45081 5434.86710
8 6388.59049 5670.45081
9 6203.67339 6388.59049
10 6302.31181 6203.67339
11 5770.19410 6302.31181
12 4998.19824 5770.19410
13 4212.46713 4998.19824
14 4912.54313 4212.46713
15 6035.61978 4912.54313
16 5959.86979 6035.61978
17 4207.06660 5959.86979
18 4675.63703 4207.06660
19 3305.55611 4675.63703
20 3402.78738 3305.55611
21 3643.57766 3402.78738
22 3357.20997 3643.57766
23 3143.05563 3357.20997
24 955.98039 3143.05563
25 870.21264 955.98039
26 -990.15664 870.21264
27 -1985.54359 -990.15664
28 -2485.65337 -1985.54359
29 -4711.46878 -2485.65337
30 -4653.22760 -4711.46878
31 -3973.94873 -4653.22760
32 -3772.79684 -3973.94873
33 -4307.38468 -3772.79684
34 -4215.10605 -4307.38468
35 -2387.53470 -4215.10605
36 -2106.85372 -2387.53470
37 -2297.96294 -2106.85372
38 -1966.51493 -2297.96294
39 -3554.85914 -1966.51493
40 -4274.31040 -3554.85914
41 -4148.07085 -4274.31040
42 -4530.22611 -4148.07085
43 -5623.70956 -4530.22611
44 -6809.28947 -5623.70956
45 -7706.59689 -6809.28947
46 -7662.35490 -7706.59689
47 -6792.14945 -7662.35490
48 -6056.83437 -6792.14945
49 -5793.28507 -6056.83437
50 -5061.93476 -5793.28507
51 -6503.67540 -5061.93476
52 -7958.44981 -6503.67540
53 -5491.59448 -7958.44981
54 -6747.78637 -5491.59448
55 -5370.15381 -6747.78637
56 -7678.68487 -5370.15381
57 -7668.62029 -7678.68487
58 -6749.95134 -7668.62029
59 -6501.69093 -6749.95134
60 -9221.07712 -6501.69093
61 -7705.47286 -9221.07712
62 -5642.09202 -7705.47286
63 -2966.74107 -5642.09202
64 -3187.46663 -2966.74107
65 -1086.62962 -3187.46663
66 -515.07140 -1086.62962
67 104.82937 -515.07140
68 -1670.09813 104.82937
69 -3120.75313 -1670.09813
70 -2836.80987 -3120.75313
71 -2606.93979 -2836.80987
72 -2451.97228 -2606.93979
73 -205.77057 -2451.97228
74 1091.90901 -205.77057
75 -180.50237 1091.90901
76 1518.41228 -180.50237
77 1710.24318 1518.41228
78 2395.75866 1710.24318
79 2064.69606 2395.75866
80 -1003.79836 2064.69606
81 -579.44115 -1003.79836
82 -1332.11978 -579.44115
83 -1717.25581 -1332.11978
84 -1424.26388 -1717.25581
85 280.66353 -1424.26388
86 1833.72122 280.66353
87 2399.97447 1833.72122
88 -82.79383 2399.97447
89 -22.98125 -82.79383
90 1187.58919 -22.98125
91 1249.88028 1187.58919
92 3837.03827 1249.88028
93 4100.13949 3837.03827
94 6726.10107 4100.13949
95 2552.70295 6726.10107
96 5444.97529 2552.70295
97 5966.21364 5444.97529
98 3428.57617 5966.21364
99 6676.95155 3428.57617
100 6825.48808 6676.95155
101 4277.03857 6825.48808
102 4598.95658 4277.03857
103 6461.19272 4598.95658
104 10187.78378 6461.19272
105 10309.62290 10187.78378
106 9770.74935 10309.62290
107 11831.77819 9770.74935
108 8002.06274 11831.77819
109 6353.37437 8002.06274
110 4094.08447 6353.37437
111 3838.33162 4094.08447
112 2686.88037 3838.33162
113 1040.97947 2686.88037
114 -2348.49283 1040.97947
115 -2434.00682 -2348.49283
116 -3391.19641 -2434.00682
117 -874.21731 -3391.19641
118 -3360.03027 -874.21731
119 -3292.16019 -3360.03027
120 -2186.86953 -3292.16019
121 -4662.30192 -2186.86953
122 -5360.33582 -4662.30192
123 -7538.06425 -5360.33582
124 -4213.09465 -7538.06425
125 -488.19047 -4213.09465
126 501.99575 -488.19047
127 -1454.78644 501.99575
128 509.66418 -1454.78644
129 NA 509.66418
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2981.86206 4046.65424
[2,] 3660.20016 2981.86206
[3,] 3778.50837 3660.20016
[4,] 5211.11818 3778.50837
[5,] 4713.60761 5211.11818
[6,] 5434.86710 4713.60761
[7,] 5670.45081 5434.86710
[8,] 6388.59049 5670.45081
[9,] 6203.67339 6388.59049
[10,] 6302.31181 6203.67339
[11,] 5770.19410 6302.31181
[12,] 4998.19824 5770.19410
[13,] 4212.46713 4998.19824
[14,] 4912.54313 4212.46713
[15,] 6035.61978 4912.54313
[16,] 5959.86979 6035.61978
[17,] 4207.06660 5959.86979
[18,] 4675.63703 4207.06660
[19,] 3305.55611 4675.63703
[20,] 3402.78738 3305.55611
[21,] 3643.57766 3402.78738
[22,] 3357.20997 3643.57766
[23,] 3143.05563 3357.20997
[24,] 955.98039 3143.05563
[25,] 870.21264 955.98039
[26,] -990.15664 870.21264
[27,] -1985.54359 -990.15664
[28,] -2485.65337 -1985.54359
[29,] -4711.46878 -2485.65337
[30,] -4653.22760 -4711.46878
[31,] -3973.94873 -4653.22760
[32,] -3772.79684 -3973.94873
[33,] -4307.38468 -3772.79684
[34,] -4215.10605 -4307.38468
[35,] -2387.53470 -4215.10605
[36,] -2106.85372 -2387.53470
[37,] -2297.96294 -2106.85372
[38,] -1966.51493 -2297.96294
[39,] -3554.85914 -1966.51493
[40,] -4274.31040 -3554.85914
[41,] -4148.07085 -4274.31040
[42,] -4530.22611 -4148.07085
[43,] -5623.70956 -4530.22611
[44,] -6809.28947 -5623.70956
[45,] -7706.59689 -6809.28947
[46,] -7662.35490 -7706.59689
[47,] -6792.14945 -7662.35490
[48,] -6056.83437 -6792.14945
[49,] -5793.28507 -6056.83437
[50,] -5061.93476 -5793.28507
[51,] -6503.67540 -5061.93476
[52,] -7958.44981 -6503.67540
[53,] -5491.59448 -7958.44981
[54,] -6747.78637 -5491.59448
[55,] -5370.15381 -6747.78637
[56,] -7678.68487 -5370.15381
[57,] -7668.62029 -7678.68487
[58,] -6749.95134 -7668.62029
[59,] -6501.69093 -6749.95134
[60,] -9221.07712 -6501.69093
[61,] -7705.47286 -9221.07712
[62,] -5642.09202 -7705.47286
[63,] -2966.74107 -5642.09202
[64,] -3187.46663 -2966.74107
[65,] -1086.62962 -3187.46663
[66,] -515.07140 -1086.62962
[67,] 104.82937 -515.07140
[68,] -1670.09813 104.82937
[69,] -3120.75313 -1670.09813
[70,] -2836.80987 -3120.75313
[71,] -2606.93979 -2836.80987
[72,] -2451.97228 -2606.93979
[73,] -205.77057 -2451.97228
[74,] 1091.90901 -205.77057
[75,] -180.50237 1091.90901
[76,] 1518.41228 -180.50237
[77,] 1710.24318 1518.41228
[78,] 2395.75866 1710.24318
[79,] 2064.69606 2395.75866
[80,] -1003.79836 2064.69606
[81,] -579.44115 -1003.79836
[82,] -1332.11978 -579.44115
[83,] -1717.25581 -1332.11978
[84,] -1424.26388 -1717.25581
[85,] 280.66353 -1424.26388
[86,] 1833.72122 280.66353
[87,] 2399.97447 1833.72122
[88,] -82.79383 2399.97447
[89,] -22.98125 -82.79383
[90,] 1187.58919 -22.98125
[91,] 1249.88028 1187.58919
[92,] 3837.03827 1249.88028
[93,] 4100.13949 3837.03827
[94,] 6726.10107 4100.13949
[95,] 2552.70295 6726.10107
[96,] 5444.97529 2552.70295
[97,] 5966.21364 5444.97529
[98,] 3428.57617 5966.21364
[99,] 6676.95155 3428.57617
[100,] 6825.48808 6676.95155
[101,] 4277.03857 6825.48808
[102,] 4598.95658 4277.03857
[103,] 6461.19272 4598.95658
[104,] 10187.78378 6461.19272
[105,] 10309.62290 10187.78378
[106,] 9770.74935 10309.62290
[107,] 11831.77819 9770.74935
[108,] 8002.06274 11831.77819
[109,] 6353.37437 8002.06274
[110,] 4094.08447 6353.37437
[111,] 3838.33162 4094.08447
[112,] 2686.88037 3838.33162
[113,] 1040.97947 2686.88037
[114,] -2348.49283 1040.97947
[115,] -2434.00682 -2348.49283
[116,] -3391.19641 -2434.00682
[117,] -874.21731 -3391.19641
[118,] -3360.03027 -874.21731
[119,] -3292.16019 -3360.03027
[120,] -2186.86953 -3292.16019
[121,] -4662.30192 -2186.86953
[122,] -5360.33582 -4662.30192
[123,] -7538.06425 -5360.33582
[124,] -4213.09465 -7538.06425
[125,] -488.19047 -4213.09465
[126,] 501.99575 -488.19047
[127,] -1454.78644 501.99575
[128,] 509.66418 -1454.78644
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2981.86206 4046.65424
2 3660.20016 2981.86206
3 3778.50837 3660.20016
4 5211.11818 3778.50837
5 4713.60761 5211.11818
6 5434.86710 4713.60761
7 5670.45081 5434.86710
8 6388.59049 5670.45081
9 6203.67339 6388.59049
10 6302.31181 6203.67339
11 5770.19410 6302.31181
12 4998.19824 5770.19410
13 4212.46713 4998.19824
14 4912.54313 4212.46713
15 6035.61978 4912.54313
16 5959.86979 6035.61978
17 4207.06660 5959.86979
18 4675.63703 4207.06660
19 3305.55611 4675.63703
20 3402.78738 3305.55611
21 3643.57766 3402.78738
22 3357.20997 3643.57766
23 3143.05563 3357.20997
24 955.98039 3143.05563
25 870.21264 955.98039
26 -990.15664 870.21264
27 -1985.54359 -990.15664
28 -2485.65337 -1985.54359
29 -4711.46878 -2485.65337
30 -4653.22760 -4711.46878
31 -3973.94873 -4653.22760
32 -3772.79684 -3973.94873
33 -4307.38468 -3772.79684
34 -4215.10605 -4307.38468
35 -2387.53470 -4215.10605
36 -2106.85372 -2387.53470
37 -2297.96294 -2106.85372
38 -1966.51493 -2297.96294
39 -3554.85914 -1966.51493
40 -4274.31040 -3554.85914
41 -4148.07085 -4274.31040
42 -4530.22611 -4148.07085
43 -5623.70956 -4530.22611
44 -6809.28947 -5623.70956
45 -7706.59689 -6809.28947
46 -7662.35490 -7706.59689
47 -6792.14945 -7662.35490
48 -6056.83437 -6792.14945
49 -5793.28507 -6056.83437
50 -5061.93476 -5793.28507
51 -6503.67540 -5061.93476
52 -7958.44981 -6503.67540
53 -5491.59448 -7958.44981
54 -6747.78637 -5491.59448
55 -5370.15381 -6747.78637
56 -7678.68487 -5370.15381
57 -7668.62029 -7678.68487
58 -6749.95134 -7668.62029
59 -6501.69093 -6749.95134
60 -9221.07712 -6501.69093
61 -7705.47286 -9221.07712
62 -5642.09202 -7705.47286
63 -2966.74107 -5642.09202
64 -3187.46663 -2966.74107
65 -1086.62962 -3187.46663
66 -515.07140 -1086.62962
67 104.82937 -515.07140
68 -1670.09813 104.82937
69 -3120.75313 -1670.09813
70 -2836.80987 -3120.75313
71 -2606.93979 -2836.80987
72 -2451.97228 -2606.93979
73 -205.77057 -2451.97228
74 1091.90901 -205.77057
75 -180.50237 1091.90901
76 1518.41228 -180.50237
77 1710.24318 1518.41228
78 2395.75866 1710.24318
79 2064.69606 2395.75866
80 -1003.79836 2064.69606
81 -579.44115 -1003.79836
82 -1332.11978 -579.44115
83 -1717.25581 -1332.11978
84 -1424.26388 -1717.25581
85 280.66353 -1424.26388
86 1833.72122 280.66353
87 2399.97447 1833.72122
88 -82.79383 2399.97447
89 -22.98125 -82.79383
90 1187.58919 -22.98125
91 1249.88028 1187.58919
92 3837.03827 1249.88028
93 4100.13949 3837.03827
94 6726.10107 4100.13949
95 2552.70295 6726.10107
96 5444.97529 2552.70295
97 5966.21364 5444.97529
98 3428.57617 5966.21364
99 6676.95155 3428.57617
100 6825.48808 6676.95155
101 4277.03857 6825.48808
102 4598.95658 4277.03857
103 6461.19272 4598.95658
104 10187.78378 6461.19272
105 10309.62290 10187.78378
106 9770.74935 10309.62290
107 11831.77819 9770.74935
108 8002.06274 11831.77819
109 6353.37437 8002.06274
110 4094.08447 6353.37437
111 3838.33162 4094.08447
112 2686.88037 3838.33162
113 1040.97947 2686.88037
114 -2348.49283 1040.97947
115 -2434.00682 -2348.49283
116 -3391.19641 -2434.00682
117 -874.21731 -3391.19641
118 -3360.03027 -874.21731
119 -3292.16019 -3360.03027
120 -2186.86953 -3292.16019
121 -4662.30192 -2186.86953
122 -5360.33582 -4662.30192
123 -7538.06425 -5360.33582
124 -4213.09465 -7538.06425
125 -488.19047 -4213.09465
126 501.99575 -488.19047
127 -1454.78644 501.99575
128 509.66418 -1454.78644
> 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/freestat/rcomp/tmp/771tm1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/871tm1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/9iabq1291137004.ps",horizontal=F,onefile=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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/10larv1291137004.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/freestat/rcomp/tmp/11obp11291137004.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/freestat/rcomp/tmp/12k35s1291137004.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/freestat/rcomp/tmp/13o3mg1291137004.tab")
>
> try(system("convert tmp/1bree1291137004.ps tmp/1bree1291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/2livz1291137004.ps tmp/2livz1291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/3livz1291137004.ps tmp/3livz1291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/4livz1291137004.ps tmp/4livz1291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/5esc21291137004.ps tmp/5esc21291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/6esc21291137004.ps tmp/6esc21291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/771tm1291137004.ps tmp/771tm1291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/871tm1291137004.ps tmp/871tm1291137004.png",intern=TRUE))
character(0)
> try(system("convert tmp/9iabq1291137004.ps tmp/9iabq1291137004.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.348 2.308 3.735