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(589
+ ,122302.01
+ ,100.01
+ ,606
+ ,109264.65
+ ,100.73
+ ,566
+ ,103674.75
+ ,100.46
+ ,487
+ ,103890.3
+ ,100.99
+ ,442
+ ,75512.66
+ ,100.8
+ ,463
+ ,83121.3
+ ,101.24
+ ,547
+ ,125096.81
+ ,101.05
+ ,432
+ ,74206.73
+ ,101.11
+ ,513
+ ,88481.63
+ ,100.86
+ ,602
+ ,111598.17
+ ,100.92
+ ,637
+ ,146919.48
+ ,101.43
+ ,913
+ ,150790.85
+ ,101.55
+ ,576
+ ,113780.5
+ ,101.49
+ ,634
+ ,110870.76
+ ,101.11
+ ,563
+ ,118785.32
+ ,100.43
+ ,513
+ ,112820.5
+ ,99.79
+ ,483
+ ,102188.92
+ ,99.09
+ ,477
+ ,97092.73
+ ,99.69
+ ,524
+ ,114067.82
+ ,100.08
+ ,470
+ ,89690.15
+ ,99.53
+ ,427
+ ,89267.9
+ ,99.58
+ ,537
+ ,96198.64
+ ,99.41
+ ,662
+ ,129599.75
+ ,99.5
+ ,1079
+ ,169424.7
+ ,100.42
+ ,816
+ ,152510.91
+ ,99.9
+ ,705
+ ,121850.2
+ ,100.02
+ ,653
+ ,144737.64
+ ,99.92
+ ,584
+ ,121381.88
+ ,99.55
+ ,508
+ ,106894.86
+ ,99.74
+ ,446
+ ,94305.06
+ ,99.76
+ ,604
+ ,116800.42
+ ,99.86
+ ,446
+ ,77584.28
+ ,99.75
+ ,512
+ ,100680.88
+ ,99.92
+ ,533
+ ,106634.05
+ ,99.86
+ ,791
+ ,168390.77
+ ,99.66
+ ,1206
+ ,211971.89
+ ,99.5
+ ,783
+ ,136163.28
+ ,99.28
+ ,567
+ ,168950.25
+ ,99.6
+ ,473
+ ,89816.88
+ ,100.15
+ ,412
+ ,85406.93
+ ,100.28
+ ,314
+ ,66055.52
+ ,100.44
+ ,323
+ ,73311.68
+ ,100.3
+ ,438
+ ,85674.51
+ ,100.87
+ ,429
+ ,82822.59
+ ,100.45
+ ,468
+ ,94277.63
+ ,100.64
+ ,518
+ ,100991.65
+ ,100.13
+ ,555
+ ,149245.88
+ ,99.9
+ ,816
+ ,208517.17
+ ,100.11
+ ,673
+ ,40733.51
+ ,99.14
+ ,593
+ ,121352.23
+ ,99.79
+ ,569
+ ,104020.11
+ ,100.31
+ ,505
+ ,99566.82
+ ,100.43
+ ,447
+ ,101352.17
+ ,100.92
+ ,433
+ ,106628.41
+ ,101.48
+ ,549
+ ,109696.95
+ ,101.64
+ ,553
+ ,248696.37
+ ,102.41
+ ,505
+ ,105628.33
+ ,102.74
+ ,601
+ ,120449.17
+ ,102.77
+ ,706
+ ,136547.7
+ ,102.37
+ ,852
+ ,140896.42
+ ,102
+ ,643
+ ,131509.91
+ ,102.45
+ ,448
+ ,95450.31
+ ,102.51
+ ,551
+ ,133592.64
+ ,102.34
+ ,476
+ ,110332.9
+ ,102.55
+ ,416
+ ,88110.54
+ ,102.25
+ ,331
+ ,64931.25
+ ,102.56
+ ,435
+ ,98446.22
+ ,102.8
+ ,395
+ ,84212.38
+ ,103.09
+ ,405
+ ,77519.55
+ ,102.65
+ ,619
+ ,124806.02
+ ,103.29
+ ,596
+ ,102185.94
+ ,104
+ ,889
+ ,151348.79
+ ,104.01
+ ,668
+ ,124378.28
+ ,103.59
+ ,555
+ ,101433.13
+ ,103.59
+ ,620
+ ,126724.22
+ ,103.84
+ ,472
+ ,87461.88
+ ,103.61
+ ,460
+ ,95288.27
+ ,103.76
+ ,417
+ ,129055.33
+ ,104.12
+ ,582
+ ,107753.06
+ ,103.95
+ ,525
+ ,96364.03
+ ,104.03
+ ,507
+ ,71662.75
+ ,104.52
+ ,750
+ ,125666.24
+ ,104.79
+ ,899
+ ,456841.51
+ ,104.91
+ ,1075
+ ,167642.32
+ ,105.1
+ ,993
+ ,167154.73
+ ,105.22
+ ,777
+ ,139685.18
+ ,105.64
+ ,675
+ ,119275.2
+ ,105.2
+ ,655
+ ,122746.05
+ ,105.19
+ ,535
+ ,107337.43
+ ,105.23
+ ,491
+ ,112584.89
+ ,105.22
+ ,686
+ ,133183.08
+ ,105.65
+ ,637
+ ,121152.57
+ ,105.93
+ ,652
+ ,119815.6
+ ,105.65
+ ,794
+ ,122858.44
+ ,106.55
+ ,859
+ ,152077.17
+ ,107.44
+ ,1049
+ ,157221.96
+ ,107.74
+ ,1022
+ ,140435.08
+ ,107.44
+ ,762
+ ,101455.09
+ ,108.2
+ ,762
+ ,104791.29
+ ,108.86
+ ,563
+ ,77226.59
+ ,108.82
+ ,573
+ ,84477.43
+ ,108.37
+ ,473
+ ,66227.74
+ ,108.35
+ ,527
+ ,89076.23
+ ,107.61
+ ,710
+ ,108924.43
+ ,107.98
+ ,630
+ ,83926.11
+ ,107.8
+ ,706
+ ,91764.8
+ ,107.44
+ ,870
+ ,120892.76
+ ,107.46
+ ,1069
+ ,129952.42
+ ,107.18
+ ,1021
+ ,135865.14
+ ,107.75
+ ,799
+ ,105512.77
+ ,108.28
+ ,694
+ ,96486.62
+ ,108.64
+ ,521
+ ,78064.88
+ ,108.52
+ ,622
+ ,92370.22
+ ,108.58
+ ,614
+ ,98454.46
+ ,108.09
+ ,661
+ ,96703.93
+ ,108.68
+ ,630
+ ,83170.95
+ ,109.18)
+ ,dim=c(3
+ ,116)
+ ,dimnames=list(c('aantal'
+ ,'omzet'
+ ,'koers')
+ ,1:116))
> y <- array(NA,dim=c(3,116),dimnames=list(c('aantal','omzet','koers'),1:116))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'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
omzet aantal koers
1 122302.01 589 100.01
2 109264.65 606 100.73
3 103674.75 566 100.46
4 103890.30 487 100.99
5 75512.66 442 100.80
6 83121.30 463 101.24
7 125096.81 547 101.05
8 74206.73 432 101.11
9 88481.63 513 100.86
10 111598.17 602 100.92
11 146919.48 637 101.43
12 150790.85 913 101.55
13 113780.50 576 101.49
14 110870.76 634 101.11
15 118785.32 563 100.43
16 112820.50 513 99.79
17 102188.92 483 99.09
18 97092.73 477 99.69
19 114067.82 524 100.08
20 89690.15 470 99.53
21 89267.90 427 99.58
22 96198.64 537 99.41
23 129599.75 662 99.50
24 169424.70 1079 100.42
25 152510.91 816 99.90
26 121850.20 705 100.02
27 144737.64 653 99.92
28 121381.88 584 99.55
29 106894.86 508 99.74
30 94305.06 446 99.76
31 116800.42 604 99.86
32 77584.28 446 99.75
33 100680.88 512 99.92
34 106634.05 533 99.86
35 168390.77 791 99.66
36 211971.89 1206 99.50
37 136163.28 783 99.28
38 168950.25 567 99.60
39 89816.88 473 100.15
40 85406.93 412 100.28
41 66055.52 314 100.44
42 73311.68 323 100.30
43 85674.51 438 100.87
44 82822.59 429 100.45
45 94277.63 468 100.64
46 100991.65 518 100.13
47 149245.88 555 99.90
48 208517.17 816 100.11
49 40733.51 673 99.14
50 121352.23 593 99.79
51 104020.11 569 100.31
52 99566.82 505 100.43
53 101352.17 447 100.92
54 106628.41 433 101.48
55 109696.95 549 101.64
56 248696.37 553 102.41
57 105628.33 505 102.74
58 120449.17 601 102.77
59 136547.70 706 102.37
60 140896.42 852 102.00
61 131509.91 643 102.45
62 95450.31 448 102.51
63 133592.64 551 102.34
64 110332.90 476 102.55
65 88110.54 416 102.25
66 64931.25 331 102.56
67 98446.22 435 102.80
68 84212.38 395 103.09
69 77519.55 405 102.65
70 124806.02 619 103.29
71 102185.94 596 104.00
72 151348.79 889 104.01
73 124378.28 668 103.59
74 101433.13 555 103.59
75 126724.22 620 103.84
76 87461.88 472 103.61
77 95288.27 460 103.76
78 129055.33 417 104.12
79 107753.06 582 103.95
80 96364.03 525 104.03
81 71662.75 507 104.52
82 125666.24 750 104.79
83 456841.51 899 104.91
84 167642.32 1075 105.10
85 167154.73 993 105.22
86 139685.18 777 105.64
87 119275.20 675 105.20
88 122746.05 655 105.19
89 107337.43 535 105.23
90 112584.89 491 105.22
91 133183.08 686 105.65
92 121152.57 637 105.93
93 119815.60 652 105.65
94 122858.44 794 106.55
95 152077.17 859 107.44
96 157221.96 1049 107.74
97 140435.08 1022 107.44
98 101455.09 762 108.20
99 104791.29 762 108.86
100 77226.59 563 108.82
101 84477.43 573 108.37
102 66227.74 473 108.35
103 89076.23 527 107.61
104 108924.43 710 107.98
105 83926.11 630 107.80
106 91764.80 706 107.44
107 120892.76 870 107.46
108 129952.42 1069 107.18
109 135865.14 1021 107.75
110 105512.77 799 108.28
111 96486.62 694 108.64
112 78064.88 521 108.52
113 92370.22 622 108.58
114 98454.46 614 108.09
115 96703.93 661 108.68
116 83170.95 630 109.18
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) aantal koers
351434.7 157.7 -3229.2
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-96695 -12665 -5379 4620 302403
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 351434.69 115174.92 3.051 0.00284 **
aantal 157.71 20.05 7.866 2.40e-12 ***
koers -3229.21 1152.68 -2.801 0.00599 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 36130 on 113 degrees of freedom
Multiple R-Squared: 0.3539, Adjusted R-squared: 0.3425
F-statistic: 30.95 on 2 and 113 DF, p-value: 1.916e-11
> postscript(file="/var/www/html/rcomp/tmp/10mmr1200412221.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/2bhij1200412221.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/397yw1200412221.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/4dvzo1200412221.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/5tcvj1200412221.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 = 116
Frequency = 1
1 2 3 4 5 6
930.1136 -12463.2650 -12616.6992 1769.3282 -20124.9652 -14407.3579
7 8 9 10 11 12
13707.0620 -18852.7520 -18159.5682 -8885.3599 22563.0387 -16705.7182
13 14 15 16 17 18
-761.9511 -14045.9020 2870.1209 2724.0472 -5436.7154 -7649.1266
19 20 21 22 23 24
3173.0411 -14464.4185 -7943.7291 -18909.9241 -4931.7867 -27900.5382
25 26 27 28 29 30
-5016.0998 -17783.6265 12981.7508 -686.9089 -2574.5093 -5321.7787
31 32 33 34 35 36
-7421.4900 -22074.8508 -8838.0667 -6390.5344 14031.4701 -8353.2404
37 38 39 40 41 42
-18161.4491 49723.9714 -12808.7048 -7178.6200 -10557.8928 -5173.2015
43 44 45 46 47 48
-9106.2352 -11895.0441 -5977.0979 -8795.4155 32880.8701 51668.2943
49 50 51 52 53 54
-96695.3392 -1360.9278 -13228.8472 -7201.2680 5313.5060 14606.0269
55 56 57 58 59 60
-102.9817 140752.0947 6319.7169 6097.3873 4344.8080 -15526.7662
61 62 63 64 65 66
9501.0100 4388.3809 25737.7376 14984.2926 1255.6983 -7517.2876
67 68 69 70 71 72
10370.9764 3381.9597 -6308.8108 9294.6678 -7405.3705 -4418.9103
73 74 75 76 77 78
2107.9590 -3016.0952 12831.2245 -3832.9297 6370.3476 48081.4021
79 80 81 82 83 84
208.2124 -1933.0785 -22213.2870 -5661.1517 302403.0105 -13939.3805
85 86 87 88 89 90
-1107.3427 6844.4788 1099.9453 7692.6794 11338.2853 23492.6409
91 92 93 94 95 96
14726.1728 11327.5734 6720.7924 -9724.7299 12116.9241 -11734.1972
97 98 99 100 101 102
-25231.7022 -20753.2016 -15285.7230 -11595.5379 -7374.9304 -9918.3234
103 104 105 106 107 108
2024.2754 -5793.4295 -18756.3024 -24065.9977 -20737.6986 -43966.2710
109 110 111 112 113 114
-28642.8784 -22272.4108 -13576.6200 -5102.2407 -6531.7381 -768.1405
115 116
-8025.7508 -15055.1527
> postscript(file="/var/www/html/rcomp/tmp/671hy1200412221.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 = 116
Frequency = 1
lag(myerror, k = 1) myerror
0 930.1136 NA
1 -12463.2650 930.1136
2 -12616.6992 -12463.2650
3 1769.3282 -12616.6992
4 -20124.9652 1769.3282
5 -14407.3579 -20124.9652
6 13707.0620 -14407.3579
7 -18852.7520 13707.0620
8 -18159.5682 -18852.7520
9 -8885.3599 -18159.5682
10 22563.0387 -8885.3599
11 -16705.7182 22563.0387
12 -761.9511 -16705.7182
13 -14045.9020 -761.9511
14 2870.1209 -14045.9020
15 2724.0472 2870.1209
16 -5436.7154 2724.0472
17 -7649.1266 -5436.7154
18 3173.0411 -7649.1266
19 -14464.4185 3173.0411
20 -7943.7291 -14464.4185
21 -18909.9241 -7943.7291
22 -4931.7867 -18909.9241
23 -27900.5382 -4931.7867
24 -5016.0998 -27900.5382
25 -17783.6265 -5016.0998
26 12981.7508 -17783.6265
27 -686.9089 12981.7508
28 -2574.5093 -686.9089
29 -5321.7787 -2574.5093
30 -7421.4900 -5321.7787
31 -22074.8508 -7421.4900
32 -8838.0667 -22074.8508
33 -6390.5344 -8838.0667
34 14031.4701 -6390.5344
35 -8353.2404 14031.4701
36 -18161.4491 -8353.2404
37 49723.9714 -18161.4491
38 -12808.7048 49723.9714
39 -7178.6200 -12808.7048
40 -10557.8928 -7178.6200
41 -5173.2015 -10557.8928
42 -9106.2352 -5173.2015
43 -11895.0441 -9106.2352
44 -5977.0979 -11895.0441
45 -8795.4155 -5977.0979
46 32880.8701 -8795.4155
47 51668.2943 32880.8701
48 -96695.3392 51668.2943
49 -1360.9278 -96695.3392
50 -13228.8472 -1360.9278
51 -7201.2680 -13228.8472
52 5313.5060 -7201.2680
53 14606.0269 5313.5060
54 -102.9817 14606.0269
55 140752.0947 -102.9817
56 6319.7169 140752.0947
57 6097.3873 6319.7169
58 4344.8080 6097.3873
59 -15526.7662 4344.8080
60 9501.0100 -15526.7662
61 4388.3809 9501.0100
62 25737.7376 4388.3809
63 14984.2926 25737.7376
64 1255.6983 14984.2926
65 -7517.2876 1255.6983
66 10370.9764 -7517.2876
67 3381.9597 10370.9764
68 -6308.8108 3381.9597
69 9294.6678 -6308.8108
70 -7405.3705 9294.6678
71 -4418.9103 -7405.3705
72 2107.9590 -4418.9103
73 -3016.0952 2107.9590
74 12831.2245 -3016.0952
75 -3832.9297 12831.2245
76 6370.3476 -3832.9297
77 48081.4021 6370.3476
78 208.2124 48081.4021
79 -1933.0785 208.2124
80 -22213.2870 -1933.0785
81 -5661.1517 -22213.2870
82 302403.0105 -5661.1517
83 -13939.3805 302403.0105
84 -1107.3427 -13939.3805
85 6844.4788 -1107.3427
86 1099.9453 6844.4788
87 7692.6794 1099.9453
88 11338.2853 7692.6794
89 23492.6409 11338.2853
90 14726.1728 23492.6409
91 11327.5734 14726.1728
92 6720.7924 11327.5734
93 -9724.7299 6720.7924
94 12116.9241 -9724.7299
95 -11734.1972 12116.9241
96 -25231.7022 -11734.1972
97 -20753.2016 -25231.7022
98 -15285.7230 -20753.2016
99 -11595.5379 -15285.7230
100 -7374.9304 -11595.5379
101 -9918.3234 -7374.9304
102 2024.2754 -9918.3234
103 -5793.4295 2024.2754
104 -18756.3024 -5793.4295
105 -24065.9977 -18756.3024
106 -20737.6986 -24065.9977
107 -43966.2710 -20737.6986
108 -28642.8784 -43966.2710
109 -22272.4108 -28642.8784
110 -13576.6200 -22272.4108
111 -5102.2407 -13576.6200
112 -6531.7381 -5102.2407
113 -768.1405 -6531.7381
114 -8025.7508 -768.1405
115 -15055.1527 -8025.7508
116 NA -15055.1527
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -12463.2650 930.1136
[2,] -12616.6992 -12463.2650
[3,] 1769.3282 -12616.6992
[4,] -20124.9652 1769.3282
[5,] -14407.3579 -20124.9652
[6,] 13707.0620 -14407.3579
[7,] -18852.7520 13707.0620
[8,] -18159.5682 -18852.7520
[9,] -8885.3599 -18159.5682
[10,] 22563.0387 -8885.3599
[11,] -16705.7182 22563.0387
[12,] -761.9511 -16705.7182
[13,] -14045.9020 -761.9511
[14,] 2870.1209 -14045.9020
[15,] 2724.0472 2870.1209
[16,] -5436.7154 2724.0472
[17,] -7649.1266 -5436.7154
[18,] 3173.0411 -7649.1266
[19,] -14464.4185 3173.0411
[20,] -7943.7291 -14464.4185
[21,] -18909.9241 -7943.7291
[22,] -4931.7867 -18909.9241
[23,] -27900.5382 -4931.7867
[24,] -5016.0998 -27900.5382
[25,] -17783.6265 -5016.0998
[26,] 12981.7508 -17783.6265
[27,] -686.9089 12981.7508
[28,] -2574.5093 -686.9089
[29,] -5321.7787 -2574.5093
[30,] -7421.4900 -5321.7787
[31,] -22074.8508 -7421.4900
[32,] -8838.0667 -22074.8508
[33,] -6390.5344 -8838.0667
[34,] 14031.4701 -6390.5344
[35,] -8353.2404 14031.4701
[36,] -18161.4491 -8353.2404
[37,] 49723.9714 -18161.4491
[38,] -12808.7048 49723.9714
[39,] -7178.6200 -12808.7048
[40,] -10557.8928 -7178.6200
[41,] -5173.2015 -10557.8928
[42,] -9106.2352 -5173.2015
[43,] -11895.0441 -9106.2352
[44,] -5977.0979 -11895.0441
[45,] -8795.4155 -5977.0979
[46,] 32880.8701 -8795.4155
[47,] 51668.2943 32880.8701
[48,] -96695.3392 51668.2943
[49,] -1360.9278 -96695.3392
[50,] -13228.8472 -1360.9278
[51,] -7201.2680 -13228.8472
[52,] 5313.5060 -7201.2680
[53,] 14606.0269 5313.5060
[54,] -102.9817 14606.0269
[55,] 140752.0947 -102.9817
[56,] 6319.7169 140752.0947
[57,] 6097.3873 6319.7169
[58,] 4344.8080 6097.3873
[59,] -15526.7662 4344.8080
[60,] 9501.0100 -15526.7662
[61,] 4388.3809 9501.0100
[62,] 25737.7376 4388.3809
[63,] 14984.2926 25737.7376
[64,] 1255.6983 14984.2926
[65,] -7517.2876 1255.6983
[66,] 10370.9764 -7517.2876
[67,] 3381.9597 10370.9764
[68,] -6308.8108 3381.9597
[69,] 9294.6678 -6308.8108
[70,] -7405.3705 9294.6678
[71,] -4418.9103 -7405.3705
[72,] 2107.9590 -4418.9103
[73,] -3016.0952 2107.9590
[74,] 12831.2245 -3016.0952
[75,] -3832.9297 12831.2245
[76,] 6370.3476 -3832.9297
[77,] 48081.4021 6370.3476
[78,] 208.2124 48081.4021
[79,] -1933.0785 208.2124
[80,] -22213.2870 -1933.0785
[81,] -5661.1517 -22213.2870
[82,] 302403.0105 -5661.1517
[83,] -13939.3805 302403.0105
[84,] -1107.3427 -13939.3805
[85,] 6844.4788 -1107.3427
[86,] 1099.9453 6844.4788
[87,] 7692.6794 1099.9453
[88,] 11338.2853 7692.6794
[89,] 23492.6409 11338.2853
[90,] 14726.1728 23492.6409
[91,] 11327.5734 14726.1728
[92,] 6720.7924 11327.5734
[93,] -9724.7299 6720.7924
[94,] 12116.9241 -9724.7299
[95,] -11734.1972 12116.9241
[96,] -25231.7022 -11734.1972
[97,] -20753.2016 -25231.7022
[98,] -15285.7230 -20753.2016
[99,] -11595.5379 -15285.7230
[100,] -7374.9304 -11595.5379
[101,] -9918.3234 -7374.9304
[102,] 2024.2754 -9918.3234
[103,] -5793.4295 2024.2754
[104,] -18756.3024 -5793.4295
[105,] -24065.9977 -18756.3024
[106,] -20737.6986 -24065.9977
[107,] -43966.2710 -20737.6986
[108,] -28642.8784 -43966.2710
[109,] -22272.4108 -28642.8784
[110,] -13576.6200 -22272.4108
[111,] -5102.2407 -13576.6200
[112,] -6531.7381 -5102.2407
[113,] -768.1405 -6531.7381
[114,] -8025.7508 -768.1405
[115,] -15055.1527 -8025.7508
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -12463.2650 930.1136
2 -12616.6992 -12463.2650
3 1769.3282 -12616.6992
4 -20124.9652 1769.3282
5 -14407.3579 -20124.9652
6 13707.0620 -14407.3579
7 -18852.7520 13707.0620
8 -18159.5682 -18852.7520
9 -8885.3599 -18159.5682
10 22563.0387 -8885.3599
11 -16705.7182 22563.0387
12 -761.9511 -16705.7182
13 -14045.9020 -761.9511
14 2870.1209 -14045.9020
15 2724.0472 2870.1209
16 -5436.7154 2724.0472
17 -7649.1266 -5436.7154
18 3173.0411 -7649.1266
19 -14464.4185 3173.0411
20 -7943.7291 -14464.4185
21 -18909.9241 -7943.7291
22 -4931.7867 -18909.9241
23 -27900.5382 -4931.7867
24 -5016.0998 -27900.5382
25 -17783.6265 -5016.0998
26 12981.7508 -17783.6265
27 -686.9089 12981.7508
28 -2574.5093 -686.9089
29 -5321.7787 -2574.5093
30 -7421.4900 -5321.7787
31 -22074.8508 -7421.4900
32 -8838.0667 -22074.8508
33 -6390.5344 -8838.0667
34 14031.4701 -6390.5344
35 -8353.2404 14031.4701
36 -18161.4491 -8353.2404
37 49723.9714 -18161.4491
38 -12808.7048 49723.9714
39 -7178.6200 -12808.7048
40 -10557.8928 -7178.6200
41 -5173.2015 -10557.8928
42 -9106.2352 -5173.2015
43 -11895.0441 -9106.2352
44 -5977.0979 -11895.0441
45 -8795.4155 -5977.0979
46 32880.8701 -8795.4155
47 51668.2943 32880.8701
48 -96695.3392 51668.2943
49 -1360.9278 -96695.3392
50 -13228.8472 -1360.9278
51 -7201.2680 -13228.8472
52 5313.5060 -7201.2680
53 14606.0269 5313.5060
54 -102.9817 14606.0269
55 140752.0947 -102.9817
56 6319.7169 140752.0947
57 6097.3873 6319.7169
58 4344.8080 6097.3873
59 -15526.7662 4344.8080
60 9501.0100 -15526.7662
61 4388.3809 9501.0100
62 25737.7376 4388.3809
63 14984.2926 25737.7376
64 1255.6983 14984.2926
65 -7517.2876 1255.6983
66 10370.9764 -7517.2876
67 3381.9597 10370.9764
68 -6308.8108 3381.9597
69 9294.6678 -6308.8108
70 -7405.3705 9294.6678
71 -4418.9103 -7405.3705
72 2107.9590 -4418.9103
73 -3016.0952 2107.9590
74 12831.2245 -3016.0952
75 -3832.9297 12831.2245
76 6370.3476 -3832.9297
77 48081.4021 6370.3476
78 208.2124 48081.4021
79 -1933.0785 208.2124
80 -22213.2870 -1933.0785
81 -5661.1517 -22213.2870
82 302403.0105 -5661.1517
83 -13939.3805 302403.0105
84 -1107.3427 -13939.3805
85 6844.4788 -1107.3427
86 1099.9453 6844.4788
87 7692.6794 1099.9453
88 11338.2853 7692.6794
89 23492.6409 11338.2853
90 14726.1728 23492.6409
91 11327.5734 14726.1728
92 6720.7924 11327.5734
93 -9724.7299 6720.7924
94 12116.9241 -9724.7299
95 -11734.1972 12116.9241
96 -25231.7022 -11734.1972
97 -20753.2016 -25231.7022
98 -15285.7230 -20753.2016
99 -11595.5379 -15285.7230
100 -7374.9304 -11595.5379
101 -9918.3234 -7374.9304
102 2024.2754 -9918.3234
103 -5793.4295 2024.2754
104 -18756.3024 -5793.4295
105 -24065.9977 -18756.3024
106 -20737.6986 -24065.9977
107 -43966.2710 -20737.6986
108 -28642.8784 -43966.2710
109 -22272.4108 -28642.8784
110 -13576.6200 -22272.4108
111 -5102.2407 -13576.6200
112 -6531.7381 -5102.2407
113 -768.1405 -6531.7381
114 -8025.7508 -768.1405
115 -15055.1527 -8025.7508
> 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/76gix1200412221.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/8g64t1200412221.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/9xu5d1200412221.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/10h9mq1200412221.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/11sg4e1200412222.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/12nucz1200412222.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/138a3d1200412222.tab")
>
> system("convert tmp/10mmr1200412221.ps tmp/10mmr1200412221.png")
> system("convert tmp/2bhij1200412221.ps tmp/2bhij1200412221.png")
> system("convert tmp/397yw1200412221.ps tmp/397yw1200412221.png")
> system("convert tmp/4dvzo1200412221.ps tmp/4dvzo1200412221.png")
> system("convert tmp/5tcvj1200412221.ps tmp/5tcvj1200412221.png")
> system("convert tmp/671hy1200412221.ps tmp/671hy1200412221.png")
> system("convert tmp/76gix1200412221.ps tmp/76gix1200412221.png")
> system("convert tmp/8g64t1200412221.ps tmp/8g64t1200412221.png")
> system("convert tmp/9xu5d1200412221.ps tmp/9xu5d1200412221.png")
>
>
> proc.time()
user system elapsed
2.552 1.525 2.946