R version 2.9.0 (2009-04-17)
Copyright (C) 2009 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(50556
+ ,-9
+ ,0
+ ,8.3
+ ,1.2
+ ,43901
+ ,-13
+ ,4
+ ,8.2
+ ,1.7
+ ,48572
+ ,-18
+ ,5
+ ,8
+ ,1.8
+ ,43899
+ ,-11
+ ,-7
+ ,7.9
+ ,1.5
+ ,37532
+ ,-9
+ ,-2
+ ,7.6
+ ,1
+ ,40357
+ ,-10
+ ,1
+ ,7.6
+ ,1.6
+ ,35489
+ ,-13
+ ,3
+ ,8.3
+ ,1.5
+ ,29027
+ ,-11
+ ,-2
+ ,8.4
+ ,1.8
+ ,34485
+ ,-5
+ ,-6
+ ,8.4
+ ,1.8
+ ,42598
+ ,-15
+ ,10
+ ,8.4
+ ,1.6
+ ,30306
+ ,-6
+ ,-9
+ ,8.4
+ ,1.9
+ ,26451
+ ,-6
+ ,0
+ ,8.6
+ ,1.7
+ ,47460
+ ,-3
+ ,-3
+ ,8.9
+ ,1.6
+ ,50104
+ ,-1
+ ,-2
+ ,8.8
+ ,1.3
+ ,61465
+ ,-3
+ ,2
+ ,8.3
+ ,1.1
+ ,53726
+ ,-4
+ ,1
+ ,7.5
+ ,1.9
+ ,39477
+ ,-6
+ ,2
+ ,7.2
+ ,2.6
+ ,43895
+ ,0
+ ,-6
+ ,7.4
+ ,2.3
+ ,31481
+ ,-4
+ ,4
+ ,8.8
+ ,2.4
+ ,29896
+ ,-2
+ ,-2
+ ,9.3
+ ,2.2
+ ,33842
+ ,-2
+ ,0
+ ,9.3
+ ,2
+ ,39120
+ ,-6
+ ,4
+ ,8.7
+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 ,-1.7
+ ,30333
+ ,-11
+ ,-6
+ ,8.3
+ ,-0.8
+ ,35908
+ ,-11
+ ,0
+ ,8.1
+ ,-1.2
+ ,40005
+ ,-12
+ ,1
+ ,7.9
+ ,-1
+ ,35263
+ ,-10
+ ,-2
+ ,7.9
+ ,-0.1
+ ,26591
+ ,-15
+ ,5
+ ,8.3
+ ,0.3
+ ,49709
+ ,-15
+ ,0
+ ,8.6
+ ,0.6
+ ,47840
+ ,-15
+ ,0
+ ,8.7
+ ,0.7
+ ,64781
+ ,-13
+ ,-2
+ ,8.5
+ ,1.7
+ ,57802
+ ,-8
+ ,-5
+ ,8.3
+ ,1.8
+ ,48154
+ ,-13
+ ,5
+ ,8
+ ,2.3)
+ ,dim=c(5
+ ,89)
+ ,dimnames=list(c('Inschrijvingen_met_transit'
+ ,'Consumentenvertrouwen'
+ ,'Evolutie_consumentenvertrouwen'
+ ,'Totaal_Werkloosheid'
+ ,'Algemene_index
')
+ ,1:89))
> y <- array(NA,dim=c(5,89),dimnames=list(c('Inschrijvingen_met_transit','Consumentenvertrouwen','Evolutie_consumentenvertrouwen','Totaal_Werkloosheid','Algemene_index
'),1:89))
> 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 = 'Do not include Seasonal 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)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> 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
Inschrijvingen_met_transit Consumentenvertrouwen
1 50556 -9
2 43901 -13
3 48572 -18
4 43899 -11
5 37532 -9
6 40357 -10
7 35489 -13
8 29027 -11
9 34485 -5
10 42598 -15
11 30306 -6
12 26451 -6
13 47460 -3
14 50104 -1
15 61465 -3
16 53726 -4
17 39477 -6
18 43895 0
19 31481 -4
20 29896 -2
21 33842 -2
22 39120 -6
23 33702 -7
24 25094 -6
25 51442 -6
26 45594 -3
27 52518 -2
28 48564 -5
29 41745 -11
30 49585 -11
31 32747 -11
32 33379 -10
33 35645 -14
34 37034 -8
35 35681 -9
36 20972 -5
37 58552 -1
38 54955 -2
39 65540 -5
40 51570 -4
41 51145 -6
42 46641 -2
43 35704 -2
44 33253 -2
45 35193 -2
46 41668 2
47 34865 1
48 21210 -8
49 56126 -1
50 49231 1
51 59723 -1
52 48103 2
53 47472 2
54 50497 1
55 40059 -1
56 34149 -2
57 36860 -2
58 46356 -1
59 36577 -8
60 23872 -4
61 57276 -6
62 56389 -3
63 57657 -3
64 62300 -7
65 48929 -9
66 51168 -11
67 39636 -13
68 33213 -11
69 38127 -9
70 43291 -17
71 30600 -22
72 21956 -25
73 48033 -20
74 46148 -24
75 50736 -24
76 48114 -22
77 38390 -19
78 44112 -18
79 36287 -17
80 30333 -11
81 35908 -11
82 40005 -12
83 35263 -10
84 26591 -15
85 49709 -15
86 47840 -15
87 64781 -13
88 57802 -8
89 48154 -13
Evolutie_consumentenvertrouwen Totaal_Werkloosheid Algemene_index\r t
1 0 8.3 1.2 1
2 4 8.2 1.7 2
3 5 8.0 1.8 3
4 -7 7.9 1.5 4
5 -2 7.6 1.0 5
6 1 7.6 1.6 6
7 3 8.3 1.5 7
8 -2 8.4 1.8 8
9 -6 8.4 1.8 9
10 10 8.4 1.6 10
11 -9 8.4 1.9 11
12 0 8.6 1.7 12
13 -3 8.9 1.6 13
14 -2 8.8 1.3 14
15 2 8.3 1.1 15
16 1 7.5 1.9 16
17 2 7.2 2.6 17
18 -6 7.4 2.3 18
19 4 8.8 2.4 19
20 -2 9.3 2.2 20
21 0 9.3 2.0 21
22 4 8.7 2.9 22
23 1 8.2 2.6 23
24 -1 8.3 2.3 24
25 0 8.5 2.3 25
26 -3 8.6 2.6 26
27 -1 8.5 3.1 27
28 3 8.2 2.8 28
29 6 8.1 2.5 29
30 0 7.9 2.9 30
31 0 8.6 3.1 31
32 -1 8.7 3.1 32
33 4 8.7 3.2 33
34 -6 8.5 2.5 34
35 1 8.4 2.6 35
36 -4 8.5 2.9 36
37 -4 8.7 2.6 37
38 1 8.7 2.4 38
39 3 8.6 1.7 39
40 -1 8.5 2.0 40
41 2 8.3 2.2 41
42 -4 8.0 1.9 42
43 0 8.2 1.6 43
44 0 8.1 1.6 44
45 0 8.1 1.2 45
46 -4 8.0 1.2 46
47 1 7.9 1.5 47
48 9 7.9 1.6 48
49 -7 8.0 1.7 49
50 -2 8.0 1.8 50
51 2 7.9 1.8 51
52 -3 8.0 1.8 52
53 0 7.7 1.3 53
54 1 7.2 1.3 54
55 2 7.5 1.4 55
56 1 7.3 1.1 56
57 0 7.0 1.5 57
58 -1 7.0 2.2 58
59 7 7.0 2.9 59
60 -4 7.2 3.1 60
61 2 7.3 3.5 61
62 -3 7.1 3.6 62
63 0 6.8 4.4 63
64 4 6.4 4.2 64
65 2 6.1 5.2 65
66 2 6.5 5.8 66
67 2 7.7 5.9 67
68 -2 7.9 5.4 68
69 -2 7.5 5.5 69
70 8 6.9 4.7 70
71 5 6.6 3.1 71
72 3 6.9 2.6 72
73 -5 7.7 2.3 73
74 4 8.0 1.9 74
75 0 8.0 0.6 75
76 -2 7.7 0.6 76
77 -3 7.3 -0.4 77
78 -1 7.4 -1.1 78
79 -1 8.1 -1.7 79
80 -6 8.3 -0.8 80
81 0 8.1 -1.2 81
82 1 7.9 -1.0 82
83 -2 7.9 -0.1 83
84 5 8.3 0.3 84
85 0 8.6 0.6 85
86 0 8.7 0.7 86
87 -2 8.5 1.7 87
88 -5 8.3 1.8 88
89 5 8.0 2.3 89
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Consumentenvertrouwen
45154.19 331.29
Evolutie_consumentenvertrouwen Totaal_Werkloosheid
33.18 -524.47
`Algemene_index\r` t
549.59 68.64
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-22000.0 -8084.2 321.3 8241.9 22841.8
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 45154.19 17817.62 2.534 0.0131 *
Consumentenvertrouwen 331.29 189.57 1.748 0.0842 .
Evolutie_consumentenvertrouwen 33.18 329.57 0.101 0.9201
Totaal_Werkloosheid -524.47 2011.10 -0.261 0.7949
`Algemene_index\r` 549.59 844.68 0.651 0.5171
t 68.64 50.61 1.356 0.1787
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10410 on 83 degrees of freedom
Multiple R-squared: 0.05872, Adjusted R-squared: 0.00202
F-statistic: 1.036 on 5 and 83 DF, p-value: 0.4023
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.08835282 0.17670565 0.91164718
[2,] 0.12687047 0.25374094 0.87312953
[3,] 0.06315866 0.12631732 0.93684134
[4,] 0.03363222 0.06726444 0.96636778
[5,] 0.17344638 0.34689276 0.82655362
[6,] 0.18823517 0.37647035 0.81176483
[7,] 0.33150094 0.66300189 0.66849906
[8,] 0.34124843 0.68249687 0.65875157
[9,] 0.26110782 0.52221565 0.73889218
[10,] 0.19445427 0.38890854 0.80554573
[11,] 0.16109022 0.32218045 0.83890978
[12,] 0.11978844 0.23957688 0.88021156
[13,] 0.08416882 0.16833764 0.91583118
[14,] 0.08182032 0.16364064 0.91817968
[15,] 0.05531426 0.11062852 0.94468574
[16,] 0.05211526 0.10423052 0.94788474
[17,] 0.13273838 0.26547676 0.86726162
[18,] 0.14757423 0.29514845 0.85242577
[19,] 0.23363301 0.46726602 0.76636699
[20,] 0.20272115 0.40544230 0.79727885
[21,] 0.15938833 0.31877666 0.84061167
[22,] 0.16877224 0.33754449 0.83122776
[23,] 0.13231981 0.26463962 0.86768019
[24,] 0.10183192 0.20366384 0.89816808
[25,] 0.07427747 0.14855494 0.92572253
[26,] 0.05421745 0.10843491 0.94578255
[27,] 0.04343674 0.08687348 0.95656326
[28,] 0.11765125 0.23530250 0.88234875
[29,] 0.18087348 0.36174696 0.81912652
[30,] 0.16292211 0.32584422 0.83707789
[31,] 0.24413636 0.48827272 0.75586364
[32,] 0.21777767 0.43555533 0.78222233
[33,] 0.21490407 0.42980814 0.78509593
[34,] 0.20020090 0.40040180 0.79979910
[35,] 0.29515806 0.59031611 0.70484194
[36,] 0.36872381 0.73744762 0.63127619
[37,] 0.38322379 0.76644759 0.61677621
[38,] 0.33483014 0.66966029 0.66516986
[39,] 0.34668127 0.69336253 0.65331873
[40,] 0.51586834 0.96826333 0.48413166
[41,] 0.54193404 0.91613193 0.45806596
[42,] 0.48482675 0.96965350 0.51517325
[43,] 0.56200124 0.87599752 0.43799876
[44,] 0.50539835 0.98920330 0.49460165
[45,] 0.45389822 0.90779644 0.54610178
[46,] 0.42918744 0.85837489 0.57081256
[47,] 0.37906624 0.75813249 0.62093376
[48,] 0.34816129 0.69632257 0.65183871
[49,] 0.30289792 0.60579584 0.69710208
[50,] 0.24993822 0.49987643 0.75006178
[51,] 0.20409474 0.40818949 0.79590526
[52,] 0.36964057 0.73928114 0.63035943
[53,] 0.41190202 0.82380405 0.58809798
[54,] 0.40594731 0.81189462 0.59405269
[55,] 0.41610223 0.83220446 0.58389777
[56,] 0.70142904 0.59714193 0.29857096
[57,] 0.72547718 0.54904565 0.27452282
[58,] 0.83384557 0.33230885 0.16615443
[59,] 0.78396639 0.43206721 0.21603361
[60,] 0.76021693 0.47956614 0.23978307
[61,] 0.71003337 0.57993326 0.28996663
[62,] 0.81465126 0.37069748 0.18534874
[63,] 0.78280967 0.43438066 0.21719033
[64,] 0.91158404 0.17683191 0.08841596
[65,] 0.89675209 0.20649582 0.10324791
[66,] 0.86452066 0.27095868 0.13547934
[67,] 0.87202087 0.25595826 0.12797913
[68,] 0.92550212 0.14899575 0.07449788
[69,] 0.86547333 0.26905334 0.13452667
[70,] 0.80108342 0.39783315 0.19891658
[71,] 0.67500803 0.64998394 0.32499197
[72,] 0.58239800 0.83520399 0.41760200
> postscript(file="/var/www/html/rcomp/tmp/1z0681292179482.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/rcomp/tmp/2r95b1292179482.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/rcomp/tmp/3r95b1292179482.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/rcomp/tmp/4r95b1292179482.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/rcomp/tmp/5r95b1292179482.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 89
Frequency = 1
1 2 3 4 5 6
12008.29914 6149.86033 12215.62454 5665.51381 -1481.11818 1177.24619
7 8 9 10 11 12
-2409.79996 -9549.56832 -6015.22604 4921.11295 -9955.65361 -13963.05903
13 14 15 16 17 18
6295.26628 8287.30960 19957.22730 11654.80145 -2575.49633 321.31808
19 20 21 22 23 24
-10488.63636 -12233.64646 -8312.71836 -2720.22739 -7873.41011 -16597.66157
25 26 27 28 29 30
9753.41614 2830.01090 8960.49048 5806.54707 919.53124 8565.21191
31 32 33 34 35 36
-8084.22110 -7766.52589 -4464.85592 -4520.63980 -5950.62609 -21999.96729
37 38 39 40 41 42
14456.01809 11065.70691 22841.84453 8387.29424 8241.88938 2550.69338
43 44 45 46 47 48
-8317.87651 -10889.96322 -8798.76592 -3637.29737 -10560.85192 -21623.27557
49 50 51 52 53 54
11433.37028 3586.32176 14487.10694 2022.93025 1341.22156 4333.45981
55 56 57 58 59 60
-5441.40245 -10995.59598 -8697.23802 47.29508 -8131.45758 -21870.34147
61 62 63 64 65 66
11761.14890 9817.67319 10320.49275 15987.42984 2569.77967 5282.74237
67 68 69 70 71 72
-5080.92569 -11722.74782 -7804.70639 -265.81196 -10547.48417 -17767.77813
73 74 75 76 77 78
7434.00201 6884.10754 12250.64005 8806.43786 -1607.07888 4085.80618
79 80 81 82 83 84
-3442.23833 -11676.46199 -6254.20920 -2142.55001 -8010.87158 -15337.35754
85 86 87 88 89
7870.34003 5930.18706 21551.83778 12787.43877 3963.34188
> postscript(file="/var/www/html/rcomp/tmp/6k14e1292179482.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 = 89
Frequency = 1
lag(myerror, k = 1) myerror
0 12008.29914 NA
1 6149.86033 12008.29914
2 12215.62454 6149.86033
3 5665.51381 12215.62454
4 -1481.11818 5665.51381
5 1177.24619 -1481.11818
6 -2409.79996 1177.24619
7 -9549.56832 -2409.79996
8 -6015.22604 -9549.56832
9 4921.11295 -6015.22604
10 -9955.65361 4921.11295
11 -13963.05903 -9955.65361
12 6295.26628 -13963.05903
13 8287.30960 6295.26628
14 19957.22730 8287.30960
15 11654.80145 19957.22730
16 -2575.49633 11654.80145
17 321.31808 -2575.49633
18 -10488.63636 321.31808
19 -12233.64646 -10488.63636
20 -8312.71836 -12233.64646
21 -2720.22739 -8312.71836
22 -7873.41011 -2720.22739
23 -16597.66157 -7873.41011
24 9753.41614 -16597.66157
25 2830.01090 9753.41614
26 8960.49048 2830.01090
27 5806.54707 8960.49048
28 919.53124 5806.54707
29 8565.21191 919.53124
30 -8084.22110 8565.21191
31 -7766.52589 -8084.22110
32 -4464.85592 -7766.52589
33 -4520.63980 -4464.85592
34 -5950.62609 -4520.63980
35 -21999.96729 -5950.62609
36 14456.01809 -21999.96729
37 11065.70691 14456.01809
38 22841.84453 11065.70691
39 8387.29424 22841.84453
40 8241.88938 8387.29424
41 2550.69338 8241.88938
42 -8317.87651 2550.69338
43 -10889.96322 -8317.87651
44 -8798.76592 -10889.96322
45 -3637.29737 -8798.76592
46 -10560.85192 -3637.29737
47 -21623.27557 -10560.85192
48 11433.37028 -21623.27557
49 3586.32176 11433.37028
50 14487.10694 3586.32176
51 2022.93025 14487.10694
52 1341.22156 2022.93025
53 4333.45981 1341.22156
54 -5441.40245 4333.45981
55 -10995.59598 -5441.40245
56 -8697.23802 -10995.59598
57 47.29508 -8697.23802
58 -8131.45758 47.29508
59 -21870.34147 -8131.45758
60 11761.14890 -21870.34147
61 9817.67319 11761.14890
62 10320.49275 9817.67319
63 15987.42984 10320.49275
64 2569.77967 15987.42984
65 5282.74237 2569.77967
66 -5080.92569 5282.74237
67 -11722.74782 -5080.92569
68 -7804.70639 -11722.74782
69 -265.81196 -7804.70639
70 -10547.48417 -265.81196
71 -17767.77813 -10547.48417
72 7434.00201 -17767.77813
73 6884.10754 7434.00201
74 12250.64005 6884.10754
75 8806.43786 12250.64005
76 -1607.07888 8806.43786
77 4085.80618 -1607.07888
78 -3442.23833 4085.80618
79 -11676.46199 -3442.23833
80 -6254.20920 -11676.46199
81 -2142.55001 -6254.20920
82 -8010.87158 -2142.55001
83 -15337.35754 -8010.87158
84 7870.34003 -15337.35754
85 5930.18706 7870.34003
86 21551.83778 5930.18706
87 12787.43877 21551.83778
88 3963.34188 12787.43877
89 NA 3963.34188
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 6149.86033 12008.29914
[2,] 12215.62454 6149.86033
[3,] 5665.51381 12215.62454
[4,] -1481.11818 5665.51381
[5,] 1177.24619 -1481.11818
[6,] -2409.79996 1177.24619
[7,] -9549.56832 -2409.79996
[8,] -6015.22604 -9549.56832
[9,] 4921.11295 -6015.22604
[10,] -9955.65361 4921.11295
[11,] -13963.05903 -9955.65361
[12,] 6295.26628 -13963.05903
[13,] 8287.30960 6295.26628
[14,] 19957.22730 8287.30960
[15,] 11654.80145 19957.22730
[16,] -2575.49633 11654.80145
[17,] 321.31808 -2575.49633
[18,] -10488.63636 321.31808
[19,] -12233.64646 -10488.63636
[20,] -8312.71836 -12233.64646
[21,] -2720.22739 -8312.71836
[22,] -7873.41011 -2720.22739
[23,] -16597.66157 -7873.41011
[24,] 9753.41614 -16597.66157
[25,] 2830.01090 9753.41614
[26,] 8960.49048 2830.01090
[27,] 5806.54707 8960.49048
[28,] 919.53124 5806.54707
[29,] 8565.21191 919.53124
[30,] -8084.22110 8565.21191
[31,] -7766.52589 -8084.22110
[32,] -4464.85592 -7766.52589
[33,] -4520.63980 -4464.85592
[34,] -5950.62609 -4520.63980
[35,] -21999.96729 -5950.62609
[36,] 14456.01809 -21999.96729
[37,] 11065.70691 14456.01809
[38,] 22841.84453 11065.70691
[39,] 8387.29424 22841.84453
[40,] 8241.88938 8387.29424
[41,] 2550.69338 8241.88938
[42,] -8317.87651 2550.69338
[43,] -10889.96322 -8317.87651
[44,] -8798.76592 -10889.96322
[45,] -3637.29737 -8798.76592
[46,] -10560.85192 -3637.29737
[47,] -21623.27557 -10560.85192
[48,] 11433.37028 -21623.27557
[49,] 3586.32176 11433.37028
[50,] 14487.10694 3586.32176
[51,] 2022.93025 14487.10694
[52,] 1341.22156 2022.93025
[53,] 4333.45981 1341.22156
[54,] -5441.40245 4333.45981
[55,] -10995.59598 -5441.40245
[56,] -8697.23802 -10995.59598
[57,] 47.29508 -8697.23802
[58,] -8131.45758 47.29508
[59,] -21870.34147 -8131.45758
[60,] 11761.14890 -21870.34147
[61,] 9817.67319 11761.14890
[62,] 10320.49275 9817.67319
[63,] 15987.42984 10320.49275
[64,] 2569.77967 15987.42984
[65,] 5282.74237 2569.77967
[66,] -5080.92569 5282.74237
[67,] -11722.74782 -5080.92569
[68,] -7804.70639 -11722.74782
[69,] -265.81196 -7804.70639
[70,] -10547.48417 -265.81196
[71,] -17767.77813 -10547.48417
[72,] 7434.00201 -17767.77813
[73,] 6884.10754 7434.00201
[74,] 12250.64005 6884.10754
[75,] 8806.43786 12250.64005
[76,] -1607.07888 8806.43786
[77,] 4085.80618 -1607.07888
[78,] -3442.23833 4085.80618
[79,] -11676.46199 -3442.23833
[80,] -6254.20920 -11676.46199
[81,] -2142.55001 -6254.20920
[82,] -8010.87158 -2142.55001
[83,] -15337.35754 -8010.87158
[84,] 7870.34003 -15337.35754
[85,] 5930.18706 7870.34003
[86,] 21551.83778 5930.18706
[87,] 12787.43877 21551.83778
[88,] 3963.34188 12787.43877
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 6149.86033 12008.29914
2 12215.62454 6149.86033
3 5665.51381 12215.62454
4 -1481.11818 5665.51381
5 1177.24619 -1481.11818
6 -2409.79996 1177.24619
7 -9549.56832 -2409.79996
8 -6015.22604 -9549.56832
9 4921.11295 -6015.22604
10 -9955.65361 4921.11295
11 -13963.05903 -9955.65361
12 6295.26628 -13963.05903
13 8287.30960 6295.26628
14 19957.22730 8287.30960
15 11654.80145 19957.22730
16 -2575.49633 11654.80145
17 321.31808 -2575.49633
18 -10488.63636 321.31808
19 -12233.64646 -10488.63636
20 -8312.71836 -12233.64646
21 -2720.22739 -8312.71836
22 -7873.41011 -2720.22739
23 -16597.66157 -7873.41011
24 9753.41614 -16597.66157
25 2830.01090 9753.41614
26 8960.49048 2830.01090
27 5806.54707 8960.49048
28 919.53124 5806.54707
29 8565.21191 919.53124
30 -8084.22110 8565.21191
31 -7766.52589 -8084.22110
32 -4464.85592 -7766.52589
33 -4520.63980 -4464.85592
34 -5950.62609 -4520.63980
35 -21999.96729 -5950.62609
36 14456.01809 -21999.96729
37 11065.70691 14456.01809
38 22841.84453 11065.70691
39 8387.29424 22841.84453
40 8241.88938 8387.29424
41 2550.69338 8241.88938
42 -8317.87651 2550.69338
43 -10889.96322 -8317.87651
44 -8798.76592 -10889.96322
45 -3637.29737 -8798.76592
46 -10560.85192 -3637.29737
47 -21623.27557 -10560.85192
48 11433.37028 -21623.27557
49 3586.32176 11433.37028
50 14487.10694 3586.32176
51 2022.93025 14487.10694
52 1341.22156 2022.93025
53 4333.45981 1341.22156
54 -5441.40245 4333.45981
55 -10995.59598 -5441.40245
56 -8697.23802 -10995.59598
57 47.29508 -8697.23802
58 -8131.45758 47.29508
59 -21870.34147 -8131.45758
60 11761.14890 -21870.34147
61 9817.67319 11761.14890
62 10320.49275 9817.67319
63 15987.42984 10320.49275
64 2569.77967 15987.42984
65 5282.74237 2569.77967
66 -5080.92569 5282.74237
67 -11722.74782 -5080.92569
68 -7804.70639 -11722.74782
69 -265.81196 -7804.70639
70 -10547.48417 -265.81196
71 -17767.77813 -10547.48417
72 7434.00201 -17767.77813
73 6884.10754 7434.00201
74 12250.64005 6884.10754
75 8806.43786 12250.64005
76 -1607.07888 8806.43786
77 4085.80618 -1607.07888
78 -3442.23833 4085.80618
79 -11676.46199 -3442.23833
80 -6254.20920 -11676.46199
81 -2142.55001 -6254.20920
82 -8010.87158 -2142.55001
83 -15337.35754 -8010.87158
84 7870.34003 -15337.35754
85 5930.18706 7870.34003
86 21551.83778 5930.18706
87 12787.43877 21551.83778
88 3963.34188 12787.43877
> 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/7dsly1292179482.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/rcomp/tmp/8dsly1292179482.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/rcomp/tmp/9njlj1292179482.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
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10njlj1292179482.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ 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/11rk1p1292179482.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/12u2iv1292179482.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/1313f71292179482.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/14cdes1292179482.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/158mc11292179482.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/16bnso1292179482.tab")
+ }
>
> try(system("convert tmp/1z0681292179482.ps tmp/1z0681292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/2r95b1292179482.ps tmp/2r95b1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/3r95b1292179482.ps tmp/3r95b1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/4r95b1292179482.ps tmp/4r95b1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/5r95b1292179482.ps tmp/5r95b1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k14e1292179482.ps tmp/6k14e1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/7dsly1292179482.ps tmp/7dsly1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dsly1292179482.ps tmp/8dsly1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/9njlj1292179482.ps tmp/9njlj1292179482.png",intern=TRUE))
character(0)
> try(system("convert tmp/10njlj1292179482.ps tmp/10njlj1292179482.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.836 1.659 6.630