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(97.06
+ ,21.454
+ ,631.923
+ ,130.678
+ ,97.73
+ ,23.899
+ ,654.294
+ ,120.877
+ ,98
+ ,24.939
+ ,671.833
+ ,137.114
+ ,97.76
+ ,23.580
+ ,586.840
+ ,134.406
+ ,97.48
+ ,24.562
+ ,600.969
+ ,120.262
+ ,97.77
+ ,24.696
+ ,625.568
+ ,130.846
+ ,97.96
+ ,23.785
+ ,558.110
+ ,120.343
+ ,98.22
+ ,23.812
+ ,630.577
+ ,98.881
+ ,98.51
+ ,21.917
+ ,628.654
+ ,115.678
+ ,98.19
+ ,19.713
+ ,603.184
+ ,120.796
+ ,98.37
+ ,19.282
+ ,656.255
+ ,94.261
+ ,98.31
+ ,18.788
+ ,600.730
+ ,89.151
+ ,98.6
+ ,21.453
+ ,670.326
+ ,119.880
+ ,98.96
+ ,24.482
+ ,678.423
+ ,131.468
+ ,99.11
+ ,27.474
+ ,641.502
+ ,155.089
+ ,99.64
+ ,27.264
+ ,625.311
+ ,149.581
+ ,100.02
+ ,27.349
+ ,628.177
+ ,122.788
+ ,99.98
+ ,30.632
+ ,589.767
+ ,143.900
+ ,100.32
+ ,29.429
+ ,582.471
+ ,112.115
+ ,100.44
+ ,30.084
+ ,636.248
+ ,109.600
+ ,100.51
+ ,26.290
+ ,599.885
+ ,117.446
+ ,101
+ ,24.379
+ ,621.694
+ ,118.456
+ ,100.88
+ ,23.335
+ ,637.406
+ ,101.901
+ ,100.55
+ ,21.346
+ ,595.994
+ ,89.940
+ ,100.82
+ ,21.106
+ ,696.308
+ ,129.143
+ ,101.5
+ ,24.514
+ ,674.201
+ ,126.102
+ ,102.15
+ ,28.353
+ ,648.861
+ ,143.048
+ ,102.39
+ ,30.805
+ ,649.605
+ ,142.258
+ ,102.54
+ ,31.348
+ ,672.392
+ ,131.011
+ ,102.85
+ ,34.556
+ ,598.396
+ ,146.471
+ ,103.47
+ ,33.855
+ ,613.177
+ ,114.073
+ ,103.56
+ ,34.787
+ ,638.104
+ ,114.642
+ ,103.69
+ ,32.529
+ ,615.632
+ ,118.226
+ ,103.49
+ ,29.998
+ ,634.465
+ ,111.338
+ ,103.47
+ ,29.257
+ ,638.686
+ ,108.701
+ ,103.45
+ ,28.155
+ ,604.243
+ ,80.512
+ ,103.48
+ ,30.466
+ ,706.669
+ ,146.865
+ ,103.93
+ ,35.704
+ ,677.185
+ ,137.179
+ ,103.89
+ ,39.327
+ ,644.328
+ ,166.536
+ ,104.4
+ ,39.351
+ ,664.825
+ ,137.070
+ ,104.79
+ ,42.234
+ ,605.707
+ ,127.090
+ ,104.77
+ ,43.630
+ ,600.136
+ ,139.966
+ ,105.13
+ ,43.722
+ ,612.166
+ ,122.243
+ ,105.26
+ ,43.121
+ ,599.659
+ ,109.097
+ ,104.96
+ ,37.985
+ ,634.210
+ ,116.591
+ ,104.75
+ ,37.135
+ ,618.234
+ ,111.964
+ ,105.01
+ ,34.646
+ ,613.576
+ ,109.754
+ ,105.15
+ ,33.026
+ ,627.200
+ ,77.609
+ ,105.2
+ ,35.087
+ ,668.973
+ ,138.445
+ ,105.77
+ ,38.846
+ ,651.479
+ ,127.901
+ ,105.78
+ ,42.013
+ ,619.661
+ ,156.615
+ ,106.26
+ ,43.908
+ ,644.260
+ ,133.264
+ ,106.13
+ ,42.868
+ ,579.936
+ ,143.521
+ ,106.12
+ ,44.423
+ ,601.752
+ ,152.139
+ ,106.57
+ ,44.167
+ ,595.376
+ ,131.523
+ ,106.44
+ ,43.636
+ ,588.902
+ ,113.925
+ ,106.54
+ ,44.382
+ ,634.341
+ ,86.495
+ ,107.1
+ ,42.142
+ ,594.305
+ ,127.877
+ ,108.1
+ ,43.452
+ ,606.200
+ ,107.017
+ ,108.4
+ ,36.912
+ ,610.926
+ ,78.716
+ ,108.84
+ ,42.413
+ ,633.685
+ ,138.278
+ ,109.62
+ ,45.344
+ ,639.696
+ ,144.238
+ ,110.42
+ ,44.873
+ ,659.451
+ ,143.679
+ ,110.67
+ ,47.510
+ ,593.248
+ ,159.932
+ ,111.66
+ ,49.554
+ ,606.677
+ ,136.781
+ ,112.28
+ ,47.369
+ ,599.434
+ ,148.173
+ ,112.87
+ ,45.998
+ ,569.578
+ ,125.673
+ ,112.18
+ ,48.140
+ ,629.873
+ ,105.573
+ ,112.36
+ ,48.441
+ ,613.438
+ ,122.405
+ ,112.16
+ ,44.928
+ ,604.172
+ ,128.045
+ ,111.49
+ ,40.454
+ ,658.328
+ ,94.467
+ ,111.25
+ ,38.661
+ ,612.633
+ ,85.573
+ ,111.36
+ ,37.246
+ ,707.372
+ ,121.501
+ ,111.74
+ ,36.843
+ ,739.770
+ ,125.074
+ ,111.1
+ ,36.424
+ ,777.535
+ ,144.979
+ ,111.33
+ ,37.594
+ ,685.030
+ ,142.120
+ ,111.25
+ ,38.144
+ ,730.234
+ ,124.213
+ ,111.04
+ ,38.737
+ ,714.154
+ ,144.407
+ ,110.97
+ ,34.560
+ ,630.872
+ ,125.170
+ ,111.31
+ ,36.080
+ ,719.492
+ ,109.267
+ ,111.02
+ ,33.508
+ ,677.023
+ ,122.354
+ ,111.07
+ ,35.462
+ ,679.272
+ ,122.589
+ ,111.36
+ ,33.374
+ ,718.317
+ ,104.982
+ ,111.54
+ ,32.110
+ ,645.672
+ ,90.542)
+ ,dim=c(4
+ ,84)
+ ,dimnames=list(c('CPI'
+ ,'vacatures'
+ ,'werklozen'
+ ,'inschrijvingen')
+ ,1:84))
> y <- array(NA,dim=c(4,84),dimnames=list(c('CPI','vacatures','werklozen','inschrijvingen'),1:84))
> 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)
> 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
vacatures CPI werklozen inschrijvingen
1 21.454 97.06 631.923 130.678
2 23.899 97.73 654.294 120.877
3 24.939 98.00 671.833 137.114
4 23.580 97.76 586.840 134.406
5 24.562 97.48 600.969 120.262
6 24.696 97.77 625.568 130.846
7 23.785 97.96 558.110 120.343
8 23.812 98.22 630.577 98.881
9 21.917 98.51 628.654 115.678
10 19.713 98.19 603.184 120.796
11 19.282 98.37 656.255 94.261
12 18.788 98.31 600.730 89.151
13 21.453 98.60 670.326 119.880
14 24.482 98.96 678.423 131.468
15 27.474 99.11 641.502 155.089
16 27.264 99.64 625.311 149.581
17 27.349 100.02 628.177 122.788
18 30.632 99.98 589.767 143.900
19 29.429 100.32 582.471 112.115
20 30.084 100.44 636.248 109.600
21 26.290 100.51 599.885 117.446
22 24.379 101.00 621.694 118.456
23 23.335 100.88 637.406 101.901
24 21.346 100.55 595.994 89.940
25 21.106 100.82 696.308 129.143
26 24.514 101.50 674.201 126.102
27 28.353 102.15 648.861 143.048
28 30.805 102.39 649.605 142.258
29 31.348 102.54 672.392 131.011
30 34.556 102.85 598.396 146.471
31 33.855 103.47 613.177 114.073
32 34.787 103.56 638.104 114.642
33 32.529 103.69 615.632 118.226
34 29.998 103.49 634.465 111.338
35 29.257 103.47 638.686 108.701
36 28.155 103.45 604.243 80.512
37 30.466 103.48 706.669 146.865
38 35.704 103.93 677.185 137.179
39 39.327 103.89 644.328 166.536
40 39.351 104.40 664.825 137.070
41 42.234 104.79 605.707 127.090
42 43.630 104.77 600.136 139.966
43 43.722 105.13 612.166 122.243
44 43.121 105.26 599.659 109.097
45 37.985 104.96 634.210 116.591
46 37.135 104.75 618.234 111.964
47 34.646 105.01 613.576 109.754
48 33.026 105.15 627.200 77.609
49 35.087 105.20 668.973 138.445
50 38.846 105.77 651.479 127.901
51 42.013 105.78 619.661 156.615
52 43.908 106.26 644.260 133.264
53 42.868 106.13 579.936 143.521
54 44.423 106.12 601.752 152.139
55 44.167 106.57 595.376 131.523
56 43.636 106.44 588.902 113.925
57 44.382 106.54 634.341 86.495
58 42.142 107.10 594.305 127.877
59 43.452 108.10 606.200 107.017
60 36.912 108.40 610.926 78.716
61 42.413 108.84 633.685 138.278
62 45.344 109.62 639.696 144.238
63 44.873 110.42 659.451 143.679
64 47.510 110.67 593.248 159.932
65 49.554 111.66 606.677 136.781
66 47.369 112.28 599.434 148.173
67 45.998 112.87 569.578 125.673
68 48.140 112.18 629.873 105.573
69 48.441 112.36 613.438 122.405
70 44.928 112.16 604.172 128.045
71 40.454 111.49 658.328 94.467
72 38.661 111.25 612.633 85.573
73 37.246 111.36 707.372 121.501
74 36.843 111.74 739.770 125.074
75 36.424 111.10 777.535 144.979
76 37.594 111.33 685.030 142.120
77 38.144 111.25 730.234 124.213
78 38.737 111.04 714.154 144.407
79 34.560 110.97 630.872 125.170
80 36.080 111.31 719.492 109.267
81 33.508 111.02 677.023 122.354
82 35.462 111.07 679.272 122.589
83 33.374 111.36 718.317 104.982
84 32.110 111.54 645.672 90.542
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) CPI werklozen inschrijvingen
-93.42511 1.51551 -0.07059 0.11056
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.4952 -2.4436 -0.1974 2.1716 11.5614
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -93.42511 10.18926 -9.169 4.09e-14 ***
CPI 1.51551 0.08878 17.070 < 2e-16 ***
werklozen -0.07059 0.01050 -6.724 2.40e-09 ***
inschrijvingen 0.11056 0.02157 5.126 2.01e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.828 on 80 degrees of freedom
Multiple R-squared: 0.8008, Adjusted R-squared: 0.7933
F-statistic: 107.2 on 3 and 80 DF, p-value: < 2.2e-16
> 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.021786154 0.043572309 0.97821385
[2,] 0.008598579 0.017197158 0.99140142
[3,] 0.018260720 0.036521439 0.98173928
[4,] 0.050628772 0.101257543 0.94937123
[5,] 0.045004800 0.090009599 0.95499520
[6,] 0.029477857 0.058955713 0.97052214
[7,] 0.015272249 0.030544498 0.98472775
[8,] 0.007988277 0.015976555 0.99201172
[9,] 0.004170422 0.008340844 0.99582958
[10,] 0.002030184 0.004060368 0.99796982
[11,] 0.001917960 0.003835919 0.99808204
[12,] 0.001653015 0.003306030 0.99834699
[13,] 0.001673620 0.003347241 0.99832638
[14,] 0.002156300 0.004312600 0.99784370
[15,] 0.001909912 0.003819824 0.99809009
[16,] 0.004855643 0.009711285 0.99514436
[17,] 0.004425013 0.008850027 0.99557499
[18,] 0.007059356 0.014118713 0.99294064
[19,] 0.020534236 0.041068472 0.97946576
[20,] 0.018443592 0.036887184 0.98155641
[21,] 0.016876513 0.033753026 0.98312349
[22,] 0.013977065 0.027954129 0.98602294
[23,] 0.014449706 0.028899413 0.98555029
[24,] 0.014543380 0.029086759 0.98545662
[25,] 0.017138429 0.034276857 0.98286157
[26,] 0.022690035 0.045380070 0.97730997
[27,] 0.019089362 0.038178723 0.98091064
[28,] 0.017651093 0.035302187 0.98234891
[29,] 0.018460969 0.036921938 0.98153903
[30,] 0.026849294 0.053698588 0.97315071
[31,] 0.025121019 0.050242037 0.97487898
[32,] 0.026019819 0.052039638 0.97398018
[33,] 0.023734116 0.047468233 0.97626588
[34,] 0.036920694 0.073841388 0.96307931
[35,] 0.061550842 0.123101685 0.93844916
[36,] 0.072075805 0.144151610 0.92792419
[37,] 0.120005109 0.240010219 0.87999489
[38,] 0.161714932 0.323429865 0.83828507
[39,] 0.128412245 0.256824490 0.87158775
[40,] 0.100320019 0.200640038 0.89967998
[41,] 0.107377340 0.214754680 0.89262266
[42,] 0.092399079 0.184798158 0.90760092
[43,] 0.096173550 0.192347100 0.90382645
[44,] 0.072128857 0.144257715 0.92787114
[45,] 0.059783556 0.119567112 0.94021644
[46,] 0.058522888 0.117045776 0.94147711
[47,] 0.053502879 0.107005759 0.94649712
[48,] 0.039456099 0.078912197 0.96054390
[49,] 0.027551210 0.055102419 0.97244879
[50,] 0.019722640 0.039445281 0.98027736
[51,] 0.094868958 0.189737916 0.90513104
[52,] 0.076323170 0.152646340 0.92367683
[53,] 0.071909210 0.143818420 0.92809079
[54,] 0.073780706 0.147561413 0.92621929
[55,] 0.075256187 0.150512375 0.92474381
[56,] 0.106440719 0.212881438 0.89355928
[57,] 0.183510253 0.367020505 0.81648975
[58,] 0.287978889 0.575957778 0.71202111
[59,] 0.517996279 0.964007442 0.48200372
[60,] 0.517491402 0.965017196 0.48250860
[61,] 0.719612142 0.560775716 0.28038786
[62,] 0.771660142 0.456679715 0.22833986
[63,] 0.765578741 0.468842517 0.23442126
[64,] 0.763159955 0.473680091 0.23684005
[65,] 0.877393494 0.245213013 0.12260651
[66,] 0.991797369 0.016405262 0.00820263
[67,] 0.987783097 0.024433806 0.01221690
[68,] 0.973794881 0.052410238 0.02620512
[69,] 0.987227524 0.025544952 0.01277248
[70,] 0.980830225 0.038339551 0.01916978
[71,] 0.949228546 0.101542908 0.05077145
> postscript(file="/var/www/html/rcomp/tmp/13kc91292792240.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/23kc91292792240.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/33kc91292792240.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/4vbcc1292792240.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/5vbcc1292792240.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 = 84
Frequency = 1
1 2 3 4 5 6
-2.05528266 2.03718381 2.11090671 -4.58484713 -0.61729559 -0.35648520
7 8 9 10 11 12
-5.15622610 1.96528565 -2.36209117 -6.44498524 -0.46856087 -4.22630947
13 14 15 16 17 18
-0.48533649 1.28846291 -1.16482718 -2.71203085 -0.03828707 -1.74033987
19 20 21 22 23 24
-0.45940692 4.08805927 -3.24646550 -4.47217877 -2.39479278 -5.48461155
25 26 27 28 29 30
-3.38677558 -2.23369109 -3.04219327 -0.81404969 2.35372251 -1.84096563
31 32 33 34 35 36
1.14387386 3.63623058 -0.80140205 -0.93826974 -1.05943291 -1.44588041
37 38 39 40 41 42
0.71397963 4.25956150 2.37791642 6.33379833 5.55587374 5.16530099
43 44 45 46 47 48
7.52045813 7.29300296 4.22214210 3.07418663 0.10667822 2.79031402
49 50 51 52 53 54
0.99818481 3.82417464 1.55519196 7.04101647 0.52318469 2.68055572
55 56 57 58 59 60
3.57184792 4.72653784 11.56139388 1.07113652 4.01167430 0.47969041
61 62 63 64 65 66
0.33512136 1.84940004 1.62235518 -2.58995047 1.46133174 -3.43412217
67 68 69 70 71 72
-5.31921571 4.34718915 1.35420812 -3.13337775 0.94351895 -2.72814120
73 74 75 76 77 78
-1.59428341 -0.68115846 0.33493923 -5.05770096 0.78446449 -1.67212085
79 80 81 82 83 84
-9.49522876 -0.47629530 -7.05373696 -5.04273190 -2.86725398 -7.93571669
> postscript(file="/var/www/html/rcomp/tmp/6vbcc1292792240.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 = 84
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.05528266 NA
1 2.03718381 -2.05528266
2 2.11090671 2.03718381
3 -4.58484713 2.11090671
4 -0.61729559 -4.58484713
5 -0.35648520 -0.61729559
6 -5.15622610 -0.35648520
7 1.96528565 -5.15622610
8 -2.36209117 1.96528565
9 -6.44498524 -2.36209117
10 -0.46856087 -6.44498524
11 -4.22630947 -0.46856087
12 -0.48533649 -4.22630947
13 1.28846291 -0.48533649
14 -1.16482718 1.28846291
15 -2.71203085 -1.16482718
16 -0.03828707 -2.71203085
17 -1.74033987 -0.03828707
18 -0.45940692 -1.74033987
19 4.08805927 -0.45940692
20 -3.24646550 4.08805927
21 -4.47217877 -3.24646550
22 -2.39479278 -4.47217877
23 -5.48461155 -2.39479278
24 -3.38677558 -5.48461155
25 -2.23369109 -3.38677558
26 -3.04219327 -2.23369109
27 -0.81404969 -3.04219327
28 2.35372251 -0.81404969
29 -1.84096563 2.35372251
30 1.14387386 -1.84096563
31 3.63623058 1.14387386
32 -0.80140205 3.63623058
33 -0.93826974 -0.80140205
34 -1.05943291 -0.93826974
35 -1.44588041 -1.05943291
36 0.71397963 -1.44588041
37 4.25956150 0.71397963
38 2.37791642 4.25956150
39 6.33379833 2.37791642
40 5.55587374 6.33379833
41 5.16530099 5.55587374
42 7.52045813 5.16530099
43 7.29300296 7.52045813
44 4.22214210 7.29300296
45 3.07418663 4.22214210
46 0.10667822 3.07418663
47 2.79031402 0.10667822
48 0.99818481 2.79031402
49 3.82417464 0.99818481
50 1.55519196 3.82417464
51 7.04101647 1.55519196
52 0.52318469 7.04101647
53 2.68055572 0.52318469
54 3.57184792 2.68055572
55 4.72653784 3.57184792
56 11.56139388 4.72653784
57 1.07113652 11.56139388
58 4.01167430 1.07113652
59 0.47969041 4.01167430
60 0.33512136 0.47969041
61 1.84940004 0.33512136
62 1.62235518 1.84940004
63 -2.58995047 1.62235518
64 1.46133174 -2.58995047
65 -3.43412217 1.46133174
66 -5.31921571 -3.43412217
67 4.34718915 -5.31921571
68 1.35420812 4.34718915
69 -3.13337775 1.35420812
70 0.94351895 -3.13337775
71 -2.72814120 0.94351895
72 -1.59428341 -2.72814120
73 -0.68115846 -1.59428341
74 0.33493923 -0.68115846
75 -5.05770096 0.33493923
76 0.78446449 -5.05770096
77 -1.67212085 0.78446449
78 -9.49522876 -1.67212085
79 -0.47629530 -9.49522876
80 -7.05373696 -0.47629530
81 -5.04273190 -7.05373696
82 -2.86725398 -5.04273190
83 -7.93571669 -2.86725398
84 NA -7.93571669
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.03718381 -2.05528266
[2,] 2.11090671 2.03718381
[3,] -4.58484713 2.11090671
[4,] -0.61729559 -4.58484713
[5,] -0.35648520 -0.61729559
[6,] -5.15622610 -0.35648520
[7,] 1.96528565 -5.15622610
[8,] -2.36209117 1.96528565
[9,] -6.44498524 -2.36209117
[10,] -0.46856087 -6.44498524
[11,] -4.22630947 -0.46856087
[12,] -0.48533649 -4.22630947
[13,] 1.28846291 -0.48533649
[14,] -1.16482718 1.28846291
[15,] -2.71203085 -1.16482718
[16,] -0.03828707 -2.71203085
[17,] -1.74033987 -0.03828707
[18,] -0.45940692 -1.74033987
[19,] 4.08805927 -0.45940692
[20,] -3.24646550 4.08805927
[21,] -4.47217877 -3.24646550
[22,] -2.39479278 -4.47217877
[23,] -5.48461155 -2.39479278
[24,] -3.38677558 -5.48461155
[25,] -2.23369109 -3.38677558
[26,] -3.04219327 -2.23369109
[27,] -0.81404969 -3.04219327
[28,] 2.35372251 -0.81404969
[29,] -1.84096563 2.35372251
[30,] 1.14387386 -1.84096563
[31,] 3.63623058 1.14387386
[32,] -0.80140205 3.63623058
[33,] -0.93826974 -0.80140205
[34,] -1.05943291 -0.93826974
[35,] -1.44588041 -1.05943291
[36,] 0.71397963 -1.44588041
[37,] 4.25956150 0.71397963
[38,] 2.37791642 4.25956150
[39,] 6.33379833 2.37791642
[40,] 5.55587374 6.33379833
[41,] 5.16530099 5.55587374
[42,] 7.52045813 5.16530099
[43,] 7.29300296 7.52045813
[44,] 4.22214210 7.29300296
[45,] 3.07418663 4.22214210
[46,] 0.10667822 3.07418663
[47,] 2.79031402 0.10667822
[48,] 0.99818481 2.79031402
[49,] 3.82417464 0.99818481
[50,] 1.55519196 3.82417464
[51,] 7.04101647 1.55519196
[52,] 0.52318469 7.04101647
[53,] 2.68055572 0.52318469
[54,] 3.57184792 2.68055572
[55,] 4.72653784 3.57184792
[56,] 11.56139388 4.72653784
[57,] 1.07113652 11.56139388
[58,] 4.01167430 1.07113652
[59,] 0.47969041 4.01167430
[60,] 0.33512136 0.47969041
[61,] 1.84940004 0.33512136
[62,] 1.62235518 1.84940004
[63,] -2.58995047 1.62235518
[64,] 1.46133174 -2.58995047
[65,] -3.43412217 1.46133174
[66,] -5.31921571 -3.43412217
[67,] 4.34718915 -5.31921571
[68,] 1.35420812 4.34718915
[69,] -3.13337775 1.35420812
[70,] 0.94351895 -3.13337775
[71,] -2.72814120 0.94351895
[72,] -1.59428341 -2.72814120
[73,] -0.68115846 -1.59428341
[74,] 0.33493923 -0.68115846
[75,] -5.05770096 0.33493923
[76,] 0.78446449 -5.05770096
[77,] -1.67212085 0.78446449
[78,] -9.49522876 -1.67212085
[79,] -0.47629530 -9.49522876
[80,] -7.05373696 -0.47629530
[81,] -5.04273190 -7.05373696
[82,] -2.86725398 -5.04273190
[83,] -7.93571669 -2.86725398
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.03718381 -2.05528266
2 2.11090671 2.03718381
3 -4.58484713 2.11090671
4 -0.61729559 -4.58484713
5 -0.35648520 -0.61729559
6 -5.15622610 -0.35648520
7 1.96528565 -5.15622610
8 -2.36209117 1.96528565
9 -6.44498524 -2.36209117
10 -0.46856087 -6.44498524
11 -4.22630947 -0.46856087
12 -0.48533649 -4.22630947
13 1.28846291 -0.48533649
14 -1.16482718 1.28846291
15 -2.71203085 -1.16482718
16 -0.03828707 -2.71203085
17 -1.74033987 -0.03828707
18 -0.45940692 -1.74033987
19 4.08805927 -0.45940692
20 -3.24646550 4.08805927
21 -4.47217877 -3.24646550
22 -2.39479278 -4.47217877
23 -5.48461155 -2.39479278
24 -3.38677558 -5.48461155
25 -2.23369109 -3.38677558
26 -3.04219327 -2.23369109
27 -0.81404969 -3.04219327
28 2.35372251 -0.81404969
29 -1.84096563 2.35372251
30 1.14387386 -1.84096563
31 3.63623058 1.14387386
32 -0.80140205 3.63623058
33 -0.93826974 -0.80140205
34 -1.05943291 -0.93826974
35 -1.44588041 -1.05943291
36 0.71397963 -1.44588041
37 4.25956150 0.71397963
38 2.37791642 4.25956150
39 6.33379833 2.37791642
40 5.55587374 6.33379833
41 5.16530099 5.55587374
42 7.52045813 5.16530099
43 7.29300296 7.52045813
44 4.22214210 7.29300296
45 3.07418663 4.22214210
46 0.10667822 3.07418663
47 2.79031402 0.10667822
48 0.99818481 2.79031402
49 3.82417464 0.99818481
50 1.55519196 3.82417464
51 7.04101647 1.55519196
52 0.52318469 7.04101647
53 2.68055572 0.52318469
54 3.57184792 2.68055572
55 4.72653784 3.57184792
56 11.56139388 4.72653784
57 1.07113652 11.56139388
58 4.01167430 1.07113652
59 0.47969041 4.01167430
60 0.33512136 0.47969041
61 1.84940004 0.33512136
62 1.62235518 1.84940004
63 -2.58995047 1.62235518
64 1.46133174 -2.58995047
65 -3.43412217 1.46133174
66 -5.31921571 -3.43412217
67 4.34718915 -5.31921571
68 1.35420812 4.34718915
69 -3.13337775 1.35420812
70 0.94351895 -3.13337775
71 -2.72814120 0.94351895
72 -1.59428341 -2.72814120
73 -0.68115846 -1.59428341
74 0.33493923 -0.68115846
75 -5.05770096 0.33493923
76 0.78446449 -5.05770096
77 -1.67212085 0.78446449
78 -9.49522876 -1.67212085
79 -0.47629530 -9.49522876
80 -7.05373696 -0.47629530
81 -5.04273190 -7.05373696
82 -2.86725398 -5.04273190
83 -7.93571669 -2.86725398
> 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/7o3bf1292792240.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/8hus01292792240.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/9hus01292792240.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/10rl9l1292792240.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/11dl881292792240.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/12g4ow1292792240.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/13uwm51292792240.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/14gelb1292792240.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/15jx1z1292792240.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/165xi51292792240.tab")
+ }
>
> try(system("convert tmp/13kc91292792240.ps tmp/13kc91292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/23kc91292792240.ps tmp/23kc91292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/33kc91292792240.ps tmp/33kc91292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/4vbcc1292792240.ps tmp/4vbcc1292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/5vbcc1292792240.ps tmp/5vbcc1292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/6vbcc1292792240.ps tmp/6vbcc1292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/7o3bf1292792240.ps tmp/7o3bf1292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/8hus01292792240.ps tmp/8hus01292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/9hus01292792240.ps tmp/9hus01292792240.png",intern=TRUE))
character(0)
> try(system("convert tmp/10rl9l1292792240.ps tmp/10rl9l1292792240.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.830 1.694 10.029