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(31514
+ ,-9
+ ,8.3
+ ,1.2
+ ,27071
+ ,-13
+ ,8.2
+ ,1.7
+ ,29462
+ ,-18
+ ,8
+ ,1.8
+ ,26105
+ ,-11
+ ,7.9
+ ,1.5
+ ,22397
+ ,-9
+ ,7.6
+ ,1
+ ,23843
+ ,-10
+ ,7.6
+ ,1.6
+ ,21705
+ ,-13
+ ,8.3
+ ,1.5
+ ,18089
+ ,-11
+ ,8.4
+ ,1.8
+ ,20764
+ ,-5
+ ,8.4
+ ,1.8
+ ,25316
+ ,-15
+ ,8.4
+ ,1.6
+ ,17704
+ ,-6
+ ,8.4
+ ,1.9
+ ,15548
+ ,-6
+ ,8.6
+ ,1.7
+ ,28029
+ ,-3
+ ,8.9
+ ,1.6
+ ,29383
+ ,-1
+ ,8.8
+ ,1.3
+ ,36438
+ ,-3
+ ,8.3
+ ,1.1
+ ,32034
+ ,-4
+ ,7.5
+ ,1.9
+ ,22679
+ ,-6
+ ,7.2
+ ,2.6
+ ,24319
+ ,0
+ ,7.4
+ ,2.3
+ ,18004
+ ,-4
+ ,8.8
+ ,2.4
+ ,17537
+ ,-2
+ ,9.3
+ ,2.2
+ ,20366
+ ,-2
+ ,9.3
+ ,2
+ ,22782
+ ,-6
+ ,8.7
+ ,2.9
+ ,19169
+ ,-7
+ ,8.2
+ ,2.6
+ ,13807
+ ,-6
+ ,8.3
+ ,2.3
+ ,29743
+ ,-6
+ ,8.5
+ ,2.3
+ ,25591
+ ,-3
+ ,8.6
+ ,2.6
+ ,29096
+ ,-2
+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entenvertrouwen'
+ ,'Totaal_Werkloosheid'
+ ,'Algemene_index
')
+ ,1:94))
> y <- array(NA,dim=c(4,94),dimnames=list(c('Inschrijvingen','Consumentenvertrouwen','Totaal_Werkloosheid','Algemene_index
'),1:94))
> 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 = '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 Consumentenvertrouwen Totaal_Werkloosheid Algemene_index\r
1 31514 -9 8.3 1.2
2 27071 -13 8.2 1.7
3 29462 -18 8.0 1.8
4 26105 -11 7.9 1.5
5 22397 -9 7.6 1.0
6 23843 -10 7.6 1.6
7 21705 -13 8.3 1.5
8 18089 -11 8.4 1.8
9 20764 -5 8.4 1.8
10 25316 -15 8.4 1.6
11 17704 -6 8.4 1.9
12 15548 -6 8.6 1.7
13 28029 -3 8.9 1.6
14 29383 -1 8.8 1.3
15 36438 -3 8.3 1.1
16 32034 -4 7.5 1.9
17 22679 -6 7.2 2.6
18 24319 0 7.4 2.3
19 18004 -4 8.8 2.4
20 17537 -2 9.3 2.2
21 20366 -2 9.3 2.0
22 22782 -6 8.7 2.9
23 19169 -7 8.2 2.6
24 13807 -6 8.3 2.3
25 29743 -6 8.5 2.3
26 25591 -3 8.6 2.6
27 29096 -2 8.5 3.1
28 26482 -5 8.2 2.8
29 22405 -11 8.1 2.5
30 27044 -11 7.9 2.9
31 17970 -11 8.6 3.1
32 18730 -10 8.7 3.1
33 19684 -14 8.7 3.2
34 19785 -8 8.5 2.5
35 18479 -9 8.4 2.6
36 10698 -5 8.5 2.9
37 31956 -1 8.7 2.6
38 29506 -2 8.7 2.4
39 34506 -5 8.6 1.7
40 27165 -4 8.5 2.0
41 26736 -6 8.3 2.2
42 23691 -2 8.0 1.9
43 18157 -2 8.2 1.6
44 17328 -2 8.1 1.6
45 18205 -2 8.1 1.2
46 20995 2 8.0 1.2
47 17382 1 7.9 1.5
48 9367 -8 7.9 1.6
49 31124 -1 8.0 1.7
50 26551 1 8.0 1.8
51 30651 -1 7.9 1.8
52 25859 2 8.0 1.8
53 25100 2 7.7 1.3
54 25778 1 7.2 1.3
55 20418 -1 7.5 1.4
56 18688 -2 7.3 1.1
57 20424 -2 7.0 1.5
58 24776 -1 7.0 2.2
59 19814 -8 7.0 2.9
60 12738 -4 7.2 3.1
61 31566 -6 7.3 3.5
62 30111 -3 7.1 3.6
63 30019 -3 6.8 4.4
64 31934 -7 6.4 4.2
65 25826 -9 6.1 5.2
66 26835 -11 6.5 5.8
67 20205 -13 7.7 5.9
68 17789 -11 7.9 5.4
69 20520 -9 7.5 5.5
70 22518 -17 6.9 4.7
71 15572 -22 6.6 3.1
72 11509 -25 6.9 2.6
73 25447 -20 7.7 2.3
74 24090 -24 8.0 1.9
75 27786 -24 8.0 0.6
76 26195 -22 7.7 0.6
77 20516 -19 7.3 -0.4
78 22759 -18 7.4 -1.1
79 19028 -17 8.1 -1.7
80 16971 -11 8.3 -0.8
81 20036 -11 8.1 -1.2
82 22485 -12 7.9 -1.0
83 18730 -10 7.9 -0.1
84 14538 -15 8.3 0.3
85 27561 -15 8.6 0.6
86 25985 -15 8.7 0.7
87 34670 -13 8.5 1.7
88 32066 -8 8.3 1.8
89 27186 -13 8.0 2.3
90 29586 -9 8.1 2.5
91 21359 -7 8.9 2.6
92 21553 -4 8.9 2.3
93 19573 -4 8.7 2.9
94 24256 -2 8.3 3.0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Consumentenvertrouwen Totaal_Werkloosheid
26301.7 110.8 -288.5
`Algemene_index\r`
102.6
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-13933.2 -4149.0 -190.7 4399.9 12750.5
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 26301.68 8283.02 3.175 0.00205 **
Consumentenvertrouwen 110.79 94.69 1.170 0.24510
Totaal_Werkloosheid -288.51 969.33 -0.298 0.76667
`Algemene_index\r` 102.55 446.00 0.230 0.81866
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5743 on 90 degrees of freedom
Multiple R-squared: 0.01734, Adjusted R-squared: -0.01542
F-statistic: 0.5293 on 3 and 90 DF, p-value: 0.6633
> 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.4007798 0.8015596 0.59922020
[2,] 0.4620941 0.9241882 0.53790590
[3,] 0.3326797 0.6653594 0.66732030
[4,] 0.2249721 0.4499443 0.77502786
[5,] 0.1499513 0.2999026 0.85004870
[6,] 0.1320602 0.2641203 0.86793983
[7,] 0.2380886 0.4761772 0.76191141
[8,] 0.2216580 0.4433160 0.77834202
[9,] 0.3596772 0.7193545 0.64032276
[10,] 0.5809736 0.8380528 0.41902641
[11,] 0.4977421 0.9954841 0.50225793
[12,] 0.4122352 0.8244703 0.58776483
[13,] 0.3430592 0.6861185 0.65694076
[14,] 0.2849570 0.5699141 0.71504296
[15,] 0.2246318 0.4492636 0.77536818
[16,] 0.2422523 0.4845047 0.75774767
[17,] 0.1924765 0.3849530 0.80752349
[18,] 0.2560820 0.5121639 0.74391805
[19,] 0.3454892 0.6909784 0.65451080
[20,] 0.3314405 0.6628809 0.66855954
[21,] 0.4175210 0.8350421 0.58247895
[22,] 0.3830634 0.7661267 0.61693663
[23,] 0.3191297 0.6382595 0.68087025
[24,] 0.2984047 0.5968095 0.70159527
[25,] 0.2606890 0.5213779 0.73931103
[26,] 0.2203069 0.4406137 0.77969314
[27,] 0.1806268 0.3612537 0.81937316
[28,] 0.1509618 0.3019236 0.84903818
[29,] 0.1341638 0.2683276 0.86583622
[30,] 0.2944717 0.5889433 0.70552833
[31,] 0.3827679 0.7655358 0.61723210
[32,] 0.3853817 0.7707633 0.61461835
[33,] 0.5137668 0.9724664 0.48623321
[34,] 0.4668113 0.9336226 0.53318868
[35,] 0.4213780 0.8427559 0.57862204
[36,] 0.3726557 0.7453114 0.62734430
[37,] 0.4164017 0.8328034 0.58359828
[38,] 0.4721921 0.9443842 0.52780792
[39,] 0.5052701 0.9894598 0.49472991
[40,] 0.4790481 0.9580962 0.52095192
[41,] 0.5150192 0.9699616 0.48498081
[42,] 0.8004436 0.3991127 0.19955636
[43,] 0.8142858 0.3714285 0.18571423
[44,] 0.7753552 0.4492896 0.22464479
[45,] 0.7833627 0.4332747 0.21663733
[46,] 0.7373827 0.5252347 0.26261733
[47,] 0.6858664 0.6282672 0.31413360
[48,] 0.6352689 0.7294622 0.36473110
[49,] 0.6006664 0.7986672 0.39933362
[50,] 0.5930141 0.8139718 0.40698588
[51,] 0.5550534 0.8898933 0.44494665
[52,] 0.4936553 0.9873107 0.50634466
[53,] 0.4536726 0.9073452 0.54632739
[54,] 0.6420559 0.7158882 0.35794412
[55,] 0.6950741 0.6098519 0.30492594
[56,] 0.6903657 0.6192686 0.30963430
[57,] 0.6809580 0.6380841 0.31904204
[58,] 0.7543220 0.4913560 0.24567802
[59,] 0.7471549 0.5056902 0.25284510
[60,] 0.7932617 0.4134767 0.20673834
[61,] 0.7529745 0.4940510 0.24702549
[62,] 0.7580508 0.4838985 0.24194925
[63,] 0.7059948 0.5880104 0.29400520
[64,] 0.6481539 0.7036922 0.35184611
[65,] 0.6194302 0.7611396 0.38056980
[66,] 0.8834678 0.2330645 0.11653225
[67,] 0.8597214 0.2805572 0.14027860
[68,] 0.8723837 0.2552326 0.12761631
[69,] 0.8359399 0.3281202 0.16406012
[70,] 0.7898064 0.4203873 0.21019364
[71,] 0.7840691 0.4318618 0.21593090
[72,] 0.7194968 0.5610063 0.28050317
[73,] 0.6444401 0.7111198 0.35555988
[74,] 0.5708975 0.8582049 0.42910246
[75,] 0.4800464 0.9600928 0.51995359
[76,] 0.4175344 0.8350688 0.58246562
[77,] 0.3178956 0.6357912 0.68210442
[78,] 0.8308791 0.3382418 0.16912092
[79,] 0.7688993 0.4622014 0.23110068
[80,] 0.9185193 0.1629615 0.08148073
[81,] 0.9471478 0.1057045 0.05285225
> postscript(file="/var/www/html/rcomp/tmp/1rk1p1292178957.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/2rk1p1292178957.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/3rk1p1292178957.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/4jt0a1292178957.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/5jt0a1292178957.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 = 94
Frequency = 1
1 2 3 4 5 6
8480.97016 4400.99206 7277.97064 3147.37528 -817.47612 677.78025
7 8 9 10 11 12
-915.64676 -4755.13543 -2744.85811 2935.52328 -5704.32612 -7782.11401
13 14 15 16 17 18
4463.33257 5597.67278 12750.50260 8144.44126 -1147.32319 -83.57863
19 20 21 22 23 24
-5561.77225 -6085.58156 -3236.07131 -642.32458 -4258.02675 -9671.19756
25 26 27 28 29 30
6322.50431 1836.22852 5150.31485 2812.88877 -597.47410 3942.80353
31 32 33 34 35 36
-4949.75019 -4271.68637 -2884.79304 -3434.43171 -4668.75066 -12894.81356
37 38 39 40 41 42
8008.50523 5689.80259 11065.09888 3553.69545 3268.05757 -275.87831
43 44 45 46 47 48
-5721.41107 -6579.26200 -5661.24150 -3343.24089 -6905.07008 -13933.24118
49 50 51 52 53 54
7066.84483 2262.01547 6554.73877 1459.22836 664.95119 1309.48364
55 56 57 58 59 60
-3752.64446 -5398.79384 -3790.36713 379.05988 -3879.21620 -11361.17304
61 62 63 64 65 66
7676.23162 5820.91329 5560.31949 7823.57447 1748.04465 3032.49186
67 68 69 70 71 72
-3039.97785 -5568.57459 -3184.80767 -391.57536 -6706.11058 -10298.92082
73 74 75 76 77 78
3346.71644 2560.43820 6389.75482 4490.62780 -1533.58603 699.26367
79 80 81 82 83 84
-2879.03617 -5635.35311 -2587.03448 -105.45948 -4174.32983 -7738.01103
85 86 87 88 89 90
5340.77639 3783.37220 12086.54486 8860.65230 4396.75944 6361.95167
91 92 93 94
-1866.07022 -1973.66619 -4072.89880 262.86811
> postscript(file="/var/www/html/rcomp/tmp/6jt0a1292178957.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 = 94
Frequency = 1
lag(myerror, k = 1) myerror
0 8480.97016 NA
1 4400.99206 8480.97016
2 7277.97064 4400.99206
3 3147.37528 7277.97064
4 -817.47612 3147.37528
5 677.78025 -817.47612
6 -915.64676 677.78025
7 -4755.13543 -915.64676
8 -2744.85811 -4755.13543
9 2935.52328 -2744.85811
10 -5704.32612 2935.52328
11 -7782.11401 -5704.32612
12 4463.33257 -7782.11401
13 5597.67278 4463.33257
14 12750.50260 5597.67278
15 8144.44126 12750.50260
16 -1147.32319 8144.44126
17 -83.57863 -1147.32319
18 -5561.77225 -83.57863
19 -6085.58156 -5561.77225
20 -3236.07131 -6085.58156
21 -642.32458 -3236.07131
22 -4258.02675 -642.32458
23 -9671.19756 -4258.02675
24 6322.50431 -9671.19756
25 1836.22852 6322.50431
26 5150.31485 1836.22852
27 2812.88877 5150.31485
28 -597.47410 2812.88877
29 3942.80353 -597.47410
30 -4949.75019 3942.80353
31 -4271.68637 -4949.75019
32 -2884.79304 -4271.68637
33 -3434.43171 -2884.79304
34 -4668.75066 -3434.43171
35 -12894.81356 -4668.75066
36 8008.50523 -12894.81356
37 5689.80259 8008.50523
38 11065.09888 5689.80259
39 3553.69545 11065.09888
40 3268.05757 3553.69545
41 -275.87831 3268.05757
42 -5721.41107 -275.87831
43 -6579.26200 -5721.41107
44 -5661.24150 -6579.26200
45 -3343.24089 -5661.24150
46 -6905.07008 -3343.24089
47 -13933.24118 -6905.07008
48 7066.84483 -13933.24118
49 2262.01547 7066.84483
50 6554.73877 2262.01547
51 1459.22836 6554.73877
52 664.95119 1459.22836
53 1309.48364 664.95119
54 -3752.64446 1309.48364
55 -5398.79384 -3752.64446
56 -3790.36713 -5398.79384
57 379.05988 -3790.36713
58 -3879.21620 379.05988
59 -11361.17304 -3879.21620
60 7676.23162 -11361.17304
61 5820.91329 7676.23162
62 5560.31949 5820.91329
63 7823.57447 5560.31949
64 1748.04465 7823.57447
65 3032.49186 1748.04465
66 -3039.97785 3032.49186
67 -5568.57459 -3039.97785
68 -3184.80767 -5568.57459
69 -391.57536 -3184.80767
70 -6706.11058 -391.57536
71 -10298.92082 -6706.11058
72 3346.71644 -10298.92082
73 2560.43820 3346.71644
74 6389.75482 2560.43820
75 4490.62780 6389.75482
76 -1533.58603 4490.62780
77 699.26367 -1533.58603
78 -2879.03617 699.26367
79 -5635.35311 -2879.03617
80 -2587.03448 -5635.35311
81 -105.45948 -2587.03448
82 -4174.32983 -105.45948
83 -7738.01103 -4174.32983
84 5340.77639 -7738.01103
85 3783.37220 5340.77639
86 12086.54486 3783.37220
87 8860.65230 12086.54486
88 4396.75944 8860.65230
89 6361.95167 4396.75944
90 -1866.07022 6361.95167
91 -1973.66619 -1866.07022
92 -4072.89880 -1973.66619
93 262.86811 -4072.89880
94 NA 262.86811
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 4400.99206 8480.97016
[2,] 7277.97064 4400.99206
[3,] 3147.37528 7277.97064
[4,] -817.47612 3147.37528
[5,] 677.78025 -817.47612
[6,] -915.64676 677.78025
[7,] -4755.13543 -915.64676
[8,] -2744.85811 -4755.13543
[9,] 2935.52328 -2744.85811
[10,] -5704.32612 2935.52328
[11,] -7782.11401 -5704.32612
[12,] 4463.33257 -7782.11401
[13,] 5597.67278 4463.33257
[14,] 12750.50260 5597.67278
[15,] 8144.44126 12750.50260
[16,] -1147.32319 8144.44126
[17,] -83.57863 -1147.32319
[18,] -5561.77225 -83.57863
[19,] -6085.58156 -5561.77225
[20,] -3236.07131 -6085.58156
[21,] -642.32458 -3236.07131
[22,] -4258.02675 -642.32458
[23,] -9671.19756 -4258.02675
[24,] 6322.50431 -9671.19756
[25,] 1836.22852 6322.50431
[26,] 5150.31485 1836.22852
[27,] 2812.88877 5150.31485
[28,] -597.47410 2812.88877
[29,] 3942.80353 -597.47410
[30,] -4949.75019 3942.80353
[31,] -4271.68637 -4949.75019
[32,] -2884.79304 -4271.68637
[33,] -3434.43171 -2884.79304
[34,] -4668.75066 -3434.43171
[35,] -12894.81356 -4668.75066
[36,] 8008.50523 -12894.81356
[37,] 5689.80259 8008.50523
[38,] 11065.09888 5689.80259
[39,] 3553.69545 11065.09888
[40,] 3268.05757 3553.69545
[41,] -275.87831 3268.05757
[42,] -5721.41107 -275.87831
[43,] -6579.26200 -5721.41107
[44,] -5661.24150 -6579.26200
[45,] -3343.24089 -5661.24150
[46,] -6905.07008 -3343.24089
[47,] -13933.24118 -6905.07008
[48,] 7066.84483 -13933.24118
[49,] 2262.01547 7066.84483
[50,] 6554.73877 2262.01547
[51,] 1459.22836 6554.73877
[52,] 664.95119 1459.22836
[53,] 1309.48364 664.95119
[54,] -3752.64446 1309.48364
[55,] -5398.79384 -3752.64446
[56,] -3790.36713 -5398.79384
[57,] 379.05988 -3790.36713
[58,] -3879.21620 379.05988
[59,] -11361.17304 -3879.21620
[60,] 7676.23162 -11361.17304
[61,] 5820.91329 7676.23162
[62,] 5560.31949 5820.91329
[63,] 7823.57447 5560.31949
[64,] 1748.04465 7823.57447
[65,] 3032.49186 1748.04465
[66,] -3039.97785 3032.49186
[67,] -5568.57459 -3039.97785
[68,] -3184.80767 -5568.57459
[69,] -391.57536 -3184.80767
[70,] -6706.11058 -391.57536
[71,] -10298.92082 -6706.11058
[72,] 3346.71644 -10298.92082
[73,] 2560.43820 3346.71644
[74,] 6389.75482 2560.43820
[75,] 4490.62780 6389.75482
[76,] -1533.58603 4490.62780
[77,] 699.26367 -1533.58603
[78,] -2879.03617 699.26367
[79,] -5635.35311 -2879.03617
[80,] -2587.03448 -5635.35311
[81,] -105.45948 -2587.03448
[82,] -4174.32983 -105.45948
[83,] -7738.01103 -4174.32983
[84,] 5340.77639 -7738.01103
[85,] 3783.37220 5340.77639
[86,] 12086.54486 3783.37220
[87,] 8860.65230 12086.54486
[88,] 4396.75944 8860.65230
[89,] 6361.95167 4396.75944
[90,] -1866.07022 6361.95167
[91,] -1973.66619 -1866.07022
[92,] -4072.89880 -1973.66619
[93,] 262.86811 -4072.89880
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 4400.99206 8480.97016
2 7277.97064 4400.99206
3 3147.37528 7277.97064
4 -817.47612 3147.37528
5 677.78025 -817.47612
6 -915.64676 677.78025
7 -4755.13543 -915.64676
8 -2744.85811 -4755.13543
9 2935.52328 -2744.85811
10 -5704.32612 2935.52328
11 -7782.11401 -5704.32612
12 4463.33257 -7782.11401
13 5597.67278 4463.33257
14 12750.50260 5597.67278
15 8144.44126 12750.50260
16 -1147.32319 8144.44126
17 -83.57863 -1147.32319
18 -5561.77225 -83.57863
19 -6085.58156 -5561.77225
20 -3236.07131 -6085.58156
21 -642.32458 -3236.07131
22 -4258.02675 -642.32458
23 -9671.19756 -4258.02675
24 6322.50431 -9671.19756
25 1836.22852 6322.50431
26 5150.31485 1836.22852
27 2812.88877 5150.31485
28 -597.47410 2812.88877
29 3942.80353 -597.47410
30 -4949.75019 3942.80353
31 -4271.68637 -4949.75019
32 -2884.79304 -4271.68637
33 -3434.43171 -2884.79304
34 -4668.75066 -3434.43171
35 -12894.81356 -4668.75066
36 8008.50523 -12894.81356
37 5689.80259 8008.50523
38 11065.09888 5689.80259
39 3553.69545 11065.09888
40 3268.05757 3553.69545
41 -275.87831 3268.05757
42 -5721.41107 -275.87831
43 -6579.26200 -5721.41107
44 -5661.24150 -6579.26200
45 -3343.24089 -5661.24150
46 -6905.07008 -3343.24089
47 -13933.24118 -6905.07008
48 7066.84483 -13933.24118
49 2262.01547 7066.84483
50 6554.73877 2262.01547
51 1459.22836 6554.73877
52 664.95119 1459.22836
53 1309.48364 664.95119
54 -3752.64446 1309.48364
55 -5398.79384 -3752.64446
56 -3790.36713 -5398.79384
57 379.05988 -3790.36713
58 -3879.21620 379.05988
59 -11361.17304 -3879.21620
60 7676.23162 -11361.17304
61 5820.91329 7676.23162
62 5560.31949 5820.91329
63 7823.57447 5560.31949
64 1748.04465 7823.57447
65 3032.49186 1748.04465
66 -3039.97785 3032.49186
67 -5568.57459 -3039.97785
68 -3184.80767 -5568.57459
69 -391.57536 -3184.80767
70 -6706.11058 -391.57536
71 -10298.92082 -6706.11058
72 3346.71644 -10298.92082
73 2560.43820 3346.71644
74 6389.75482 2560.43820
75 4490.62780 6389.75482
76 -1533.58603 4490.62780
77 699.26367 -1533.58603
78 -2879.03617 699.26367
79 -5635.35311 -2879.03617
80 -2587.03448 -5635.35311
81 -105.45948 -2587.03448
82 -4174.32983 -105.45948
83 -7738.01103 -4174.32983
84 5340.77639 -7738.01103
85 3783.37220 5340.77639
86 12086.54486 3783.37220
87 8860.65230 12086.54486
88 4396.75944 8860.65230
89 6361.95167 4396.75944
90 -1866.07022 6361.95167
91 -1973.66619 -1866.07022
92 -4072.89880 -1973.66619
93 262.86811 -4072.89880
> 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/7u2iv1292178957.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/85uzy1292178957.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/95uzy1292178957.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/105uzy1292178957.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/1113f71292178957.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/12cdes1292178957.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/13iebm1292178957.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/144w991292178957.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/15xn9u1292178957.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/16bfo31292178957.tab")
+ }
>
> try(system("convert tmp/1rk1p1292178957.ps tmp/1rk1p1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/2rk1p1292178957.ps tmp/2rk1p1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/3rk1p1292178957.ps tmp/3rk1p1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/4jt0a1292178957.ps tmp/4jt0a1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/5jt0a1292178957.ps tmp/5jt0a1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jt0a1292178957.ps tmp/6jt0a1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/7u2iv1292178957.ps tmp/7u2iv1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/85uzy1292178957.ps tmp/85uzy1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/95uzy1292178957.ps tmp/95uzy1292178957.png",intern=TRUE))
character(0)
> try(system("convert tmp/105uzy1292178957.ps tmp/105uzy1292178957.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.909 1.735 7.468