R version 2.12.1 (2010-12-16)
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(235.1,46,280.7,62,264.6,66,240.7,59,201.4,58,240.8,61,241.1,41,223.8,27,206.1,58,174.7,70,203.3,49,220.5,59,299.5,44,347.4,36,338.3,72,327.7,45,351.6,56,396.6,54,438.8,53,395.6,35,363.5,61,378.8,52,357,47,369,51,464.8,52,479.1,63,431.3,74,366.5,45,326.3,51,355.1,64,331.6,36,261.3,30,249,55,205.5,64,235.6,39,240.9,40,264.9,63,253.8,45,232.3,59,193.8,55,177,40,213.2,64,207.2,27,180.6,28,188.6,45,175.4,57,199,45,179.6,69,225.8,60,234,56,200.2,58,183.6,50,178.2,51,203.2,53,208.5,37,191.8,22,172.8,55,148,70,159.4,62,154.5,58,213.2,39,196.4,49,182.8,58,176.4,47,153.6,42,173.2,62,171,39,151.2,40,161.9,72,157.2,70,201.7,54,236.4,65),dim=c(2,72),dimnames=list(c('werkloosheid','faillissementen'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('werkloosheid','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 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
werkloosheid faillissementen
1 235.1 46
2 280.7 62
3 264.6 66
4 240.7 59
5 201.4 58
6 240.8 61
7 241.1 41
8 223.8 27
9 206.1 58
10 174.7 70
11 203.3 49
12 220.5 59
13 299.5 44
14 347.4 36
15 338.3 72
16 327.7 45
17 351.6 56
18 396.6 54
19 438.8 53
20 395.6 35
21 363.5 61
22 378.8 52
23 357.0 47
24 369.0 51
25 464.8 52
26 479.1 63
27 431.3 74
28 366.5 45
29 326.3 51
30 355.1 64
31 331.6 36
32 261.3 30
33 249.0 55
34 205.5 64
35 235.6 39
36 240.9 40
37 264.9 63
38 253.8 45
39 232.3 59
40 193.8 55
41 177.0 40
42 213.2 64
43 207.2 27
44 180.6 28
45 188.6 45
46 175.4 57
47 199.0 45
48 179.6 69
49 225.8 60
50 234.0 56
51 200.2 58
52 183.6 50
53 178.2 51
54 203.2 53
55 208.5 37
56 191.8 22
57 172.8 55
58 148.0 70
59 159.4 62
60 154.5 58
61 213.2 39
62 196.4 49
63 182.8 58
64 176.4 47
65 153.6 42
66 173.2 62
67 171.0 39
68 151.2 40
69 161.9 72
70 157.2 70
71 201.7 54
72 236.4 65
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) faillissementen
237.5707 0.2242
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-105.27 -63.73 -27.76 58.37 227.40
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 237.5707 44.6277 5.323 1.17e-06 ***
faillissementen 0.2242 0.8369 0.268 0.79
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 85.13 on 70 degrees of freedom
Multiple R-squared: 0.001025, Adjusted R-squared: -0.01325
F-statistic: 0.07179 on 1 and 70 DF, p-value: 0.7895
> 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.0551275821 1.102552e-01 9.448724e-01
[2,] 0.0161341527 3.226831e-02 9.838658e-01
[3,] 0.0052415345 1.048307e-02 9.947585e-01
[4,] 0.0013110614 2.622123e-03 9.986889e-01
[5,] 0.0009275708 1.855142e-03 9.990724e-01
[6,] 0.0023627169 4.725434e-03 9.976373e-01
[7,] 0.0010713650 2.142730e-03 9.989286e-01
[8,] 0.0003545529 7.091057e-04 9.996454e-01
[9,] 0.0007157268 1.431454e-03 9.992843e-01
[10,] 0.0033289356 6.657871e-03 9.966711e-01
[11,] 0.0121591851 2.431837e-02 9.878408e-01
[12,] 0.0132744364 2.654887e-02 9.867256e-01
[13,] 0.0223900932 4.478019e-02 9.776099e-01
[14,] 0.0685303981 1.370608e-01 9.314696e-01
[15,] 0.2413413076 4.826826e-01 7.586587e-01
[16,] 0.3128284211 6.256568e-01 6.871716e-01
[17,] 0.3440636974 6.881274e-01 6.559363e-01
[18,] 0.3978304048 7.956608e-01 6.021696e-01
[19,] 0.4057400501 8.114801e-01 5.942599e-01
[20,] 0.4447817627 8.895635e-01 5.552182e-01
[21,] 0.7902132031 4.195736e-01 2.097868e-01
[22,] 0.9825915840 3.481683e-02 1.740842e-02
[23,] 0.9991595602 1.680880e-03 8.404398e-04
[24,] 0.9998653960 2.692081e-04 1.346040e-04
[25,] 0.9999579967 8.400668e-05 4.200334e-05
[26,] 0.9999992169 1.566102e-06 7.830510e-07
[27,] 0.9999999790 4.193717e-08 2.096858e-08
[28,] 0.9999999862 2.759621e-08 1.379810e-08
[29,] 0.9999999913 1.739032e-08 8.695158e-09
[30,] 0.9999999891 2.173450e-08 1.086725e-08
[31,] 0.9999999880 2.402824e-08 1.201412e-08
[32,] 0.9999999895 2.102701e-08 1.051350e-08
[33,] 0.9999999985 3.022181e-09 1.511091e-09
[34,] 0.9999999997 6.754433e-10 3.377217e-10
[35,] 0.9999999998 3.620963e-10 1.810481e-10
[36,] 0.9999999997 6.670089e-10 3.335045e-10
[37,] 0.9999999994 1.114668e-09 5.573339e-10
[38,] 0.9999999993 1.399642e-09 6.998211e-10
[39,] 0.9999999983 3.361708e-09 1.680854e-09
[40,] 0.9999999961 7.805525e-09 3.902763e-09
[41,] 0.9999999902 1.950039e-08 9.750196e-09
[42,] 0.9999999802 3.968195e-08 1.984097e-08
[43,] 0.9999999496 1.007166e-07 5.035828e-08
[44,] 0.9999998897 2.206770e-07 1.103385e-07
[45,] 0.9999999031 1.937998e-07 9.689991e-08
[46,] 0.9999999608 7.844997e-08 3.922498e-08
[47,] 0.9999999182 1.636304e-07 8.181518e-08
[48,] 0.9999997534 4.932016e-07 2.466008e-07
[49,] 0.9999992720 1.455952e-06 7.279760e-07
[50,] 0.9999984845 3.030964e-06 1.515482e-06
[51,] 0.9999967196 6.560876e-06 3.280438e-06
[52,] 0.9999893702 2.125967e-05 1.062983e-05
[53,] 0.9999694587 6.108260e-05 3.054130e-05
[54,] 0.9999484346 1.031308e-04 5.156540e-05
[55,] 0.9998814767 2.370466e-04 1.185233e-04
[56,] 0.9997706805 4.586390e-04 2.293195e-04
[57,] 0.9996876891 6.246218e-04 3.123109e-04
[58,] 0.9992309752 1.538050e-03 7.690248e-04
[59,] 0.9975474929 4.905014e-03 2.452507e-03
[60,] 0.9925788565 1.484229e-02 7.421143e-03
[61,] 0.9811237586 3.775248e-02 1.887624e-02
[62,] 0.9492159812 1.015680e-01 5.078402e-02
[63,] 0.8701300577 2.597399e-01 1.298699e-01
> postscript(file="/var/www/rcomp/tmp/12b4l1323436561.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/273t71323436561.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/3at211323436561.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/4nkr01323436561.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/5ikzo1323436561.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.786078 29.225953 12.228961 -10.101302 -49.177054 -10.449798
7 8 9 10 11 12
-5.664837 -19.825364 -44.477054 -78.568031 -45.258822 -30.301302
13 14 15 16 17 18
52.062419 101.756403 84.583473 80.038171 101.471442 146.919938
19 20 21 22 23 24
189.344186 150.180651 112.250202 129.568434 108.889674 119.992682
25 26 27 28 29 30
215.568434 227.401705 177.134977 118.838171 77.292682 103.177457
31 32 33 34 35 36
85.956403 17.001891 -0.904310 -46.422543 -10.716341 -5.640589
37 38 39 40 41 42
13.201705 6.138171 -18.501302 -56.104310 -69.540589 -38.722543
43 44 45 46 47 48
-36.425364 -63.249612 -59.061829 -74.952806 -48.661829 -73.443783
49 50 51 52 53 54
-25.225550 -16.128558 -50.377054 -65.183070 -70.807318 -46.255814
55 56 57 58 59 60
-37.367845 -50.704124 -77.104310 -105.268031 -92.074047 -96.077054
61 62 63 64 65 66
-33.116341 -52.158822 -67.777054 -71.710326 -93.389085 -78.274047
67 68 69 70 71 72
-75.316341 -95.340589 -91.816527 -96.068031 -47.980062 -15.746791
> postscript(file="/var/www/rcomp/tmp/6qch61323436561.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.786078 NA
1 29.225953 -12.786078
2 12.228961 29.225953
3 -10.101302 12.228961
4 -49.177054 -10.101302
5 -10.449798 -49.177054
6 -5.664837 -10.449798
7 -19.825364 -5.664837
8 -44.477054 -19.825364
9 -78.568031 -44.477054
10 -45.258822 -78.568031
11 -30.301302 -45.258822
12 52.062419 -30.301302
13 101.756403 52.062419
14 84.583473 101.756403
15 80.038171 84.583473
16 101.471442 80.038171
17 146.919938 101.471442
18 189.344186 146.919938
19 150.180651 189.344186
20 112.250202 150.180651
21 129.568434 112.250202
22 108.889674 129.568434
23 119.992682 108.889674
24 215.568434 119.992682
25 227.401705 215.568434
26 177.134977 227.401705
27 118.838171 177.134977
28 77.292682 118.838171
29 103.177457 77.292682
30 85.956403 103.177457
31 17.001891 85.956403
32 -0.904310 17.001891
33 -46.422543 -0.904310
34 -10.716341 -46.422543
35 -5.640589 -10.716341
36 13.201705 -5.640589
37 6.138171 13.201705
38 -18.501302 6.138171
39 -56.104310 -18.501302
40 -69.540589 -56.104310
41 -38.722543 -69.540589
42 -36.425364 -38.722543
43 -63.249612 -36.425364
44 -59.061829 -63.249612
45 -74.952806 -59.061829
46 -48.661829 -74.952806
47 -73.443783 -48.661829
48 -25.225550 -73.443783
49 -16.128558 -25.225550
50 -50.377054 -16.128558
51 -65.183070 -50.377054
52 -70.807318 -65.183070
53 -46.255814 -70.807318
54 -37.367845 -46.255814
55 -50.704124 -37.367845
56 -77.104310 -50.704124
57 -105.268031 -77.104310
58 -92.074047 -105.268031
59 -96.077054 -92.074047
60 -33.116341 -96.077054
61 -52.158822 -33.116341
62 -67.777054 -52.158822
63 -71.710326 -67.777054
64 -93.389085 -71.710326
65 -78.274047 -93.389085
66 -75.316341 -78.274047
67 -95.340589 -75.316341
68 -91.816527 -95.340589
69 -96.068031 -91.816527
70 -47.980062 -96.068031
71 -15.746791 -47.980062
72 NA -15.746791
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 29.225953 -12.786078
[2,] 12.228961 29.225953
[3,] -10.101302 12.228961
[4,] -49.177054 -10.101302
[5,] -10.449798 -49.177054
[6,] -5.664837 -10.449798
[7,] -19.825364 -5.664837
[8,] -44.477054 -19.825364
[9,] -78.568031 -44.477054
[10,] -45.258822 -78.568031
[11,] -30.301302 -45.258822
[12,] 52.062419 -30.301302
[13,] 101.756403 52.062419
[14,] 84.583473 101.756403
[15,] 80.038171 84.583473
[16,] 101.471442 80.038171
[17,] 146.919938 101.471442
[18,] 189.344186 146.919938
[19,] 150.180651 189.344186
[20,] 112.250202 150.180651
[21,] 129.568434 112.250202
[22,] 108.889674 129.568434
[23,] 119.992682 108.889674
[24,] 215.568434 119.992682
[25,] 227.401705 215.568434
[26,] 177.134977 227.401705
[27,] 118.838171 177.134977
[28,] 77.292682 118.838171
[29,] 103.177457 77.292682
[30,] 85.956403 103.177457
[31,] 17.001891 85.956403
[32,] -0.904310 17.001891
[33,] -46.422543 -0.904310
[34,] -10.716341 -46.422543
[35,] -5.640589 -10.716341
[36,] 13.201705 -5.640589
[37,] 6.138171 13.201705
[38,] -18.501302 6.138171
[39,] -56.104310 -18.501302
[40,] -69.540589 -56.104310
[41,] -38.722543 -69.540589
[42,] -36.425364 -38.722543
[43,] -63.249612 -36.425364
[44,] -59.061829 -63.249612
[45,] -74.952806 -59.061829
[46,] -48.661829 -74.952806
[47,] -73.443783 -48.661829
[48,] -25.225550 -73.443783
[49,] -16.128558 -25.225550
[50,] -50.377054 -16.128558
[51,] -65.183070 -50.377054
[52,] -70.807318 -65.183070
[53,] -46.255814 -70.807318
[54,] -37.367845 -46.255814
[55,] -50.704124 -37.367845
[56,] -77.104310 -50.704124
[57,] -105.268031 -77.104310
[58,] -92.074047 -105.268031
[59,] -96.077054 -92.074047
[60,] -33.116341 -96.077054
[61,] -52.158822 -33.116341
[62,] -67.777054 -52.158822
[63,] -71.710326 -67.777054
[64,] -93.389085 -71.710326
[65,] -78.274047 -93.389085
[66,] -75.316341 -78.274047
[67,] -95.340589 -75.316341
[68,] -91.816527 -95.340589
[69,] -96.068031 -91.816527
[70,] -47.980062 -96.068031
[71,] -15.746791 -47.980062
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 29.225953 -12.786078
2 12.228961 29.225953
3 -10.101302 12.228961
4 -49.177054 -10.101302
5 -10.449798 -49.177054
6 -5.664837 -10.449798
7 -19.825364 -5.664837
8 -44.477054 -19.825364
9 -78.568031 -44.477054
10 -45.258822 -78.568031
11 -30.301302 -45.258822
12 52.062419 -30.301302
13 101.756403 52.062419
14 84.583473 101.756403
15 80.038171 84.583473
16 101.471442 80.038171
17 146.919938 101.471442
18 189.344186 146.919938
19 150.180651 189.344186
20 112.250202 150.180651
21 129.568434 112.250202
22 108.889674 129.568434
23 119.992682 108.889674
24 215.568434 119.992682
25 227.401705 215.568434
26 177.134977 227.401705
27 118.838171 177.134977
28 77.292682 118.838171
29 103.177457 77.292682
30 85.956403 103.177457
31 17.001891 85.956403
32 -0.904310 17.001891
33 -46.422543 -0.904310
34 -10.716341 -46.422543
35 -5.640589 -10.716341
36 13.201705 -5.640589
37 6.138171 13.201705
38 -18.501302 6.138171
39 -56.104310 -18.501302
40 -69.540589 -56.104310
41 -38.722543 -69.540589
42 -36.425364 -38.722543
43 -63.249612 -36.425364
44 -59.061829 -63.249612
45 -74.952806 -59.061829
46 -48.661829 -74.952806
47 -73.443783 -48.661829
48 -25.225550 -73.443783
49 -16.128558 -25.225550
50 -50.377054 -16.128558
51 -65.183070 -50.377054
52 -70.807318 -65.183070
53 -46.255814 -70.807318
54 -37.367845 -46.255814
55 -50.704124 -37.367845
56 -77.104310 -50.704124
57 -105.268031 -77.104310
58 -92.074047 -105.268031
59 -96.077054 -92.074047
60 -33.116341 -96.077054
61 -52.158822 -33.116341
62 -67.777054 -52.158822
63 -71.710326 -67.777054
64 -93.389085 -71.710326
65 -78.274047 -93.389085
66 -75.316341 -78.274047
67 -95.340589 -75.316341
68 -91.816527 -95.340589
69 -96.068031 -91.816527
70 -47.980062 -96.068031
71 -15.746791 -47.980062
> 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/7ujvv1323436562.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/85ln71323436562.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/9wrs41323436562.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/10vmc51323436562.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/11fe731323436562.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/12zy3i1323436562.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/13j3791323436562.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/14foga1323436562.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/158b6d1323436562.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/16xtlu1323436562.tab")
+ }
>
> try(system("convert tmp/12b4l1323436561.ps tmp/12b4l1323436561.png",intern=TRUE))
character(0)
> try(system("convert tmp/273t71323436561.ps tmp/273t71323436561.png",intern=TRUE))
character(0)
> try(system("convert tmp/3at211323436561.ps tmp/3at211323436561.png",intern=TRUE))
character(0)
> try(system("convert tmp/4nkr01323436561.ps tmp/4nkr01323436561.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ikzo1323436561.ps tmp/5ikzo1323436561.png",intern=TRUE))
character(0)
> try(system("convert tmp/6qch61323436561.ps tmp/6qch61323436561.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ujvv1323436562.ps tmp/7ujvv1323436562.png",intern=TRUE))
character(0)
> try(system("convert tmp/85ln71323436562.ps tmp/85ln71323436562.png",intern=TRUE))
character(0)
> try(system("convert tmp/9wrs41323436562.ps tmp/9wrs41323436562.png",intern=TRUE))
character(0)
> try(system("convert tmp/10vmc51323436562.ps tmp/10vmc51323436562.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.920 0.664 4.837