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(108.01,102.9,101.21,97.4,119.93,111.4,94.76,87.4,95.26,96.8,117.96,114.1,115.86,110.3,111.44,103.9,108.16,101.6,108.77,94.6,109.45,95.9,124.83,104.7,115.31,102.8,109.49,98.1,124.24,113.9,92.85,80.9,98.42,95.7,120.88,113.2,111.72,105.9,116.1,108.8,109.37,102.3,111.65,99,114.29,100.7,133.68,115.5,114.27,100.7,126.49,109.9,131,114.6,104,85.4,108.88,100.5,128.48,114.8,132.44,116.5,128.04,112.9,116.35,102,120.93,106,118.59,105.3,133.1,118.8,121.05,106.1,127.62,109.3,135.44,117.2,114.88,92.5,114.34,104.2,128.85,112.5,138.9,122.4,129.44,113.3,114.96,100,127.98,110.7,127.03,112.8,128.75,109.8,137.91,117.3,128.37,109.1,135.9,115.9,122.19,96,113.08,99.8,136.2,116.8,138,115.7,115.24,99.4,110.95,94.3,99.23,91,102.39,93.2,112.67,103.1),dim=c(2,60),dimnames=list(c('Y(omzet)','X(prod)'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y(omzet)','X(prod)'),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
Y(omzet) X(prod) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 108.01 102.9 1 0 0 0 0 0 0 0 0 0 0
2 101.21 97.4 0 1 0 0 0 0 0 0 0 0 0
3 119.93 111.4 0 0 1 0 0 0 0 0 0 0 0
4 94.76 87.4 0 0 0 1 0 0 0 0 0 0 0
5 95.26 96.8 0 0 0 0 1 0 0 0 0 0 0
6 117.96 114.1 0 0 0 0 0 1 0 0 0 0 0
7 115.86 110.3 0 0 0 0 0 0 1 0 0 0 0
8 111.44 103.9 0 0 0 0 0 0 0 1 0 0 0
9 108.16 101.6 0 0 0 0 0 0 0 0 1 0 0
10 108.77 94.6 0 0 0 0 0 0 0 0 0 1 0
11 109.45 95.9 0 0 0 0 0 0 0 0 0 0 1
12 124.83 104.7 0 0 0 0 0 0 0 0 0 0 0
13 115.31 102.8 1 0 0 0 0 0 0 0 0 0 0
14 109.49 98.1 0 1 0 0 0 0 0 0 0 0 0
15 124.24 113.9 0 0 1 0 0 0 0 0 0 0 0
16 92.85 80.9 0 0 0 1 0 0 0 0 0 0 0
17 98.42 95.7 0 0 0 0 1 0 0 0 0 0 0
18 120.88 113.2 0 0 0 0 0 1 0 0 0 0 0
19 111.72 105.9 0 0 0 0 0 0 1 0 0 0 0
20 116.10 108.8 0 0 0 0 0 0 0 1 0 0 0
21 109.37 102.3 0 0 0 0 0 0 0 0 1 0 0
22 111.65 99.0 0 0 0 0 0 0 0 0 0 1 0
23 114.29 100.7 0 0 0 0 0 0 0 0 0 0 1
24 133.68 115.5 0 0 0 0 0 0 0 0 0 0 0
25 114.27 100.7 1 0 0 0 0 0 0 0 0 0 0
26 126.49 109.9 0 1 0 0 0 0 0 0 0 0 0
27 131.00 114.6 0 0 1 0 0 0 0 0 0 0 0
28 104.00 85.4 0 0 0 1 0 0 0 0 0 0 0
29 108.88 100.5 0 0 0 0 1 0 0 0 0 0 0
30 128.48 114.8 0 0 0 0 0 1 0 0 0 0 0
31 132.44 116.5 0 0 0 0 0 0 1 0 0 0 0
32 128.04 112.9 0 0 0 0 0 0 0 1 0 0 0
33 116.35 102.0 0 0 0 0 0 0 0 0 1 0 0
34 120.93 106.0 0 0 0 0 0 0 0 0 0 1 0
35 118.59 105.3 0 0 0 0 0 0 0 0 0 0 1
36 133.10 118.8 0 0 0 0 0 0 0 0 0 0 0
37 121.05 106.1 1 0 0 0 0 0 0 0 0 0 0
38 127.62 109.3 0 1 0 0 0 0 0 0 0 0 0
39 135.44 117.2 0 0 1 0 0 0 0 0 0 0 0
40 114.88 92.5 0 0 0 1 0 0 0 0 0 0 0
41 114.34 104.2 0 0 0 0 1 0 0 0 0 0 0
42 128.85 112.5 0 0 0 0 0 1 0 0 0 0 0
43 138.90 122.4 0 0 0 0 0 0 1 0 0 0 0
44 129.44 113.3 0 0 0 0 0 0 0 1 0 0 0
45 114.96 100.0 0 0 0 0 0 0 0 0 1 0 0
46 127.98 110.7 0 0 0 0 0 0 0 0 0 1 0
47 127.03 112.8 0 0 0 0 0 0 0 0 0 0 1
48 128.75 109.8 0 0 0 0 0 0 0 0 0 0 0
49 137.91 117.3 1 0 0 0 0 0 0 0 0 0 0
50 128.37 109.1 0 1 0 0 0 0 0 0 0 0 0
51 135.90 115.9 0 0 1 0 0 0 0 0 0 0 0
52 122.19 96.0 0 0 0 1 0 0 0 0 0 0 0
53 113.08 99.8 0 0 0 0 1 0 0 0 0 0 0
54 136.20 116.8 0 0 0 0 0 1 0 0 0 0 0
55 138.00 115.7 0 0 0 0 0 0 1 0 0 0 0
56 115.24 99.4 0 0 0 0 0 0 0 1 0 0 0
57 110.95 94.3 0 0 0 0 0 0 0 0 1 0 0
58 99.23 91.0 0 0 0 0 0 0 0 0 0 1 0
59 102.39 93.2 0 0 0 0 0 0 0 0 0 0 1
60 112.67 103.1 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `X(prod)` M1 M2 M3 M4
-37.7534 1.4890 -0.7145 0.3984 -3.5877 11.7994
M5 M6 M7 M8 M9 M10
-4.2604 -5.9392 -4.8505 -2.5038 0.7486 2.1750
M11
0.8475
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.4274 -3.1630 0.7381 2.8461 8.3229
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -37.7534 13.3711 -2.823 0.00695 **
`X(prod)` 1.4890 0.1196 12.451 < 2e-16 ***
M1 -0.7145 3.0609 -0.233 0.81645
M2 0.3984 3.0889 0.129 0.89794
M3 -3.5877 3.0569 -1.174 0.24645
M4 11.7994 3.9967 2.952 0.00491 **
M5 -4.2604 3.2885 -1.296 0.20145
M6 -5.9392 3.0508 -1.947 0.05755 .
M7 -4.8505 3.0486 -1.591 0.11830
M8 -2.5038 3.0324 -0.826 0.41316
M9 0.7486 3.2587 0.230 0.81930
M10 2.1750 3.2488 0.669 0.50646
M11 0.8475 3.1933 0.265 0.79187
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.767 on 47 degrees of freedom
Multiple R-squared: 0.8704, Adjusted R-squared: 0.8373
F-statistic: 26.3 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.7893947 0.42121057 0.21060528
[2,] 0.7318699 0.53626012 0.26813006
[3,] 0.7153135 0.56937303 0.28468651
[4,] 0.7143489 0.57130216 0.28565108
[5,] 0.7391583 0.52168340 0.26084170
[6,] 0.8283187 0.34336253 0.17168127
[7,] 0.7474525 0.50509500 0.25254750
[8,] 0.6778721 0.64425570 0.32212785
[9,] 0.6017536 0.79649272 0.39824636
[10,] 0.6072485 0.78550300 0.39275150
[11,] 0.8494754 0.30104914 0.15052457
[12,] 0.8820231 0.23595376 0.11797688
[13,] 0.9387062 0.12258761 0.06129380
[14,] 0.9475234 0.10495317 0.05247659
[15,] 0.9658814 0.06823722 0.03411861
[16,] 0.9677685 0.06446292 0.03223146
[17,] 0.9581463 0.08370744 0.04185372
[18,] 0.9592494 0.08150124 0.04075062
[19,] 0.9352888 0.12942242 0.06471121
[20,] 0.9023590 0.19528191 0.09764096
[21,] 0.9082383 0.18352348 0.09176174
[22,] 0.8705739 0.25885229 0.12942615
[23,] 0.8179545 0.36409092 0.18204546
[24,] 0.7582105 0.48357901 0.24178950
[25,] 0.7047851 0.59042977 0.29521488
[26,] 0.6540652 0.69186953 0.34593476
[27,] 0.5840961 0.83180780 0.41590390
[28,] 0.6720670 0.65586607 0.32793303
[29,] 0.6112783 0.77744339 0.38872169
> postscript(file="/var/www/html/rcomp/tmp/1yzo71258657883.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/2gkgv1258657883.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/37r2d1258657883.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/4l2vm1258657883.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/57chv1258657883.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 7
-6.7435616 -6.4667234 -4.6070971 -9.4274066 -6.8645164 -8.2459742 -5.7763359
8 9 10 11 12 13 14
-3.0132391 -6.1208902 3.4859220 3.5577026 6.6817026 0.7053416 0.7709541
15 16 17 18 19 20 21
-4.0196775 -1.6586976 -2.0665810 -3.9858453 -3.3645944 -5.6494967 -5.9532127
22 23 24 25 26 27 28
-0.1858195 1.2503483 -0.5498446 2.7923091 0.2003747 1.6980000 2.7906577
29 30 31 32 33 34 35
1.2460646 1.2317033 1.5716648 0.1854715 1.4734970 -1.3290445 -1.2991996
36 37 38 39 40 41 42
-6.0436507 1.5315355 2.2237940 2.2665164 3.0985295 1.1966457 5.0264772
43 44 45 46 47 48 49
-0.7536249 0.9898587 3.0615613 -1.2774957 -4.0269407 3.0076386 1.7143754
50 51 52 53 54 55 56
3.2716005 4.6622582 5.1969169 6.4883871 5.9736390 8.3228905 7.4874056
57 58 59 60
7.5390445 -0.6935623 0.5180894 -3.0958459
> postscript(file="/var/www/html/rcomp/tmp/6f00e1258657883.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 -6.7435616 NA
1 -6.4667234 -6.7435616
2 -4.6070971 -6.4667234
3 -9.4274066 -4.6070971
4 -6.8645164 -9.4274066
5 -8.2459742 -6.8645164
6 -5.7763359 -8.2459742
7 -3.0132391 -5.7763359
8 -6.1208902 -3.0132391
9 3.4859220 -6.1208902
10 3.5577026 3.4859220
11 6.6817026 3.5577026
12 0.7053416 6.6817026
13 0.7709541 0.7053416
14 -4.0196775 0.7709541
15 -1.6586976 -4.0196775
16 -2.0665810 -1.6586976
17 -3.9858453 -2.0665810
18 -3.3645944 -3.9858453
19 -5.6494967 -3.3645944
20 -5.9532127 -5.6494967
21 -0.1858195 -5.9532127
22 1.2503483 -0.1858195
23 -0.5498446 1.2503483
24 2.7923091 -0.5498446
25 0.2003747 2.7923091
26 1.6980000 0.2003747
27 2.7906577 1.6980000
28 1.2460646 2.7906577
29 1.2317033 1.2460646
30 1.5716648 1.2317033
31 0.1854715 1.5716648
32 1.4734970 0.1854715
33 -1.3290445 1.4734970
34 -1.2991996 -1.3290445
35 -6.0436507 -1.2991996
36 1.5315355 -6.0436507
37 2.2237940 1.5315355
38 2.2665164 2.2237940
39 3.0985295 2.2665164
40 1.1966457 3.0985295
41 5.0264772 1.1966457
42 -0.7536249 5.0264772
43 0.9898587 -0.7536249
44 3.0615613 0.9898587
45 -1.2774957 3.0615613
46 -4.0269407 -1.2774957
47 3.0076386 -4.0269407
48 1.7143754 3.0076386
49 3.2716005 1.7143754
50 4.6622582 3.2716005
51 5.1969169 4.6622582
52 6.4883871 5.1969169
53 5.9736390 6.4883871
54 8.3228905 5.9736390
55 7.4874056 8.3228905
56 7.5390445 7.4874056
57 -0.6935623 7.5390445
58 0.5180894 -0.6935623
59 -3.0958459 0.5180894
60 NA -3.0958459
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -6.4667234 -6.7435616
[2,] -4.6070971 -6.4667234
[3,] -9.4274066 -4.6070971
[4,] -6.8645164 -9.4274066
[5,] -8.2459742 -6.8645164
[6,] -5.7763359 -8.2459742
[7,] -3.0132391 -5.7763359
[8,] -6.1208902 -3.0132391
[9,] 3.4859220 -6.1208902
[10,] 3.5577026 3.4859220
[11,] 6.6817026 3.5577026
[12,] 0.7053416 6.6817026
[13,] 0.7709541 0.7053416
[14,] -4.0196775 0.7709541
[15,] -1.6586976 -4.0196775
[16,] -2.0665810 -1.6586976
[17,] -3.9858453 -2.0665810
[18,] -3.3645944 -3.9858453
[19,] -5.6494967 -3.3645944
[20,] -5.9532127 -5.6494967
[21,] -0.1858195 -5.9532127
[22,] 1.2503483 -0.1858195
[23,] -0.5498446 1.2503483
[24,] 2.7923091 -0.5498446
[25,] 0.2003747 2.7923091
[26,] 1.6980000 0.2003747
[27,] 2.7906577 1.6980000
[28,] 1.2460646 2.7906577
[29,] 1.2317033 1.2460646
[30,] 1.5716648 1.2317033
[31,] 0.1854715 1.5716648
[32,] 1.4734970 0.1854715
[33,] -1.3290445 1.4734970
[34,] -1.2991996 -1.3290445
[35,] -6.0436507 -1.2991996
[36,] 1.5315355 -6.0436507
[37,] 2.2237940 1.5315355
[38,] 2.2665164 2.2237940
[39,] 3.0985295 2.2665164
[40,] 1.1966457 3.0985295
[41,] 5.0264772 1.1966457
[42,] -0.7536249 5.0264772
[43,] 0.9898587 -0.7536249
[44,] 3.0615613 0.9898587
[45,] -1.2774957 3.0615613
[46,] -4.0269407 -1.2774957
[47,] 3.0076386 -4.0269407
[48,] 1.7143754 3.0076386
[49,] 3.2716005 1.7143754
[50,] 4.6622582 3.2716005
[51,] 5.1969169 4.6622582
[52,] 6.4883871 5.1969169
[53,] 5.9736390 6.4883871
[54,] 8.3228905 5.9736390
[55,] 7.4874056 8.3228905
[56,] 7.5390445 7.4874056
[57,] -0.6935623 7.5390445
[58,] 0.5180894 -0.6935623
[59,] -3.0958459 0.5180894
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -6.4667234 -6.7435616
2 -4.6070971 -6.4667234
3 -9.4274066 -4.6070971
4 -6.8645164 -9.4274066
5 -8.2459742 -6.8645164
6 -5.7763359 -8.2459742
7 -3.0132391 -5.7763359
8 -6.1208902 -3.0132391
9 3.4859220 -6.1208902
10 3.5577026 3.4859220
11 6.6817026 3.5577026
12 0.7053416 6.6817026
13 0.7709541 0.7053416
14 -4.0196775 0.7709541
15 -1.6586976 -4.0196775
16 -2.0665810 -1.6586976
17 -3.9858453 -2.0665810
18 -3.3645944 -3.9858453
19 -5.6494967 -3.3645944
20 -5.9532127 -5.6494967
21 -0.1858195 -5.9532127
22 1.2503483 -0.1858195
23 -0.5498446 1.2503483
24 2.7923091 -0.5498446
25 0.2003747 2.7923091
26 1.6980000 0.2003747
27 2.7906577 1.6980000
28 1.2460646 2.7906577
29 1.2317033 1.2460646
30 1.5716648 1.2317033
31 0.1854715 1.5716648
32 1.4734970 0.1854715
33 -1.3290445 1.4734970
34 -1.2991996 -1.3290445
35 -6.0436507 -1.2991996
36 1.5315355 -6.0436507
37 2.2237940 1.5315355
38 2.2665164 2.2237940
39 3.0985295 2.2665164
40 1.1966457 3.0985295
41 5.0264772 1.1966457
42 -0.7536249 5.0264772
43 0.9898587 -0.7536249
44 3.0615613 0.9898587
45 -1.2774957 3.0615613
46 -4.0269407 -1.2774957
47 3.0076386 -4.0269407
48 1.7143754 3.0076386
49 3.2716005 1.7143754
50 4.6622582 3.2716005
51 5.1969169 4.6622582
52 6.4883871 5.1969169
53 5.9736390 6.4883871
54 8.3228905 5.9736390
55 7.4874056 8.3228905
56 7.5390445 7.4874056
57 -0.6935623 7.5390445
58 0.5180894 -0.6935623
59 -3.0958459 0.5180894
> 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/7wur21258657883.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/8irwx1258657883.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/9xexm1258657883.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/10yi1q1258657883.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/112gq01258657883.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/12kjpb1258657883.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/134l8v1258657883.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/14ct9z1258657883.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/159ddq1258657883.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/16n3lw1258657883.tab")
+ }
>
> system("convert tmp/1yzo71258657883.ps tmp/1yzo71258657883.png")
> system("convert tmp/2gkgv1258657883.ps tmp/2gkgv1258657883.png")
> system("convert tmp/37r2d1258657883.ps tmp/37r2d1258657883.png")
> system("convert tmp/4l2vm1258657883.ps tmp/4l2vm1258657883.png")
> system("convert tmp/57chv1258657883.ps tmp/57chv1258657883.png")
> system("convert tmp/6f00e1258657883.ps tmp/6f00e1258657883.png")
> system("convert tmp/7wur21258657883.ps tmp/7wur21258657883.png")
> system("convert tmp/8irwx1258657883.ps tmp/8irwx1258657883.png")
> system("convert tmp/9xexm1258657883.ps tmp/9xexm1258657883.png")
> system("convert tmp/10yi1q1258657883.ps tmp/10yi1q1258657883.png")
>
>
> proc.time()
user system elapsed
2.395 1.549 4.708