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(98.60,627,98.97,696,99.11,825,99.64,677,100.03,656,99.98,785,100.32,412,100.44,352,100.51,839,101.00,729,100.88,696,100.55,641,100.83,695,101.51,638,102.16,762,102.39,635,102.54,721,102.85,854,103.47,418,103.57,367,103.69,824,103.50,687,103.47,601,103.45,676,103.48,740,103.93,691,103.89,683,104.40,594,104.79,729,104.77,731,105.13,386,105.26,331,104.96,707,104.75,715,105.01,657,105.15,653,105.20,642,105.77,643,105.78,718,106.26,654,106.13,632,106.12,731,106.57,392,106.44,344,106.54,792,107.10,852,108.10,649,108.40,629,108.84,685,109.62,617,110.42,715,110.67,715,111.66,629,112.28,916,112.87,531,112.18,357,112.36,917,112.16,828,111.49,708,111.25,858,111.36,775,111.74,785,111.10,1006,111.33,789,111.25,734,111.04,906,110.97,532,111.31,387,111.02,991,111.07,841,111.36,892,111.54,782),dim=c(2,72),dimnames=list(c('CPI','Faillissementen'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('CPI','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 = '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
Faillissementen CPI M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 627 98.60 1 0 0 0 0 0 0 0 0 0 0
2 696 98.97 0 1 0 0 0 0 0 0 0 0 0
3 825 99.11 0 0 1 0 0 0 0 0 0 0 0
4 677 99.64 0 0 0 1 0 0 0 0 0 0 0
5 656 100.03 0 0 0 0 1 0 0 0 0 0 0
6 785 99.98 0 0 0 0 0 1 0 0 0 0 0
7 412 100.32 0 0 0 0 0 0 1 0 0 0 0
8 352 100.44 0 0 0 0 0 0 0 1 0 0 0
9 839 100.51 0 0 0 0 0 0 0 0 1 0 0
10 729 101.00 0 0 0 0 0 0 0 0 0 1 0
11 696 100.88 0 0 0 0 0 0 0 0 0 0 1
12 641 100.55 0 0 0 0 0 0 0 0 0 0 0
13 695 100.83 1 0 0 0 0 0 0 0 0 0 0
14 638 101.51 0 1 0 0 0 0 0 0 0 0 0
15 762 102.16 0 0 1 0 0 0 0 0 0 0 0
16 635 102.39 0 0 0 1 0 0 0 0 0 0 0
17 721 102.54 0 0 0 0 1 0 0 0 0 0 0
18 854 102.85 0 0 0 0 0 1 0 0 0 0 0
19 418 103.47 0 0 0 0 0 0 1 0 0 0 0
20 367 103.57 0 0 0 0 0 0 0 1 0 0 0
21 824 103.69 0 0 0 0 0 0 0 0 1 0 0
22 687 103.50 0 0 0 0 0 0 0 0 0 1 0
23 601 103.47 0 0 0 0 0 0 0 0 0 0 1
24 676 103.45 0 0 0 0 0 0 0 0 0 0 0
25 740 103.48 1 0 0 0 0 0 0 0 0 0 0
26 691 103.93 0 1 0 0 0 0 0 0 0 0 0
27 683 103.89 0 0 1 0 0 0 0 0 0 0 0
28 594 104.40 0 0 0 1 0 0 0 0 0 0 0
29 729 104.79 0 0 0 0 1 0 0 0 0 0 0
30 731 104.77 0 0 0 0 0 1 0 0 0 0 0
31 386 105.13 0 0 0 0 0 0 1 0 0 0 0
32 331 105.26 0 0 0 0 0 0 0 1 0 0 0
33 707 104.96 0 0 0 0 0 0 0 0 1 0 0
34 715 104.75 0 0 0 0 0 0 0 0 0 1 0
35 657 105.01 0 0 0 0 0 0 0 0 0 0 1
36 653 105.15 0 0 0 0 0 0 0 0 0 0 0
37 642 105.20 1 0 0 0 0 0 0 0 0 0 0
38 643 105.77 0 1 0 0 0 0 0 0 0 0 0
39 718 105.78 0 0 1 0 0 0 0 0 0 0 0
40 654 106.26 0 0 0 1 0 0 0 0 0 0 0
41 632 106.13 0 0 0 0 1 0 0 0 0 0 0
42 731 106.12 0 0 0 0 0 1 0 0 0 0 0
43 392 106.57 0 0 0 0 0 0 1 0 0 0 0
44 344 106.44 0 0 0 0 0 0 0 1 0 0 0
45 792 106.54 0 0 0 0 0 0 0 0 1 0 0
46 852 107.10 0 0 0 0 0 0 0 0 0 1 0
47 649 108.10 0 0 0 0 0 0 0 0 0 0 1
48 629 108.40 0 0 0 0 0 0 0 0 0 0 0
49 685 108.84 1 0 0 0 0 0 0 0 0 0 0
50 617 109.62 0 1 0 0 0 0 0 0 0 0 0
51 715 110.42 0 0 1 0 0 0 0 0 0 0 0
52 715 110.67 0 0 0 1 0 0 0 0 0 0 0
53 629 111.66 0 0 0 0 1 0 0 0 0 0 0
54 916 112.28 0 0 0 0 0 1 0 0 0 0 0
55 531 112.87 0 0 0 0 0 0 1 0 0 0 0
56 357 112.18 0 0 0 0 0 0 0 1 0 0 0
57 917 112.36 0 0 0 0 0 0 0 0 1 0 0
58 828 112.16 0 0 0 0 0 0 0 0 0 1 0
59 708 111.49 0 0 0 0 0 0 0 0 0 0 1
60 858 111.25 0 0 0 0 0 0 0 0 0 0 0
61 775 111.36 1 0 0 0 0 0 0 0 0 0 0
62 785 111.74 0 1 0 0 0 0 0 0 0 0 0
63 1006 111.10 0 0 1 0 0 0 0 0 0 0 0
64 789 111.33 0 0 0 1 0 0 0 0 0 0 0
65 734 111.25 0 0 0 0 1 0 0 0 0 0 0
66 906 111.04 0 0 0 0 0 1 0 0 0 0 0
67 532 110.97 0 0 0 0 0 0 1 0 0 0 0
68 387 111.31 0 0 0 0 0 0 0 1 0 0 0
69 991 111.02 0 0 0 0 0 0 0 0 1 0 0
70 841 111.07 0 0 0 0 0 0 0 0 0 1 0
71 892 111.36 0 0 0 0 0 0 0 0 0 0 1
72 782 111.54 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) CPI M1 M2 M3 M4
-239.726 8.866 5.277 -15.163 89.978 -20.818
M5 M6 M7 M8 M9 M10
-17.178 118.876 -259.841 -348.482 140.362 69.956
M11
-5.956
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-124.228 -47.249 1.737 43.570 170.718
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -239.726 204.543 -1.172 0.245905
CPI 8.866 1.899 4.669 1.79e-05 ***
M1 5.277 39.248 0.134 0.893509
M2 -15.163 39.162 -0.387 0.700012
M3 89.978 39.142 2.299 0.025080 *
M4 -20.818 39.104 -0.532 0.596468
M5 -17.178 39.083 -0.440 0.661886
M6 118.876 39.077 3.042 0.003503 **
M7 -259.841 39.064 -6.652 1.05e-08 ***
M8 -348.482 39.064 -8.921 1.55e-12 ***
M9 140.362 39.065 3.593 0.000667 ***
M10 69.956 39.064 1.791 0.078450 .
M11 -5.956 39.063 -0.152 0.879341
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 67.66 on 59 degrees of freedom
Multiple R-squared: 0.8447, Adjusted R-squared: 0.8132
F-statistic: 26.75 on 12 and 59 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.2075397017 0.4150794033 0.7924603
[2,] 0.2263973384 0.4527946769 0.7736027
[3,] 0.2139673494 0.4279346988 0.7860327
[4,] 0.1237407238 0.2474814475 0.8762593
[5,] 0.0741583412 0.1483166823 0.9258417
[6,] 0.0415461497 0.0830922994 0.9584539
[7,] 0.0262539142 0.0525078283 0.9737461
[8,] 0.0349765733 0.0699531467 0.9650234
[9,] 0.0227825469 0.0455650938 0.9772175
[10,] 0.0366859418 0.0733718835 0.9633141
[11,] 0.0263256786 0.0526513573 0.9736743
[12,] 0.0580041784 0.1160083568 0.9419958
[13,] 0.0465339520 0.0930679039 0.9534660
[14,] 0.0620678629 0.1241357258 0.9379321
[15,] 0.0647317730 0.1294635460 0.9352682
[16,] 0.0416813743 0.0833627486 0.9583186
[17,] 0.0298058274 0.0596116548 0.9701942
[18,] 0.0551863193 0.1103726386 0.9448137
[19,] 0.0359974598 0.0719949196 0.9640025
[20,] 0.0230981349 0.0461962697 0.9769019
[21,] 0.0137112819 0.0274225638 0.9862887
[22,] 0.0082383576 0.0164767152 0.9917616
[23,] 0.0049735206 0.0099470411 0.9950265
[24,] 0.0027774836 0.0055549671 0.9972225
[25,] 0.0017191893 0.0034383785 0.9982808
[26,] 0.0014283799 0.0028567597 0.9985716
[27,] 0.0009005423 0.0018010845 0.9990995
[28,] 0.0004362960 0.0008725921 0.9995637
[29,] 0.0003493493 0.0006986986 0.9996507
[30,] 0.0001700966 0.0003401933 0.9998299
[31,] 0.0045321817 0.0090643633 0.9954678
[32,] 0.0023557894 0.0047115789 0.9976442
[33,] 0.0017011250 0.0034022500 0.9982989
[34,] 0.0008767169 0.0017534338 0.9991233
[35,] 0.0010242807 0.0020485613 0.9989757
[36,] 0.0851072852 0.1702145705 0.9148927
[37,] 0.1187542154 0.2375084308 0.8812458
[38,] 0.1382221472 0.2764442944 0.8617779
[39,] 0.1638126821 0.3276253642 0.8361873
[40,] 0.1683018269 0.3366036539 0.8316982
[41,] 0.0899578356 0.1799156711 0.9100422
> postscript(file="/var/www/html/rcomp/tmp/1r4mr1291132391.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/22d4u1291132391.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/32d4u1291132391.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/42d4u1291132391.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/5vm3x1291132391.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
-12.7538941 73.4052424 96.0234578 54.1196496 26.0220364 19.4110677
7 8 9 10 11 12
22.1138243 49.6911187 47.2264978 3.2875939 47.2635819 -10.7662554
13 14 15 16 17 18
35.4745751 -7.1147972 5.9816780 -12.2622831 68.7679815 62.9651962
19 20 21 22 23 24
0.1854287 36.9400462 4.0321175 -60.8777995 -70.6997656 -1.4781117
25 26 27 28 29 30
56.9792582 24.4291021 -88.3567742 -71.0832593 56.8191275 -77.0578259
31 32 33 34 35 36
-46.5323925 -14.0437597 -124.2279023 -43.9604961 -28.3536479 -39.5505791
37 38 39 40 41 42
-56.2705324 -39.8846274 -70.1138115 -27.5743119 -52.0615233 -89.0271383
43 44 45 46 47 48
-53.2996590 -11.5058253 -53.2364309 72.2040341 -63.7500740 -92.3655905
49 50 51 52 53 54
-45.5433451 -100.0193331 -114.2527816 -5.6740657 -104.0913733 41.3573326
55 56 57 58 59 60
29.8435498 -49.3975684 20.1625335 3.3412781 -34.8063474 111.3658612
61 62 63 64 65 66
22.1139384 49.1844133 170.7182315 62.4742704 4.5437512 42.3513677
67 68 69 70 71 72
47.6892487 -11.6840115 106.0431843 26.0053895 150.3462531 32.7946755
> postscript(file="/var/www/html/rcomp/tmp/6vm3x1291132391.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 -12.7538941 NA
1 73.4052424 -12.7538941
2 96.0234578 73.4052424
3 54.1196496 96.0234578
4 26.0220364 54.1196496
5 19.4110677 26.0220364
6 22.1138243 19.4110677
7 49.6911187 22.1138243
8 47.2264978 49.6911187
9 3.2875939 47.2264978
10 47.2635819 3.2875939
11 -10.7662554 47.2635819
12 35.4745751 -10.7662554
13 -7.1147972 35.4745751
14 5.9816780 -7.1147972
15 -12.2622831 5.9816780
16 68.7679815 -12.2622831
17 62.9651962 68.7679815
18 0.1854287 62.9651962
19 36.9400462 0.1854287
20 4.0321175 36.9400462
21 -60.8777995 4.0321175
22 -70.6997656 -60.8777995
23 -1.4781117 -70.6997656
24 56.9792582 -1.4781117
25 24.4291021 56.9792582
26 -88.3567742 24.4291021
27 -71.0832593 -88.3567742
28 56.8191275 -71.0832593
29 -77.0578259 56.8191275
30 -46.5323925 -77.0578259
31 -14.0437597 -46.5323925
32 -124.2279023 -14.0437597
33 -43.9604961 -124.2279023
34 -28.3536479 -43.9604961
35 -39.5505791 -28.3536479
36 -56.2705324 -39.5505791
37 -39.8846274 -56.2705324
38 -70.1138115 -39.8846274
39 -27.5743119 -70.1138115
40 -52.0615233 -27.5743119
41 -89.0271383 -52.0615233
42 -53.2996590 -89.0271383
43 -11.5058253 -53.2996590
44 -53.2364309 -11.5058253
45 72.2040341 -53.2364309
46 -63.7500740 72.2040341
47 -92.3655905 -63.7500740
48 -45.5433451 -92.3655905
49 -100.0193331 -45.5433451
50 -114.2527816 -100.0193331
51 -5.6740657 -114.2527816
52 -104.0913733 -5.6740657
53 41.3573326 -104.0913733
54 29.8435498 41.3573326
55 -49.3975684 29.8435498
56 20.1625335 -49.3975684
57 3.3412781 20.1625335
58 -34.8063474 3.3412781
59 111.3658612 -34.8063474
60 22.1139384 111.3658612
61 49.1844133 22.1139384
62 170.7182315 49.1844133
63 62.4742704 170.7182315
64 4.5437512 62.4742704
65 42.3513677 4.5437512
66 47.6892487 42.3513677
67 -11.6840115 47.6892487
68 106.0431843 -11.6840115
69 26.0053895 106.0431843
70 150.3462531 26.0053895
71 32.7946755 150.3462531
72 NA 32.7946755
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 73.4052424 -12.7538941
[2,] 96.0234578 73.4052424
[3,] 54.1196496 96.0234578
[4,] 26.0220364 54.1196496
[5,] 19.4110677 26.0220364
[6,] 22.1138243 19.4110677
[7,] 49.6911187 22.1138243
[8,] 47.2264978 49.6911187
[9,] 3.2875939 47.2264978
[10,] 47.2635819 3.2875939
[11,] -10.7662554 47.2635819
[12,] 35.4745751 -10.7662554
[13,] -7.1147972 35.4745751
[14,] 5.9816780 -7.1147972
[15,] -12.2622831 5.9816780
[16,] 68.7679815 -12.2622831
[17,] 62.9651962 68.7679815
[18,] 0.1854287 62.9651962
[19,] 36.9400462 0.1854287
[20,] 4.0321175 36.9400462
[21,] -60.8777995 4.0321175
[22,] -70.6997656 -60.8777995
[23,] -1.4781117 -70.6997656
[24,] 56.9792582 -1.4781117
[25,] 24.4291021 56.9792582
[26,] -88.3567742 24.4291021
[27,] -71.0832593 -88.3567742
[28,] 56.8191275 -71.0832593
[29,] -77.0578259 56.8191275
[30,] -46.5323925 -77.0578259
[31,] -14.0437597 -46.5323925
[32,] -124.2279023 -14.0437597
[33,] -43.9604961 -124.2279023
[34,] -28.3536479 -43.9604961
[35,] -39.5505791 -28.3536479
[36,] -56.2705324 -39.5505791
[37,] -39.8846274 -56.2705324
[38,] -70.1138115 -39.8846274
[39,] -27.5743119 -70.1138115
[40,] -52.0615233 -27.5743119
[41,] -89.0271383 -52.0615233
[42,] -53.2996590 -89.0271383
[43,] -11.5058253 -53.2996590
[44,] -53.2364309 -11.5058253
[45,] 72.2040341 -53.2364309
[46,] -63.7500740 72.2040341
[47,] -92.3655905 -63.7500740
[48,] -45.5433451 -92.3655905
[49,] -100.0193331 -45.5433451
[50,] -114.2527816 -100.0193331
[51,] -5.6740657 -114.2527816
[52,] -104.0913733 -5.6740657
[53,] 41.3573326 -104.0913733
[54,] 29.8435498 41.3573326
[55,] -49.3975684 29.8435498
[56,] 20.1625335 -49.3975684
[57,] 3.3412781 20.1625335
[58,] -34.8063474 3.3412781
[59,] 111.3658612 -34.8063474
[60,] 22.1139384 111.3658612
[61,] 49.1844133 22.1139384
[62,] 170.7182315 49.1844133
[63,] 62.4742704 170.7182315
[64,] 4.5437512 62.4742704
[65,] 42.3513677 4.5437512
[66,] 47.6892487 42.3513677
[67,] -11.6840115 47.6892487
[68,] 106.0431843 -11.6840115
[69,] 26.0053895 106.0431843
[70,] 150.3462531 26.0053895
[71,] 32.7946755 150.3462531
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 73.4052424 -12.7538941
2 96.0234578 73.4052424
3 54.1196496 96.0234578
4 26.0220364 54.1196496
5 19.4110677 26.0220364
6 22.1138243 19.4110677
7 49.6911187 22.1138243
8 47.2264978 49.6911187
9 3.2875939 47.2264978
10 47.2635819 3.2875939
11 -10.7662554 47.2635819
12 35.4745751 -10.7662554
13 -7.1147972 35.4745751
14 5.9816780 -7.1147972
15 -12.2622831 5.9816780
16 68.7679815 -12.2622831
17 62.9651962 68.7679815
18 0.1854287 62.9651962
19 36.9400462 0.1854287
20 4.0321175 36.9400462
21 -60.8777995 4.0321175
22 -70.6997656 -60.8777995
23 -1.4781117 -70.6997656
24 56.9792582 -1.4781117
25 24.4291021 56.9792582
26 -88.3567742 24.4291021
27 -71.0832593 -88.3567742
28 56.8191275 -71.0832593
29 -77.0578259 56.8191275
30 -46.5323925 -77.0578259
31 -14.0437597 -46.5323925
32 -124.2279023 -14.0437597
33 -43.9604961 -124.2279023
34 -28.3536479 -43.9604961
35 -39.5505791 -28.3536479
36 -56.2705324 -39.5505791
37 -39.8846274 -56.2705324
38 -70.1138115 -39.8846274
39 -27.5743119 -70.1138115
40 -52.0615233 -27.5743119
41 -89.0271383 -52.0615233
42 -53.2996590 -89.0271383
43 -11.5058253 -53.2996590
44 -53.2364309 -11.5058253
45 72.2040341 -53.2364309
46 -63.7500740 72.2040341
47 -92.3655905 -63.7500740
48 -45.5433451 -92.3655905
49 -100.0193331 -45.5433451
50 -114.2527816 -100.0193331
51 -5.6740657 -114.2527816
52 -104.0913733 -5.6740657
53 41.3573326 -104.0913733
54 29.8435498 41.3573326
55 -49.3975684 29.8435498
56 20.1625335 -49.3975684
57 3.3412781 20.1625335
58 -34.8063474 3.3412781
59 111.3658612 -34.8063474
60 22.1139384 111.3658612
61 49.1844133 22.1139384
62 170.7182315 49.1844133
63 62.4742704 170.7182315
64 4.5437512 62.4742704
65 42.3513677 4.5437512
66 47.6892487 42.3513677
67 -11.6840115 47.6892487
68 106.0431843 -11.6840115
69 26.0053895 106.0431843
70 150.3462531 26.0053895
71 32.7946755 150.3462531
> 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/7ne201291132391.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/8ne201291132391.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/9y5j31291132391.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/10y5j31291132391.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/1115i91291132391.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/12n6zf1291132391.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/13upvr1291132391.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/14myvb1291132391.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/15qzbh1291132391.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/16mqrq1291132391.tab")
+ }
>
> try(system("convert tmp/1r4mr1291132391.ps tmp/1r4mr1291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/22d4u1291132391.ps tmp/22d4u1291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/32d4u1291132391.ps tmp/32d4u1291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/42d4u1291132391.ps tmp/42d4u1291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/5vm3x1291132391.ps tmp/5vm3x1291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/6vm3x1291132391.ps tmp/6vm3x1291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ne201291132391.ps tmp/7ne201291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ne201291132391.ps tmp/8ne201291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/9y5j31291132391.ps tmp/9y5j31291132391.png",intern=TRUE))
character(0)
> try(system("convert tmp/10y5j31291132391.ps tmp/10y5j31291132391.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.645 1.700 6.917