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(104.2,97.4,103.2,97,112.7,105.4,106.4,102.7,102.6,98.1,110.6,104.5,95.2,87.4,89,89.9,112.5,109.8,116.8,111.7,107.2,98.6,113.6,96.9,101.8,95.1,102.6,97,122.7,112.7,110.3,102.9,110.5,97.4,121.6,111.4,100.3,87.4,100.7,96.8,123.4,114.1,127.1,110.3,124.1,103.9,131.2,101.6,111.6,94.6,114.2,95.9,130.1,104.7,125.9,102.8,119,98.1,133.8,113.9,107.5,80.9,113.5,95.7,134.4,113.2,126.8,105.9,135.6,108.8,139.9,102.3,129.8,99,131,100.7,153.1,115.5,134.1,100.7,144.1,109.9,155.9,114.6,123.3,85.4,128.1,100.5,144.3,114.8,153,116.5,149.9,112.9,150.9,102,141,106,138.9,105.3,157.4,118.8,142.9,106.1,151.7,109.3,161,117.2,138.5,92.5,135.9,104.2,151.5,112.5,164,122.4,159.1,113.3,157,100,142.1,110.7,144.8,112.8,152.1,109.8,154.9,117.3,148.4,109.1,157.3,115.9,145.7,96,133.8,99.8,156.8,116.8),dim=c(2,69),dimnames=list(c('Omzet','Productie'),1:69))
> y <- array(NA,dim=c(2,69),dimnames=list(c('Omzet','Productie'),1:69))
> 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 = '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
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
Omzet Productie t
1 104.2 97.4 1
2 103.2 97.0 2
3 112.7 105.4 3
4 106.4 102.7 4
5 102.6 98.1 5
6 110.6 104.5 6
7 95.2 87.4 7
8 89.0 89.9 8
9 112.5 109.8 9
10 116.8 111.7 10
11 107.2 98.6 11
12 113.6 96.9 12
13 101.8 95.1 13
14 102.6 97.0 14
15 122.7 112.7 15
16 110.3 102.9 16
17 110.5 97.4 17
18 121.6 111.4 18
19 100.3 87.4 19
20 100.7 96.8 20
21 123.4 114.1 21
22 127.1 110.3 22
23 124.1 103.9 23
24 131.2 101.6 24
25 111.6 94.6 25
26 114.2 95.9 26
27 130.1 104.7 27
28 125.9 102.8 28
29 119.0 98.1 29
30 133.8 113.9 30
31 107.5 80.9 31
32 113.5 95.7 32
33 134.4 113.2 33
34 126.8 105.9 34
35 135.6 108.8 35
36 139.9 102.3 36
37 129.8 99.0 37
38 131.0 100.7 38
39 153.1 115.5 39
40 134.1 100.7 40
41 144.1 109.9 41
42 155.9 114.6 42
43 123.3 85.4 43
44 128.1 100.5 44
45 144.3 114.8 45
46 153.0 116.5 46
47 149.9 112.9 47
48 150.9 102.0 48
49 141.0 106.0 49
50 138.9 105.3 50
51 157.4 118.8 51
52 142.9 106.1 52
53 151.7 109.3 53
54 161.0 117.2 54
55 138.5 92.5 55
56 135.9 104.2 56
57 151.5 112.5 57
58 164.0 122.4 58
59 159.1 113.3 59
60 157.0 100.0 60
61 142.1 110.7 61
62 144.8 112.8 62
63 152.1 109.8 63
64 154.9 117.3 64
65 148.4 109.1 65
66 157.3 115.9 66
67 145.7 96.0 67
68 133.8 99.8 68
69 156.8 116.8 69
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Productie t
9.6289 0.9252 0.6769
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-14.1987 -3.8278 -0.7557 3.7749 14.4039
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.62893 9.11750 1.056 0.295
Productie 0.92525 0.09159 10.102 5.02e-15 ***
t 0.67691 0.04070 16.633 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.142 on 66 degrees of freedom
Multiple R-squared: 0.9039, Adjusted R-squared: 0.9009
F-statistic: 310.2 on 2 and 66 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.014389331 0.028778661 0.9856107
[2,] 0.008353541 0.016707081 0.9916465
[3,] 0.039878178 0.079756356 0.9601218
[4,] 0.015593014 0.031186028 0.9844070
[5,] 0.007660695 0.015321391 0.9923393
[6,] 0.012030594 0.024061188 0.9879694
[7,] 0.102617572 0.205235145 0.8973824
[8,] 0.066323224 0.132646449 0.9336768
[9,] 0.045751187 0.091502373 0.9542488
[10,] 0.028754785 0.057509570 0.9712452
[11,] 0.017501712 0.035003423 0.9824983
[12,] 0.013693505 0.027387011 0.9863065
[13,] 0.007760195 0.015520391 0.9922398
[14,] 0.004656882 0.009313765 0.9953431
[15,] 0.013379103 0.026758205 0.9866209
[16,] 0.010085913 0.020171826 0.9899141
[17,] 0.013121658 0.026243316 0.9868783
[18,] 0.022600720 0.045201439 0.9773993
[19,] 0.162142594 0.324285188 0.8378574
[20,] 0.131225007 0.262450014 0.8687750
[21,] 0.105027198 0.210054395 0.8949728
[22,] 0.107884318 0.215768637 0.8921157
[23,] 0.083990049 0.167980098 0.9160100
[24,] 0.064856205 0.129712411 0.9351438
[25,] 0.052074886 0.104149772 0.9479251
[26,] 0.039886053 0.079772106 0.9601139
[27,] 0.063510091 0.127020181 0.9364899
[28,] 0.060104779 0.120209558 0.9398952
[29,] 0.076000715 0.152001431 0.9239993
[30,] 0.069291814 0.138583629 0.9307082
[31,] 0.130526748 0.261053496 0.8694733
[32,] 0.110016245 0.220032490 0.8899838
[33,] 0.093269890 0.186539780 0.9067301
[34,] 0.107707417 0.215414833 0.8922926
[35,] 0.084152959 0.168305918 0.9158470
[36,] 0.062361467 0.124722934 0.9376385
[37,] 0.078587051 0.157174101 0.9214129
[38,] 0.059349947 0.118699894 0.9406501
[39,] 0.111067750 0.222135501 0.8889322
[40,] 0.127086973 0.254173946 0.8729130
[41,] 0.092835267 0.185670535 0.9071647
[42,] 0.066415218 0.132830435 0.9335848
[43,] 0.115347051 0.230694103 0.8846529
[44,] 0.099619825 0.199239650 0.9003802
[45,] 0.114637037 0.229274074 0.8853630
[46,] 0.080327677 0.160655354 0.9196723
[47,] 0.072131133 0.144262267 0.9278689
[48,] 0.047729026 0.095458052 0.9522710
[49,] 0.036455613 0.072911227 0.9635444
[50,] 0.022750515 0.045501030 0.9772495
[51,] 0.095433801 0.190867602 0.9045662
[52,] 0.078978662 0.157957325 0.9210213
[53,] 0.053412603 0.106825206 0.9465874
[54,] 0.040425822 0.080851645 0.9595742
[55,] 0.331366124 0.662732248 0.6686339
[56,] 0.364797921 0.729595842 0.6352021
[57,] 0.467402748 0.934805495 0.5325973
[58,] 0.316714974 0.633429949 0.6832850
> postscript(file="/var/www/html/rcomp/tmp/1rb5b1261063126.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/25kfg1261063126.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/39d3s1261063126.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/4b0xw1261063126.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/5w6zu1261063126.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 = 69
Frequency = 1
1 2 3 4 5 6
3.77492362 2.46811174 3.51911017 -0.95962941 -1.18039622 0.22109987
7 8 9 10 11 12
-0.03405661 -9.22409009 -4.81345317 -2.94833736 -1.10448914 6.19152245
13 14 15 16 17 18
-4.61994108 -6.25482527 -1.35814327 -5.36761618 -0.75565905 -3.28605405
19 20 21 22 23 24
-3.05699362 -12.03124401 -6.01496013 0.52407399 2.76875507 11.31991595
25 26 27 28 29 30
-2.48025368 -1.75998857 5.32091034 2.20197169 -1.02627024 -1.52211313
31 32 33 34 35 36
2.03418675 -6.33640731 -2.30517320 -3.82776818 1.61209881 11.24930476
37 38 39 40 41 42
3.52571448 2.47588005 10.20528600 4.22205722 5.03285659 11.80727569
43 44 45 46 47 48
5.54763002 -4.30053869 -2.00850833 4.44165725 3.99564161 14.40394240
49 50 51 52 53 54
0.12603568 -2.00320156 3.32902786 -0.09722346 5.06506888 6.37869173
55 56 57 58 59 60
6.05542634 -8.04689635 -0.80337304 1.85975216 4.70260507 14.23150305
61 62 63 64 65 66
-11.24557082 -11.16550477 -1.76666971 -6.58294733 -6.17281836 -4.24142180
67 68 69
1.89411844 -14.19873852 -7.60488000
> postscript(file="/var/www/html/rcomp/tmp/6t6tf1261063126.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 = 69
Frequency = 1
lag(myerror, k = 1) myerror
0 3.77492362 NA
1 2.46811174 3.77492362
2 3.51911017 2.46811174
3 -0.95962941 3.51911017
4 -1.18039622 -0.95962941
5 0.22109987 -1.18039622
6 -0.03405661 0.22109987
7 -9.22409009 -0.03405661
8 -4.81345317 -9.22409009
9 -2.94833736 -4.81345317
10 -1.10448914 -2.94833736
11 6.19152245 -1.10448914
12 -4.61994108 6.19152245
13 -6.25482527 -4.61994108
14 -1.35814327 -6.25482527
15 -5.36761618 -1.35814327
16 -0.75565905 -5.36761618
17 -3.28605405 -0.75565905
18 -3.05699362 -3.28605405
19 -12.03124401 -3.05699362
20 -6.01496013 -12.03124401
21 0.52407399 -6.01496013
22 2.76875507 0.52407399
23 11.31991595 2.76875507
24 -2.48025368 11.31991595
25 -1.75998857 -2.48025368
26 5.32091034 -1.75998857
27 2.20197169 5.32091034
28 -1.02627024 2.20197169
29 -1.52211313 -1.02627024
30 2.03418675 -1.52211313
31 -6.33640731 2.03418675
32 -2.30517320 -6.33640731
33 -3.82776818 -2.30517320
34 1.61209881 -3.82776818
35 11.24930476 1.61209881
36 3.52571448 11.24930476
37 2.47588005 3.52571448
38 10.20528600 2.47588005
39 4.22205722 10.20528600
40 5.03285659 4.22205722
41 11.80727569 5.03285659
42 5.54763002 11.80727569
43 -4.30053869 5.54763002
44 -2.00850833 -4.30053869
45 4.44165725 -2.00850833
46 3.99564161 4.44165725
47 14.40394240 3.99564161
48 0.12603568 14.40394240
49 -2.00320156 0.12603568
50 3.32902786 -2.00320156
51 -0.09722346 3.32902786
52 5.06506888 -0.09722346
53 6.37869173 5.06506888
54 6.05542634 6.37869173
55 -8.04689635 6.05542634
56 -0.80337304 -8.04689635
57 1.85975216 -0.80337304
58 4.70260507 1.85975216
59 14.23150305 4.70260507
60 -11.24557082 14.23150305
61 -11.16550477 -11.24557082
62 -1.76666971 -11.16550477
63 -6.58294733 -1.76666971
64 -6.17281836 -6.58294733
65 -4.24142180 -6.17281836
66 1.89411844 -4.24142180
67 -14.19873852 1.89411844
68 -7.60488000 -14.19873852
69 NA -7.60488000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.46811174 3.77492362
[2,] 3.51911017 2.46811174
[3,] -0.95962941 3.51911017
[4,] -1.18039622 -0.95962941
[5,] 0.22109987 -1.18039622
[6,] -0.03405661 0.22109987
[7,] -9.22409009 -0.03405661
[8,] -4.81345317 -9.22409009
[9,] -2.94833736 -4.81345317
[10,] -1.10448914 -2.94833736
[11,] 6.19152245 -1.10448914
[12,] -4.61994108 6.19152245
[13,] -6.25482527 -4.61994108
[14,] -1.35814327 -6.25482527
[15,] -5.36761618 -1.35814327
[16,] -0.75565905 -5.36761618
[17,] -3.28605405 -0.75565905
[18,] -3.05699362 -3.28605405
[19,] -12.03124401 -3.05699362
[20,] -6.01496013 -12.03124401
[21,] 0.52407399 -6.01496013
[22,] 2.76875507 0.52407399
[23,] 11.31991595 2.76875507
[24,] -2.48025368 11.31991595
[25,] -1.75998857 -2.48025368
[26,] 5.32091034 -1.75998857
[27,] 2.20197169 5.32091034
[28,] -1.02627024 2.20197169
[29,] -1.52211313 -1.02627024
[30,] 2.03418675 -1.52211313
[31,] -6.33640731 2.03418675
[32,] -2.30517320 -6.33640731
[33,] -3.82776818 -2.30517320
[34,] 1.61209881 -3.82776818
[35,] 11.24930476 1.61209881
[36,] 3.52571448 11.24930476
[37,] 2.47588005 3.52571448
[38,] 10.20528600 2.47588005
[39,] 4.22205722 10.20528600
[40,] 5.03285659 4.22205722
[41,] 11.80727569 5.03285659
[42,] 5.54763002 11.80727569
[43,] -4.30053869 5.54763002
[44,] -2.00850833 -4.30053869
[45,] 4.44165725 -2.00850833
[46,] 3.99564161 4.44165725
[47,] 14.40394240 3.99564161
[48,] 0.12603568 14.40394240
[49,] -2.00320156 0.12603568
[50,] 3.32902786 -2.00320156
[51,] -0.09722346 3.32902786
[52,] 5.06506888 -0.09722346
[53,] 6.37869173 5.06506888
[54,] 6.05542634 6.37869173
[55,] -8.04689635 6.05542634
[56,] -0.80337304 -8.04689635
[57,] 1.85975216 -0.80337304
[58,] 4.70260507 1.85975216
[59,] 14.23150305 4.70260507
[60,] -11.24557082 14.23150305
[61,] -11.16550477 -11.24557082
[62,] -1.76666971 -11.16550477
[63,] -6.58294733 -1.76666971
[64,] -6.17281836 -6.58294733
[65,] -4.24142180 -6.17281836
[66,] 1.89411844 -4.24142180
[67,] -14.19873852 1.89411844
[68,] -7.60488000 -14.19873852
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.46811174 3.77492362
2 3.51911017 2.46811174
3 -0.95962941 3.51911017
4 -1.18039622 -0.95962941
5 0.22109987 -1.18039622
6 -0.03405661 0.22109987
7 -9.22409009 -0.03405661
8 -4.81345317 -9.22409009
9 -2.94833736 -4.81345317
10 -1.10448914 -2.94833736
11 6.19152245 -1.10448914
12 -4.61994108 6.19152245
13 -6.25482527 -4.61994108
14 -1.35814327 -6.25482527
15 -5.36761618 -1.35814327
16 -0.75565905 -5.36761618
17 -3.28605405 -0.75565905
18 -3.05699362 -3.28605405
19 -12.03124401 -3.05699362
20 -6.01496013 -12.03124401
21 0.52407399 -6.01496013
22 2.76875507 0.52407399
23 11.31991595 2.76875507
24 -2.48025368 11.31991595
25 -1.75998857 -2.48025368
26 5.32091034 -1.75998857
27 2.20197169 5.32091034
28 -1.02627024 2.20197169
29 -1.52211313 -1.02627024
30 2.03418675 -1.52211313
31 -6.33640731 2.03418675
32 -2.30517320 -6.33640731
33 -3.82776818 -2.30517320
34 1.61209881 -3.82776818
35 11.24930476 1.61209881
36 3.52571448 11.24930476
37 2.47588005 3.52571448
38 10.20528600 2.47588005
39 4.22205722 10.20528600
40 5.03285659 4.22205722
41 11.80727569 5.03285659
42 5.54763002 11.80727569
43 -4.30053869 5.54763002
44 -2.00850833 -4.30053869
45 4.44165725 -2.00850833
46 3.99564161 4.44165725
47 14.40394240 3.99564161
48 0.12603568 14.40394240
49 -2.00320156 0.12603568
50 3.32902786 -2.00320156
51 -0.09722346 3.32902786
52 5.06506888 -0.09722346
53 6.37869173 5.06506888
54 6.05542634 6.37869173
55 -8.04689635 6.05542634
56 -0.80337304 -8.04689635
57 1.85975216 -0.80337304
58 4.70260507 1.85975216
59 14.23150305 4.70260507
60 -11.24557082 14.23150305
61 -11.16550477 -11.24557082
62 -1.76666971 -11.16550477
63 -6.58294733 -1.76666971
64 -6.17281836 -6.58294733
65 -4.24142180 -6.17281836
66 1.89411844 -4.24142180
67 -14.19873852 1.89411844
68 -7.60488000 -14.19873852
> 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/7jheb1261063126.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/8rshl1261063126.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/9jvqc1261063126.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/10zcuw1261063126.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/11iyzc1261063126.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/12835f1261063126.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/13r0he1261063126.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/149zp21261063126.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/15wzrq1261063126.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/16jssu1261063126.tab")
+ }
>
> try(system("convert tmp/1rb5b1261063126.ps tmp/1rb5b1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/25kfg1261063126.ps tmp/25kfg1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/39d3s1261063126.ps tmp/39d3s1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/4b0xw1261063126.ps tmp/4b0xw1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/5w6zu1261063126.ps tmp/5w6zu1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/6t6tf1261063126.ps tmp/6t6tf1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/7jheb1261063126.ps tmp/7jheb1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/8rshl1261063126.ps tmp/8rshl1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jvqc1261063126.ps tmp/9jvqc1261063126.png",intern=TRUE))
character(0)
> try(system("convert tmp/10zcuw1261063126.ps tmp/10zcuw1261063126.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.560 1.590 4.047