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(95.1,117.1,97,118.7,112.7,126.5,102.9,127.5,97.4,134.6,111.4,131.8,87.4,135.9,96.8,142.7,114.1,141.7,110.3,153.4,103.9,145,101.6,137.7,94.6,148.3,95.9,152.2,104.7,169.4,102.8,168.6,98.1,161.1,113.9,174.1,80.9,179,95.7,190.6,113.2,190,105.9,181.6,108.8,174.8,102.3,180.5,99,196.8,100.7,193.8,115.5,197,100.7,216.3,109.9,221.4,114.6,217.9,85.4,229.7,100.5,227.4,114.8,204.2,116.5,196.6,112.9,198.8,102,207.5,106,190.7,105.3,201.6,118.8,210.5,106.1,223.5,109.3,223.8,117.2,231.2,92.5,244,104.2,234.7,112.5,250.2,122.4,265.7,113.3,287.6,100,283.3,110.7,295.4,112.8,312.3,109.8,333.8,117.3,347.7,109.1,383.2,115.9,407.1,96,413.6,99.8,362.7,116.8,321.9,115.7,239.4,99.4,191,94.3,159.7,91,163.4),dim=c(2,61),dimnames=list(c('tot.ind.prod.index','prijsindex.grondst.incl.energie'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('tot.ind.prod.index','prijsindex.grondst.incl.energie'),1:61))
> 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
tot.ind.prod.index prijsindex.grondst.incl.energie M1 M2 M3 M4 M5 M6 M7 M8
1 95.1 117.1 1 0 0 0 0 0 0 0
2 97.0 118.7 0 1 0 0 0 0 0 0
3 112.7 126.5 0 0 1 0 0 0 0 0
4 102.9 127.5 0 0 0 1 0 0 0 0
5 97.4 134.6 0 0 0 0 1 0 0 0
6 111.4 131.8 0 0 0 0 0 1 0 0
7 87.4 135.9 0 0 0 0 0 0 1 0
8 96.8 142.7 0 0 0 0 0 0 0 1
9 114.1 141.7 0 0 0 0 0 0 0 0
10 110.3 153.4 0 0 0 0 0 0 0 0
11 103.9 145.0 0 0 0 0 0 0 0 0
12 101.6 137.7 0 0 0 0 0 0 0 0
13 94.6 148.3 1 0 0 0 0 0 0 0
14 95.9 152.2 0 1 0 0 0 0 0 0
15 104.7 169.4 0 0 1 0 0 0 0 0
16 102.8 168.6 0 0 0 1 0 0 0 0
17 98.1 161.1 0 0 0 0 1 0 0 0
18 113.9 174.1 0 0 0 0 0 1 0 0
19 80.9 179.0 0 0 0 0 0 0 1 0
20 95.7 190.6 0 0 0 0 0 0 0 1
21 113.2 190.0 0 0 0 0 0 0 0 0
22 105.9 181.6 0 0 0 0 0 0 0 0
23 108.8 174.8 0 0 0 0 0 0 0 0
24 102.3 180.5 0 0 0 0 0 0 0 0
25 99.0 196.8 1 0 0 0 0 0 0 0
26 100.7 193.8 0 1 0 0 0 0 0 0
27 115.5 197.0 0 0 1 0 0 0 0 0
28 100.7 216.3 0 0 0 1 0 0 0 0
29 109.9 221.4 0 0 0 0 1 0 0 0
30 114.6 217.9 0 0 0 0 0 1 0 0
31 85.4 229.7 0 0 0 0 0 0 1 0
32 100.5 227.4 0 0 0 0 0 0 0 1
33 114.8 204.2 0 0 0 0 0 0 0 0
34 116.5 196.6 0 0 0 0 0 0 0 0
35 112.9 198.8 0 0 0 0 0 0 0 0
36 102.0 207.5 0 0 0 0 0 0 0 0
37 106.0 190.7 1 0 0 0 0 0 0 0
38 105.3 201.6 0 1 0 0 0 0 0 0
39 118.8 210.5 0 0 1 0 0 0 0 0
40 106.1 223.5 0 0 0 1 0 0 0 0
41 109.3 223.8 0 0 0 0 1 0 0 0
42 117.2 231.2 0 0 0 0 0 1 0 0
43 92.5 244.0 0 0 0 0 0 0 1 0
44 104.2 234.7 0 0 0 0 0 0 0 1
45 112.5 250.2 0 0 0 0 0 0 0 0
46 122.4 265.7 0 0 0 0 0 0 0 0
47 113.3 287.6 0 0 0 0 0 0 0 0
48 100.0 283.3 0 0 0 0 0 0 0 0
49 110.7 295.4 1 0 0 0 0 0 0 0
50 112.8 312.3 0 1 0 0 0 0 0 0
51 109.8 333.8 0 0 1 0 0 0 0 0
52 117.3 347.7 0 0 0 1 0 0 0 0
53 109.1 383.2 0 0 0 0 1 0 0 0
54 115.9 407.1 0 0 0 0 0 1 0 0
55 96.0 413.6 0 0 0 0 0 0 1 0
56 99.8 362.7 0 0 0 0 0 0 0 1
57 116.8 321.9 0 0 0 0 0 0 0 0
58 115.7 239.4 0 0 0 0 0 0 0 0
59 99.4 191.0 0 0 0 0 0 0 0 0
60 94.3 159.7 0 0 0 0 0 0 0 0
61 91.0 163.4 1 0 0 0 0 0 0 0
M9 M10 M11
1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0
6 0 0 0
7 0 0 0
8 0 0 0
9 1 0 0
10 0 1 0
11 0 0 1
12 0 0 0
13 0 0 0
14 0 0 0
15 0 0 0
16 0 0 0
17 0 0 0
18 0 0 0
19 0 0 0
20 0 0 0
21 1 0 0
22 0 1 0
23 0 0 1
24 0 0 0
25 0 0 0
26 0 0 0
27 0 0 0
28 0 0 0
29 0 0 0
30 0 0 0
31 0 0 0
32 0 0 0
33 1 0 0
34 0 1 0
35 0 0 1
36 0 0 0
37 0 0 0
38 0 0 0
39 0 0 0
40 0 0 0
41 0 0 0
42 0 0 0
43 0 0 0
44 0 0 0
45 1 0 0
46 0 1 0
47 0 0 1
48 0 0 0
49 0 0 0
50 0 0 0
51 0 0 0
52 0 0 0
53 0 0 0
54 0 0 0
55 0 0 0
56 0 0 0
57 1 0 0
58 0 1 0
59 0 0 1
60 0 0 0
61 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) prijsindex.grondst.incl.energie
91.90036 0.04201
M1 M2
-0.28471 2.21681
M3 M4
11.68442 4.95454
M5 M6
3.41423 12.93493
M7 M8
-13.56202 -2.23146
M9 M10
13.06951 13.54862
M11
7.38052
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.905 -2.982 0.285 3.177 6.674
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 91.90036 2.57161 35.737 < 2e-16 ***
prijsindex.grondst.incl.energie 0.04201 0.00827 5.080 6.14e-06 ***
M1 -0.28471 2.72436 -0.105 0.917204
M2 2.21681 2.84462 0.779 0.439627
M3 11.68442 2.84682 4.104 0.000156 ***
M4 4.95454 2.85091 1.738 0.088645 .
M5 3.41423 2.85616 1.195 0.237806
M6 12.93493 2.86250 4.519 4.06e-05 ***
M7 -13.56202 2.87067 -4.724 2.05e-05 ***
M8 -2.23146 2.86177 -0.780 0.439367
M9 13.06951 2.85388 4.580 3.32e-05 ***
M10 13.54862 2.84679 4.759 1.82e-05 ***
M11 7.38052 2.84496 2.594 0.012534 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.498 on 48 degrees of freedom
Multiple R-squared: 0.8051, Adjusted R-squared: 0.7564
F-statistic: 16.53 on 12 and 48 DF, p-value: 3.787e-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.14005851 0.28011701 0.8599415
[2,] 0.07574067 0.15148134 0.9242593
[3,] 0.06458803 0.12917606 0.9354120
[4,] 0.05850026 0.11700052 0.9414997
[5,] 0.02863982 0.05727963 0.9713602
[6,] 0.01297144 0.02594287 0.9870286
[7,] 0.01172095 0.02344190 0.9882790
[8,] 0.01779142 0.03558283 0.9822086
[9,] 0.01050423 0.02100847 0.9894958
[10,] 0.01445555 0.02891110 0.9855444
[11,] 0.01540761 0.03081522 0.9845924
[12,] 0.02231927 0.04463854 0.9776807
[13,] 0.02238259 0.04476518 0.9776174
[14,] 0.07852300 0.15704599 0.9214770
[15,] 0.04826016 0.09652033 0.9517398
[16,] 0.03564904 0.07129808 0.9643510
[17,] 0.02171947 0.04343893 0.9782805
[18,] 0.01219003 0.02438006 0.9878100
[19,] 0.01449881 0.02899761 0.9855012
[20,] 0.01673339 0.03346678 0.9832666
[21,] 0.01168022 0.02336044 0.9883198
[22,] 0.02082238 0.04164475 0.9791776
[23,] 0.01678326 0.03356652 0.9832167
[24,] 0.03980771 0.07961542 0.9601923
[25,] 0.03142322 0.06284645 0.9685768
[26,] 0.02670432 0.05340864 0.9732957
[27,] 0.03210868 0.06421735 0.9678913
[28,] 0.03055650 0.06111301 0.9694435
[29,] 0.31259649 0.62519299 0.6874035
[30,] 0.25082177 0.50164355 0.7491782
> postscript(file="/var/www/html/rcomp/tmp/15hx31258644158.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/2j2cj1258644158.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/3za9w1258644158.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/4ugl11258644158.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/5ym891258644158.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 = 61
Frequency = 1
1 2 3 4 5 6 7
-1.4353995 -2.1041428 3.8005489 0.6884183 -3.5695685 1.0273688 3.3520606
8 9 10 11 12 13 14
1.1358143 3.1768552 -1.5938076 -1.4728010 3.9144201 -3.2462116 -4.6115853
15 16 17 18 19 20 21
-6.0018176 -1.1383245 -3.9829185 1.7502102 -4.9587086 -1.9766183 0.2476173
22 23 24 25 26 27 28
-7.1785801 2.1752054 2.8162549 -0.8838521 -1.5593346 3.6386179 -5.2423545
29 30 31 32 33 34 35
5.2836852 0.6100318 -2.5887782 1.2772957 1.2510298 2.7912218 5.2668885
36 37 38 39 40 41 42
1.3818983 6.3724285 2.7129623 6.3714396 -0.1448495 4.5828535 2.6512561
43 44 45 46 47 48 49
3.9104330 4.6705993 -2.9815777 5.7881093 1.9361157 -3.8027028 6.6736457
50 51 52 53 54 55 56
5.5621004 -7.8087888 5.8371102 -2.3140516 -6.0388669 0.2849932 -5.1070911
57 58 59 60 61
-1.6939246 0.1930566 -7.9054085 -4.3098705 -7.4806110
> postscript(file="/var/www/html/rcomp/tmp/6cuxm1258644158.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.4353995 NA
1 -2.1041428 -1.4353995
2 3.8005489 -2.1041428
3 0.6884183 3.8005489
4 -3.5695685 0.6884183
5 1.0273688 -3.5695685
6 3.3520606 1.0273688
7 1.1358143 3.3520606
8 3.1768552 1.1358143
9 -1.5938076 3.1768552
10 -1.4728010 -1.5938076
11 3.9144201 -1.4728010
12 -3.2462116 3.9144201
13 -4.6115853 -3.2462116
14 -6.0018176 -4.6115853
15 -1.1383245 -6.0018176
16 -3.9829185 -1.1383245
17 1.7502102 -3.9829185
18 -4.9587086 1.7502102
19 -1.9766183 -4.9587086
20 0.2476173 -1.9766183
21 -7.1785801 0.2476173
22 2.1752054 -7.1785801
23 2.8162549 2.1752054
24 -0.8838521 2.8162549
25 -1.5593346 -0.8838521
26 3.6386179 -1.5593346
27 -5.2423545 3.6386179
28 5.2836852 -5.2423545
29 0.6100318 5.2836852
30 -2.5887782 0.6100318
31 1.2772957 -2.5887782
32 1.2510298 1.2772957
33 2.7912218 1.2510298
34 5.2668885 2.7912218
35 1.3818983 5.2668885
36 6.3724285 1.3818983
37 2.7129623 6.3724285
38 6.3714396 2.7129623
39 -0.1448495 6.3714396
40 4.5828535 -0.1448495
41 2.6512561 4.5828535
42 3.9104330 2.6512561
43 4.6705993 3.9104330
44 -2.9815777 4.6705993
45 5.7881093 -2.9815777
46 1.9361157 5.7881093
47 -3.8027028 1.9361157
48 6.6736457 -3.8027028
49 5.5621004 6.6736457
50 -7.8087888 5.5621004
51 5.8371102 -7.8087888
52 -2.3140516 5.8371102
53 -6.0388669 -2.3140516
54 0.2849932 -6.0388669
55 -5.1070911 0.2849932
56 -1.6939246 -5.1070911
57 0.1930566 -1.6939246
58 -7.9054085 0.1930566
59 -4.3098705 -7.9054085
60 -7.4806110 -4.3098705
61 NA -7.4806110
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.1041428 -1.4353995
[2,] 3.8005489 -2.1041428
[3,] 0.6884183 3.8005489
[4,] -3.5695685 0.6884183
[5,] 1.0273688 -3.5695685
[6,] 3.3520606 1.0273688
[7,] 1.1358143 3.3520606
[8,] 3.1768552 1.1358143
[9,] -1.5938076 3.1768552
[10,] -1.4728010 -1.5938076
[11,] 3.9144201 -1.4728010
[12,] -3.2462116 3.9144201
[13,] -4.6115853 -3.2462116
[14,] -6.0018176 -4.6115853
[15,] -1.1383245 -6.0018176
[16,] -3.9829185 -1.1383245
[17,] 1.7502102 -3.9829185
[18,] -4.9587086 1.7502102
[19,] -1.9766183 -4.9587086
[20,] 0.2476173 -1.9766183
[21,] -7.1785801 0.2476173
[22,] 2.1752054 -7.1785801
[23,] 2.8162549 2.1752054
[24,] -0.8838521 2.8162549
[25,] -1.5593346 -0.8838521
[26,] 3.6386179 -1.5593346
[27,] -5.2423545 3.6386179
[28,] 5.2836852 -5.2423545
[29,] 0.6100318 5.2836852
[30,] -2.5887782 0.6100318
[31,] 1.2772957 -2.5887782
[32,] 1.2510298 1.2772957
[33,] 2.7912218 1.2510298
[34,] 5.2668885 2.7912218
[35,] 1.3818983 5.2668885
[36,] 6.3724285 1.3818983
[37,] 2.7129623 6.3724285
[38,] 6.3714396 2.7129623
[39,] -0.1448495 6.3714396
[40,] 4.5828535 -0.1448495
[41,] 2.6512561 4.5828535
[42,] 3.9104330 2.6512561
[43,] 4.6705993 3.9104330
[44,] -2.9815777 4.6705993
[45,] 5.7881093 -2.9815777
[46,] 1.9361157 5.7881093
[47,] -3.8027028 1.9361157
[48,] 6.6736457 -3.8027028
[49,] 5.5621004 6.6736457
[50,] -7.8087888 5.5621004
[51,] 5.8371102 -7.8087888
[52,] -2.3140516 5.8371102
[53,] -6.0388669 -2.3140516
[54,] 0.2849932 -6.0388669
[55,] -5.1070911 0.2849932
[56,] -1.6939246 -5.1070911
[57,] 0.1930566 -1.6939246
[58,] -7.9054085 0.1930566
[59,] -4.3098705 -7.9054085
[60,] -7.4806110 -4.3098705
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.1041428 -1.4353995
2 3.8005489 -2.1041428
3 0.6884183 3.8005489
4 -3.5695685 0.6884183
5 1.0273688 -3.5695685
6 3.3520606 1.0273688
7 1.1358143 3.3520606
8 3.1768552 1.1358143
9 -1.5938076 3.1768552
10 -1.4728010 -1.5938076
11 3.9144201 -1.4728010
12 -3.2462116 3.9144201
13 -4.6115853 -3.2462116
14 -6.0018176 -4.6115853
15 -1.1383245 -6.0018176
16 -3.9829185 -1.1383245
17 1.7502102 -3.9829185
18 -4.9587086 1.7502102
19 -1.9766183 -4.9587086
20 0.2476173 -1.9766183
21 -7.1785801 0.2476173
22 2.1752054 -7.1785801
23 2.8162549 2.1752054
24 -0.8838521 2.8162549
25 -1.5593346 -0.8838521
26 3.6386179 -1.5593346
27 -5.2423545 3.6386179
28 5.2836852 -5.2423545
29 0.6100318 5.2836852
30 -2.5887782 0.6100318
31 1.2772957 -2.5887782
32 1.2510298 1.2772957
33 2.7912218 1.2510298
34 5.2668885 2.7912218
35 1.3818983 5.2668885
36 6.3724285 1.3818983
37 2.7129623 6.3724285
38 6.3714396 2.7129623
39 -0.1448495 6.3714396
40 4.5828535 -0.1448495
41 2.6512561 4.5828535
42 3.9104330 2.6512561
43 4.6705993 3.9104330
44 -2.9815777 4.6705993
45 5.7881093 -2.9815777
46 1.9361157 5.7881093
47 -3.8027028 1.9361157
48 6.6736457 -3.8027028
49 5.5621004 6.6736457
50 -7.8087888 5.5621004
51 5.8371102 -7.8087888
52 -2.3140516 5.8371102
53 -6.0388669 -2.3140516
54 0.2849932 -6.0388669
55 -5.1070911 0.2849932
56 -1.6939246 -5.1070911
57 0.1930566 -1.6939246
58 -7.9054085 0.1930566
59 -4.3098705 -7.9054085
60 -7.4806110 -4.3098705
> 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/776131258644158.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/8w0al1258644158.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/91di61258644158.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/108tkc1258644158.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/11f0yn1258644158.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/12t0i21258644158.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/139yzz1258644158.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/147k351258644158.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/15gtwx1258644158.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/16kz791258644158.tab")
+ }
>
> system("convert tmp/15hx31258644158.ps tmp/15hx31258644158.png")
> system("convert tmp/2j2cj1258644158.ps tmp/2j2cj1258644158.png")
> system("convert tmp/3za9w1258644158.ps tmp/3za9w1258644158.png")
> system("convert tmp/4ugl11258644158.ps tmp/4ugl11258644158.png")
> system("convert tmp/5ym891258644158.ps tmp/5ym891258644158.png")
> system("convert tmp/6cuxm1258644158.ps tmp/6cuxm1258644158.png")
> system("convert tmp/776131258644158.ps tmp/776131258644158.png")
> system("convert tmp/8w0al1258644158.ps tmp/8w0al1258644158.png")
> system("convert tmp/91di61258644158.ps tmp/91di61258644158.png")
> system("convert tmp/108tkc1258644158.ps tmp/108tkc1258644158.png")
>
>
> proc.time()
user system elapsed
2.472 1.604 3.404