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(99.5,0,101.6,0,103.9,0,106.6,0,108.3,0,102,0,93.8,0,91.6,0,97.7,0,94.8,0,98,0,103.8,0,97.8,0,91.2,0,89.3,0,87.5,0,90.4,0,94.2,0,102.2,0,101.3,0,96,0,90.8,0,93.2,0,90.9,0,91.1,0,90.2,0,94.3,0,96,0,99,0,103.3,0,113.1,0,112.8,0,112.1,0,107.4,0,111,0,110.5,0,110.8,0,112.4,0,111.5,0,116.2,0,122.5,0,121.3,0,113.9,0,110.7,0,120.8,0,141.1,1,147.4,1,148,1,158.1,1,165,1,187,1,190.3,1,182.4,1,168.8,1,151.2,1,120.1,0,112.5,0,106.2,0,107.1,0,108.5,0,106.5,0,108.3,0,125.6,0,124,0,127.2,0,136.9,0,135.8,0,124.3,0,115.4,0,113.6,0,114.4,0,118.4,0,117,0,116.5,0,115.4,0,113.6,0,117.4,0,116.9,0,116.4,0,111.1,0,110.2,0,118.9,0,131.8,0,130.6,0,138.3,0,148.4,0,148.7,0,144.3,0,152.5,0,162.9,0,167.2,0,166.5,0,185.6,0),dim=c(2,93),dimnames=list(c('Oliezaden','Fluctuatie'),1:93))
> y <- array(NA,dim=c(2,93),dimnames=list(c('Oliezaden','Fluctuatie'),1:93))
> 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
Oliezaden Fluctuatie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 99.5 0 1 0 0 0 0 0 0 0 0 0 0 1
2 101.6 0 0 1 0 0 0 0 0 0 0 0 0 2
3 103.9 0 0 0 1 0 0 0 0 0 0 0 0 3
4 106.6 0 0 0 0 1 0 0 0 0 0 0 0 4
5 108.3 0 0 0 0 0 1 0 0 0 0 0 0 5
6 102.0 0 0 0 0 0 0 1 0 0 0 0 0 6
7 93.8 0 0 0 0 0 0 0 1 0 0 0 0 7
8 91.6 0 0 0 0 0 0 0 0 1 0 0 0 8
9 97.7 0 0 0 0 0 0 0 0 0 1 0 0 9
10 94.8 0 0 0 0 0 0 0 0 0 0 1 0 10
11 98.0 0 0 0 0 0 0 0 0 0 0 0 1 11
12 103.8 0 0 0 0 0 0 0 0 0 0 0 0 12
13 97.8 0 1 0 0 0 0 0 0 0 0 0 0 13
14 91.2 0 0 1 0 0 0 0 0 0 0 0 0 14
15 89.3 0 0 0 1 0 0 0 0 0 0 0 0 15
16 87.5 0 0 0 0 1 0 0 0 0 0 0 0 16
17 90.4 0 0 0 0 0 1 0 0 0 0 0 0 17
18 94.2 0 0 0 0 0 0 1 0 0 0 0 0 18
19 102.2 0 0 0 0 0 0 0 1 0 0 0 0 19
20 101.3 0 0 0 0 0 0 0 0 1 0 0 0 20
21 96.0 0 0 0 0 0 0 0 0 0 1 0 0 21
22 90.8 0 0 0 0 0 0 0 0 0 0 1 0 22
23 93.2 0 0 0 0 0 0 0 0 0 0 0 1 23
24 90.9 0 0 0 0 0 0 0 0 0 0 0 0 24
25 91.1 0 1 0 0 0 0 0 0 0 0 0 0 25
26 90.2 0 0 1 0 0 0 0 0 0 0 0 0 26
27 94.3 0 0 0 1 0 0 0 0 0 0 0 0 27
28 96.0 0 0 0 0 1 0 0 0 0 0 0 0 28
29 99.0 0 0 0 0 0 1 0 0 0 0 0 0 29
30 103.3 0 0 0 0 0 0 1 0 0 0 0 0 30
31 113.1 0 0 0 0 0 0 0 1 0 0 0 0 31
32 112.8 0 0 0 0 0 0 0 0 1 0 0 0 32
33 112.1 0 0 0 0 0 0 0 0 0 1 0 0 33
34 107.4 0 0 0 0 0 0 0 0 0 0 1 0 34
35 111.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 110.5 0 0 0 0 0 0 0 0 0 0 0 0 36
37 110.8 0 1 0 0 0 0 0 0 0 0 0 0 37
38 112.4 0 0 1 0 0 0 0 0 0 0 0 0 38
39 111.5 0 0 0 1 0 0 0 0 0 0 0 0 39
40 116.2 0 0 0 0 1 0 0 0 0 0 0 0 40
41 122.5 0 0 0 0 0 1 0 0 0 0 0 0 41
42 121.3 0 0 0 0 0 0 1 0 0 0 0 0 42
43 113.9 0 0 0 0 0 0 0 1 0 0 0 0 43
44 110.7 0 0 0 0 0 0 0 0 1 0 0 0 44
45 120.8 0 0 0 0 0 0 0 0 0 1 0 0 45
46 141.1 1 0 0 0 0 0 0 0 0 0 1 0 46
47 147.4 1 0 0 0 0 0 0 0 0 0 0 1 47
48 148.0 1 0 0 0 0 0 0 0 0 0 0 0 48
49 158.1 1 1 0 0 0 0 0 0 0 0 0 0 49
50 165.0 1 0 1 0 0 0 0 0 0 0 0 0 50
51 187.0 1 0 0 1 0 0 0 0 0 0 0 0 51
52 190.3 1 0 0 0 1 0 0 0 0 0 0 0 52
53 182.4 1 0 0 0 0 1 0 0 0 0 0 0 53
54 168.8 1 0 0 0 0 0 1 0 0 0 0 0 54
55 151.2 1 0 0 0 0 0 0 1 0 0 0 0 55
56 120.1 0 0 0 0 0 0 0 0 1 0 0 0 56
57 112.5 0 0 0 0 0 0 0 0 0 1 0 0 57
58 106.2 0 0 0 0 0 0 0 0 0 0 1 0 58
59 107.1 0 0 0 0 0 0 0 0 0 0 0 1 59
60 108.5 0 0 0 0 0 0 0 0 0 0 0 0 60
61 106.5 0 1 0 0 0 0 0 0 0 0 0 0 61
62 108.3 0 0 1 0 0 0 0 0 0 0 0 0 62
63 125.6 0 0 0 1 0 0 0 0 0 0 0 0 63
64 124.0 0 0 0 0 1 0 0 0 0 0 0 0 64
65 127.2 0 0 0 0 0 1 0 0 0 0 0 0 65
66 136.9 0 0 0 0 0 0 1 0 0 0 0 0 66
67 135.8 0 0 0 0 0 0 0 1 0 0 0 0 67
68 124.3 0 0 0 0 0 0 0 0 1 0 0 0 68
69 115.4 0 0 0 0 0 0 0 0 0 1 0 0 69
70 113.6 0 0 0 0 0 0 0 0 0 0 1 0 70
71 114.4 0 0 0 0 0 0 0 0 0 0 0 1 71
72 118.4 0 0 0 0 0 0 0 0 0 0 0 0 72
73 117.0 0 1 0 0 0 0 0 0 0 0 0 0 73
74 116.5 0 0 1 0 0 0 0 0 0 0 0 0 74
75 115.4 0 0 0 1 0 0 0 0 0 0 0 0 75
76 113.6 0 0 0 0 1 0 0 0 0 0 0 0 76
77 117.4 0 0 0 0 0 1 0 0 0 0 0 0 77
78 116.9 0 0 0 0 0 0 1 0 0 0 0 0 78
79 116.4 0 0 0 0 0 0 0 1 0 0 0 0 79
80 111.1 0 0 0 0 0 0 0 0 1 0 0 0 80
81 110.2 0 0 0 0 0 0 0 0 0 1 0 0 81
82 118.9 0 0 0 0 0 0 0 0 0 0 1 0 82
83 131.8 0 0 0 0 0 0 0 0 0 0 0 1 83
84 130.6 0 0 0 0 0 0 0 0 0 0 0 0 84
85 138.3 0 1 0 0 0 0 0 0 0 0 0 0 85
86 148.4 0 0 1 0 0 0 0 0 0 0 0 0 86
87 148.7 0 0 0 1 0 0 0 0 0 0 0 0 87
88 144.3 0 0 0 0 1 0 0 0 0 0 0 0 88
89 152.5 0 0 0 0 0 1 0 0 0 0 0 0 89
90 162.9 0 0 0 0 0 0 1 0 0 0 0 0 90
91 167.2 0 0 0 0 0 0 0 1 0 0 0 0 91
92 166.5 0 0 0 0 0 0 0 0 1 0 0 0 92
93 185.6 0 0 0 0 0 0 0 0 0 1 0 0 93
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Fluctuatie M1 M2 M3 M4
83.2960 48.8973 2.6061 3.8866 8.6172 8.4353
M5 M6 M7 M8 M9 M10
10.5533 10.8464 8.7269 7.4072 8.3627 -4.3504
M11 t
-0.5823 0.5319
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-24.546 -9.212 -1.159 7.183 44.471
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 83.29598 5.36568 15.524 <2e-16 ***
Fluctuatie 48.89730 4.30775 11.351 <2e-16 ***
M1 2.60607 6.56953 0.397 0.693
M2 3.88663 6.56790 0.592 0.556
M3 8.61719 6.56664 1.312 0.193
M4 8.43525 6.56575 1.285 0.203
M5 10.55332 6.56523 1.607 0.112
M6 10.84638 6.56507 1.652 0.102
M7 8.72694 6.56529 1.329 0.188
M8 7.40717 6.59465 1.123 0.265
M9 8.36273 6.59582 1.268 0.209
M10 -4.35041 6.78063 -0.642 0.523
M11 -0.58235 6.78009 -0.086 0.932
t 0.53194 0.04925 10.800 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 12.68 on 79 degrees of freedom
Multiple R-Squared: 0.7749, Adjusted R-squared: 0.7378
F-statistic: 20.92 on 13 and 79 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1k9l91197729314.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/20qit1197729314.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/3hiic1197729314.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/4qkle1197729314.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/566og1197729314.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 = 93
Frequency = 1
1 2 3 4 5 6
13.06602172 13.35352172 10.39102172 12.74102172 11.79102172 4.66602172
7 8 9 10 11 12
-1.94647828 -3.35864046 1.25385954 10.53506496 9.43506496 14.12077924
13 14 15 16 17 18
4.98277614 -3.42972386 -10.59222386 -12.74222386 -12.49222386 -9.51722386
19 20 21 22 23 24
0.07027614 -0.04188605 -6.82938605 0.15181937 -1.74818063 -5.16246634
25 26 27 28 29 30
-8.10046944 -10.81296944 -11.97546944 -10.62546944 -10.27546944 -6.80046944
31 32 33 34 35 36
4.58703056 5.07486837 2.88736837 10.36857379 9.66857379 8.05428808
37 38 39 40 41 42
5.21628497 5.00378497 -1.15871503 3.19128497 6.84128497 4.81628497
43 44 45 46 47 48
-0.99621503 -3.40837721 5.20412279 -11.21196926 -9.21196926 -9.72625497
49 50 51 52 53 54
-2.76425807 2.32324193 19.06074193 22.01074193 11.46074193 -2.96425807
55 56 57 58 59 60
-18.97675807 -0.39162279 -9.47912279 -3.59791737 -6.99791737 -6.71220309
61 62 63 64 65 66
-11.85020619 -11.86270619 0.17479381 -1.77520619 -1.22520619 7.64979381
67 68 69 70 71 72
8.13729381 -2.57486837 -12.96236837 -2.58116295 -6.08116295 -3.19544867
73 74 75 76 77 78
-7.73345177 -10.04595177 -16.40845177 -18.55845177 -17.40845177 -18.73345177
79 80 81 82 83 84
-17.64595177 -22.15811395 -24.54561395 -3.66440854 4.93559146 2.62130575
85 86 87 88 89 90
7.18330265 15.47080265 10.50830265 5.75830265 11.30830265 20.88330265
91 92 93
26.77080265 26.85864046 44.47114046
> postscript(file="/var/www/html/rcomp/tmp/6s5xg1197729314.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 = 93
Frequency = 1
lag(myerror, k = 1) myerror
0 13.06602172 NA
1 13.35352172 13.06602172
2 10.39102172 13.35352172
3 12.74102172 10.39102172
4 11.79102172 12.74102172
5 4.66602172 11.79102172
6 -1.94647828 4.66602172
7 -3.35864046 -1.94647828
8 1.25385954 -3.35864046
9 10.53506496 1.25385954
10 9.43506496 10.53506496
11 14.12077924 9.43506496
12 4.98277614 14.12077924
13 -3.42972386 4.98277614
14 -10.59222386 -3.42972386
15 -12.74222386 -10.59222386
16 -12.49222386 -12.74222386
17 -9.51722386 -12.49222386
18 0.07027614 -9.51722386
19 -0.04188605 0.07027614
20 -6.82938605 -0.04188605
21 0.15181937 -6.82938605
22 -1.74818063 0.15181937
23 -5.16246634 -1.74818063
24 -8.10046944 -5.16246634
25 -10.81296944 -8.10046944
26 -11.97546944 -10.81296944
27 -10.62546944 -11.97546944
28 -10.27546944 -10.62546944
29 -6.80046944 -10.27546944
30 4.58703056 -6.80046944
31 5.07486837 4.58703056
32 2.88736837 5.07486837
33 10.36857379 2.88736837
34 9.66857379 10.36857379
35 8.05428808 9.66857379
36 5.21628497 8.05428808
37 5.00378497 5.21628497
38 -1.15871503 5.00378497
39 3.19128497 -1.15871503
40 6.84128497 3.19128497
41 4.81628497 6.84128497
42 -0.99621503 4.81628497
43 -3.40837721 -0.99621503
44 5.20412279 -3.40837721
45 -11.21196926 5.20412279
46 -9.21196926 -11.21196926
47 -9.72625497 -9.21196926
48 -2.76425807 -9.72625497
49 2.32324193 -2.76425807
50 19.06074193 2.32324193
51 22.01074193 19.06074193
52 11.46074193 22.01074193
53 -2.96425807 11.46074193
54 -18.97675807 -2.96425807
55 -0.39162279 -18.97675807
56 -9.47912279 -0.39162279
57 -3.59791737 -9.47912279
58 -6.99791737 -3.59791737
59 -6.71220309 -6.99791737
60 -11.85020619 -6.71220309
61 -11.86270619 -11.85020619
62 0.17479381 -11.86270619
63 -1.77520619 0.17479381
64 -1.22520619 -1.77520619
65 7.64979381 -1.22520619
66 8.13729381 7.64979381
67 -2.57486837 8.13729381
68 -12.96236837 -2.57486837
69 -2.58116295 -12.96236837
70 -6.08116295 -2.58116295
71 -3.19544867 -6.08116295
72 -7.73345177 -3.19544867
73 -10.04595177 -7.73345177
74 -16.40845177 -10.04595177
75 -18.55845177 -16.40845177
76 -17.40845177 -18.55845177
77 -18.73345177 -17.40845177
78 -17.64595177 -18.73345177
79 -22.15811395 -17.64595177
80 -24.54561395 -22.15811395
81 -3.66440854 -24.54561395
82 4.93559146 -3.66440854
83 2.62130575 4.93559146
84 7.18330265 2.62130575
85 15.47080265 7.18330265
86 10.50830265 15.47080265
87 5.75830265 10.50830265
88 11.30830265 5.75830265
89 20.88330265 11.30830265
90 26.77080265 20.88330265
91 26.85864046 26.77080265
92 44.47114046 26.85864046
93 NA 44.47114046
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 13.35352172 13.06602172
[2,] 10.39102172 13.35352172
[3,] 12.74102172 10.39102172
[4,] 11.79102172 12.74102172
[5,] 4.66602172 11.79102172
[6,] -1.94647828 4.66602172
[7,] -3.35864046 -1.94647828
[8,] 1.25385954 -3.35864046
[9,] 10.53506496 1.25385954
[10,] 9.43506496 10.53506496
[11,] 14.12077924 9.43506496
[12,] 4.98277614 14.12077924
[13,] -3.42972386 4.98277614
[14,] -10.59222386 -3.42972386
[15,] -12.74222386 -10.59222386
[16,] -12.49222386 -12.74222386
[17,] -9.51722386 -12.49222386
[18,] 0.07027614 -9.51722386
[19,] -0.04188605 0.07027614
[20,] -6.82938605 -0.04188605
[21,] 0.15181937 -6.82938605
[22,] -1.74818063 0.15181937
[23,] -5.16246634 -1.74818063
[24,] -8.10046944 -5.16246634
[25,] -10.81296944 -8.10046944
[26,] -11.97546944 -10.81296944
[27,] -10.62546944 -11.97546944
[28,] -10.27546944 -10.62546944
[29,] -6.80046944 -10.27546944
[30,] 4.58703056 -6.80046944
[31,] 5.07486837 4.58703056
[32,] 2.88736837 5.07486837
[33,] 10.36857379 2.88736837
[34,] 9.66857379 10.36857379
[35,] 8.05428808 9.66857379
[36,] 5.21628497 8.05428808
[37,] 5.00378497 5.21628497
[38,] -1.15871503 5.00378497
[39,] 3.19128497 -1.15871503
[40,] 6.84128497 3.19128497
[41,] 4.81628497 6.84128497
[42,] -0.99621503 4.81628497
[43,] -3.40837721 -0.99621503
[44,] 5.20412279 -3.40837721
[45,] -11.21196926 5.20412279
[46,] -9.21196926 -11.21196926
[47,] -9.72625497 -9.21196926
[48,] -2.76425807 -9.72625497
[49,] 2.32324193 -2.76425807
[50,] 19.06074193 2.32324193
[51,] 22.01074193 19.06074193
[52,] 11.46074193 22.01074193
[53,] -2.96425807 11.46074193
[54,] -18.97675807 -2.96425807
[55,] -0.39162279 -18.97675807
[56,] -9.47912279 -0.39162279
[57,] -3.59791737 -9.47912279
[58,] -6.99791737 -3.59791737
[59,] -6.71220309 -6.99791737
[60,] -11.85020619 -6.71220309
[61,] -11.86270619 -11.85020619
[62,] 0.17479381 -11.86270619
[63,] -1.77520619 0.17479381
[64,] -1.22520619 -1.77520619
[65,] 7.64979381 -1.22520619
[66,] 8.13729381 7.64979381
[67,] -2.57486837 8.13729381
[68,] -12.96236837 -2.57486837
[69,] -2.58116295 -12.96236837
[70,] -6.08116295 -2.58116295
[71,] -3.19544867 -6.08116295
[72,] -7.73345177 -3.19544867
[73,] -10.04595177 -7.73345177
[74,] -16.40845177 -10.04595177
[75,] -18.55845177 -16.40845177
[76,] -17.40845177 -18.55845177
[77,] -18.73345177 -17.40845177
[78,] -17.64595177 -18.73345177
[79,] -22.15811395 -17.64595177
[80,] -24.54561395 -22.15811395
[81,] -3.66440854 -24.54561395
[82,] 4.93559146 -3.66440854
[83,] 2.62130575 4.93559146
[84,] 7.18330265 2.62130575
[85,] 15.47080265 7.18330265
[86,] 10.50830265 15.47080265
[87,] 5.75830265 10.50830265
[88,] 11.30830265 5.75830265
[89,] 20.88330265 11.30830265
[90,] 26.77080265 20.88330265
[91,] 26.85864046 26.77080265
[92,] 44.47114046 26.85864046
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 13.35352172 13.06602172
2 10.39102172 13.35352172
3 12.74102172 10.39102172
4 11.79102172 12.74102172
5 4.66602172 11.79102172
6 -1.94647828 4.66602172
7 -3.35864046 -1.94647828
8 1.25385954 -3.35864046
9 10.53506496 1.25385954
10 9.43506496 10.53506496
11 14.12077924 9.43506496
12 4.98277614 14.12077924
13 -3.42972386 4.98277614
14 -10.59222386 -3.42972386
15 -12.74222386 -10.59222386
16 -12.49222386 -12.74222386
17 -9.51722386 -12.49222386
18 0.07027614 -9.51722386
19 -0.04188605 0.07027614
20 -6.82938605 -0.04188605
21 0.15181937 -6.82938605
22 -1.74818063 0.15181937
23 -5.16246634 -1.74818063
24 -8.10046944 -5.16246634
25 -10.81296944 -8.10046944
26 -11.97546944 -10.81296944
27 -10.62546944 -11.97546944
28 -10.27546944 -10.62546944
29 -6.80046944 -10.27546944
30 4.58703056 -6.80046944
31 5.07486837 4.58703056
32 2.88736837 5.07486837
33 10.36857379 2.88736837
34 9.66857379 10.36857379
35 8.05428808 9.66857379
36 5.21628497 8.05428808
37 5.00378497 5.21628497
38 -1.15871503 5.00378497
39 3.19128497 -1.15871503
40 6.84128497 3.19128497
41 4.81628497 6.84128497
42 -0.99621503 4.81628497
43 -3.40837721 -0.99621503
44 5.20412279 -3.40837721
45 -11.21196926 5.20412279
46 -9.21196926 -11.21196926
47 -9.72625497 -9.21196926
48 -2.76425807 -9.72625497
49 2.32324193 -2.76425807
50 19.06074193 2.32324193
51 22.01074193 19.06074193
52 11.46074193 22.01074193
53 -2.96425807 11.46074193
54 -18.97675807 -2.96425807
55 -0.39162279 -18.97675807
56 -9.47912279 -0.39162279
57 -3.59791737 -9.47912279
58 -6.99791737 -3.59791737
59 -6.71220309 -6.99791737
60 -11.85020619 -6.71220309
61 -11.86270619 -11.85020619
62 0.17479381 -11.86270619
63 -1.77520619 0.17479381
64 -1.22520619 -1.77520619
65 7.64979381 -1.22520619
66 8.13729381 7.64979381
67 -2.57486837 8.13729381
68 -12.96236837 -2.57486837
69 -2.58116295 -12.96236837
70 -6.08116295 -2.58116295
71 -3.19544867 -6.08116295
72 -7.73345177 -3.19544867
73 -10.04595177 -7.73345177
74 -16.40845177 -10.04595177
75 -18.55845177 -16.40845177
76 -17.40845177 -18.55845177
77 -18.73345177 -17.40845177
78 -17.64595177 -18.73345177
79 -22.15811395 -17.64595177
80 -24.54561395 -22.15811395
81 -3.66440854 -24.54561395
82 4.93559146 -3.66440854
83 2.62130575 4.93559146
84 7.18330265 2.62130575
85 15.47080265 7.18330265
86 10.50830265 15.47080265
87 5.75830265 10.50830265
88 11.30830265 5.75830265
89 20.88330265 11.30830265
90 26.77080265 20.88330265
91 26.85864046 26.77080265
92 44.47114046 26.85864046
> 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/7gjxq1197729314.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/8tr7l1197729314.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/91zzu1197729314.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/10903q1197729315.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/11uq1p1197729315.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/12kmtb1197729315.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/13cuk71197729315.tab")
>
> system("convert tmp/1k9l91197729314.ps tmp/1k9l91197729314.png")
> system("convert tmp/20qit1197729314.ps tmp/20qit1197729314.png")
> system("convert tmp/3hiic1197729314.ps tmp/3hiic1197729314.png")
> system("convert tmp/4qkle1197729314.ps tmp/4qkle1197729314.png")
> system("convert tmp/566og1197729314.ps tmp/566og1197729314.png")
> system("convert tmp/6s5xg1197729314.ps tmp/6s5xg1197729314.png")
> system("convert tmp/7gjxq1197729314.ps tmp/7gjxq1197729314.png")
> system("convert tmp/8tr7l1197729314.ps tmp/8tr7l1197729314.png")
> system("convert tmp/91zzu1197729314.ps tmp/91zzu1197729314.png")
>
>
> proc.time()
user system elapsed
2.343 1.449 2.771