R version 2.11.1 (2010-05-31)
Copyright (C) 2010 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(101.82
+ ,107.34
+ ,93.63
+ ,99.85
+ ,101.76
+ ,101.68
+ ,107.34
+ ,93.63
+ ,99.91
+ ,102.37
+ ,101.68
+ ,107.34
+ ,93.63
+ ,99.87
+ ,102.38
+ ,102.45
+ ,107.34
+ ,96.13
+ ,99.86
+ ,102.86
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.10
+ ,102.87
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.10
+ ,102.92
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.12
+ ,102.95
+ ,102.45
+ ,107.34
+ ,96.13
+ ,99.95
+ ,103.02
+ ,102.45
+ ,112.60
+ ,96.13
+ ,99.94
+ ,104.08
+ ,102.52
+ ,112.60
+ ,96.13
+ ,100.18
+ ,104.16
+ ,102.52
+ ,112.60
+ ,96.13
+ ,100.31
+ ,104.24
+ ,102.85
+ ,112.60
+ ,96.13
+ ,100.65
+ ,104.33
+ ,102.85
+ ,112.61
+ ,96.13
+ ,100.65
+ ,104.73
+ ,102.85
+ ,112.61
+ ,96.13
+ ,100.69
+ ,104.86
+ ,103.25
+ ,112.61
+ ,96.13
+ ,101.26
+ ,105.03
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.26
+ ,105.62
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.63
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.63
+ ,104.45
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.94
+ ,104.45
+ ,112.61
+ ,98.73
+ ,101.44
+ ,106.61
+ ,104.45
+ ,118.65
+ ,98.73
+ ,101.40
+ ,107.69
+ ,104.80
+ ,118.65
+ ,98.73
+ ,101.40
+ ,107.78
+ ,104.80
+ ,118.65
+ ,98.73
+ ,100.58
+ ,107.93
+ ,105.29
+ ,118.65
+ ,98.73
+ ,100.58
+ ,108.48
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.58
+ ,108.14
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.59
+ ,108.48
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.81
+ ,108.48
+ ,106.04
+ ,114.29
+ ,101.67
+ ,100.75
+ ,108.89
+ ,105.94
+ ,114.29
+ ,101.67
+ ,100.75
+ ,108.93
+ ,105.94
+ ,114.29
+ ,101.67
+ ,100.96
+ ,109.21
+ ,105.94
+ ,114.29
+ ,101.67
+ ,101.31
+ ,109.47
+ ,106.28
+ ,114.29
+ ,101.67
+ ,101.64
+ ,109.80
+ ,106.48
+ ,123.33
+ ,101.67
+ ,101.46
+ ,111.73
+ ,107.19
+ ,123.33
+ ,101.67
+ ,101.73
+ ,111.85
+ ,108.14
+ ,123.33
+ ,101.67
+ ,101.73
+ ,112.12
+ ,108.22
+ ,123.33
+ ,101.67
+ ,101.64
+ ,112.15
+ ,108.22
+ ,123.33
+ ,101.67
+ ,101.77
+ ,112.17
+ ,108.61
+ ,123.33
+ ,101.67
+ ,101.74
+ ,112.67
+ ,108.61
+ ,123.33
+ ,101.67
+ ,101.89
+ ,112.80
+ ,108.61
+ ,123.33
+ ,107.94
+ ,101.89
+ ,113.44
+ ,108.61
+ ,123.33
+ ,107.94
+ ,101.93
+ ,113.53
+ ,109.06
+ ,123.33
+ ,107.94
+ ,101.93
+ ,114.53
+ ,109.06
+ ,123.33
+ ,107.94
+ ,102.32
+ ,114.51
+ ,112.93
+ ,123.33
+ ,107.94
+ ,102.41
+ ,115.05
+ ,115.84
+ ,129.03
+ ,107.94
+ ,103.58
+ ,116.67
+ ,118.57
+ ,128.76
+ ,107.94
+ ,104.12
+ ,117.07
+ ,118.57
+ ,128.76
+ ,107.94
+ ,104.10
+ ,116.92
+ ,118.86
+ ,128.76
+ ,107.94
+ ,104.15
+ ,117.00
+ ,118.98
+ ,128.76
+ ,107.94
+ ,104.15
+ ,117.02
+ ,119.27
+ ,128.76
+ ,107.94
+ ,104.16
+ ,117.35
+ ,119.39
+ ,128.76
+ ,107.94
+ ,102.94
+ ,117.36
+ ,119.49
+ ,128.76
+ ,110.30
+ ,103.07
+ ,117.82
+ ,119.59
+ ,128.76
+ ,110.30
+ ,103.04
+ ,117.88
+ ,120.12
+ ,128.76
+ ,110.30
+ ,103.06
+ ,118.24
+ ,120.14
+ ,128.76
+ ,110.30
+ ,103.05
+ ,118.50
+ ,120.14
+ ,128.76
+ ,110.30
+ ,102.95
+ ,118.80
+ ,120.14
+ ,132.63
+ ,110.30
+ ,102.95
+ ,119.76
+ ,120.14
+ ,132.63
+ ,110.30
+ ,103.05
+ ,120.09)
+ ,dim=c(5
+ ,58)
+ ,dimnames=list(c('Bioscoop'
+ ,'Schouwburgabonnement'
+ ,'Eendagsattracties'
+ ,'HuurvaneenDVD'
+ ,'And.dienstenrecr.&cultuur')
+ ,1:58))
> y <- array(NA,dim=c(5,58),dimnames=list(c('Bioscoop','Schouwburgabonnement','Eendagsattracties','HuurvaneenDVD','And.dienstenrecr.&cultuur'),1:58))
> 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 = '3'
> #'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
> 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
Eendagsattracties Bioscoop Schouwburgabonnement HuurvaneenDVD
1 93.63 101.82 107.34 99.85
2 93.63 101.68 107.34 99.91
3 93.63 101.68 107.34 99.87
4 96.13 102.45 107.34 99.86
5 96.13 102.45 107.34 100.10
6 96.13 102.45 107.34 100.10
7 96.13 102.45 107.34 100.12
8 96.13 102.45 107.34 99.95
9 96.13 102.45 112.60 99.94
10 96.13 102.52 112.60 100.18
11 96.13 102.52 112.60 100.31
12 96.13 102.85 112.60 100.65
13 96.13 102.85 112.61 100.65
14 96.13 102.85 112.61 100.69
15 96.13 103.25 112.61 101.26
16 98.73 103.25 112.61 101.26
17 98.73 103.25 112.61 101.38
18 98.73 103.25 112.61 101.38
19 98.73 104.45 112.61 101.38
20 98.73 104.45 112.61 101.44
21 98.73 104.45 118.65 101.40
22 98.73 104.80 118.65 101.40
23 98.73 104.80 118.65 100.58
24 98.73 105.29 118.65 100.58
25 98.73 105.29 114.29 100.58
26 98.73 105.29 114.29 100.59
27 98.73 105.29 114.29 100.81
28 101.67 106.04 114.29 100.75
29 101.67 105.94 114.29 100.75
30 101.67 105.94 114.29 100.96
31 101.67 105.94 114.29 101.31
32 101.67 106.28 114.29 101.64
33 101.67 106.48 123.33 101.46
34 101.67 107.19 123.33 101.73
35 101.67 108.14 123.33 101.73
36 101.67 108.22 123.33 101.64
37 101.67 108.22 123.33 101.77
38 101.67 108.61 123.33 101.74
39 101.67 108.61 123.33 101.89
40 107.94 108.61 123.33 101.89
41 107.94 108.61 123.33 101.93
42 107.94 109.06 123.33 101.93
43 107.94 109.06 123.33 102.32
44 107.94 112.93 123.33 102.41
45 107.94 115.84 129.03 103.58
46 107.94 118.57 128.76 104.12
47 107.94 118.57 128.76 104.10
48 107.94 118.86 128.76 104.15
49 107.94 118.98 128.76 104.15
50 107.94 119.27 128.76 104.16
51 107.94 119.39 128.76 102.94
52 110.30 119.49 128.76 103.07
53 110.30 119.59 128.76 103.04
54 110.30 120.12 128.76 103.06
55 110.30 120.14 128.76 103.05
56 110.30 120.14 128.76 102.95
57 110.30 120.14 132.63 102.95
58 110.30 120.14 132.63 103.05
And.dienstenrecr.&cultuur t
1 101.76 1
2 102.37 2
3 102.38 3
4 102.86 4
5 102.87 5
6 102.92 6
7 102.95 7
8 103.02 8
9 104.08 9
10 104.16 10
11 104.24 11
12 104.33 12
13 104.73 13
14 104.86 14
15 105.03 15
16 105.62 16
17 105.63 17
18 105.63 18
19 105.94 19
20 106.61 20
21 107.69 21
22 107.78 22
23 107.93 23
24 108.48 24
25 108.14 25
26 108.48 26
27 108.48 27
28 108.89 28
29 108.93 29
30 109.21 30
31 109.47 31
32 109.80 32
33 111.73 33
34 111.85 34
35 112.12 35
36 112.15 36
37 112.17 37
38 112.67 38
39 112.80 39
40 113.44 40
41 113.53 41
42 114.53 42
43 114.51 43
44 115.05 44
45 116.67 45
46 117.07 46
47 116.92 47
48 117.00 48
49 117.02 49
50 117.35 50
51 117.36 51
52 117.82 52
53 117.88 53
54 118.24 54
55 118.50 55
56 118.80 56
57 119.76 57
58 120.09 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Bioscoop
-81.28373 -0.06431
Schouwburgabonnement HuurvaneenDVD
-0.42720 0.42474
`And.dienstenrecr.&cultuur` t
1.82171 -0.10437
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.06928 -0.68176 -0.01254 0.65427 3.13920
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -81.28373 45.49079 -1.787 0.079797 .
Bioscoop -0.06431 0.09670 -0.665 0.508961
Schouwburgabonnement -0.42720 0.10308 -4.144 0.000126 ***
HuurvaneenDVD 0.42474 0.33997 1.249 0.217137
`And.dienstenrecr.&cultuur` 1.82171 0.46546 3.914 0.000265 ***
t -0.10437 0.10499 -0.994 0.324808
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.148 on 52 degrees of freedom
Multiple R-squared: 0.9586, Adjusted R-squared: 0.9547
F-statistic: 241.1 on 5 and 52 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,] 1.093255e-06 2.186510e-06 0.999998907
[2,] 2.726276e-05 5.452553e-05 0.999972737
[3,] 1.941949e-06 3.883898e-06 0.999998058
[4,] 1.296286e-04 2.592571e-04 0.999870371
[5,] 1.359963e-04 2.719926e-04 0.999864004
[6,] 4.432124e-05 8.864249e-05 0.999955679
[7,] 1.204191e-05 2.408381e-05 0.999987958
[8,] 1.895650e-03 3.791300e-03 0.998104350
[9,] 3.363979e-03 6.727958e-03 0.996636021
[10,] 3.574566e-03 7.149133e-03 0.996425434
[11,] 8.395920e-03 1.679184e-02 0.991604080
[12,] 2.118095e-02 4.236191e-02 0.978819047
[13,] 1.429259e-02 2.858518e-02 0.985707412
[14,] 1.204341e-02 2.408683e-02 0.987956586
[15,] 1.936085e-02 3.872171e-02 0.980639147
[16,] 2.687579e-02 5.375158e-02 0.973124211
[17,] 3.582424e-02 7.164849e-02 0.964175756
[18,] 3.452725e-02 6.905450e-02 0.965472751
[19,] 3.448919e-02 6.897838e-02 0.965510808
[20,] 6.141330e-02 1.228266e-01 0.938586700
[21,] 7.392291e-02 1.478458e-01 0.926077091
[22,] 6.018118e-02 1.203624e-01 0.939818821
[23,] 3.914113e-02 7.828226e-02 0.960858869
[24,] 4.815338e-02 9.630676e-02 0.951846618
[25,] 3.434737e-02 6.869474e-02 0.965652632
[26,] 2.175870e-02 4.351741e-02 0.978241296
[27,] 1.507517e-02 3.015033e-02 0.984924833
[28,] 9.456310e-03 1.891262e-02 0.990543690
[29,] 6.000072e-03 1.200014e-02 0.993999928
[30,] 1.441886e-02 2.883771e-02 0.985581144
[31,] 8.912035e-01 2.175929e-01 0.108796465
[32,] 9.902483e-01 1.950337e-02 0.009751687
[33,] 9.967415e-01 6.516999e-03 0.003258500
[34,] 9.935808e-01 1.283845e-02 0.006419223
[35,] 9.890819e-01 2.183617e-02 0.010918086
[36,] 9.833936e-01 3.321281e-02 0.016606403
[37,] 9.643789e-01 7.124216e-02 0.035621078
[38,] 9.296296e-01 1.407407e-01 0.070370368
[39,] 8.636051e-01 2.727899e-01 0.136394931
[40,] 7.538185e-01 4.923630e-01 0.246181520
[41,] 5.985980e-01 8.028040e-01 0.401402003
> postscript(file="/var/www/rcomp/tmp/1qvex1290172019.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/rcomp/tmp/2qvex1290172019.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/rcomp/tmp/31mdi1290172019.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/rcomp/tmp/41mdi1290172019.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/rcomp/tmp/51mdi1290172019.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 = 58
Frequency = 1
1 2 3 4 5 6
-0.36482233 -1.40618248 -1.30304104 0.48067724 0.46489173 0.47817535
7 8 9 10 11 12
0.51939831 0.56845345 0.99313917 0.85433612 0.75775246 0.57497983
13 14 15 16 17 18
-0.04506179 -0.19450425 -0.61620148 1.01336067 1.04854386 1.15291279
19 20 21 22 23 24
0.76972838 -0.37193033 0.36228035 0.32520527 0.50460432 -0.36145188
25 26 27 28 29 30
-1.50029989 -2.01955853 -2.00863219 0.36255623 0.38762561 -0.10727846
31 32 33 34 35 36
-0.62521187 -1.24030353 -0.70061369 -0.88386683 -1.21026125 -1.11717194
37 38 39 40 41 42
-1.10445321 -1.87311323 -2.06927699 3.13919985 3.06262564 1.37422903
43 44 45 46 47 48
1.34938384 0.68069622 -0.04084638 -0.83428887 -0.44816919 -0.49212294
49 50 51 52 53 54
-0.41647057 -0.89886136 -0.28681021 1.29078900 1.30502903 0.77917478
55 56 57 58
0.41543370 0.01576463 0.02456396 -0.51470413
> postscript(file="/var/www/rcomp/tmp/6uvul1290172019.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.36482233 NA
1 -1.40618248 -0.36482233
2 -1.30304104 -1.40618248
3 0.48067724 -1.30304104
4 0.46489173 0.48067724
5 0.47817535 0.46489173
6 0.51939831 0.47817535
7 0.56845345 0.51939831
8 0.99313917 0.56845345
9 0.85433612 0.99313917
10 0.75775246 0.85433612
11 0.57497983 0.75775246
12 -0.04506179 0.57497983
13 -0.19450425 -0.04506179
14 -0.61620148 -0.19450425
15 1.01336067 -0.61620148
16 1.04854386 1.01336067
17 1.15291279 1.04854386
18 0.76972838 1.15291279
19 -0.37193033 0.76972838
20 0.36228035 -0.37193033
21 0.32520527 0.36228035
22 0.50460432 0.32520527
23 -0.36145188 0.50460432
24 -1.50029989 -0.36145188
25 -2.01955853 -1.50029989
26 -2.00863219 -2.01955853
27 0.36255623 -2.00863219
28 0.38762561 0.36255623
29 -0.10727846 0.38762561
30 -0.62521187 -0.10727846
31 -1.24030353 -0.62521187
32 -0.70061369 -1.24030353
33 -0.88386683 -0.70061369
34 -1.21026125 -0.88386683
35 -1.11717194 -1.21026125
36 -1.10445321 -1.11717194
37 -1.87311323 -1.10445321
38 -2.06927699 -1.87311323
39 3.13919985 -2.06927699
40 3.06262564 3.13919985
41 1.37422903 3.06262564
42 1.34938384 1.37422903
43 0.68069622 1.34938384
44 -0.04084638 0.68069622
45 -0.83428887 -0.04084638
46 -0.44816919 -0.83428887
47 -0.49212294 -0.44816919
48 -0.41647057 -0.49212294
49 -0.89886136 -0.41647057
50 -0.28681021 -0.89886136
51 1.29078900 -0.28681021
52 1.30502903 1.29078900
53 0.77917478 1.30502903
54 0.41543370 0.77917478
55 0.01576463 0.41543370
56 0.02456396 0.01576463
57 -0.51470413 0.02456396
58 NA -0.51470413
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.40618248 -0.36482233
[2,] -1.30304104 -1.40618248
[3,] 0.48067724 -1.30304104
[4,] 0.46489173 0.48067724
[5,] 0.47817535 0.46489173
[6,] 0.51939831 0.47817535
[7,] 0.56845345 0.51939831
[8,] 0.99313917 0.56845345
[9,] 0.85433612 0.99313917
[10,] 0.75775246 0.85433612
[11,] 0.57497983 0.75775246
[12,] -0.04506179 0.57497983
[13,] -0.19450425 -0.04506179
[14,] -0.61620148 -0.19450425
[15,] 1.01336067 -0.61620148
[16,] 1.04854386 1.01336067
[17,] 1.15291279 1.04854386
[18,] 0.76972838 1.15291279
[19,] -0.37193033 0.76972838
[20,] 0.36228035 -0.37193033
[21,] 0.32520527 0.36228035
[22,] 0.50460432 0.32520527
[23,] -0.36145188 0.50460432
[24,] -1.50029989 -0.36145188
[25,] -2.01955853 -1.50029989
[26,] -2.00863219 -2.01955853
[27,] 0.36255623 -2.00863219
[28,] 0.38762561 0.36255623
[29,] -0.10727846 0.38762561
[30,] -0.62521187 -0.10727846
[31,] -1.24030353 -0.62521187
[32,] -0.70061369 -1.24030353
[33,] -0.88386683 -0.70061369
[34,] -1.21026125 -0.88386683
[35,] -1.11717194 -1.21026125
[36,] -1.10445321 -1.11717194
[37,] -1.87311323 -1.10445321
[38,] -2.06927699 -1.87311323
[39,] 3.13919985 -2.06927699
[40,] 3.06262564 3.13919985
[41,] 1.37422903 3.06262564
[42,] 1.34938384 1.37422903
[43,] 0.68069622 1.34938384
[44,] -0.04084638 0.68069622
[45,] -0.83428887 -0.04084638
[46,] -0.44816919 -0.83428887
[47,] -0.49212294 -0.44816919
[48,] -0.41647057 -0.49212294
[49,] -0.89886136 -0.41647057
[50,] -0.28681021 -0.89886136
[51,] 1.29078900 -0.28681021
[52,] 1.30502903 1.29078900
[53,] 0.77917478 1.30502903
[54,] 0.41543370 0.77917478
[55,] 0.01576463 0.41543370
[56,] 0.02456396 0.01576463
[57,] -0.51470413 0.02456396
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.40618248 -0.36482233
2 -1.30304104 -1.40618248
3 0.48067724 -1.30304104
4 0.46489173 0.48067724
5 0.47817535 0.46489173
6 0.51939831 0.47817535
7 0.56845345 0.51939831
8 0.99313917 0.56845345
9 0.85433612 0.99313917
10 0.75775246 0.85433612
11 0.57497983 0.75775246
12 -0.04506179 0.57497983
13 -0.19450425 -0.04506179
14 -0.61620148 -0.19450425
15 1.01336067 -0.61620148
16 1.04854386 1.01336067
17 1.15291279 1.04854386
18 0.76972838 1.15291279
19 -0.37193033 0.76972838
20 0.36228035 -0.37193033
21 0.32520527 0.36228035
22 0.50460432 0.32520527
23 -0.36145188 0.50460432
24 -1.50029989 -0.36145188
25 -2.01955853 -1.50029989
26 -2.00863219 -2.01955853
27 0.36255623 -2.00863219
28 0.38762561 0.36255623
29 -0.10727846 0.38762561
30 -0.62521187 -0.10727846
31 -1.24030353 -0.62521187
32 -0.70061369 -1.24030353
33 -0.88386683 -0.70061369
34 -1.21026125 -0.88386683
35 -1.11717194 -1.21026125
36 -1.10445321 -1.11717194
37 -1.87311323 -1.10445321
38 -2.06927699 -1.87311323
39 3.13919985 -2.06927699
40 3.06262564 3.13919985
41 1.37422903 3.06262564
42 1.34938384 1.37422903
43 0.68069622 1.34938384
44 -0.04084638 0.68069622
45 -0.83428887 -0.04084638
46 -0.44816919 -0.83428887
47 -0.49212294 -0.44816919
48 -0.41647057 -0.49212294
49 -0.89886136 -0.41647057
50 -0.28681021 -0.89886136
51 1.29078900 -0.28681021
52 1.30502903 1.29078900
53 0.77917478 1.30502903
54 0.41543370 0.77917478
55 0.01576463 0.41543370
56 0.02456396 0.01576463
57 -0.51470413 0.02456396
> 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/rcomp/tmp/7m4t61290172019.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/rcomp/tmp/8m4t61290172019.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/rcomp/tmp/9m4t61290172019.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/rcomp/tmp/10fws91290172019.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11iwrf1290172019.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/rcomp/tmp/12mx8l1290172019.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/rcomp/tmp/13i7nb1290172019.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/rcomp/tmp/14374z1290172019.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/rcomp/tmp/15pqk51290172019.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/rcomp/tmp/16sqjb1290172019.tab")
+ }
>
> try(system("convert tmp/1qvex1290172019.ps tmp/1qvex1290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qvex1290172019.ps tmp/2qvex1290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/31mdi1290172019.ps tmp/31mdi1290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/41mdi1290172019.ps tmp/41mdi1290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/51mdi1290172019.ps tmp/51mdi1290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/6uvul1290172019.ps tmp/6uvul1290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/7m4t61290172019.ps tmp/7m4t61290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/8m4t61290172019.ps tmp/8m4t61290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/9m4t61290172019.ps tmp/9m4t61290172019.png",intern=TRUE))
character(0)
> try(system("convert tmp/10fws91290172019.ps tmp/10fws91290172019.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.700 2.110 5.747