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(216234.00
+ ,627
+ ,213586.00
+ ,696
+ ,209465.00
+ ,825
+ ,204045.00
+ ,677
+ ,200237.00
+ ,656
+ ,203666.00
+ ,785
+ ,241476.00
+ ,412
+ ,260307.00
+ ,352
+ ,243324.00
+ ,839
+ ,244460.00
+ ,729
+ ,233575.00
+ ,696
+ ,237217.00
+ ,641
+ ,235243.00
+ ,695
+ ,230354.00
+ ,638
+ ,227184.00
+ ,762
+ ,221678.00
+ ,635
+ ,217142.00
+ ,721
+ ,219452.00
+ ,854
+ ,256446.00
+ ,418
+ ,265845.00
+ ,367
+ ,248624.00
+ ,824
+ ,241114.00
+ ,687
+ ,229245.00
+ ,601
+ ,231805.00
+ ,676
+ ,219277.00
+ ,740
+ ,219313.00
+ ,691
+ ,212610.00
+ ,683
+ ,214771.00
+ ,594
+ ,211142.00
+ ,729
+ ,211457.00
+ ,731
+ ,240048.00
+ ,386
+ ,240636.00
+ ,331
+ ,230580.00
+ ,707
+ ,208795.00
+ ,715
+ ,197922.00
+ ,657
+ ,194596.00
+ ,653
+ ,194581.00
+ ,642
+ ,185686.00
+ ,643
+ ,178106.00
+ ,718
+ ,172608.00
+ ,654
+ ,167302.00
+ ,632
+ ,168053.00
+ ,731
+ ,202300.00
+ ,392
+ ,202388.00
+ ,344
+ ,182516.00
+ ,792
+ ,173476.00
+ ,852
+ ,166444.00
+ ,649
+ ,171297.00
+ ,629
+ ,169701.00
+ ,685
+ ,164182.00
+ ,617
+ ,161914.00
+ ,715
+ ,159612.00
+ ,715
+ ,151001.00
+ ,629
+ ,158114.00
+ ,916
+ ,186530.00
+ ,531
+ ,187069.00
+ ,357
+ ,174330.00
+ ,917
+ ,169362.00
+ ,828
+ ,166827.00
+ ,708
+ ,178037.00
+ ,858
+ ,186413.00
+ ,775
+ ,189226.00
+ ,785
+ ,191563.00
+ ,1006
+ ,188906.00
+ ,789
+ ,186005.00
+ ,734
+ ,195309.00
+ ,906
+ ,223532.00
+ ,532
+ ,226899.00
+ ,387
+ ,214126.00
+ ,991
+ ,206903.00
+ ,841
+ ,204442.00
+ ,892
+ ,220375.00
+ ,782)
+ ,dim=c(2
+ ,72)
+ ,dimnames=list(c('werklozen'
+ ,'faillissementen')
+ ,1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('werklozen','faillissementen'),1:72))
> 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 = 'Include Monthly 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
werklozen faillissementen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 216234 627 1 0 0 0 0 0 0 0 0 0 0
2 213586 696 0 1 0 0 0 0 0 0 0 0 0
3 209465 825 0 0 1 0 0 0 0 0 0 0 0
4 204045 677 0 0 0 1 0 0 0 0 0 0 0
5 200237 656 0 0 0 0 1 0 0 0 0 0 0
6 203666 785 0 0 0 0 0 1 0 0 0 0 0
7 241476 412 0 0 0 0 0 0 1 0 0 0 0
8 260307 352 0 0 0 0 0 0 0 1 0 0 0
9 243324 839 0 0 0 0 0 0 0 0 1 0 0
10 244460 729 0 0 0 0 0 0 0 0 0 1 0
11 233575 696 0 0 0 0 0 0 0 0 0 0 1
12 237217 641 0 0 0 0 0 0 0 0 0 0 0
13 235243 695 1 0 0 0 0 0 0 0 0 0 0
14 230354 638 0 1 0 0 0 0 0 0 0 0 0
15 227184 762 0 0 1 0 0 0 0 0 0 0 0
16 221678 635 0 0 0 1 0 0 0 0 0 0 0
17 217142 721 0 0 0 0 1 0 0 0 0 0 0
18 219452 854 0 0 0 0 0 1 0 0 0 0 0
19 256446 418 0 0 0 0 0 0 1 0 0 0 0
20 265845 367 0 0 0 0 0 0 0 1 0 0 0
21 248624 824 0 0 0 0 0 0 0 0 1 0 0
22 241114 687 0 0 0 0 0 0 0 0 0 1 0
23 229245 601 0 0 0 0 0 0 0 0 0 0 1
24 231805 676 0 0 0 0 0 0 0 0 0 0 0
25 219277 740 1 0 0 0 0 0 0 0 0 0 0
26 219313 691 0 1 0 0 0 0 0 0 0 0 0
27 212610 683 0 0 1 0 0 0 0 0 0 0 0
28 214771 594 0 0 0 1 0 0 0 0 0 0 0
29 211142 729 0 0 0 0 1 0 0 0 0 0 0
30 211457 731 0 0 0 0 0 1 0 0 0 0 0
31 240048 386 0 0 0 0 0 0 1 0 0 0 0
32 240636 331 0 0 0 0 0 0 0 1 0 0 0
33 230580 707 0 0 0 0 0 0 0 0 1 0 0
34 208795 715 0 0 0 0 0 0 0 0 0 1 0
35 197922 657 0 0 0 0 0 0 0 0 0 0 1
36 194596 653 0 0 0 0 0 0 0 0 0 0 0
37 194581 642 1 0 0 0 0 0 0 0 0 0 0
38 185686 643 0 1 0 0 0 0 0 0 0 0 0
39 178106 718 0 0 1 0 0 0 0 0 0 0 0
40 172608 654 0 0 0 1 0 0 0 0 0 0 0
41 167302 632 0 0 0 0 1 0 0 0 0 0 0
42 168053 731 0 0 0 0 0 1 0 0 0 0 0
43 202300 392 0 0 0 0 0 0 1 0 0 0 0
44 202388 344 0 0 0 0 0 0 0 1 0 0 0
45 182516 792 0 0 0 0 0 0 0 0 1 0 0
46 173476 852 0 0 0 0 0 0 0 0 0 1 0
47 166444 649 0 0 0 0 0 0 0 0 0 0 1
48 171297 629 0 0 0 0 0 0 0 0 0 0 0
49 169701 685 1 0 0 0 0 0 0 0 0 0 0
50 164182 617 0 1 0 0 0 0 0 0 0 0 0
51 161914 715 0 0 1 0 0 0 0 0 0 0 0
52 159612 715 0 0 0 1 0 0 0 0 0 0 0
53 151001 629 0 0 0 0 1 0 0 0 0 0 0
54 158114 916 0 0 0 0 0 1 0 0 0 0 0
55 186530 531 0 0 0 0 0 0 1 0 0 0 0
56 187069 357 0 0 0 0 0 0 0 1 0 0 0
57 174330 917 0 0 0 0 0 0 0 0 1 0 0
58 169362 828 0 0 0 0 0 0 0 0 0 1 0
59 166827 708 0 0 0 0 0 0 0 0 0 0 1
60 178037 858 0 0 0 0 0 0 0 0 0 0 0
61 186413 775 1 0 0 0 0 0 0 0 0 0 0
62 189226 785 0 1 0 0 0 0 0 0 0 0 0
63 191563 1006 0 0 1 0 0 0 0 0 0 0 0
64 188906 789 0 0 0 1 0 0 0 0 0 0 0
65 186005 734 0 0 0 0 1 0 0 0 0 0 0
66 195309 906 0 0 0 0 0 1 0 0 0 0 0
67 223532 532 0 0 0 0 0 0 1 0 0 0 0
68 226899 387 0 0 0 0 0 0 0 1 0 0 0
69 214126 991 0 0 0 0 0 0 0 0 1 0 0
70 206903 841 0 0 0 0 0 0 0 0 0 1 0
71 204442 892 0 0 0 0 0 0 0 0 0 0 1
72 220375 782 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) faillissementen M1 M2
247782.13 -59.77 -2726.79 -6846.86
M3 M4 M5 M6
-4065.50 -13694.46 -18124.38 -6065.53
M7 M8 M9 M10
3880.90 4039.98 18307.00 5911.35
M11
-6170.62
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-43415 -24919 7507 20648 35959
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 247782.13 33440.84 7.410 5.47e-10 ***
faillissementen -59.77 44.66 -1.338 0.186
M1 -2726.79 15689.77 -0.174 0.863
M2 -6846.86 15730.20 -0.435 0.665
M3 -4065.50 16065.29 -0.253 0.801
M4 -13694.46 15733.84 -0.870 0.388
M5 -18124.38 15713.44 -1.153 0.253
M6 -6065.53 16485.54 -0.368 0.714
M7 3880.90 19546.03 0.199 0.843
M8 4039.98 22144.36 0.182 0.856
M9 18307.00 16855.54 1.086 0.282
M10 5911.35 15978.28 0.370 0.713
M11 -6170.62 15682.12 -0.393 0.695
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 27160 on 59 degrees of freedom
Multiple R-squared: 0.2207, Adjusted R-squared: 0.06218
F-statistic: 1.392 on 12 and 59 DF, p-value: 0.1954
> 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.1378045591 0.2756091182 0.8621954
[2,] 0.1022328543 0.2044657086 0.8977671
[3,] 0.0625857372 0.1251714743 0.9374143
[4,] 0.0393037754 0.0786075509 0.9606962
[5,] 0.0215192067 0.0430384134 0.9784808
[6,] 0.0117533732 0.0235067463 0.9882466
[7,] 0.0063818799 0.0127637598 0.9936181
[8,] 0.0033655570 0.0067311140 0.9966344
[9,] 0.0019156239 0.0038312478 0.9980844
[10,] 0.0011381504 0.0022763008 0.9988618
[11,] 0.0006273777 0.0012547553 0.9993726
[12,] 0.0003429073 0.0006858146 0.9996571
[13,] 0.0002235970 0.0004471941 0.9997764
[14,] 0.0001519357 0.0003038715 0.9998481
[15,] 0.0001064594 0.0002129188 0.9998935
[16,] 0.0001059902 0.0002119804 0.9998940
[17,] 0.0004373554 0.0008747108 0.9995626
[18,] 0.0011636895 0.0023273789 0.9988363
[19,] 0.0155388776 0.0310777552 0.9844611
[20,] 0.0585204074 0.1170408149 0.9414796
[21,] 0.1463109737 0.2926219474 0.8536890
[22,] 0.2057196403 0.4114392805 0.7942804
[23,] 0.2777033751 0.5554067503 0.7222966
[24,] 0.3601675524 0.7203351048 0.6398324
[25,] 0.4623319526 0.9246639052 0.5376680
[26,] 0.4822500730 0.9645001460 0.5177499
[27,] 0.5110801671 0.9778396658 0.4889198
[28,] 0.5643809151 0.8712381697 0.4356191
[29,] 0.6230068222 0.7539863556 0.3769932
[30,] 0.6923395442 0.6153209117 0.3076605
[31,] 0.7854052184 0.4291895632 0.2145948
[32,] 0.7742267312 0.4515465377 0.2257733
[33,] 0.7413238608 0.5173522785 0.2586761
[34,] 0.6988178005 0.6023643990 0.3011822
[35,] 0.6403872297 0.7192255405 0.3596128
[36,] 0.6007230276 0.7985539448 0.3992770
[37,] 0.5393399296 0.9213201407 0.4606601
[38,] 0.4618463010 0.9236926020 0.5381537
[39,] 0.4700629994 0.9401259988 0.5299370
[40,] 0.4549471793 0.9098943586 0.5450528
[41,] 0.4195995514 0.8391991028 0.5804004
> postscript(file="/var/www/rcomp/tmp/1jg3x1292612757.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/2jg3x1292612757.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/3t8301292612757.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/4t8301292612757.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/5t8301292612757.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 = 72
Frequency = 1
1 2 3 4 5 6
8654.5652 14250.7730 15058.7686 10421.7433 9788.4869 8868.9922
7 8 9 10 11 12
14438.2893 29523.9959 27382.0456 34338.9820 33563.5342 27747.5537
13 14 15 16 17 18
31727.9368 27552.1031 29012.2477 25544.3961 30578.5481 28779.1341
19 20 21 22 23 24
29766.9103 35958.5485 31785.4931 28482.6348 23555.3679 24427.5098
25 26 27 28 29 30
18451.5946 19678.9222 9716.4042 16186.8190 25056.7095 13432.4030
31 32 33 34 35 36
11456.2648 8597.8223 6748.3830 -2162.8004 -4420.5025 -14156.2042
37 38 39 40 41 42
-12101.8823 -16817.0461 -22695.6398 -22389.9707 -24580.9972 -29971.5970
43 44 45 46 47 48
-25933.1141 -28873.1655 -36235.1524 -29293.2868 -36376.6638 -38889.6883
49 50 51 52 53 54
-34411.7649 -39875.0705 -39066.9503 -31739.9902 -41061.3077 -28853.1153
55 56 57 58 59 60
-33395.0603 -43415.1532 -36949.8810 -34841.7710 -32467.2237 -18462.3190
61 62 63 64 65 66
-12320.4494 -4789.6817 7975.1697 1977.0025 218.5603 7744.1830
67 68 69 70 71 72
3666.7099 -1792.0481 7269.1117 3476.2413 16145.4879 19333.1480
> postscript(file="/var/www/rcomp/tmp/64z2l1292612757.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 8654.5652 NA
1 14250.7730 8654.5652
2 15058.7686 14250.7730
3 10421.7433 15058.7686
4 9788.4869 10421.7433
5 8868.9922 9788.4869
6 14438.2893 8868.9922
7 29523.9959 14438.2893
8 27382.0456 29523.9959
9 34338.9820 27382.0456
10 33563.5342 34338.9820
11 27747.5537 33563.5342
12 31727.9368 27747.5537
13 27552.1031 31727.9368
14 29012.2477 27552.1031
15 25544.3961 29012.2477
16 30578.5481 25544.3961
17 28779.1341 30578.5481
18 29766.9103 28779.1341
19 35958.5485 29766.9103
20 31785.4931 35958.5485
21 28482.6348 31785.4931
22 23555.3679 28482.6348
23 24427.5098 23555.3679
24 18451.5946 24427.5098
25 19678.9222 18451.5946
26 9716.4042 19678.9222
27 16186.8190 9716.4042
28 25056.7095 16186.8190
29 13432.4030 25056.7095
30 11456.2648 13432.4030
31 8597.8223 11456.2648
32 6748.3830 8597.8223
33 -2162.8004 6748.3830
34 -4420.5025 -2162.8004
35 -14156.2042 -4420.5025
36 -12101.8823 -14156.2042
37 -16817.0461 -12101.8823
38 -22695.6398 -16817.0461
39 -22389.9707 -22695.6398
40 -24580.9972 -22389.9707
41 -29971.5970 -24580.9972
42 -25933.1141 -29971.5970
43 -28873.1655 -25933.1141
44 -36235.1524 -28873.1655
45 -29293.2868 -36235.1524
46 -36376.6638 -29293.2868
47 -38889.6883 -36376.6638
48 -34411.7649 -38889.6883
49 -39875.0705 -34411.7649
50 -39066.9503 -39875.0705
51 -31739.9902 -39066.9503
52 -41061.3077 -31739.9902
53 -28853.1153 -41061.3077
54 -33395.0603 -28853.1153
55 -43415.1532 -33395.0603
56 -36949.8810 -43415.1532
57 -34841.7710 -36949.8810
58 -32467.2237 -34841.7710
59 -18462.3190 -32467.2237
60 -12320.4494 -18462.3190
61 -4789.6817 -12320.4494
62 7975.1697 -4789.6817
63 1977.0025 7975.1697
64 218.5603 1977.0025
65 7744.1830 218.5603
66 3666.7099 7744.1830
67 -1792.0481 3666.7099
68 7269.1117 -1792.0481
69 3476.2413 7269.1117
70 16145.4879 3476.2413
71 19333.1480 16145.4879
72 NA 19333.1480
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 14250.7730 8654.5652
[2,] 15058.7686 14250.7730
[3,] 10421.7433 15058.7686
[4,] 9788.4869 10421.7433
[5,] 8868.9922 9788.4869
[6,] 14438.2893 8868.9922
[7,] 29523.9959 14438.2893
[8,] 27382.0456 29523.9959
[9,] 34338.9820 27382.0456
[10,] 33563.5342 34338.9820
[11,] 27747.5537 33563.5342
[12,] 31727.9368 27747.5537
[13,] 27552.1031 31727.9368
[14,] 29012.2477 27552.1031
[15,] 25544.3961 29012.2477
[16,] 30578.5481 25544.3961
[17,] 28779.1341 30578.5481
[18,] 29766.9103 28779.1341
[19,] 35958.5485 29766.9103
[20,] 31785.4931 35958.5485
[21,] 28482.6348 31785.4931
[22,] 23555.3679 28482.6348
[23,] 24427.5098 23555.3679
[24,] 18451.5946 24427.5098
[25,] 19678.9222 18451.5946
[26,] 9716.4042 19678.9222
[27,] 16186.8190 9716.4042
[28,] 25056.7095 16186.8190
[29,] 13432.4030 25056.7095
[30,] 11456.2648 13432.4030
[31,] 8597.8223 11456.2648
[32,] 6748.3830 8597.8223
[33,] -2162.8004 6748.3830
[34,] -4420.5025 -2162.8004
[35,] -14156.2042 -4420.5025
[36,] -12101.8823 -14156.2042
[37,] -16817.0461 -12101.8823
[38,] -22695.6398 -16817.0461
[39,] -22389.9707 -22695.6398
[40,] -24580.9972 -22389.9707
[41,] -29971.5970 -24580.9972
[42,] -25933.1141 -29971.5970
[43,] -28873.1655 -25933.1141
[44,] -36235.1524 -28873.1655
[45,] -29293.2868 -36235.1524
[46,] -36376.6638 -29293.2868
[47,] -38889.6883 -36376.6638
[48,] -34411.7649 -38889.6883
[49,] -39875.0705 -34411.7649
[50,] -39066.9503 -39875.0705
[51,] -31739.9902 -39066.9503
[52,] -41061.3077 -31739.9902
[53,] -28853.1153 -41061.3077
[54,] -33395.0603 -28853.1153
[55,] -43415.1532 -33395.0603
[56,] -36949.8810 -43415.1532
[57,] -34841.7710 -36949.8810
[58,] -32467.2237 -34841.7710
[59,] -18462.3190 -32467.2237
[60,] -12320.4494 -18462.3190
[61,] -4789.6817 -12320.4494
[62,] 7975.1697 -4789.6817
[63,] 1977.0025 7975.1697
[64,] 218.5603 1977.0025
[65,] 7744.1830 218.5603
[66,] 3666.7099 7744.1830
[67,] -1792.0481 3666.7099
[68,] 7269.1117 -1792.0481
[69,] 3476.2413 7269.1117
[70,] 16145.4879 3476.2413
[71,] 19333.1480 16145.4879
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 14250.7730 8654.5652
2 15058.7686 14250.7730
3 10421.7433 15058.7686
4 9788.4869 10421.7433
5 8868.9922 9788.4869
6 14438.2893 8868.9922
7 29523.9959 14438.2893
8 27382.0456 29523.9959
9 34338.9820 27382.0456
10 33563.5342 34338.9820
11 27747.5537 33563.5342
12 31727.9368 27747.5537
13 27552.1031 31727.9368
14 29012.2477 27552.1031
15 25544.3961 29012.2477
16 30578.5481 25544.3961
17 28779.1341 30578.5481
18 29766.9103 28779.1341
19 35958.5485 29766.9103
20 31785.4931 35958.5485
21 28482.6348 31785.4931
22 23555.3679 28482.6348
23 24427.5098 23555.3679
24 18451.5946 24427.5098
25 19678.9222 18451.5946
26 9716.4042 19678.9222
27 16186.8190 9716.4042
28 25056.7095 16186.8190
29 13432.4030 25056.7095
30 11456.2648 13432.4030
31 8597.8223 11456.2648
32 6748.3830 8597.8223
33 -2162.8004 6748.3830
34 -4420.5025 -2162.8004
35 -14156.2042 -4420.5025
36 -12101.8823 -14156.2042
37 -16817.0461 -12101.8823
38 -22695.6398 -16817.0461
39 -22389.9707 -22695.6398
40 -24580.9972 -22389.9707
41 -29971.5970 -24580.9972
42 -25933.1141 -29971.5970
43 -28873.1655 -25933.1141
44 -36235.1524 -28873.1655
45 -29293.2868 -36235.1524
46 -36376.6638 -29293.2868
47 -38889.6883 -36376.6638
48 -34411.7649 -38889.6883
49 -39875.0705 -34411.7649
50 -39066.9503 -39875.0705
51 -31739.9902 -39066.9503
52 -41061.3077 -31739.9902
53 -28853.1153 -41061.3077
54 -33395.0603 -28853.1153
55 -43415.1532 -33395.0603
56 -36949.8810 -43415.1532
57 -34841.7710 -36949.8810
58 -32467.2237 -34841.7710
59 -18462.3190 -32467.2237
60 -12320.4494 -18462.3190
61 -4789.6817 -12320.4494
62 7975.1697 -4789.6817
63 1977.0025 7975.1697
64 218.5603 1977.0025
65 7744.1830 218.5603
66 3666.7099 7744.1830
67 -1792.0481 3666.7099
68 7269.1117 -1792.0481
69 3476.2413 7269.1117
70 16145.4879 3476.2413
71 19333.1480 16145.4879
> 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/7w8jo1292612757.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/8w8jo1292612757.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/9w8jo1292612757.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/107z081292612757.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/11bizf1292612757.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/1239yh1292612757.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/13asvb1292612757.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/14l1uw1292612757.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/156ktk1292612757.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/16ku9b1292612757.tab")
+ }
> try(system("convert tmp/1jg3x1292612757.ps tmp/1jg3x1292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/2jg3x1292612757.ps tmp/2jg3x1292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/3t8301292612757.ps tmp/3t8301292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/4t8301292612757.ps tmp/4t8301292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/5t8301292612757.ps tmp/5t8301292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/64z2l1292612757.ps tmp/64z2l1292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/7w8jo1292612757.ps tmp/7w8jo1292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/8w8jo1292612757.ps tmp/8w8jo1292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/9w8jo1292612757.ps tmp/9w8jo1292612757.png",intern=TRUE))
character(0)
> try(system("convert tmp/107z081292612757.ps tmp/107z081292612757.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.140 1.660 4.791