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(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 = '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
Faillissementen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 46 1 0 0 0 0 0 0 0 0 0 0
2 62 0 1 0 0 0 0 0 0 0 0 0
3 66 0 0 1 0 0 0 0 0 0 0 0
4 59 0 0 0 1 0 0 0 0 0 0 0
5 58 0 0 0 0 1 0 0 0 0 0 0
6 61 0 0 0 0 0 1 0 0 0 0 0
7 41 0 0 0 0 0 0 1 0 0 0 0
8 27 0 0 0 0 0 0 0 1 0 0 0
9 58 0 0 0 0 0 0 0 0 1 0 0
10 70 0 0 0 0 0 0 0 0 0 1 0
11 49 0 0 0 0 0 0 0 0 0 0 1
12 59 0 0 0 0 0 0 0 0 0 0 0
13 44 1 0 0 0 0 0 0 0 0 0 0
14 36 0 1 0 0 0 0 0 0 0 0 0
15 72 0 0 1 0 0 0 0 0 0 0 0
16 45 0 0 0 1 0 0 0 0 0 0 0
17 56 0 0 0 0 1 0 0 0 0 0 0
18 54 0 0 0 0 0 1 0 0 0 0 0
19 53 0 0 0 0 0 0 1 0 0 0 0
20 35 0 0 0 0 0 0 0 1 0 0 0
21 61 0 0 0 0 0 0 0 0 1 0 0
22 52 0 0 0 0 0 0 0 0 0 1 0
23 47 0 0 0 0 0 0 0 0 0 0 1
24 51 0 0 0 0 0 0 0 0 0 0 0
25 52 1 0 0 0 0 0 0 0 0 0 0
26 63 0 1 0 0 0 0 0 0 0 0 0
27 74 0 0 1 0 0 0 0 0 0 0 0
28 45 0 0 0 1 0 0 0 0 0 0 0
29 51 0 0 0 0 1 0 0 0 0 0 0
30 64 0 0 0 0 0 1 0 0 0 0 0
31 36 0 0 0 0 0 0 1 0 0 0 0
32 30 0 0 0 0 0 0 0 1 0 0 0
33 55 0 0 0 0 0 0 0 0 1 0 0
34 64 0 0 0 0 0 0 0 0 0 1 0
35 39 0 0 0 0 0 0 0 0 0 0 1
36 40 0 0 0 0 0 0 0 0 0 0 0
37 63 1 0 0 0 0 0 0 0 0 0 0
38 45 0 1 0 0 0 0 0 0 0 0 0
39 59 0 0 1 0 0 0 0 0 0 0 0
40 55 0 0 0 1 0 0 0 0 0 0 0
41 40 0 0 0 0 1 0 0 0 0 0 0
42 64 0 0 0 0 0 1 0 0 0 0 0
43 27 0 0 0 0 0 0 1 0 0 0 0
44 28 0 0 0 0 0 0 0 1 0 0 0
45 45 0 0 0 0 0 0 0 0 1 0 0
46 57 0 0 0 0 0 0 0 0 0 1 0
47 45 0 0 0 0 0 0 0 0 0 0 1
48 69 0 0 0 0 0 0 0 0 0 0 0
49 60 1 0 0 0 0 0 0 0 0 0 0
50 56 0 1 0 0 0 0 0 0 0 0 0
51 58 0 0 1 0 0 0 0 0 0 0 0
52 50 0 0 0 1 0 0 0 0 0 0 0
53 51 0 0 0 0 1 0 0 0 0 0 0
54 53 0 0 0 0 0 1 0 0 0 0 0
55 37 0 0 0 0 0 0 1 0 0 0 0
56 22 0 0 0 0 0 0 0 1 0 0 0
57 55 0 0 0 0 0 0 0 0 1 0 0
58 70 0 0 0 0 0 0 0 0 0 1 0
59 62 0 0 0 0 0 0 0 0 0 0 1
60 58 0 0 0 0 0 0 0 0 0 0 0
61 39 1 0 0 0 0 0 0 0 0 0 0
62 49 0 1 0 0 0 0 0 0 0 0 0
63 58 0 0 1 0 0 0 0 0 0 0 0
64 47 0 0 0 1 0 0 0 0 0 0 0
65 42 0 0 0 0 1 0 0 0 0 0 0
66 62 0 0 0 0 0 1 0 0 0 0 0
67 39 0 0 0 0 0 0 1 0 0 0 0
68 40 0 0 0 0 0 0 0 1 0 0 0
69 72 0 0 0 0 0 0 0 0 1 0 0
70 70 0 0 0 0 0 0 0 0 0 1 0
71 54 0 0 0 0 0 0 0 0 0 0 1
72 65 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) M1 M2 M3 M4 M5
57.0000 -6.3333 -5.1667 7.5000 -6.8333 -7.3333
M6 M7 M8 M9 M10 M11
2.6667 -18.1667 -26.6667 0.6667 6.8333 -7.6667
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-17.0000 -5.5417 0.1667 5.1667 14.3333
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 57.0000 3.2960 17.294 < 2e-16 ***
M1 -6.3333 4.6612 -1.359 0.179318
M2 -5.1667 4.6612 -1.108 0.272095
M3 7.5000 4.6612 1.609 0.112860
M4 -6.8333 4.6612 -1.466 0.147870
M5 -7.3333 4.6612 -1.573 0.120915
M6 2.6667 4.6612 0.572 0.569393
M7 -18.1667 4.6612 -3.897 0.000248 ***
M8 -26.6667 4.6612 -5.721 3.57e-07 ***
M9 0.6667 4.6612 0.143 0.886750
M10 6.8333 4.6612 1.466 0.147870
M11 -7.6667 4.6612 -1.645 0.105245
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 8.073 on 60 degrees of freedom
Multiple R-squared: 0.622, Adjusted R-squared: 0.5527
F-statistic: 8.977 on 11 and 60 DF, p-value: 3.414e-09
> 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.8235367 0.3529266 0.1764633
[2,] 0.8122574 0.3754853 0.1877426
[3,] 0.7184305 0.5631390 0.2815695
[4,] 0.6375641 0.7248718 0.3624359
[5,] 0.6709695 0.6580610 0.3290305
[6,] 0.6060562 0.7878875 0.3939438
[7,] 0.5067003 0.9865993 0.4932997
[8,] 0.6280925 0.7438150 0.3719075
[9,] 0.5339496 0.9321008 0.4660504
[10,] 0.4825513 0.9651026 0.5174487
[11,] 0.4222000 0.8443999 0.5778000
[12,] 0.5001303 0.9997393 0.4998697
[13,] 0.4959999 0.9919998 0.5040001
[14,] 0.4467031 0.8934063 0.5532969
[15,] 0.3954012 0.7908024 0.6045988
[16,] 0.3425058 0.6850115 0.6574942
[17,] 0.3272724 0.6545448 0.6727276
[18,] 0.2547482 0.5094963 0.7452518
[19,] 0.2005989 0.4011978 0.7994011
[20,] 0.1501245 0.3002490 0.8498755
[21,] 0.1714814 0.3429629 0.8285186
[22,] 0.3931010 0.7862020 0.6068990
[23,] 0.5125950 0.9748099 0.4874050
[24,] 0.4904866 0.9809732 0.5095134
[25,] 0.4672911 0.9345823 0.5327089
[26,] 0.4162419 0.8324838 0.5837581
[27,] 0.4411549 0.8823099 0.5588451
[28,] 0.3853086 0.7706172 0.6146914
[29,] 0.4526492 0.9052984 0.5473508
[30,] 0.3745637 0.7491274 0.6254363
[31,] 0.5301421 0.9397157 0.4698579
[32,] 0.5560406 0.8879188 0.4439594
[33,] 0.5842083 0.8315834 0.4157917
[34,] 0.6233558 0.7532884 0.3766442
[35,] 0.8017527 0.3964946 0.1982473
[36,] 0.7551074 0.4897853 0.2448926
[37,] 0.6799176 0.6401647 0.3200824
[38,] 0.5796731 0.8406538 0.4203269
[39,] 0.5257881 0.9484237 0.4742119
[40,] 0.4790540 0.9581080 0.5209460
[41,] 0.3526892 0.7053785 0.6473108
[42,] 0.5351196 0.9297607 0.4648804
[43,] 0.8219344 0.3561311 0.1780656
> postscript(file="/var/www/rcomp/tmp/1w5y41292675429.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/2w5y41292675429.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/36wf71292675429.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/46wf71292675429.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/56wf71292675429.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.6666667 10.1666667 1.5000000 8.8333333 8.3333333 1.3333333
7 8 9 10 11 12
2.1666667 -3.3333333 0.3333333 6.1666667 -0.3333333 2.0000000
13 14 15 16 17 18
-6.6666667 -15.8333333 7.5000000 -5.1666667 6.3333333 -5.6666667
19 20 21 22 23 24
14.1666667 4.6666667 3.3333333 -11.8333333 -2.3333333 -6.0000000
25 26 27 28 29 30
1.3333333 11.1666667 9.5000000 -5.1666667 1.3333333 4.3333333
31 32 33 34 35 36
-2.8333333 -0.3333333 -2.6666667 0.1666667 -10.3333333 -17.0000000
37 38 39 40 41 42
12.3333333 -6.8333333 -5.5000000 4.8333333 -9.6666667 4.3333333
43 44 45 46 47 48
-11.8333333 -2.3333333 -12.6666667 -6.8333333 -4.3333333 12.0000000
49 50 51 52 53 54
9.3333333 4.1666667 -6.5000000 -0.1666667 1.3333333 -6.6666667
55 56 57 58 59 60
-1.8333333 -8.3333333 -2.6666667 6.1666667 12.6666667 1.0000000
61 62 63 64 65 66
-11.6666667 -2.8333333 -6.5000000 -3.1666667 -7.6666667 2.3333333
67 68 69 70 71 72
0.1666667 9.6666667 14.3333333 6.1666667 4.6666667 8.0000000
> postscript(file="/var/www/rcomp/tmp/6h5es1292675429.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.6666667 NA
1 10.1666667 -4.6666667
2 1.5000000 10.1666667
3 8.8333333 1.5000000
4 8.3333333 8.8333333
5 1.3333333 8.3333333
6 2.1666667 1.3333333
7 -3.3333333 2.1666667
8 0.3333333 -3.3333333
9 6.1666667 0.3333333
10 -0.3333333 6.1666667
11 2.0000000 -0.3333333
12 -6.6666667 2.0000000
13 -15.8333333 -6.6666667
14 7.5000000 -15.8333333
15 -5.1666667 7.5000000
16 6.3333333 -5.1666667
17 -5.6666667 6.3333333
18 14.1666667 -5.6666667
19 4.6666667 14.1666667
20 3.3333333 4.6666667
21 -11.8333333 3.3333333
22 -2.3333333 -11.8333333
23 -6.0000000 -2.3333333
24 1.3333333 -6.0000000
25 11.1666667 1.3333333
26 9.5000000 11.1666667
27 -5.1666667 9.5000000
28 1.3333333 -5.1666667
29 4.3333333 1.3333333
30 -2.8333333 4.3333333
31 -0.3333333 -2.8333333
32 -2.6666667 -0.3333333
33 0.1666667 -2.6666667
34 -10.3333333 0.1666667
35 -17.0000000 -10.3333333
36 12.3333333 -17.0000000
37 -6.8333333 12.3333333
38 -5.5000000 -6.8333333
39 4.8333333 -5.5000000
40 -9.6666667 4.8333333
41 4.3333333 -9.6666667
42 -11.8333333 4.3333333
43 -2.3333333 -11.8333333
44 -12.6666667 -2.3333333
45 -6.8333333 -12.6666667
46 -4.3333333 -6.8333333
47 12.0000000 -4.3333333
48 9.3333333 12.0000000
49 4.1666667 9.3333333
50 -6.5000000 4.1666667
51 -0.1666667 -6.5000000
52 1.3333333 -0.1666667
53 -6.6666667 1.3333333
54 -1.8333333 -6.6666667
55 -8.3333333 -1.8333333
56 -2.6666667 -8.3333333
57 6.1666667 -2.6666667
58 12.6666667 6.1666667
59 1.0000000 12.6666667
60 -11.6666667 1.0000000
61 -2.8333333 -11.6666667
62 -6.5000000 -2.8333333
63 -3.1666667 -6.5000000
64 -7.6666667 -3.1666667
65 2.3333333 -7.6666667
66 0.1666667 2.3333333
67 9.6666667 0.1666667
68 14.3333333 9.6666667
69 6.1666667 14.3333333
70 4.6666667 6.1666667
71 8.0000000 4.6666667
72 NA 8.0000000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 10.1666667 -4.6666667
[2,] 1.5000000 10.1666667
[3,] 8.8333333 1.5000000
[4,] 8.3333333 8.8333333
[5,] 1.3333333 8.3333333
[6,] 2.1666667 1.3333333
[7,] -3.3333333 2.1666667
[8,] 0.3333333 -3.3333333
[9,] 6.1666667 0.3333333
[10,] -0.3333333 6.1666667
[11,] 2.0000000 -0.3333333
[12,] -6.6666667 2.0000000
[13,] -15.8333333 -6.6666667
[14,] 7.5000000 -15.8333333
[15,] -5.1666667 7.5000000
[16,] 6.3333333 -5.1666667
[17,] -5.6666667 6.3333333
[18,] 14.1666667 -5.6666667
[19,] 4.6666667 14.1666667
[20,] 3.3333333 4.6666667
[21,] -11.8333333 3.3333333
[22,] -2.3333333 -11.8333333
[23,] -6.0000000 -2.3333333
[24,] 1.3333333 -6.0000000
[25,] 11.1666667 1.3333333
[26,] 9.5000000 11.1666667
[27,] -5.1666667 9.5000000
[28,] 1.3333333 -5.1666667
[29,] 4.3333333 1.3333333
[30,] -2.8333333 4.3333333
[31,] -0.3333333 -2.8333333
[32,] -2.6666667 -0.3333333
[33,] 0.1666667 -2.6666667
[34,] -10.3333333 0.1666667
[35,] -17.0000000 -10.3333333
[36,] 12.3333333 -17.0000000
[37,] -6.8333333 12.3333333
[38,] -5.5000000 -6.8333333
[39,] 4.8333333 -5.5000000
[40,] -9.6666667 4.8333333
[41,] 4.3333333 -9.6666667
[42,] -11.8333333 4.3333333
[43,] -2.3333333 -11.8333333
[44,] -12.6666667 -2.3333333
[45,] -6.8333333 -12.6666667
[46,] -4.3333333 -6.8333333
[47,] 12.0000000 -4.3333333
[48,] 9.3333333 12.0000000
[49,] 4.1666667 9.3333333
[50,] -6.5000000 4.1666667
[51,] -0.1666667 -6.5000000
[52,] 1.3333333 -0.1666667
[53,] -6.6666667 1.3333333
[54,] -1.8333333 -6.6666667
[55,] -8.3333333 -1.8333333
[56,] -2.6666667 -8.3333333
[57,] 6.1666667 -2.6666667
[58,] 12.6666667 6.1666667
[59,] 1.0000000 12.6666667
[60,] -11.6666667 1.0000000
[61,] -2.8333333 -11.6666667
[62,] -6.5000000 -2.8333333
[63,] -3.1666667 -6.5000000
[64,] -7.6666667 -3.1666667
[65,] 2.3333333 -7.6666667
[66,] 0.1666667 2.3333333
[67,] 9.6666667 0.1666667
[68,] 14.3333333 9.6666667
[69,] 6.1666667 14.3333333
[70,] 4.6666667 6.1666667
[71,] 8.0000000 4.6666667
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 10.1666667 -4.6666667
2 1.5000000 10.1666667
3 8.8333333 1.5000000
4 8.3333333 8.8333333
5 1.3333333 8.3333333
6 2.1666667 1.3333333
7 -3.3333333 2.1666667
8 0.3333333 -3.3333333
9 6.1666667 0.3333333
10 -0.3333333 6.1666667
11 2.0000000 -0.3333333
12 -6.6666667 2.0000000
13 -15.8333333 -6.6666667
14 7.5000000 -15.8333333
15 -5.1666667 7.5000000
16 6.3333333 -5.1666667
17 -5.6666667 6.3333333
18 14.1666667 -5.6666667
19 4.6666667 14.1666667
20 3.3333333 4.6666667
21 -11.8333333 3.3333333
22 -2.3333333 -11.8333333
23 -6.0000000 -2.3333333
24 1.3333333 -6.0000000
25 11.1666667 1.3333333
26 9.5000000 11.1666667
27 -5.1666667 9.5000000
28 1.3333333 -5.1666667
29 4.3333333 1.3333333
30 -2.8333333 4.3333333
31 -0.3333333 -2.8333333
32 -2.6666667 -0.3333333
33 0.1666667 -2.6666667
34 -10.3333333 0.1666667
35 -17.0000000 -10.3333333
36 12.3333333 -17.0000000
37 -6.8333333 12.3333333
38 -5.5000000 -6.8333333
39 4.8333333 -5.5000000
40 -9.6666667 4.8333333
41 4.3333333 -9.6666667
42 -11.8333333 4.3333333
43 -2.3333333 -11.8333333
44 -12.6666667 -2.3333333
45 -6.8333333 -12.6666667
46 -4.3333333 -6.8333333
47 12.0000000 -4.3333333
48 9.3333333 12.0000000
49 4.1666667 9.3333333
50 -6.5000000 4.1666667
51 -0.1666667 -6.5000000
52 1.3333333 -0.1666667
53 -6.6666667 1.3333333
54 -1.8333333 -6.6666667
55 -8.3333333 -1.8333333
56 -2.6666667 -8.3333333
57 6.1666667 -2.6666667
58 12.6666667 6.1666667
59 1.0000000 12.6666667
60 -11.6666667 1.0000000
61 -2.8333333 -11.6666667
62 -6.5000000 -2.8333333
63 -3.1666667 -6.5000000
64 -7.6666667 -3.1666667
65 2.3333333 -7.6666667
66 0.1666667 2.3333333
67 9.6666667 0.1666667
68 14.3333333 9.6666667
69 6.1666667 14.3333333
70 4.6666667 6.1666667
71 8.0000000 4.6666667
> 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/7sxev1292675429.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/8sxev1292675429.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/93odg1292675429.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')
hat values (leverages) are all = 0.1666667
and there are no factor predictors; no plot no. 5
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10dfcj1292675429.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/1166t41292675429.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/12rpas1292675429.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/13gqp41292675429.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/14rz7p1292675429.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/15uinc1292675429.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/16qr331292675429.tab")
+ }
>
> try(system("convert tmp/1w5y41292675429.ps tmp/1w5y41292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/2w5y41292675429.ps tmp/2w5y41292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/36wf71292675429.ps tmp/36wf71292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/46wf71292675429.ps tmp/46wf71292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/56wf71292675429.ps tmp/56wf71292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/6h5es1292675429.ps tmp/6h5es1292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/7sxev1292675429.ps tmp/7sxev1292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/8sxev1292675429.ps tmp/8sxev1292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/93odg1292675429.ps tmp/93odg1292675429.png",intern=TRUE))
character(0)
> try(system("convert tmp/10dfcj1292675429.ps tmp/10dfcj1292675429.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.220 1.700 4.976