R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(593408
+ ,151936
+ ,321178
+ ,489
+ ,39507
+ ,30786
+ ,590072
+ ,151387
+ ,320325
+ ,495
+ ,38561
+ ,29669
+ ,579799
+ ,149802
+ ,315040
+ ,494
+ ,36499
+ ,28472
+ ,574205
+ ,148487
+ ,312575
+ ,550
+ ,37886
+ ,25925
+ ,572775
+ ,147960
+ ,311767
+ ,612
+ ,37440
+ ,25672
+ ,572942
+ ,146449
+ ,311028
+ ,662
+ ,40076
+ ,26543
+ ,619567
+ ,147841
+ ,333874
+ ,808
+ ,53954
+ ,34018
+ ,625809
+ ,146389
+ ,335895
+ ,885
+ ,57650
+ ,36259
+ ,619916
+ ,146322
+ ,334780
+ ,973
+ ,54001
+ ,35559
+ ,587625
+ ,142256
+ ,317057
+ ,974
+ ,48563
+ ,31945
+ ,565742
+ ,139879
+ ,306281
+ ,949
+ ,43835
+ ,29114
+ ,557274
+ ,138440
+ ,301979
+ ,949
+ ,42488
+ ,28005
+ ,560576
+ ,139821
+ ,305837
+ ,951
+ ,40802
+ ,26960
+ ,548854
+ ,137664
+ ,298953
+ ,986
+ ,39476
+ ,25699
+ ,531673
+ ,135277
+ ,288936
+ ,945
+ ,36605
+ ,24132
+ ,525919
+ ,133506
+ ,286226
+ ,945
+ ,36408
+ ,23572
+ ,511038
+ ,130625
+ ,278383
+ ,917
+ ,33902
+ ,22576
+ ,498662
+ ,126645
+ ,268909
+ ,982
+ ,35160
+ ,22779
+ ,555362
+ ,132338
+ ,297008
+ ,1248
+ ,49104
+ ,29788
+ ,564591
+ ,132127
+ ,301101
+ ,1438
+ ,52273
+ ,31554
+ ,541657
+ ,128818
+ ,289847
+ ,1551
+ ,46308
+ ,29853
+ ,527070
+ ,127845
+ ,282308
+ ,1517
+ ,42719
+ ,27534
+ ,509846
+ ,126448
+ ,273887
+ ,1442
+ ,38171
+ ,25360
+ ,514258
+ ,126770
+ ,276715
+ ,1418
+ ,39012
+ ,25631
+ ,516922
+ ,128984
+ ,279650
+ ,1383
+ ,37323
+ ,24364
+ ,507561
+ ,127977
+ ,274857
+ ,1354
+ ,35686
+ ,23046
+ ,492622
+ ,125253
+ ,265988
+ ,1310
+ ,33734
+ ,22217
+ ,490243
+ ,125249
+ ,264963
+ ,1269
+ ,32797
+ ,21672
+ ,469357
+ ,121200
+ ,252945
+ ,1198
+ ,30236
+ ,20454
+ ,477580
+ ,121383
+ ,256677
+ ,1257
+ ,33189
+ ,21065
+ ,528379
+ ,125005
+ ,283487
+ ,1585
+ ,45914
+ ,27256
+ ,533590
+ ,124507
+ ,284913
+ ,1662
+ ,48666
+ ,28575
+ ,517945
+ ,123736
+ ,278183
+ ,1695
+ ,43005
+ ,26921
+ ,506174
+ ,123707
+ ,271420
+ ,1610
+ ,39301
+ ,25025
+ ,501866
+ ,124393
+ ,270336
+ ,1580
+ ,36726
+ ,23794
+ ,516141
+ ,123815
+ ,281687
+ ,1584
+ ,38976
+ ,24448
+ ,528222
+ ,127330
+ ,290649
+ ,1573
+ ,37732
+ ,24071
+ ,532638
+ ,128548
+ ,292919
+ ,1633
+ ,37960
+ ,23990
+ ,536322
+ ,129531
+ ,295650
+ ,1631
+ ,37258
+ ,23764
+ ,536535
+ ,129164
+ ,295210
+ ,1652
+ ,37611
+ ,23915
+ ,523597
+ ,127836
+ ,287481
+ ,1591
+ ,35519
+ ,23238
+ ,536214
+ ,128925
+ ,292852
+ ,1652
+ ,38830
+ ,24789
+ ,586570
+ ,131556
+ ,318280
+ ,2034
+ ,52310
+ ,32108
+ ,596594
+ ,131496
+ ,322402
+ ,2266
+ ,55630
+ ,34097
+ ,580523
+ ,130080
+ ,313665
+ ,2372
+ ,50708
+ ,33161
+ ,564478
+ ,129694
+ ,305353
+ ,2237
+ ,45832
+ ,30857
+ ,557560
+ ,129842
+ ,301647
+ ,2118
+ ,43852
+ ,29511
+ ,575093
+ ,132838
+ ,312991
+ ,2150
+ ,45495
+ ,30406
+ ,580112
+ ,147512
+ ,335839
+ ,2629
+ ,48300
+ ,29975
+ ,574761
+ ,147292
+ ,332590
+ ,2584
+ ,47043
+ ,29504
+ ,563250
+ ,146997
+ ,325896
+ ,2442
+ ,44032
+ ,28655
+ ,551531
+ ,144952
+ ,318433
+ ,2383
+ ,42872
+ ,28129
+ ,537034
+ ,142704
+ ,309351
+ ,2275
+ ,40866
+ ,27435
+ ,544686
+ ,143288
+ ,312122
+ ,2368
+ ,43635
+ ,28881
+ ,600901
+ ,147234
+ ,342116
+ ,2866
+ ,57022
+ ,36183
+ ,604378
+ ,146713
+ ,342105
+ ,3084
+ ,59494
+ ,37516
+ ,586111
+ ,144235
+ ,332239
+ ,3018
+ ,54715
+ ,37078
+ ,563698
+ ,143059
+ ,320198
+ ,2805
+ ,49098
+ ,34251
+ ,548604
+ ,141610
+ ,311980
+ ,2688
+ ,46251
+ ,32039
+ ,551074
+ ,142279
+ ,313907
+ ,2658
+ ,45915
+ ,32081)
+ ,dim=c(6
+ ,60)
+ ,dimnames=list(c('Totaal_Belgie'
+ ,'Basisonderwijs'
+ ,'Secundair_onderwijs'
+ ,'Academische_bachelor'
+ ,'Professionele_bachelor'
+ ,'Master_doctoraat')
+ ,1:60))
> y <- array(NA,dim=c(6,60),dimnames=list(c('Totaal_Belgie','Basisonderwijs','Secundair_onderwijs','Academische_bachelor','Professionele_bachelor','Master_doctoraat'),1:60))
> 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
> 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
Totaal_Belgie Basisonderwijs Secundair_onderwijs Academische_bachelor
1 593408 151936 321178 489
2 590072 151387 320325 495
3 579799 149802 315040 494
4 574205 148487 312575 550
5 572775 147960 311767 612
6 572942 146449 311028 662
7 619567 147841 333874 808
8 625809 146389 335895 885
9 619916 146322 334780 973
10 587625 142256 317057 974
11 565742 139879 306281 949
12 557274 138440 301979 949
13 560576 139821 305837 951
14 548854 137664 298953 986
15 531673 135277 288936 945
16 525919 133506 286226 945
17 511038 130625 278383 917
18 498662 126645 268909 982
19 555362 132338 297008 1248
20 564591 132127 301101 1438
21 541657 128818 289847 1551
22 527070 127845 282308 1517
23 509846 126448 273887 1442
24 514258 126770 276715 1418
25 516922 128984 279650 1383
26 507561 127977 274857 1354
27 492622 125253 265988 1310
28 490243 125249 264963 1269
29 469357 121200 252945 1198
30 477580 121383 256677 1257
31 528379 125005 283487 1585
32 533590 124507 284913 1662
33 517945 123736 278183 1695
34 506174 123707 271420 1610
35 501866 124393 270336 1580
36 516141 123815 281687 1584
37 528222 127330 290649 1573
38 532638 128548 292919 1633
39 536322 129531 295650 1631
40 536535 129164 295210 1652
41 523597 127836 287481 1591
42 536214 128925 292852 1652
43 586570 131556 318280 2034
44 596594 131496 322402 2266
45 580523 130080 313665 2372
46 564478 129694 305353 2237
47 557560 129842 301647 2118
48 575093 132838 312991 2150
49 580112 147512 335839 2629
50 574761 147292 332590 2584
51 563250 146997 325896 2442
52 551531 144952 318433 2383
53 537034 142704 309351 2275
54 544686 143288 312122 2368
55 600901 147234 342116 2866
56 604378 146713 342105 3084
57 586111 144235 332239 3018
58 563698 143059 320198 2805
59 548604 141610 311980 2688
60 551074 142279 313907 2658
Professionele_bachelor Master_doctoraat
1 39507 30786
2 38561 29669
3 36499 28472
4 37886 25925
5 37440 25672
6 40076 26543
7 53954 34018
8 57650 36259
9 54001 35559
10 48563 31945
11 43835 29114
12 42488 28005
13 40802 26960
14 39476 25699
15 36605 24132
16 36408 23572
17 33902 22576
18 35160 22779
19 49104 29788
20 52273 31554
21 46308 29853
22 42719 27534
23 38171 25360
24 39012 25631
25 37323 24364
26 35686 23046
27 33734 22217
28 32797 21672
29 30236 20454
30 33189 21065
31 45914 27256
32 48666 28575
33 43005 26921
34 39301 25025
35 36726 23794
36 38976 24448
37 37732 24071
38 37960 23990
39 37258 23764
40 37611 23915
41 35519 23238
42 38830 24789
43 52310 32108
44 55630 34097
45 50708 33161
46 45832 30857
47 43852 29511
48 45495 30406
49 48300 29975
50 47043 29504
51 44032 28655
52 42872 28129
53 40866 27435
54 43635 28881
55 57022 36183
56 59494 37516
57 54715 37078
58 49098 34251
59 46251 32039
60 45915 32081
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Basisonderwijs Secundair_onderwijs
1.528e+05 -1.513e+00 1.904e+00
Academische_bachelor Professionele_bachelor Master_doctoraat
-1.934e+01 -4.965e-01 2.869e+00
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5844.3 -1740.8 -268.2 1309.5 6979.7
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.528e+05 6.578e+03 23.226 < 2e-16 ***
Basisonderwijs -1.513e+00 1.278e-01 -11.839 < 2e-16 ***
Secundair_onderwijs 1.904e+00 6.674e-02 28.535 < 2e-16 ***
Academische_bachelor -1.934e+01 6.769e-01 -28.562 < 2e-16 ***
Professionele_bachelor -4.965e-01 2.083e-01 -2.383 0.0207 *
Master_doctoraat 2.869e+00 3.440e-01 8.339 2.81e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2863 on 54 degrees of freedom
Multiple R-squared: 0.9943, Adjusted R-squared: 0.9937
F-statistic: 1869 on 5 and 54 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,] 6.630083e-03 1.326017e-02 9.933699e-01
[2,] 9.158581e-04 1.831716e-03 9.990841e-01
[3,] 1.873490e-04 3.746980e-04 9.998127e-01
[4,] 2.358142e-05 4.716284e-05 9.999764e-01
[5,] 2.886727e-06 5.773454e-06 9.999971e-01
[6,] 1.797996e-06 3.595992e-06 9.999982e-01
[7,] 3.401646e-06 6.803292e-06 9.999966e-01
[8,] 5.684090e-07 1.136818e-06 9.999994e-01
[9,] 1.084720e-07 2.169439e-07 9.999999e-01
[10,] 8.324781e-08 1.664956e-07 9.999999e-01
[11,] 7.415817e-07 1.483163e-06 9.999993e-01
[12,] 6.769550e-07 1.353910e-06 9.999993e-01
[13,] 3.737183e-07 7.474366e-07 9.999996e-01
[14,] 1.006946e-07 2.013892e-07 9.999999e-01
[15,] 2.227992e-08 4.455984e-08 1.000000e+00
[16,] 6.312296e-09 1.262459e-08 1.000000e+00
[17,] 2.043300e-09 4.086599e-09 1.000000e+00
[18,] 8.567116e-10 1.713423e-09 1.000000e+00
[19,] 2.621283e-10 5.242567e-10 1.000000e+00
[20,] 1.433965e-10 2.867930e-10 1.000000e+00
[21,] 3.055280e-11 6.110560e-11 1.000000e+00
[22,] 1.583584e-11 3.167169e-11 1.000000e+00
[23,] 2.136490e-11 4.272981e-11 1.000000e+00
[24,] 1.435164e-11 2.870328e-11 1.000000e+00
[25,] 3.490350e-12 6.980700e-12 1.000000e+00
[26,] 3.643323e-12 7.286647e-12 1.000000e+00
[27,] 3.053517e-10 6.107034e-10 1.000000e+00
[28,] 1.402530e-08 2.805060e-08 1.000000e+00
[29,] 4.409287e-07 8.818573e-07 9.999996e-01
[30,] 5.411796e-07 1.082359e-06 9.999995e-01
[31,] 9.965622e-07 1.993124e-06 9.999990e-01
[32,] 3.417468e-06 6.834935e-06 9.999966e-01
[33,] 1.701933e-05 3.403865e-05 9.999830e-01
[34,] 2.738164e-05 5.476329e-05 9.999726e-01
[35,] 6.026945e-05 1.205389e-04 9.999397e-01
[36,] 6.582643e-04 1.316529e-03 9.993417e-01
[37,] 9.716744e-03 1.943349e-02 9.902833e-01
[38,] 1.452190e-02 2.904380e-02 9.854781e-01
[39,] 1.069128e-02 2.138257e-02 9.893087e-01
[40,] 9.999961e-01 7.798320e-06 3.899160e-06
[41,] 1.000000e+00 6.630050e-08 3.315025e-08
[42,] 9.999993e-01 1.442405e-06 7.212024e-07
[43,] 9.999805e-01 3.902570e-05 1.951285e-05
> postscript(file="/var/www/rcomp/tmp/1hzp41321818256.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/rcomp/tmp/2hut11321818256.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/rcomp/tmp/38e2r1321818256.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/rcomp/tmp/4vge51321818256.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/rcomp/tmp/5okyi1321818256.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 = 60
Frequency = 1
1 2 3 4 5 6
-314.085617 -5.993523 -222.357607 5965.436799 6979.701998 6044.207185
7 8 9 10 11 12
-461.930693 -3370.950777 -5344.119734 -2350.273048 -2018.536799 -1959.100062
13 14 15 16 17 18
-1715.062198 44.115104 604.019145 -1160.742898 -4394.090224 -3452.077557
19 20 21 22 23 24
311.944032 1607.927161 -798.948982 1711.837052 938.816426 -371.448423
25 26 27 28 29 30
2173.027150 2823.186499 1210.042171 1082.446404 -2194.529270 52.305142
31 32 33 34 35 36
175.780682 988.863389 -434.169722 2586.911600 3054.236724 -5844.326549
37 38 39 40 41 42
-5259.862995 -1817.865363 -1586.036182 -942.385424 -1447.005015 963.643266
43 44 45 46 47 48
-40.590904 2471.050335 3186.761972 3965.235021 4906.204994 4236.790495
49 50 51 52 53 54
-157.570411 202.888733 -811.421402 -1620.530987 -3317.128160 -1033.439294
55 56 57 58 59 60
-638.637538 3689.363034 -1931.288233 -1990.609907 -957.475463 -2012.151550
> postscript(file="/var/www/rcomp/tmp/6f74t1321818256.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -314.085617 NA
1 -5.993523 -314.085617
2 -222.357607 -5.993523
3 5965.436799 -222.357607
4 6979.701998 5965.436799
5 6044.207185 6979.701998
6 -461.930693 6044.207185
7 -3370.950777 -461.930693
8 -5344.119734 -3370.950777
9 -2350.273048 -5344.119734
10 -2018.536799 -2350.273048
11 -1959.100062 -2018.536799
12 -1715.062198 -1959.100062
13 44.115104 -1715.062198
14 604.019145 44.115104
15 -1160.742898 604.019145
16 -4394.090224 -1160.742898
17 -3452.077557 -4394.090224
18 311.944032 -3452.077557
19 1607.927161 311.944032
20 -798.948982 1607.927161
21 1711.837052 -798.948982
22 938.816426 1711.837052
23 -371.448423 938.816426
24 2173.027150 -371.448423
25 2823.186499 2173.027150
26 1210.042171 2823.186499
27 1082.446404 1210.042171
28 -2194.529270 1082.446404
29 52.305142 -2194.529270
30 175.780682 52.305142
31 988.863389 175.780682
32 -434.169722 988.863389
33 2586.911600 -434.169722
34 3054.236724 2586.911600
35 -5844.326549 3054.236724
36 -5259.862995 -5844.326549
37 -1817.865363 -5259.862995
38 -1586.036182 -1817.865363
39 -942.385424 -1586.036182
40 -1447.005015 -942.385424
41 963.643266 -1447.005015
42 -40.590904 963.643266
43 2471.050335 -40.590904
44 3186.761972 2471.050335
45 3965.235021 3186.761972
46 4906.204994 3965.235021
47 4236.790495 4906.204994
48 -157.570411 4236.790495
49 202.888733 -157.570411
50 -811.421402 202.888733
51 -1620.530987 -811.421402
52 -3317.128160 -1620.530987
53 -1033.439294 -3317.128160
54 -638.637538 -1033.439294
55 3689.363034 -638.637538
56 -1931.288233 3689.363034
57 -1990.609907 -1931.288233
58 -957.475463 -1990.609907
59 -2012.151550 -957.475463
60 NA -2012.151550
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -5.993523 -314.085617
[2,] -222.357607 -5.993523
[3,] 5965.436799 -222.357607
[4,] 6979.701998 5965.436799
[5,] 6044.207185 6979.701998
[6,] -461.930693 6044.207185
[7,] -3370.950777 -461.930693
[8,] -5344.119734 -3370.950777
[9,] -2350.273048 -5344.119734
[10,] -2018.536799 -2350.273048
[11,] -1959.100062 -2018.536799
[12,] -1715.062198 -1959.100062
[13,] 44.115104 -1715.062198
[14,] 604.019145 44.115104
[15,] -1160.742898 604.019145
[16,] -4394.090224 -1160.742898
[17,] -3452.077557 -4394.090224
[18,] 311.944032 -3452.077557
[19,] 1607.927161 311.944032
[20,] -798.948982 1607.927161
[21,] 1711.837052 -798.948982
[22,] 938.816426 1711.837052
[23,] -371.448423 938.816426
[24,] 2173.027150 -371.448423
[25,] 2823.186499 2173.027150
[26,] 1210.042171 2823.186499
[27,] 1082.446404 1210.042171
[28,] -2194.529270 1082.446404
[29,] 52.305142 -2194.529270
[30,] 175.780682 52.305142
[31,] 988.863389 175.780682
[32,] -434.169722 988.863389
[33,] 2586.911600 -434.169722
[34,] 3054.236724 2586.911600
[35,] -5844.326549 3054.236724
[36,] -5259.862995 -5844.326549
[37,] -1817.865363 -5259.862995
[38,] -1586.036182 -1817.865363
[39,] -942.385424 -1586.036182
[40,] -1447.005015 -942.385424
[41,] 963.643266 -1447.005015
[42,] -40.590904 963.643266
[43,] 2471.050335 -40.590904
[44,] 3186.761972 2471.050335
[45,] 3965.235021 3186.761972
[46,] 4906.204994 3965.235021
[47,] 4236.790495 4906.204994
[48,] -157.570411 4236.790495
[49,] 202.888733 -157.570411
[50,] -811.421402 202.888733
[51,] -1620.530987 -811.421402
[52,] -3317.128160 -1620.530987
[53,] -1033.439294 -3317.128160
[54,] -638.637538 -1033.439294
[55,] 3689.363034 -638.637538
[56,] -1931.288233 3689.363034
[57,] -1990.609907 -1931.288233
[58,] -957.475463 -1990.609907
[59,] -2012.151550 -957.475463
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -5.993523 -314.085617
2 -222.357607 -5.993523
3 5965.436799 -222.357607
4 6979.701998 5965.436799
5 6044.207185 6979.701998
6 -461.930693 6044.207185
7 -3370.950777 -461.930693
8 -5344.119734 -3370.950777
9 -2350.273048 -5344.119734
10 -2018.536799 -2350.273048
11 -1959.100062 -2018.536799
12 -1715.062198 -1959.100062
13 44.115104 -1715.062198
14 604.019145 44.115104
15 -1160.742898 604.019145
16 -4394.090224 -1160.742898
17 -3452.077557 -4394.090224
18 311.944032 -3452.077557
19 1607.927161 311.944032
20 -798.948982 1607.927161
21 1711.837052 -798.948982
22 938.816426 1711.837052
23 -371.448423 938.816426
24 2173.027150 -371.448423
25 2823.186499 2173.027150
26 1210.042171 2823.186499
27 1082.446404 1210.042171
28 -2194.529270 1082.446404
29 52.305142 -2194.529270
30 175.780682 52.305142
31 988.863389 175.780682
32 -434.169722 988.863389
33 2586.911600 -434.169722
34 3054.236724 2586.911600
35 -5844.326549 3054.236724
36 -5259.862995 -5844.326549
37 -1817.865363 -5259.862995
38 -1586.036182 -1817.865363
39 -942.385424 -1586.036182
40 -1447.005015 -942.385424
41 963.643266 -1447.005015
42 -40.590904 963.643266
43 2471.050335 -40.590904
44 3186.761972 2471.050335
45 3965.235021 3186.761972
46 4906.204994 3965.235021
47 4236.790495 4906.204994
48 -157.570411 4236.790495
49 202.888733 -157.570411
50 -811.421402 202.888733
51 -1620.530987 -811.421402
52 -3317.128160 -1620.530987
53 -1033.439294 -3317.128160
54 -638.637538 -1033.439294
55 3689.363034 -638.637538
56 -1931.288233 3689.363034
57 -1990.609907 -1931.288233
58 -957.475463 -1990.609907
59 -2012.151550 -957.475463
> 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/rcomp/tmp/7ie7x1321818256.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/rcomp/tmp/8ma431321818256.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/rcomp/tmp/9at7r1321818256.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/rcomp/tmp/10o0tw1321818256.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11fwob1321818256.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/rcomp/tmp/12c3h11321818256.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/rcomp/tmp/13ofj31321818256.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/rcomp/tmp/14mow51321818256.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/rcomp/tmp/15242o1321818256.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/rcomp/tmp/16f7sp1321818256.tab")
+ }
>
> try(system("convert tmp/1hzp41321818256.ps tmp/1hzp41321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/2hut11321818256.ps tmp/2hut11321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/38e2r1321818256.ps tmp/38e2r1321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/4vge51321818256.ps tmp/4vge51321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/5okyi1321818256.ps tmp/5okyi1321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/6f74t1321818256.ps tmp/6f74t1321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ie7x1321818256.ps tmp/7ie7x1321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ma431321818256.ps tmp/8ma431321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/9at7r1321818256.ps tmp/9at7r1321818256.png",intern=TRUE))
character(0)
> try(system("convert tmp/10o0tw1321818256.ps tmp/10o0tw1321818256.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.240 0.390 4.606