R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(91.2,0,99.2,0,108.2,0,101.5,0,106.9,0,104.4,0,77.9,0,60,0,99.5,0,95,0,105.6,0,102.5,0,93.3,0,97.3,0,127,0,111.7,0,96.4,0,133,0,72.2,0,95.8,0,124.1,0,127.6,0,110.7,0,104.6,0,112.7,0,115.3,0,139.4,0,119,0,97.4,0,154,0,81.5,0,88.8,0,127.7,1,105.1,1,114.9,1,106.4,1,104.5,1,121.6,1,141.4,1,99,1,126.7,1,134.1,1,81.3,1,88.6,1,132.7,1,132.9,1,134.4,1,103.7,1,119.7,1,115,1,132.9,1,108.5,1,113.9,1,142,1,97.7,1,92.2,1,128.8,1,134.9,1,128.2,1,114.8,1),dim=c(2,60),dimnames=list(c('Transportmiddelen','Conjunctuur'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Transportmiddelen','Conjunctuur'),1:60))
> 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
Transportmiddelen Conjunctuur M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 91.2 0 1 0 0 0 0 0 0 0 0 0 0 1
2 99.2 0 0 1 0 0 0 0 0 0 0 0 0 2
3 108.2 0 0 0 1 0 0 0 0 0 0 0 0 3
4 101.5 0 0 0 0 1 0 0 0 0 0 0 0 4
5 106.9 0 0 0 0 0 1 0 0 0 0 0 0 5
6 104.4 0 0 0 0 0 0 1 0 0 0 0 0 6
7 77.9 0 0 0 0 0 0 0 1 0 0 0 0 7
8 60.0 0 0 0 0 0 0 0 0 1 0 0 0 8
9 99.5 0 0 0 0 0 0 0 0 0 1 0 0 9
10 95.0 0 0 0 0 0 0 0 0 0 0 1 0 10
11 105.6 0 0 0 0 0 0 0 0 0 0 0 1 11
12 102.5 0 0 0 0 0 0 0 0 0 0 0 0 12
13 93.3 0 1 0 0 0 0 0 0 0 0 0 0 13
14 97.3 0 0 1 0 0 0 0 0 0 0 0 0 14
15 127.0 0 0 0 1 0 0 0 0 0 0 0 0 15
16 111.7 0 0 0 0 1 0 0 0 0 0 0 0 16
17 96.4 0 0 0 0 0 1 0 0 0 0 0 0 17
18 133.0 0 0 0 0 0 0 1 0 0 0 0 0 18
19 72.2 0 0 0 0 0 0 0 1 0 0 0 0 19
20 95.8 0 0 0 0 0 0 0 0 1 0 0 0 20
21 124.1 0 0 0 0 0 0 0 0 0 1 0 0 21
22 127.6 0 0 0 0 0 0 0 0 0 0 1 0 22
23 110.7 0 0 0 0 0 0 0 0 0 0 0 1 23
24 104.6 0 0 0 0 0 0 0 0 0 0 0 0 24
25 112.7 0 1 0 0 0 0 0 0 0 0 0 0 25
26 115.3 0 0 1 0 0 0 0 0 0 0 0 0 26
27 139.4 0 0 0 1 0 0 0 0 0 0 0 0 27
28 119.0 0 0 0 0 1 0 0 0 0 0 0 0 28
29 97.4 0 0 0 0 0 1 0 0 0 0 0 0 29
30 154.0 0 0 0 0 0 0 1 0 0 0 0 0 30
31 81.5 0 0 0 0 0 0 0 1 0 0 0 0 31
32 88.8 0 0 0 0 0 0 0 0 1 0 0 0 32
33 127.7 1 0 0 0 0 0 0 0 0 1 0 0 33
34 105.1 1 0 0 0 0 0 0 0 0 0 1 0 34
35 114.9 1 0 0 0 0 0 0 0 0 0 0 1 35
36 106.4 1 0 0 0 0 0 0 0 0 0 0 0 36
37 104.5 1 1 0 0 0 0 0 0 0 0 0 0 37
38 121.6 1 0 1 0 0 0 0 0 0 0 0 0 38
39 141.4 1 0 0 1 0 0 0 0 0 0 0 0 39
40 99.0 1 0 0 0 1 0 0 0 0 0 0 0 40
41 126.7 1 0 0 0 0 1 0 0 0 0 0 0 41
42 134.1 1 0 0 0 0 0 1 0 0 0 0 0 42
43 81.3 1 0 0 0 0 0 0 1 0 0 0 0 43
44 88.6 1 0 0 0 0 0 0 0 1 0 0 0 44
45 132.7 1 0 0 0 0 0 0 0 0 1 0 0 45
46 132.9 1 0 0 0 0 0 0 0 0 0 1 0 46
47 134.4 1 0 0 0 0 0 0 0 0 0 0 1 47
48 103.7 1 0 0 0 0 0 0 0 0 0 0 0 48
49 119.7 1 1 0 0 0 0 0 0 0 0 0 0 49
50 115.0 1 0 1 0 0 0 0 0 0 0 0 0 50
51 132.9 1 0 0 1 0 0 0 0 0 0 0 0 51
52 108.5 1 0 0 0 1 0 0 0 0 0 0 0 52
53 113.9 1 0 0 0 0 1 0 0 0 0 0 0 53
54 142.0 1 0 0 0 0 0 1 0 0 0 0 0 54
55 97.7 1 0 0 0 0 0 0 1 0 0 0 0 55
56 92.2 1 0 0 0 0 0 0 0 1 0 0 0 56
57 128.8 1 0 0 0 0 0 0 0 0 1 0 0 57
58 134.9 1 0 0 0 0 0 0 0 0 0 1 0 58
59 128.2 1 0 0 0 0 0 0 0 0 0 0 1 59
60 114.8 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Conjunctuur M1 M2 M3 M4
86.858 -10.089 3.683 8.372 27.761 5.210
M5 M6 M7 M8 M9 M10
4.819 29.348 -22.743 -20.494 18.293 14.122
M11 t
13.071 0.711
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-16.07222 -5.88847 0.06167 5.87986 16.46444
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 86.8583 5.0166 17.314 < 2e-16 ***
Conjunctuur -10.0889 4.8273 -2.090 0.042176 *
M1 3.6829 5.8544 0.629 0.532406
M2 8.3719 5.8395 1.434 0.158425
M3 27.7610 5.8278 4.764 1.93e-05 ***
M4 5.2100 5.8195 0.895 0.375304
M5 4.8190 5.8145 0.829 0.411498
M6 29.3481 5.8128 5.049 7.46e-06 ***
M7 -22.7429 5.8145 -3.911 0.000300 ***
M8 -20.4939 5.8195 -3.522 0.000981 ***
M9 18.2929 5.8078 3.150 0.002870 **
M10 14.1219 5.7994 2.435 0.018826 *
M11 13.0710 5.7944 2.256 0.028882 *
t 0.7110 0.1394 5.102 6.24e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9.159 on 46 degrees of freedom
Multiple R-squared: 0.8197, Adjusted R-squared: 0.7687
F-statistic: 16.08 on 13 and 46 DF, p-value: 6.003e-13
> 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.6805080 0.6389839 0.31949196
[2,] 0.8426476 0.3147048 0.15735241
[3,] 0.8196504 0.3606992 0.18034958
[4,] 0.9376618 0.1246764 0.06233822
[5,] 0.9205782 0.1588435 0.07942175
[6,] 0.9307141 0.1385719 0.06928595
[7,] 0.9122170 0.1755660 0.08778301
[8,] 0.8761630 0.2476741 0.12383703
[9,] 0.8144147 0.3711705 0.18558526
[10,] 0.7381961 0.5236078 0.26180390
[11,] 0.6523732 0.6952535 0.34762676
[12,] 0.6606767 0.6786466 0.33932330
[13,] 0.8399937 0.3200125 0.16000627
[14,] 0.9100750 0.1798499 0.08992497
[15,] 0.8807070 0.2385859 0.11929296
[16,] 0.8248673 0.3502654 0.17513270
[17,] 0.7608009 0.4783983 0.23919913
[18,] 0.9044188 0.1911625 0.09558124
[19,] 0.9047808 0.1904383 0.09521916
[20,] 0.8472456 0.3055088 0.15275439
[21,] 0.8508284 0.2983432 0.14917161
[22,] 0.8111018 0.3777964 0.18889820
[23,] 0.7903156 0.4193687 0.20968436
[24,] 0.7756688 0.4486623 0.22433116
[25,] 0.8643215 0.2713569 0.13567847
[26,] 0.7661072 0.4677856 0.23389278
[27,] 0.8180920 0.3638159 0.18190795
> postscript(file="/var/www/html/rcomp/tmp/1yp211229094301.ps",horizontal=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/27mgh1229094301.ps",horizontal=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/3laqx1229094301.ps",horizontal=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/4ellr1229094301.ps",horizontal=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/5z9q51229094301.ps",horizontal=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 = 60
Frequency = 1
1 2 3 4 5 6
-0.05222222 2.54777778 -8.55222222 6.58777778 11.66777778 -16.07222222
7 8 9 10 11 12
8.80777778 -12.05222222 -12.05000000 -13.09000000 -2.15000000 7.11000000
13 14 15 16 17 18
-6.48388889 -7.88388889 1.71611111 8.25611111 -7.36388889 3.99611111
19 20 21 22 23 24
-5.42388889 15.21611111 4.01833333 10.97833333 -5.58166667 0.67833333
25 26 27 28 29 30
4.38444444 1.58444444 5.58444444 7.02444444 -14.89555556 16.46444444
31 32 33 34 35 36
-4.65555556 -0.31555556 9.17555556 -9.96444444 0.17555556 4.03555556
37 38 39 40 41 42
-2.25833333 9.44166667 9.14166667 -11.41833333 15.96166667 -1.87833333
43 44 45 46 47 48
-3.29833333 1.04166667 5.64388889 9.30388889 11.14388889 -7.19611111
49 50 51 52 53 54
4.41000000 -5.69000000 -7.89000000 -10.45000000 -5.37000000 -2.51000000
55 56 57 58 59 60
4.57000000 -3.89000000 -6.78777778 2.77222222 -3.58777778 -4.62777778
> postscript(file="/var/www/html/rcomp/tmp/6d4pz1229094301.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.05222222 NA
1 2.54777778 -0.05222222
2 -8.55222222 2.54777778
3 6.58777778 -8.55222222
4 11.66777778 6.58777778
5 -16.07222222 11.66777778
6 8.80777778 -16.07222222
7 -12.05222222 8.80777778
8 -12.05000000 -12.05222222
9 -13.09000000 -12.05000000
10 -2.15000000 -13.09000000
11 7.11000000 -2.15000000
12 -6.48388889 7.11000000
13 -7.88388889 -6.48388889
14 1.71611111 -7.88388889
15 8.25611111 1.71611111
16 -7.36388889 8.25611111
17 3.99611111 -7.36388889
18 -5.42388889 3.99611111
19 15.21611111 -5.42388889
20 4.01833333 15.21611111
21 10.97833333 4.01833333
22 -5.58166667 10.97833333
23 0.67833333 -5.58166667
24 4.38444444 0.67833333
25 1.58444444 4.38444444
26 5.58444444 1.58444444
27 7.02444444 5.58444444
28 -14.89555556 7.02444444
29 16.46444444 -14.89555556
30 -4.65555556 16.46444444
31 -0.31555556 -4.65555556
32 9.17555556 -0.31555556
33 -9.96444444 9.17555556
34 0.17555556 -9.96444444
35 4.03555556 0.17555556
36 -2.25833333 4.03555556
37 9.44166667 -2.25833333
38 9.14166667 9.44166667
39 -11.41833333 9.14166667
40 15.96166667 -11.41833333
41 -1.87833333 15.96166667
42 -3.29833333 -1.87833333
43 1.04166667 -3.29833333
44 5.64388889 1.04166667
45 9.30388889 5.64388889
46 11.14388889 9.30388889
47 -7.19611111 11.14388889
48 4.41000000 -7.19611111
49 -5.69000000 4.41000000
50 -7.89000000 -5.69000000
51 -10.45000000 -7.89000000
52 -5.37000000 -10.45000000
53 -2.51000000 -5.37000000
54 4.57000000 -2.51000000
55 -3.89000000 4.57000000
56 -6.78777778 -3.89000000
57 2.77222222 -6.78777778
58 -3.58777778 2.77222222
59 -4.62777778 -3.58777778
60 NA -4.62777778
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.5477778 -0.05222222
[2,] -8.5522222 2.54777778
[3,] 6.5877778 -8.55222222
[4,] 11.6677778 6.58777778
[5,] -16.0722222 11.66777778
[6,] 8.8077778 -16.07222222
[7,] -12.0522222 8.80777778
[8,] -12.0500000 -12.05222222
[9,] -13.0900000 -12.05000000
[10,] -2.1500000 -13.09000000
[11,] 7.1100000 -2.15000000
[12,] -6.4838889 7.11000000
[13,] -7.8838889 -6.48388889
[14,] 1.7161111 -7.88388889
[15,] 8.2561111 1.71611111
[16,] -7.3638889 8.25611111
[17,] 3.9961111 -7.36388889
[18,] -5.4238889 3.99611111
[19,] 15.2161111 -5.42388889
[20,] 4.0183333 15.21611111
[21,] 10.9783333 4.01833333
[22,] -5.5816667 10.97833333
[23,] 0.6783333 -5.58166667
[24,] 4.3844444 0.67833333
[25,] 1.5844444 4.38444444
[26,] 5.5844444 1.58444444
[27,] 7.0244444 5.58444444
[28,] -14.8955556 7.02444444
[29,] 16.4644444 -14.89555556
[30,] -4.6555556 16.46444444
[31,] -0.3155556 -4.65555556
[32,] 9.1755556 -0.31555556
[33,] -9.9644444 9.17555556
[34,] 0.1755556 -9.96444444
[35,] 4.0355556 0.17555556
[36,] -2.2583333 4.03555556
[37,] 9.4416667 -2.25833333
[38,] 9.1416667 9.44166667
[39,] -11.4183333 9.14166667
[40,] 15.9616667 -11.41833333
[41,] -1.8783333 15.96166667
[42,] -3.2983333 -1.87833333
[43,] 1.0416667 -3.29833333
[44,] 5.6438889 1.04166667
[45,] 9.3038889 5.64388889
[46,] 11.1438889 9.30388889
[47,] -7.1961111 11.14388889
[48,] 4.4100000 -7.19611111
[49,] -5.6900000 4.41000000
[50,] -7.8900000 -5.69000000
[51,] -10.4500000 -7.89000000
[52,] -5.3700000 -10.45000000
[53,] -2.5100000 -5.37000000
[54,] 4.5700000 -2.51000000
[55,] -3.8900000 4.57000000
[56,] -6.7877778 -3.89000000
[57,] 2.7722222 -6.78777778
[58,] -3.5877778 2.77222222
[59,] -4.6277778 -3.58777778
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.5477778 -0.05222222
2 -8.5522222 2.54777778
3 6.5877778 -8.55222222
4 11.6677778 6.58777778
5 -16.0722222 11.66777778
6 8.8077778 -16.07222222
7 -12.0522222 8.80777778
8 -12.0500000 -12.05222222
9 -13.0900000 -12.05000000
10 -2.1500000 -13.09000000
11 7.1100000 -2.15000000
12 -6.4838889 7.11000000
13 -7.8838889 -6.48388889
14 1.7161111 -7.88388889
15 8.2561111 1.71611111
16 -7.3638889 8.25611111
17 3.9961111 -7.36388889
18 -5.4238889 3.99611111
19 15.2161111 -5.42388889
20 4.0183333 15.21611111
21 10.9783333 4.01833333
22 -5.5816667 10.97833333
23 0.6783333 -5.58166667
24 4.3844444 0.67833333
25 1.5844444 4.38444444
26 5.5844444 1.58444444
27 7.0244444 5.58444444
28 -14.8955556 7.02444444
29 16.4644444 -14.89555556
30 -4.6555556 16.46444444
31 -0.3155556 -4.65555556
32 9.1755556 -0.31555556
33 -9.9644444 9.17555556
34 0.1755556 -9.96444444
35 4.0355556 0.17555556
36 -2.2583333 4.03555556
37 9.4416667 -2.25833333
38 9.1416667 9.44166667
39 -11.4183333 9.14166667
40 15.9616667 -11.41833333
41 -1.8783333 15.96166667
42 -3.2983333 -1.87833333
43 1.0416667 -3.29833333
44 5.6438889 1.04166667
45 9.3038889 5.64388889
46 11.1438889 9.30388889
47 -7.1961111 11.14388889
48 4.4100000 -7.19611111
49 -5.6900000 4.41000000
50 -7.8900000 -5.69000000
51 -10.4500000 -7.89000000
52 -5.3700000 -10.45000000
53 -2.5100000 -5.37000000
54 4.5700000 -2.51000000
55 -3.8900000 4.57000000
56 -6.7877778 -3.89000000
57 2.7722222 -6.78777778
58 -3.5877778 2.77222222
59 -4.6277778 -3.58777778
> 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/7w0g51229094301.ps",horizontal=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/8kedk1229094301.ps",horizontal=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/9v77h1229094301.ps",horizontal=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/10xglv1229094301.ps",horizontal=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/11p3si1229094302.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/12yqvb1229094302.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/13oenk1229094302.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/14mv2h1229094302.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/15cqra1229094302.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/16h3yy1229094302.tab")
+ }
>
> system("convert tmp/1yp211229094301.ps tmp/1yp211229094301.png")
> system("convert tmp/27mgh1229094301.ps tmp/27mgh1229094301.png")
> system("convert tmp/3laqx1229094301.ps tmp/3laqx1229094301.png")
> system("convert tmp/4ellr1229094301.ps tmp/4ellr1229094301.png")
> system("convert tmp/5z9q51229094301.ps tmp/5z9q51229094301.png")
> system("convert tmp/6d4pz1229094301.ps tmp/6d4pz1229094301.png")
> system("convert tmp/7w0g51229094301.ps tmp/7w0g51229094301.png")
> system("convert tmp/8kedk1229094301.ps tmp/8kedk1229094301.png")
> system("convert tmp/9v77h1229094301.ps tmp/9v77h1229094301.png")
> system("convert tmp/10xglv1229094301.ps tmp/10xglv1229094301.png")
>
>
> proc.time()
user system elapsed
2.496 1.668 5.529