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(89.1,72.7,82.6,79.7,102.7,115.8,91.8,87.8,94.1,99.2,103.1,111.4,93.2,102.3,91,94.4,94.3,118.5,99.4,112.1,115.7,136.5,116.8,139.8,99.8,104.5,96,123.3,115.9,156.6,109.1,136.2,117.3,147.5,109.8,143.8,112.8,135.8,110.7,121.6,100,128,113.3,129.7,122.4,136.2,112.5,130.5,104.2,99.2,92.5,110.4,117.2,151.6,109.3,129.6,106.1,123.6,118.8,142.7,105.3,119,106,118.1,102,120,112.9,124.3,116.5,123.3,114.8,122.4,100.5,90.5,85.4,91,114.6,137,109.9,127.7,100.7,105.1,115.5,135.6,100.7,112.4,99,102.5,102.3,112.6,108.8,110.8,105.9,103.4,113.2,117.6,95.7,87.5,80.9,87,113.9,130,98.1,102.9,102.8,111.1,104.7,128.9,95.9,106.3,94.6,99,101.6,109.9,103.9,104,110.3,112.9,114.1,113.6),dim=c(2,60),dimnames=list(c('TotaleIndustrieleProductie','Investeringsgoederen'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('TotaleIndustrieleProductie','Investeringsgoederen'),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 = '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
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
TotaleIndustrieleProductie Investeringsgoederen M1 M2 M3 M4 M5 M6 M7 M8 M9
1 89.1 72.7 1 0 0 0 0 0 0 0 0
2 82.6 79.7 0 1 0 0 0 0 0 0 0
3 102.7 115.8 0 0 1 0 0 0 0 0 0
4 91.8 87.8 0 0 0 1 0 0 0 0 0
5 94.1 99.2 0 0 0 0 1 0 0 0 0
6 103.1 111.4 0 0 0 0 0 1 0 0 0
7 93.2 102.3 0 0 0 0 0 0 1 0 0
8 91.0 94.4 0 0 0 0 0 0 0 1 0
9 94.3 118.5 0 0 0 0 0 0 0 0 1
10 99.4 112.1 0 0 0 0 0 0 0 0 0
11 115.7 136.5 0 0 0 0 0 0 0 0 0
12 116.8 139.8 0 0 0 0 0 0 0 0 0
13 99.8 104.5 1 0 0 0 0 0 0 0 0
14 96.0 123.3 0 1 0 0 0 0 0 0 0
15 115.9 156.6 0 0 1 0 0 0 0 0 0
16 109.1 136.2 0 0 0 1 0 0 0 0 0
17 117.3 147.5 0 0 0 0 1 0 0 0 0
18 109.8 143.8 0 0 0 0 0 1 0 0 0
19 112.8 135.8 0 0 0 0 0 0 1 0 0
20 110.7 121.6 0 0 0 0 0 0 0 1 0
21 100.0 128.0 0 0 0 0 0 0 0 0 1
22 113.3 129.7 0 0 0 0 0 0 0 0 0
23 122.4 136.2 0 0 0 0 0 0 0 0 0
24 112.5 130.5 0 0 0 0 0 0 0 0 0
25 104.2 99.2 1 0 0 0 0 0 0 0 0
26 92.5 110.4 0 1 0 0 0 0 0 0 0
27 117.2 151.6 0 0 1 0 0 0 0 0 0
28 109.3 129.6 0 0 0 1 0 0 0 0 0
29 106.1 123.6 0 0 0 0 1 0 0 0 0
30 118.8 142.7 0 0 0 0 0 1 0 0 0
31 105.3 119.0 0 0 0 0 0 0 1 0 0
32 106.0 118.1 0 0 0 0 0 0 0 1 0
33 102.0 120.0 0 0 0 0 0 0 0 0 1
34 112.9 124.3 0 0 0 0 0 0 0 0 0
35 116.5 123.3 0 0 0 0 0 0 0 0 0
36 114.8 122.4 0 0 0 0 0 0 0 0 0
37 100.5 90.5 1 0 0 0 0 0 0 0 0
38 85.4 91.0 0 1 0 0 0 0 0 0 0
39 114.6 137.0 0 0 1 0 0 0 0 0 0
40 109.9 127.7 0 0 0 1 0 0 0 0 0
41 100.7 105.1 0 0 0 0 1 0 0 0 0
42 115.5 135.6 0 0 0 0 0 1 0 0 0
43 100.7 112.4 0 0 0 0 0 0 1 0 0
44 99.0 102.5 0 0 0 0 0 0 0 1 0
45 102.3 112.6 0 0 0 0 0 0 0 0 1
46 108.8 110.8 0 0 0 0 0 0 0 0 0
47 105.9 103.4 0 0 0 0 0 0 0 0 0
48 113.2 117.6 0 0 0 0 0 0 0 0 0
49 95.7 87.5 1 0 0 0 0 0 0 0 0
50 80.9 87.0 0 1 0 0 0 0 0 0 0
51 113.9 130.0 0 0 1 0 0 0 0 0 0
52 98.1 102.9 0 0 0 1 0 0 0 0 0
53 102.8 111.1 0 0 0 0 1 0 0 0 0
54 104.7 128.9 0 0 0 0 0 1 0 0 0
55 95.9 106.3 0 0 0 0 0 0 1 0 0
56 94.6 99.0 0 0 0 0 0 0 0 1 0
57 101.6 109.9 0 0 0 0 0 0 0 0 1
58 103.9 104.0 0 0 0 0 0 0 0 0 0
59 110.3 112.9 0 0 0 0 0 0 0 0 0
60 114.1 113.6 0 0 0 0 0 0 0 0 0
M10 M11
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
7 0 0
8 0 0
9 0 0
10 1 0
11 0 1
12 0 0
13 0 0
14 0 0
15 0 0
16 0 0
17 0 0
18 0 0
19 0 0
20 0 0
21 0 0
22 1 0
23 0 1
24 0 0
25 0 0
26 0 0
27 0 0
28 0 0
29 0 0
30 0 0
31 0 0
32 0 0
33 0 0
34 1 0
35 0 1
36 0 0
37 0 0
38 0 0
39 0 0
40 0 0
41 0 0
42 0 0
43 0 0
44 0 0
45 0 0
46 1 0
47 0 1
48 0 0
49 0 0
50 0 0
51 0 0
52 0 0
53 0 0
54 0 0
55 0 0
56 0 0
57 0 0
58 1 0
59 0 1
60 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Investeringsgoederen M1
65.3856 0.3918 -3.1365
M2 M3 M4
-16.4161 -6.6786 -7.5288
M5 M6 M7
-7.1490 -6.9172 -8.9305
M8 M9 M10
-7.1000 -11.5049 -3.2501
M11
0.7891
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.6613 -2.1721 0.4463 2.0962 4.7661
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 65.38558 4.32995 15.101 < 2e-16 ***
Investeringsgoederen 0.39184 0.03266 11.998 6.52e-16 ***
M1 -3.13646 2.34699 -1.336 0.187862
M2 -16.41611 2.24313 -7.318 2.69e-09 ***
M3 -6.67856 2.11535 -3.157 0.002781 **
M4 -7.52875 2.08563 -3.610 0.000742 ***
M5 -7.14900 2.08382 -3.431 0.001264 **
M6 -6.91721 2.08467 -3.318 0.001755 **
M7 -8.93045 2.09316 -4.266 9.53e-05 ***
M8 -7.10002 2.14832 -3.305 0.001824 **
M9 -11.50492 2.08197 -5.526 1.39e-06 ***
M10 -3.25013 2.08842 -1.556 0.126355
M11 0.78908 2.07084 0.381 0.704887
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.272 on 47 degrees of freedom
Multiple R-squared: 0.9079, Adjusted R-squared: 0.8844
F-statistic: 38.63 on 12 and 47 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.01860780 0.03721560 0.98139220
[2,] 0.34284318 0.68568637 0.65715682
[3,] 0.48981379 0.97962758 0.51018621
[4,] 0.71618719 0.56762563 0.28381281
[5,] 0.90922535 0.18154930 0.09077465
[6,] 0.93867677 0.12264647 0.06132323
[7,] 0.95626040 0.08747920 0.04373960
[8,] 0.96494028 0.07011945 0.03505972
[9,] 0.98296351 0.03407299 0.01703649
[10,] 0.98380667 0.03238665 0.01619333
[11,] 0.97058093 0.05883814 0.02941907
[12,] 0.97912282 0.04175435 0.02087718
[13,] 0.96716694 0.06566613 0.03283306
[14,] 0.96170370 0.07659261 0.03829630
[15,] 0.97531478 0.04937044 0.02468522
[16,] 0.96701150 0.06597701 0.03298850
[17,] 0.94542563 0.10914874 0.05457437
[18,] 0.97144177 0.05711646 0.02855823
[19,] 0.96840177 0.06319646 0.03159823
[20,] 0.94847136 0.10305729 0.05152864
[21,] 0.94635710 0.10728580 0.05364290
[22,] 0.93858591 0.12282817 0.06141409
[23,] 0.91046673 0.17906653 0.08953327
[24,] 0.89955989 0.20088021 0.10044011
[25,] 0.87788169 0.24423661 0.12211831
[26,] 0.82597477 0.34805047 0.17402523
[27,] 0.96462536 0.07074928 0.03537464
[28,] 0.92695817 0.14608366 0.07304183
[29,] 0.90927190 0.18145621 0.09072810
> postscript(file="/var/www/html/rcomp/tmp/1eq2y1258721790.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/2mt881258721790.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/3lb2b1258721790.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/45uau1258721790.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/5rlt91258721790.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
-1.63625850 2.40047949 -1.38267274 -0.46082215 -3.00760609 0.98009191
7 8 9 10 11 12
-3.34087372 -4.27573202 -6.01429148 -6.66127253 -3.96150334 -3.36551141
13 14 15 16 17 18
-3.39692845 -1.28396108 -4.16994740 -2.12611856 1.26628199 -5.01568503
19 20 21 22 23 24
3.13231988 4.76608488 -4.03681866 0.34225604 2.85605015 -4.02135321
25 26 27 28 29 30
3.07984987 0.27083900 -0.91072256 0.66005822 -0.56862329 4.41534444
31 32 33 34 35 36
2.21531533 1.43754226 1.09794107 2.05821887 2.01085023 1.45259102
37 38 39 40 41 42
2.78890109 0.77263136 2.21021396 2.00456366 1.28050860 3.89744370
43 44 45 46 47 48
0.20149211 0.55032375 4.29759383 3.24812592 -0.79143493 1.73344686
49 50 51 52 53 54
-0.83556401 -2.15998877 4.25312873 -0.07768116 1.02943880 -4.27719502
55 56 57 58 59 60
-2.20825359 -2.47821887 4.65557524 1.01267170 -0.11396211 4.20082673
> postscript(file="/var/www/html/rcomp/tmp/6gd3h1258721790.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 -1.63625850 NA
1 2.40047949 -1.63625850
2 -1.38267274 2.40047949
3 -0.46082215 -1.38267274
4 -3.00760609 -0.46082215
5 0.98009191 -3.00760609
6 -3.34087372 0.98009191
7 -4.27573202 -3.34087372
8 -6.01429148 -4.27573202
9 -6.66127253 -6.01429148
10 -3.96150334 -6.66127253
11 -3.36551141 -3.96150334
12 -3.39692845 -3.36551141
13 -1.28396108 -3.39692845
14 -4.16994740 -1.28396108
15 -2.12611856 -4.16994740
16 1.26628199 -2.12611856
17 -5.01568503 1.26628199
18 3.13231988 -5.01568503
19 4.76608488 3.13231988
20 -4.03681866 4.76608488
21 0.34225604 -4.03681866
22 2.85605015 0.34225604
23 -4.02135321 2.85605015
24 3.07984987 -4.02135321
25 0.27083900 3.07984987
26 -0.91072256 0.27083900
27 0.66005822 -0.91072256
28 -0.56862329 0.66005822
29 4.41534444 -0.56862329
30 2.21531533 4.41534444
31 1.43754226 2.21531533
32 1.09794107 1.43754226
33 2.05821887 1.09794107
34 2.01085023 2.05821887
35 1.45259102 2.01085023
36 2.78890109 1.45259102
37 0.77263136 2.78890109
38 2.21021396 0.77263136
39 2.00456366 2.21021396
40 1.28050860 2.00456366
41 3.89744370 1.28050860
42 0.20149211 3.89744370
43 0.55032375 0.20149211
44 4.29759383 0.55032375
45 3.24812592 4.29759383
46 -0.79143493 3.24812592
47 1.73344686 -0.79143493
48 -0.83556401 1.73344686
49 -2.15998877 -0.83556401
50 4.25312873 -2.15998877
51 -0.07768116 4.25312873
52 1.02943880 -0.07768116
53 -4.27719502 1.02943880
54 -2.20825359 -4.27719502
55 -2.47821887 -2.20825359
56 4.65557524 -2.47821887
57 1.01267170 4.65557524
58 -0.11396211 1.01267170
59 4.20082673 -0.11396211
60 NA 4.20082673
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.40047949 -1.63625850
[2,] -1.38267274 2.40047949
[3,] -0.46082215 -1.38267274
[4,] -3.00760609 -0.46082215
[5,] 0.98009191 -3.00760609
[6,] -3.34087372 0.98009191
[7,] -4.27573202 -3.34087372
[8,] -6.01429148 -4.27573202
[9,] -6.66127253 -6.01429148
[10,] -3.96150334 -6.66127253
[11,] -3.36551141 -3.96150334
[12,] -3.39692845 -3.36551141
[13,] -1.28396108 -3.39692845
[14,] -4.16994740 -1.28396108
[15,] -2.12611856 -4.16994740
[16,] 1.26628199 -2.12611856
[17,] -5.01568503 1.26628199
[18,] 3.13231988 -5.01568503
[19,] 4.76608488 3.13231988
[20,] -4.03681866 4.76608488
[21,] 0.34225604 -4.03681866
[22,] 2.85605015 0.34225604
[23,] -4.02135321 2.85605015
[24,] 3.07984987 -4.02135321
[25,] 0.27083900 3.07984987
[26,] -0.91072256 0.27083900
[27,] 0.66005822 -0.91072256
[28,] -0.56862329 0.66005822
[29,] 4.41534444 -0.56862329
[30,] 2.21531533 4.41534444
[31,] 1.43754226 2.21531533
[32,] 1.09794107 1.43754226
[33,] 2.05821887 1.09794107
[34,] 2.01085023 2.05821887
[35,] 1.45259102 2.01085023
[36,] 2.78890109 1.45259102
[37,] 0.77263136 2.78890109
[38,] 2.21021396 0.77263136
[39,] 2.00456366 2.21021396
[40,] 1.28050860 2.00456366
[41,] 3.89744370 1.28050860
[42,] 0.20149211 3.89744370
[43,] 0.55032375 0.20149211
[44,] 4.29759383 0.55032375
[45,] 3.24812592 4.29759383
[46,] -0.79143493 3.24812592
[47,] 1.73344686 -0.79143493
[48,] -0.83556401 1.73344686
[49,] -2.15998877 -0.83556401
[50,] 4.25312873 -2.15998877
[51,] -0.07768116 4.25312873
[52,] 1.02943880 -0.07768116
[53,] -4.27719502 1.02943880
[54,] -2.20825359 -4.27719502
[55,] -2.47821887 -2.20825359
[56,] 4.65557524 -2.47821887
[57,] 1.01267170 4.65557524
[58,] -0.11396211 1.01267170
[59,] 4.20082673 -0.11396211
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.40047949 -1.63625850
2 -1.38267274 2.40047949
3 -0.46082215 -1.38267274
4 -3.00760609 -0.46082215
5 0.98009191 -3.00760609
6 -3.34087372 0.98009191
7 -4.27573202 -3.34087372
8 -6.01429148 -4.27573202
9 -6.66127253 -6.01429148
10 -3.96150334 -6.66127253
11 -3.36551141 -3.96150334
12 -3.39692845 -3.36551141
13 -1.28396108 -3.39692845
14 -4.16994740 -1.28396108
15 -2.12611856 -4.16994740
16 1.26628199 -2.12611856
17 -5.01568503 1.26628199
18 3.13231988 -5.01568503
19 4.76608488 3.13231988
20 -4.03681866 4.76608488
21 0.34225604 -4.03681866
22 2.85605015 0.34225604
23 -4.02135321 2.85605015
24 3.07984987 -4.02135321
25 0.27083900 3.07984987
26 -0.91072256 0.27083900
27 0.66005822 -0.91072256
28 -0.56862329 0.66005822
29 4.41534444 -0.56862329
30 2.21531533 4.41534444
31 1.43754226 2.21531533
32 1.09794107 1.43754226
33 2.05821887 1.09794107
34 2.01085023 2.05821887
35 1.45259102 2.01085023
36 2.78890109 1.45259102
37 0.77263136 2.78890109
38 2.21021396 0.77263136
39 2.00456366 2.21021396
40 1.28050860 2.00456366
41 3.89744370 1.28050860
42 0.20149211 3.89744370
43 0.55032375 0.20149211
44 4.29759383 0.55032375
45 3.24812592 4.29759383
46 -0.79143493 3.24812592
47 1.73344686 -0.79143493
48 -0.83556401 1.73344686
49 -2.15998877 -0.83556401
50 4.25312873 -2.15998877
51 -0.07768116 4.25312873
52 1.02943880 -0.07768116
53 -4.27719502 1.02943880
54 -2.20825359 -4.27719502
55 -2.47821887 -2.20825359
56 4.65557524 -2.47821887
57 1.01267170 4.65557524
58 -0.11396211 1.01267170
59 4.20082673 -0.11396211
> 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/742er1258721790.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/84gvo1258721790.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/984yd1258721790.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/10zsry1258721790.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/1144f21258721790.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/12ljp81258721790.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/139z2r1258721790.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/141a4d1258721790.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/15ihw01258721790.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/16472u1258721790.tab")
+ }
>
> system("convert tmp/1eq2y1258721790.ps tmp/1eq2y1258721790.png")
> system("convert tmp/2mt881258721790.ps tmp/2mt881258721790.png")
> system("convert tmp/3lb2b1258721790.ps tmp/3lb2b1258721790.png")
> system("convert tmp/45uau1258721790.ps tmp/45uau1258721790.png")
> system("convert tmp/5rlt91258721790.ps tmp/5rlt91258721790.png")
> system("convert tmp/6gd3h1258721790.ps tmp/6gd3h1258721790.png")
> system("convert tmp/742er1258721790.ps tmp/742er1258721790.png")
> system("convert tmp/84gvo1258721790.ps tmp/84gvo1258721790.png")
> system("convert tmp/984yd1258721790.ps tmp/984yd1258721790.png")
> system("convert tmp/10zsry1258721790.ps tmp/10zsry1258721790.png")
>
>
> proc.time()
user system elapsed
2.366 1.563 2.806