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(46,62,66,59,58,61,41,27,58,70,49,59,44,36,72,45,56,54,53,35,61,52,47,51,52,63,74,45,51,64,36,30,55,64,39,40,63,45,59,55,40,64,27,28,45,57,45,69,60,56,58,50,51,53,37,22,55,70,62,58,39,49,58,47,42,62,39,40,72,70,54,65),dim=c(1,72),dimnames=list(c('Faillissementen'),1:72))
> y <- array(NA,dim=c(1,72),dimnames=list(c('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 = '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
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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 46 1 0 0 0 0 0 0 0 0 0 0 1
2 62 0 1 0 0 0 0 0 0 0 0 0 2
3 66 0 0 1 0 0 0 0 0 0 0 0 3
4 59 0 0 0 1 0 0 0 0 0 0 0 4
5 58 0 0 0 0 1 0 0 0 0 0 0 5
6 61 0 0 0 0 0 1 0 0 0 0 0 6
7 41 0 0 0 0 0 0 1 0 0 0 0 7
8 27 0 0 0 0 0 0 0 1 0 0 0 8
9 58 0 0 0 0 0 0 0 0 1 0 0 9
10 70 0 0 0 0 0 0 0 0 0 1 0 10
11 49 0 0 0 0 0 0 0 0 0 0 1 11
12 59 0 0 0 0 0 0 0 0 0 0 0 12
13 44 1 0 0 0 0 0 0 0 0 0 0 13
14 36 0 1 0 0 0 0 0 0 0 0 0 14
15 72 0 0 1 0 0 0 0 0 0 0 0 15
16 45 0 0 0 1 0 0 0 0 0 0 0 16
17 56 0 0 0 0 1 0 0 0 0 0 0 17
18 54 0 0 0 0 0 1 0 0 0 0 0 18
19 53 0 0 0 0 0 0 1 0 0 0 0 19
20 35 0 0 0 0 0 0 0 1 0 0 0 20
21 61 0 0 0 0 0 0 0 0 1 0 0 21
22 52 0 0 0 0 0 0 0 0 0 1 0 22
23 47 0 0 0 0 0 0 0 0 0 0 1 23
24 51 0 0 0 0 0 0 0 0 0 0 0 24
25 52 1 0 0 0 0 0 0 0 0 0 0 25
26 63 0 1 0 0 0 0 0 0 0 0 0 26
27 74 0 0 1 0 0 0 0 0 0 0 0 27
28 45 0 0 0 1 0 0 0 0 0 0 0 28
29 51 0 0 0 0 1 0 0 0 0 0 0 29
30 64 0 0 0 0 0 1 0 0 0 0 0 30
31 36 0 0 0 0 0 0 1 0 0 0 0 31
32 30 0 0 0 0 0 0 0 1 0 0 0 32
33 55 0 0 0 0 0 0 0 0 1 0 0 33
34 64 0 0 0 0 0 0 0 0 0 1 0 34
35 39 0 0 0 0 0 0 0 0 0 0 1 35
36 40 0 0 0 0 0 0 0 0 0 0 0 36
37 63 1 0 0 0 0 0 0 0 0 0 0 37
38 45 0 1 0 0 0 0 0 0 0 0 0 38
39 59 0 0 1 0 0 0 0 0 0 0 0 39
40 55 0 0 0 1 0 0 0 0 0 0 0 40
41 40 0 0 0 0 1 0 0 0 0 0 0 41
42 64 0 0 0 0 0 1 0 0 0 0 0 42
43 27 0 0 0 0 0 0 1 0 0 0 0 43
44 28 0 0 0 0 0 0 0 1 0 0 0 44
45 45 0 0 0 0 0 0 0 0 1 0 0 45
46 57 0 0 0 0 0 0 0 0 0 1 0 46
47 45 0 0 0 0 0 0 0 0 0 0 1 47
48 69 0 0 0 0 0 0 0 0 0 0 0 48
49 60 1 0 0 0 0 0 0 0 0 0 0 49
50 56 0 1 0 0 0 0 0 0 0 0 0 50
51 58 0 0 1 0 0 0 0 0 0 0 0 51
52 50 0 0 0 1 0 0 0 0 0 0 0 52
53 51 0 0 0 0 1 0 0 0 0 0 0 53
54 53 0 0 0 0 0 1 0 0 0 0 0 54
55 37 0 0 0 0 0 0 1 0 0 0 0 55
56 22 0 0 0 0 0 0 0 1 0 0 0 56
57 55 0 0 0 0 0 0 0 0 1 0 0 57
58 70 0 0 0 0 0 0 0 0 0 1 0 58
59 62 0 0 0 0 0 0 0 0 0 0 1 59
60 58 0 0 0 0 0 0 0 0 0 0 0 60
61 39 1 0 0 0 0 0 0 0 0 0 0 61
62 49 0 1 0 0 0 0 0 0 0 0 0 62
63 58 0 0 1 0 0 0 0 0 0 0 0 63
64 47 0 0 0 1 0 0 0 0 0 0 0 64
65 42 0 0 0 0 1 0 0 0 0 0 0 65
66 62 0 0 0 0 0 1 0 0 0 0 0 66
67 39 0 0 0 0 0 0 1 0 0 0 0 67
68 40 0 0 0 0 0 0 0 1 0 0 0 68
69 72 0 0 0 0 0 0 0 0 1 0 0 69
70 70 0 0 0 0 0 0 0 0 0 1 0 70
71 54 0 0 0 0 0 0 0 0 0 0 1 71
72 65 0 0 0 0 0 0 0 0 0 0 0 72
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) M1 M2 M3 M4 M5
57.275000 -6.405357 -5.232143 7.441071 -6.885714 -7.379167
M6 M7 M8 M9 M10 M11
2.627381 -18.199405 -26.692857 0.647024 6.820238 -7.673214
t
-0.006548
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-17.0393 -5.5417 0.1321 5.1470 14.5298
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 57.275000 3.861250 14.833 < 2e-16 ***
M1 -6.405357 4.727887 -1.355 0.180645
M2 -5.232143 4.723019 -1.108 0.272446
M3 7.441071 4.718609 1.577 0.120151
M4 -6.885714 4.714660 -1.460 0.149460
M5 -7.379167 4.711173 -1.566 0.122624
M6 2.627381 4.708149 0.558 0.578922
M7 -18.199405 4.705588 -3.868 0.000277 ***
M8 -26.692857 4.703492 -5.675 4.44e-07 ***
M9 0.647024 4.701861 0.138 0.891017
M10 6.820238 4.700696 1.451 0.152104
M11 -7.673214 4.699997 -1.633 0.107879
t -0.006548 0.046811 -0.140 0.889236
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 8.14 on 59 degrees of freedom
Multiple R-squared: 0.6222, Adjusted R-squared: 0.5453
F-statistic: 8.096 on 12 and 59 DF, p-value: 1.054e-08
> 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.7329087 0.5341825 0.2670913
[2,] 0.6310039 0.7379921 0.3689961
[3,] 0.4881258 0.9762516 0.5118742
[4,] 0.6739631 0.6520738 0.3260369
[5,] 0.6594907 0.6810186 0.3405093
[6,] 0.5809678 0.8380644 0.4190322
[7,] 0.6255900 0.7488199 0.3744100
[8,] 0.5243140 0.9513721 0.4756860
[9,] 0.4365305 0.8730609 0.5634695
[10,] 0.4399275 0.8798550 0.5600725
[11,] 0.5717877 0.8564247 0.4282123
[12,] 0.6017403 0.7965195 0.3982597
[13,] 0.5397977 0.9204045 0.4602023
[14,] 0.5022963 0.9954075 0.4977037
[15,] 0.4739265 0.9478530 0.5260735
[16,] 0.4591392 0.9182784 0.5408608
[17,] 0.3856932 0.7713865 0.6143068
[18,] 0.3147589 0.6295179 0.6852411
[19,] 0.2583969 0.5167937 0.7416031
[20,] 0.2372099 0.4744199 0.7627901
[21,] 0.3830479 0.7660957 0.6169521
[22,] 0.5895073 0.8209854 0.4104927
[23,] 0.5349819 0.9300361 0.4650181
[24,] 0.4959635 0.9919271 0.5040365
[25,] 0.4947138 0.9894275 0.5052862
[26,] 0.4704116 0.9408232 0.5295884
[27,] 0.4734222 0.9468444 0.5265778
[28,] 0.4671316 0.9342633 0.5328684
[29,] 0.3815385 0.7630771 0.6184615
[30,] 0.4427946 0.8855891 0.5572054
[31,] 0.4268611 0.8537221 0.5731389
[32,] 0.4537990 0.9075979 0.5462010
[33,] 0.5334265 0.9331470 0.4665735
[34,] 0.7735477 0.4529046 0.2264523
[35,] 0.7575966 0.4848068 0.2424034
[36,] 0.6783174 0.6433653 0.3216826
[37,] 0.6060063 0.7879874 0.3939937
[38,] 0.6757993 0.6484014 0.3242007
[39,] 0.5542291 0.8915419 0.4457709
[40,] 0.4237493 0.8474985 0.5762507
[41,] 0.4416136 0.8832272 0.5583864
> postscript(file="/var/www/html/rcomp/tmp/1v03s1292677846.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/2v03s1292677846.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/36rkd1292677846.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/46rkd1292677846.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/56rkd1292677846.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
-4.86309524 9.97023810 1.30357143 8.63690476 8.13690476 1.13690476
7 8 9 10 11 12
1.97023810 -3.52976190 0.13690476 5.97023810 -0.52976190 1.80357143
13 14 15 16 17 18
-6.78452381 -15.95119048 7.38214286 -5.28452381 6.21547619 -5.78452381
19 20 21 22 23 24
14.04880952 4.54880952 3.21547619 -11.95119048 -2.45119048 -6.11785714
25 26 27 28 29 30
1.29404762 11.12738095 9.46071429 -5.20595238 1.29404762 4.29404762
31 32 33 34 35 36
-2.87261905 -0.37261905 -2.70595238 0.12738095 -10.37261905 -17.03928571
37 38 39 40 41 42
12.37261905 -6.79404762 -5.46071429 4.87261905 -9.62738095 4.37261905
43 44 45 46 47 48
-11.79404762 -2.29404762 -12.62738095 -6.79404762 -4.29404762 12.03928571
49 50 51 52 53 54
9.45119048 4.28452381 -6.38214286 -0.04880952 1.45119048 -6.54880952
55 56 57 58 59 60
-1.71547619 -8.21547619 -2.54880952 6.28452381 12.78452381 1.11785714
61 62 63 64 65 66
-11.47023810 -2.63690476 -6.30357143 -2.97023810 -7.47023810 2.52976190
67 68 69 70 71 72
0.36309524 9.86309524 14.52976190 6.36309524 4.86309524 8.19642857
> postscript(file="/var/www/html/rcomp/tmp/6h02g1292677846.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 -4.86309524 NA
1 9.97023810 -4.86309524
2 1.30357143 9.97023810
3 8.63690476 1.30357143
4 8.13690476 8.63690476
5 1.13690476 8.13690476
6 1.97023810 1.13690476
7 -3.52976190 1.97023810
8 0.13690476 -3.52976190
9 5.97023810 0.13690476
10 -0.52976190 5.97023810
11 1.80357143 -0.52976190
12 -6.78452381 1.80357143
13 -15.95119048 -6.78452381
14 7.38214286 -15.95119048
15 -5.28452381 7.38214286
16 6.21547619 -5.28452381
17 -5.78452381 6.21547619
18 14.04880952 -5.78452381
19 4.54880952 14.04880952
20 3.21547619 4.54880952
21 -11.95119048 3.21547619
22 -2.45119048 -11.95119048
23 -6.11785714 -2.45119048
24 1.29404762 -6.11785714
25 11.12738095 1.29404762
26 9.46071429 11.12738095
27 -5.20595238 9.46071429
28 1.29404762 -5.20595238
29 4.29404762 1.29404762
30 -2.87261905 4.29404762
31 -0.37261905 -2.87261905
32 -2.70595238 -0.37261905
33 0.12738095 -2.70595238
34 -10.37261905 0.12738095
35 -17.03928571 -10.37261905
36 12.37261905 -17.03928571
37 -6.79404762 12.37261905
38 -5.46071429 -6.79404762
39 4.87261905 -5.46071429
40 -9.62738095 4.87261905
41 4.37261905 -9.62738095
42 -11.79404762 4.37261905
43 -2.29404762 -11.79404762
44 -12.62738095 -2.29404762
45 -6.79404762 -12.62738095
46 -4.29404762 -6.79404762
47 12.03928571 -4.29404762
48 9.45119048 12.03928571
49 4.28452381 9.45119048
50 -6.38214286 4.28452381
51 -0.04880952 -6.38214286
52 1.45119048 -0.04880952
53 -6.54880952 1.45119048
54 -1.71547619 -6.54880952
55 -8.21547619 -1.71547619
56 -2.54880952 -8.21547619
57 6.28452381 -2.54880952
58 12.78452381 6.28452381
59 1.11785714 12.78452381
60 -11.47023810 1.11785714
61 -2.63690476 -11.47023810
62 -6.30357143 -2.63690476
63 -2.97023810 -6.30357143
64 -7.47023810 -2.97023810
65 2.52976190 -7.47023810
66 0.36309524 2.52976190
67 9.86309524 0.36309524
68 14.52976190 9.86309524
69 6.36309524 14.52976190
70 4.86309524 6.36309524
71 8.19642857 4.86309524
72 NA 8.19642857
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 9.97023810 -4.86309524
[2,] 1.30357143 9.97023810
[3,] 8.63690476 1.30357143
[4,] 8.13690476 8.63690476
[5,] 1.13690476 8.13690476
[6,] 1.97023810 1.13690476
[7,] -3.52976190 1.97023810
[8,] 0.13690476 -3.52976190
[9,] 5.97023810 0.13690476
[10,] -0.52976190 5.97023810
[11,] 1.80357143 -0.52976190
[12,] -6.78452381 1.80357143
[13,] -15.95119048 -6.78452381
[14,] 7.38214286 -15.95119048
[15,] -5.28452381 7.38214286
[16,] 6.21547619 -5.28452381
[17,] -5.78452381 6.21547619
[18,] 14.04880952 -5.78452381
[19,] 4.54880952 14.04880952
[20,] 3.21547619 4.54880952
[21,] -11.95119048 3.21547619
[22,] -2.45119048 -11.95119048
[23,] -6.11785714 -2.45119048
[24,] 1.29404762 -6.11785714
[25,] 11.12738095 1.29404762
[26,] 9.46071429 11.12738095
[27,] -5.20595238 9.46071429
[28,] 1.29404762 -5.20595238
[29,] 4.29404762 1.29404762
[30,] -2.87261905 4.29404762
[31,] -0.37261905 -2.87261905
[32,] -2.70595238 -0.37261905
[33,] 0.12738095 -2.70595238
[34,] -10.37261905 0.12738095
[35,] -17.03928571 -10.37261905
[36,] 12.37261905 -17.03928571
[37,] -6.79404762 12.37261905
[38,] -5.46071429 -6.79404762
[39,] 4.87261905 -5.46071429
[40,] -9.62738095 4.87261905
[41,] 4.37261905 -9.62738095
[42,] -11.79404762 4.37261905
[43,] -2.29404762 -11.79404762
[44,] -12.62738095 -2.29404762
[45,] -6.79404762 -12.62738095
[46,] -4.29404762 -6.79404762
[47,] 12.03928571 -4.29404762
[48,] 9.45119048 12.03928571
[49,] 4.28452381 9.45119048
[50,] -6.38214286 4.28452381
[51,] -0.04880952 -6.38214286
[52,] 1.45119048 -0.04880952
[53,] -6.54880952 1.45119048
[54,] -1.71547619 -6.54880952
[55,] -8.21547619 -1.71547619
[56,] -2.54880952 -8.21547619
[57,] 6.28452381 -2.54880952
[58,] 12.78452381 6.28452381
[59,] 1.11785714 12.78452381
[60,] -11.47023810 1.11785714
[61,] -2.63690476 -11.47023810
[62,] -6.30357143 -2.63690476
[63,] -2.97023810 -6.30357143
[64,] -7.47023810 -2.97023810
[65,] 2.52976190 -7.47023810
[66,] 0.36309524 2.52976190
[67,] 9.86309524 0.36309524
[68,] 14.52976190 9.86309524
[69,] 6.36309524 14.52976190
[70,] 4.86309524 6.36309524
[71,] 8.19642857 4.86309524
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 9.97023810 -4.86309524
2 1.30357143 9.97023810
3 8.63690476 1.30357143
4 8.13690476 8.63690476
5 1.13690476 8.13690476
6 1.97023810 1.13690476
7 -3.52976190 1.97023810
8 0.13690476 -3.52976190
9 5.97023810 0.13690476
10 -0.52976190 5.97023810
11 1.80357143 -0.52976190
12 -6.78452381 1.80357143
13 -15.95119048 -6.78452381
14 7.38214286 -15.95119048
15 -5.28452381 7.38214286
16 6.21547619 -5.28452381
17 -5.78452381 6.21547619
18 14.04880952 -5.78452381
19 4.54880952 14.04880952
20 3.21547619 4.54880952
21 -11.95119048 3.21547619
22 -2.45119048 -11.95119048
23 -6.11785714 -2.45119048
24 1.29404762 -6.11785714
25 11.12738095 1.29404762
26 9.46071429 11.12738095
27 -5.20595238 9.46071429
28 1.29404762 -5.20595238
29 4.29404762 1.29404762
30 -2.87261905 4.29404762
31 -0.37261905 -2.87261905
32 -2.70595238 -0.37261905
33 0.12738095 -2.70595238
34 -10.37261905 0.12738095
35 -17.03928571 -10.37261905
36 12.37261905 -17.03928571
37 -6.79404762 12.37261905
38 -5.46071429 -6.79404762
39 4.87261905 -5.46071429
40 -9.62738095 4.87261905
41 4.37261905 -9.62738095
42 -11.79404762 4.37261905
43 -2.29404762 -11.79404762
44 -12.62738095 -2.29404762
45 -6.79404762 -12.62738095
46 -4.29404762 -6.79404762
47 12.03928571 -4.29404762
48 9.45119048 12.03928571
49 4.28452381 9.45119048
50 -6.38214286 4.28452381
51 -0.04880952 -6.38214286
52 1.45119048 -0.04880952
53 -6.54880952 1.45119048
54 -1.71547619 -6.54880952
55 -8.21547619 -1.71547619
56 -2.54880952 -8.21547619
57 6.28452381 -2.54880952
58 12.78452381 6.28452381
59 1.11785714 12.78452381
60 -11.47023810 1.11785714
61 -2.63690476 -11.47023810
62 -6.30357143 -2.63690476
63 -2.97023810 -6.30357143
64 -7.47023810 -2.97023810
65 2.52976190 -7.47023810
66 0.36309524 2.52976190
67 9.86309524 0.36309524
68 14.52976190 9.86309524
69 6.36309524 14.52976190
70 4.86309524 6.36309524
71 8.19642857 4.86309524
> 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/7rr1j1292677846.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/8rr1j1292677846.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/9rr1j1292677846.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/10kjim1292677846.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/11n1za1292677846.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/1292ff1292677846.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/13ntdo1292677846.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/14qcuc1292677846.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/15udai1292677846.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/16fd8o1292677846.tab")
+ }
>
> try(system("convert tmp/1v03s1292677846.ps tmp/1v03s1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/2v03s1292677846.ps tmp/2v03s1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/36rkd1292677846.ps tmp/36rkd1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/46rkd1292677846.ps tmp/46rkd1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/56rkd1292677846.ps tmp/56rkd1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/6h02g1292677846.ps tmp/6h02g1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/7rr1j1292677846.ps tmp/7rr1j1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/8rr1j1292677846.ps tmp/8rr1j1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/9rr1j1292677846.ps tmp/9rr1j1292677846.png",intern=TRUE))
character(0)
> try(system("convert tmp/10kjim1292677846.ps tmp/10kjim1292677846.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.601 1.705 6.410