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(6
+ ,101.82
+ ,107.34
+ ,93.63
+ ,99.85
+ ,101.76
+ ,6
+ ,101.68
+ ,107.34
+ ,93.63
+ ,99.91
+ ,102.37
+ ,6
+ ,101.68
+ ,107.34
+ ,93.63
+ ,99.87
+ ,102.38
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,99.86
+ ,102.86
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.10
+ ,102.87
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.10
+ ,102.92
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.12
+ ,102.95
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,99.95
+ ,103.02
+ ,6
+ ,102.45
+ ,112.60
+ ,96.13
+ ,99.94
+ ,104.08
+ ,6
+ ,102.52
+ ,112.60
+ ,96.13
+ ,100.18
+ ,104.16
+ ,6
+ ,102.52
+ ,112.60
+ ,96.13
+ ,100.31
+ ,104.24
+ ,6
+ ,102.85
+ ,112.60
+ ,96.13
+ ,100.65
+ ,104.33
+ ,7
+ ,102.85
+ ,112.61
+ ,96.13
+ ,100.65
+ ,104.73
+ ,7
+ ,102.85
+ ,112.61
+ ,96.13
+ ,100.69
+ ,104.86
+ ,7
+ ,103.25
+ ,112.61
+ ,96.13
+ ,101.26
+ ,105.03
+ ,7
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.26
+ ,105.62
+ ,7
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.63
+ ,7
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.63
+ ,7
+ ,104.45
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.94
+ ,7
+ ,104.45
+ ,112.61
+ ,98.73
+ ,101.44
+ ,106.61
+ ,7
+ ,104.45
+ ,118.65
+ ,98.73
+ ,101.40
+ ,107.69
+ ,7
+ ,104.80
+ ,118.65
+ ,98.73
+ ,101.40
+ ,107.78
+ ,7
+ ,104.80
+ ,118.65
+ ,98.73
+ ,100.58
+ ,107.93
+ ,7
+ ,105.29
+ ,118.65
+ ,98.73
+ ,100.58
+ ,108.48
+ ,8
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.58
+ ,108.14
+ ,8
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.59
+ ,108.48
+ ,8
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.81
+ ,108.48
+ ,8
+ ,106.04
+ ,114.29
+ ,101.67
+ ,100.75
+ ,108.89
+ ,8
+ ,105.94
+ ,114.29
+ ,101.67
+ ,100.75
+ ,108.93
+ ,8
+ ,105.94
+ ,114.29
+ ,101.67
+ ,100.96
+ ,109.21
+ ,8
+ ,105.94
+ ,114.29
+ ,101.67
+ ,101.31
+ ,109.47
+ ,8
+ ,106.28
+ ,114.29
+ ,101.67
+ ,101.64
+ ,109.80
+ ,8
+ ,106.48
+ ,123.33
+ ,101.67
+ ,101.46
+ ,111.73
+ ,8
+ ,107.19
+ ,123.33
+ ,101.67
+ ,101.73
+ ,111.85
+ ,8
+ ,108.14
+ ,123.33
+ ,101.67
+ ,101.73
+ ,112.12
+ ,8
+ ,108.22
+ ,123.33
+ ,101.67
+ ,101.64
+ ,112.15
+ ,9
+ ,108.22
+ ,123.33
+ ,101.67
+ ,101.77
+ ,112.17
+ ,9
+ ,108.61
+ ,123.33
+ ,101.67
+ ,101.74
+ ,112.67
+ ,9
+ ,108.61
+ ,123.33
+ ,101.67
+ ,101.89
+ ,112.80
+ ,9
+ ,108.61
+ ,123.33
+ ,107.94
+ ,101.89
+ ,113.44
+ ,9
+ ,108.61
+ ,123.33
+ ,107.94
+ ,101.93
+ ,113.53
+ ,9
+ ,109.06
+ ,123.33
+ ,107.94
+ ,101.93
+ ,114.53
+ ,9
+ ,109.06
+ ,123.33
+ ,107.94
+ ,102.32
+ ,114.51
+ ,9
+ ,112.93
+ ,123.33
+ ,107.94
+ ,102.41
+ ,115.05
+ ,9
+ ,115.84
+ ,129.03
+ ,107.94
+ ,103.58
+ ,116.67
+ ,9
+ ,118.57
+ ,128.76
+ ,107.94
+ ,104.12
+ ,117.07
+ ,9
+ ,118.57
+ ,128.76
+ ,107.94
+ ,104.10
+ ,116.92
+ ,9
+ ,118.86
+ ,128.76
+ ,107.94
+ ,104.15
+ ,117.00
+ ,10
+ ,118.98
+ ,128.76
+ ,107.94
+ ,104.15
+ ,117.02
+ ,10
+ ,119.27
+ ,128.76
+ ,107.94
+ ,104.16
+ ,117.35
+ ,10
+ ,119.39
+ ,128.76
+ ,107.94
+ ,102.94
+ ,117.36
+ ,10
+ ,119.49
+ ,128.76
+ ,110.30
+ ,103.07
+ ,117.82
+ ,10
+ ,119.59
+ ,128.76
+ ,110.30
+ ,103.04
+ ,117.88
+ ,10
+ ,120.12
+ ,128.76
+ ,110.30
+ ,103.06
+ ,118.24
+ ,10
+ ,120.14
+ ,128.76
+ ,110.30
+ ,103.05
+ ,118.50
+ ,10
+ ,120.14
+ ,128.76
+ ,110.30
+ ,102.95
+ ,118.80
+ ,10
+ ,120.14
+ ,132.63
+ ,110.30
+ ,102.95
+ ,119.76
+ ,10
+ ,120.14
+ ,132.63
+ ,110.30
+ ,103.05
+ ,120.09)
+ ,dim=c(6
+ ,58)
+ ,dimnames=list(c('Jaar'
+ ,'Bioscoop'
+ ,'Schouwburg'
+ ,'Eendagattractie'
+ ,'DVDhuren'
+ ,'Cultuuruitgaves')
+ ,1:58))
> y <- array(NA,dim=c(6,58),dimnames=list(c('Jaar','Bioscoop','Schouwburg','Eendagattractie','DVDhuren','Cultuuruitgaves'),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 = '6'
> #'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
Cultuuruitgaves Jaar Bioscoop Schouwburg Eendagattractie DVDhuren t
1 101.76 6 101.82 107.34 93.63 99.85 1
2 102.37 6 101.68 107.34 93.63 99.91 2
3 102.38 6 101.68 107.34 93.63 99.87 3
4 102.86 6 102.45 107.34 96.13 99.86 4
5 102.87 6 102.45 107.34 96.13 100.10 5
6 102.92 6 102.45 107.34 96.13 100.10 6
7 102.95 6 102.45 107.34 96.13 100.12 7
8 103.02 6 102.45 107.34 96.13 99.95 8
9 104.08 6 102.45 112.60 96.13 99.94 9
10 104.16 6 102.52 112.60 96.13 100.18 10
11 104.24 6 102.52 112.60 96.13 100.31 11
12 104.33 6 102.85 112.60 96.13 100.65 12
13 104.73 7 102.85 112.61 96.13 100.65 13
14 104.86 7 102.85 112.61 96.13 100.69 14
15 105.03 7 103.25 112.61 96.13 101.26 15
16 105.62 7 103.25 112.61 98.73 101.26 16
17 105.63 7 103.25 112.61 98.73 101.38 17
18 105.63 7 103.25 112.61 98.73 101.38 18
19 105.94 7 104.45 112.61 98.73 101.38 19
20 106.61 7 104.45 112.61 98.73 101.44 20
21 107.69 7 104.45 118.65 98.73 101.40 21
22 107.78 7 104.80 118.65 98.73 101.40 22
23 107.93 7 104.80 118.65 98.73 100.58 23
24 108.48 7 105.29 118.65 98.73 100.58 24
25 108.14 8 105.29 114.29 98.73 100.58 25
26 108.48 8 105.29 114.29 98.73 100.59 26
27 108.48 8 105.29 114.29 98.73 100.81 27
28 108.89 8 106.04 114.29 101.67 100.75 28
29 108.93 8 105.94 114.29 101.67 100.75 29
30 109.21 8 105.94 114.29 101.67 100.96 30
31 109.47 8 105.94 114.29 101.67 101.31 31
32 109.80 8 106.28 114.29 101.67 101.64 32
33 111.73 8 106.48 123.33 101.67 101.46 33
34 111.85 8 107.19 123.33 101.67 101.73 34
35 112.12 8 108.14 123.33 101.67 101.73 35
36 112.15 8 108.22 123.33 101.67 101.64 36
37 112.17 9 108.22 123.33 101.67 101.77 37
38 112.67 9 108.61 123.33 101.67 101.74 38
39 112.80 9 108.61 123.33 101.67 101.89 39
40 113.44 9 108.61 123.33 107.94 101.89 40
41 113.53 9 108.61 123.33 107.94 101.93 41
42 114.53 9 109.06 123.33 107.94 101.93 42
43 114.51 9 109.06 123.33 107.94 102.32 43
44 115.05 9 112.93 123.33 107.94 102.41 44
45 116.67 9 115.84 129.03 107.94 103.58 45
46 117.07 9 118.57 128.76 107.94 104.12 46
47 116.92 9 118.57 128.76 107.94 104.10 47
48 117.00 9 118.86 128.76 107.94 104.15 48
49 117.02 10 118.98 128.76 107.94 104.15 49
50 117.35 10 119.27 128.76 107.94 104.16 50
51 117.36 10 119.39 128.76 107.94 102.94 51
52 117.82 10 119.49 128.76 110.30 103.07 52
53 117.88 10 119.59 128.76 110.30 103.04 53
54 118.24 10 120.12 128.76 110.30 103.06 54
55 118.50 10 120.14 128.76 110.30 103.05 55
56 118.80 10 120.14 128.76 110.30 102.95 56
57 119.76 10 120.14 132.63 110.30 102.95 57
58 120.09 10 120.14 132.63 110.30 103.05 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Jaar Bioscoop Schouwburg
67.23149 0.08089 0.11190 0.17727
Eendagattractie DVDhuren t
0.12737 -0.08684 0.16915
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.50065 -0.23830 -0.02876 0.20518 0.65852
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 67.23149 8.06105 8.340 4.29e-11 ***
Jaar 0.08089 0.15474 0.523 0.603391
Bioscoop 0.11190 0.02032 5.506 1.20e-06 ***
Schouwburg 0.17727 0.02162 8.199 7.11e-11 ***
Eendagattractie 0.12737 0.03248 3.921 0.000264 ***
DVDhuren -0.08684 0.09024 -0.962 0.340437
t 0.16915 0.02091 8.089 1.06e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3027 on 51 degrees of freedom
Multiple R-squared: 0.9974, Adjusted R-squared: 0.9971
F-statistic: 3213 on 6 and 51 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.11242093 0.22484185 0.88757907
[2,] 0.04761017 0.09522035 0.95238983
[3,] 0.22682486 0.45364973 0.77317514
[4,] 0.13701640 0.27403279 0.86298360
[5,] 0.07689296 0.15378592 0.92310704
[6,] 0.05691248 0.11382496 0.94308752
[7,] 0.04124541 0.08249082 0.95875459
[8,] 0.02555298 0.05110596 0.97444702
[9,] 0.02305810 0.04611621 0.97694190
[10,] 0.02864982 0.05729963 0.97135018
[11,] 0.22815238 0.45630476 0.77184762
[12,] 0.27405915 0.54811830 0.72594085
[13,] 0.27136927 0.54273854 0.72863073
[14,] 0.31202672 0.62405345 0.68797328
[15,] 0.35538170 0.71076340 0.64461830
[16,] 0.32063747 0.64127495 0.67936253
[17,] 0.47918161 0.95836321 0.52081839
[18,] 0.49754836 0.99509672 0.50245164
[19,] 0.49089172 0.98178343 0.50910828
[20,] 0.42526977 0.85053955 0.57473023
[21,] 0.36677052 0.73354105 0.63322948
[22,] 0.38749671 0.77499343 0.61250329
[23,] 0.42561947 0.85123893 0.57438053
[24,] 0.66125222 0.67749556 0.33874778
[25,] 0.59212066 0.81575868 0.40787934
[26,] 0.52442277 0.95115445 0.47557723
[27,] 0.58011863 0.83976273 0.41988137
[28,] 0.65519068 0.68961864 0.34480932
[29,] 0.58256648 0.83486705 0.41743352
[30,] 0.52141685 0.95716630 0.47858315
[31,] 0.50245864 0.99508272 0.49754136
[32,] 0.90118021 0.19763958 0.09881979
[33,] 0.90565105 0.18869790 0.09434895
[34,] 0.91740401 0.16519197 0.08259599
[35,] 0.88506257 0.22987487 0.11493743
[36,] 0.82412214 0.35175573 0.17587786
[37,] 0.98383383 0.03233234 0.01616617
[38,] 0.98341440 0.03317120 0.01658560
[39,] 0.94490529 0.11018943 0.05509471
> postscript(file="/var/www/html/rcomp/tmp/1plat1290168858.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/2hu9e1290168858.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/3hu9e1290168858.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/4hu9e1290168858.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/5al8h1290168858.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.19679298 0.65851795 0.49589263 0.40127855 0.26296809 0.14381632
7 8 9 10 11 12
0.00640133 -0.10751303 -0.14998039 -0.22612406 -0.30398678 -0.39054133
13 14 15 16 17 18
-0.24236071 -0.27803893 -0.27245376 -0.18277135 -0.33150246 -0.50065423
19 20 21 22 23 24
-0.49408950 0.01196906 -0.15137511 -0.26969290 -0.36005247 -0.03403667
25 26 27 28 29 30
0.14881967 0.32053629 0.17048905 -0.05227236 -0.17023384 -0.04114946
31 32 33 34 35 36
0.08009235 0.23155039 0.35185421 0.24669784 0.24123830 0.08531881
37 38 39 40 41 42
-0.13343882 0.15116211 0.12503616 -0.20273473 -0.27841295 0.50207897
43 44 45 46 47 48
0.34679433 0.29239374 0.50875926 0.52886872 0.20798018 0.09071850
49 50 51 52 53 54
-0.15275652 -0.02349175 -0.30201519 -0.31166488 -0.43461210 -0.30133564
55 56 57 58
-0.21359386 -0.09142950 0.01337868 0.18291079
> postscript(file="/var/www/html/rcomp/tmp/6al8h1290168858.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.19679298 NA
1 0.65851795 0.19679298
2 0.49589263 0.65851795
3 0.40127855 0.49589263
4 0.26296809 0.40127855
5 0.14381632 0.26296809
6 0.00640133 0.14381632
7 -0.10751303 0.00640133
8 -0.14998039 -0.10751303
9 -0.22612406 -0.14998039
10 -0.30398678 -0.22612406
11 -0.39054133 -0.30398678
12 -0.24236071 -0.39054133
13 -0.27803893 -0.24236071
14 -0.27245376 -0.27803893
15 -0.18277135 -0.27245376
16 -0.33150246 -0.18277135
17 -0.50065423 -0.33150246
18 -0.49408950 -0.50065423
19 0.01196906 -0.49408950
20 -0.15137511 0.01196906
21 -0.26969290 -0.15137511
22 -0.36005247 -0.26969290
23 -0.03403667 -0.36005247
24 0.14881967 -0.03403667
25 0.32053629 0.14881967
26 0.17048905 0.32053629
27 -0.05227236 0.17048905
28 -0.17023384 -0.05227236
29 -0.04114946 -0.17023384
30 0.08009235 -0.04114946
31 0.23155039 0.08009235
32 0.35185421 0.23155039
33 0.24669784 0.35185421
34 0.24123830 0.24669784
35 0.08531881 0.24123830
36 -0.13343882 0.08531881
37 0.15116211 -0.13343882
38 0.12503616 0.15116211
39 -0.20273473 0.12503616
40 -0.27841295 -0.20273473
41 0.50207897 -0.27841295
42 0.34679433 0.50207897
43 0.29239374 0.34679433
44 0.50875926 0.29239374
45 0.52886872 0.50875926
46 0.20798018 0.52886872
47 0.09071850 0.20798018
48 -0.15275652 0.09071850
49 -0.02349175 -0.15275652
50 -0.30201519 -0.02349175
51 -0.31166488 -0.30201519
52 -0.43461210 -0.31166488
53 -0.30133564 -0.43461210
54 -0.21359386 -0.30133564
55 -0.09142950 -0.21359386
56 0.01337868 -0.09142950
57 0.18291079 0.01337868
58 NA 0.18291079
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.65851795 0.19679298
[2,] 0.49589263 0.65851795
[3,] 0.40127855 0.49589263
[4,] 0.26296809 0.40127855
[5,] 0.14381632 0.26296809
[6,] 0.00640133 0.14381632
[7,] -0.10751303 0.00640133
[8,] -0.14998039 -0.10751303
[9,] -0.22612406 -0.14998039
[10,] -0.30398678 -0.22612406
[11,] -0.39054133 -0.30398678
[12,] -0.24236071 -0.39054133
[13,] -0.27803893 -0.24236071
[14,] -0.27245376 -0.27803893
[15,] -0.18277135 -0.27245376
[16,] -0.33150246 -0.18277135
[17,] -0.50065423 -0.33150246
[18,] -0.49408950 -0.50065423
[19,] 0.01196906 -0.49408950
[20,] -0.15137511 0.01196906
[21,] -0.26969290 -0.15137511
[22,] -0.36005247 -0.26969290
[23,] -0.03403667 -0.36005247
[24,] 0.14881967 -0.03403667
[25,] 0.32053629 0.14881967
[26,] 0.17048905 0.32053629
[27,] -0.05227236 0.17048905
[28,] -0.17023384 -0.05227236
[29,] -0.04114946 -0.17023384
[30,] 0.08009235 -0.04114946
[31,] 0.23155039 0.08009235
[32,] 0.35185421 0.23155039
[33,] 0.24669784 0.35185421
[34,] 0.24123830 0.24669784
[35,] 0.08531881 0.24123830
[36,] -0.13343882 0.08531881
[37,] 0.15116211 -0.13343882
[38,] 0.12503616 0.15116211
[39,] -0.20273473 0.12503616
[40,] -0.27841295 -0.20273473
[41,] 0.50207897 -0.27841295
[42,] 0.34679433 0.50207897
[43,] 0.29239374 0.34679433
[44,] 0.50875926 0.29239374
[45,] 0.52886872 0.50875926
[46,] 0.20798018 0.52886872
[47,] 0.09071850 0.20798018
[48,] -0.15275652 0.09071850
[49,] -0.02349175 -0.15275652
[50,] -0.30201519 -0.02349175
[51,] -0.31166488 -0.30201519
[52,] -0.43461210 -0.31166488
[53,] -0.30133564 -0.43461210
[54,] -0.21359386 -0.30133564
[55,] -0.09142950 -0.21359386
[56,] 0.01337868 -0.09142950
[57,] 0.18291079 0.01337868
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.65851795 0.19679298
2 0.49589263 0.65851795
3 0.40127855 0.49589263
4 0.26296809 0.40127855
5 0.14381632 0.26296809
6 0.00640133 0.14381632
7 -0.10751303 0.00640133
8 -0.14998039 -0.10751303
9 -0.22612406 -0.14998039
10 -0.30398678 -0.22612406
11 -0.39054133 -0.30398678
12 -0.24236071 -0.39054133
13 -0.27803893 -0.24236071
14 -0.27245376 -0.27803893
15 -0.18277135 -0.27245376
16 -0.33150246 -0.18277135
17 -0.50065423 -0.33150246
18 -0.49408950 -0.50065423
19 0.01196906 -0.49408950
20 -0.15137511 0.01196906
21 -0.26969290 -0.15137511
22 -0.36005247 -0.26969290
23 -0.03403667 -0.36005247
24 0.14881967 -0.03403667
25 0.32053629 0.14881967
26 0.17048905 0.32053629
27 -0.05227236 0.17048905
28 -0.17023384 -0.05227236
29 -0.04114946 -0.17023384
30 0.08009235 -0.04114946
31 0.23155039 0.08009235
32 0.35185421 0.23155039
33 0.24669784 0.35185421
34 0.24123830 0.24669784
35 0.08531881 0.24123830
36 -0.13343882 0.08531881
37 0.15116211 -0.13343882
38 0.12503616 0.15116211
39 -0.20273473 0.12503616
40 -0.27841295 -0.20273473
41 0.50207897 -0.27841295
42 0.34679433 0.50207897
43 0.29239374 0.34679433
44 0.50875926 0.29239374
45 0.52886872 0.50875926
46 0.20798018 0.52886872
47 0.09071850 0.20798018
48 -0.15275652 0.09071850
49 -0.02349175 -0.15275652
50 -0.30201519 -0.02349175
51 -0.31166488 -0.30201519
52 -0.43461210 -0.31166488
53 -0.30133564 -0.43461210
54 -0.21359386 -0.30133564
55 -0.09142950 -0.21359386
56 0.01337868 -0.09142950
57 0.18291079 0.01337868
> 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/7ldp21290168858.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/8ldp21290168858.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/9v4751290168858.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/10v4751290168858.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/11hmns1290168858.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/12k53g1290168858.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/13gfj71290168858.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/142x0v1290168858.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/15nyhj1290168858.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/16ryx71290168858.tab")
+ }
>
> try(system("convert tmp/1plat1290168858.ps tmp/1plat1290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/2hu9e1290168858.ps tmp/2hu9e1290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/3hu9e1290168858.ps tmp/3hu9e1290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/4hu9e1290168858.ps tmp/4hu9e1290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/5al8h1290168858.ps tmp/5al8h1290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/6al8h1290168858.ps tmp/6al8h1290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ldp21290168858.ps tmp/7ldp21290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ldp21290168858.ps tmp/8ldp21290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/9v4751290168858.ps tmp/9v4751290168858.png",intern=TRUE))
character(0)
> try(system("convert tmp/10v4751290168858.ps tmp/10v4751290168858.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.422 1.577 9.495