R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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'
+ ,'DVDhuren'
+ ,'Cultuuruitgaven')
+ ,1:58))
> y <- array(NA,dim=c(5,58),dimnames=list(c('Bioscoop','Schouwburgabonnement','Eendagsattracties','DVDhuren','Cultuuruitgaven'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal 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
> 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
Bioscoop Schouwburgabonnement Eendagsattracties DVDhuren Cultuuruitgaven
1 101.82 107.34 93.63 99.85 101.76
2 101.68 107.34 93.63 99.91 102.37
3 101.68 107.34 93.63 99.87 102.38
4 102.45 107.34 96.13 99.86 102.86
5 102.45 107.34 96.13 100.10 102.87
6 102.45 107.34 96.13 100.10 102.92
7 102.45 107.34 96.13 100.12 102.95
8 102.45 107.34 96.13 99.95 103.02
9 102.45 112.60 96.13 99.94 104.08
10 102.52 112.60 96.13 100.18 104.16
11 102.52 112.60 96.13 100.31 104.24
12 102.85 112.60 96.13 100.65 104.33
13 102.85 112.61 96.13 100.65 104.73
14 102.85 112.61 96.13 100.69 104.86
15 103.25 112.61 96.13 101.26 105.03
16 103.25 112.61 98.73 101.26 105.62
17 103.25 112.61 98.73 101.38 105.63
18 103.25 112.61 98.73 101.38 105.63
19 104.45 112.61 98.73 101.38 105.94
20 104.45 112.61 98.73 101.44 106.61
21 104.45 118.65 98.73 101.40 107.69
22 104.80 118.65 98.73 101.40 107.78
23 104.80 118.65 98.73 100.58 107.93
24 105.29 118.65 98.73 100.58 108.48
25 105.29 114.29 98.73 100.58 108.14
26 105.29 114.29 98.73 100.59 108.48
27 105.29 114.29 98.73 100.81 108.48
28 106.04 114.29 101.67 100.75 108.89
29 105.94 114.29 101.67 100.75 108.93
30 105.94 114.29 101.67 100.96 109.21
31 105.94 114.29 101.67 101.31 109.47
32 106.28 114.29 101.67 101.64 109.80
33 106.48 123.33 101.67 101.46 111.73
34 107.19 123.33 101.67 101.73 111.85
35 108.14 123.33 101.67 101.73 112.12
36 108.22 123.33 101.67 101.64 112.15
37 108.22 123.33 101.67 101.77 112.17
38 108.61 123.33 101.67 101.74 112.67
39 108.61 123.33 101.67 101.89 112.80
40 108.61 123.33 107.94 101.89 113.44
41 108.61 123.33 107.94 101.93 113.53
42 109.06 123.33 107.94 101.93 114.53
43 109.06 123.33 107.94 102.32 114.51
44 112.93 123.33 107.94 102.41 115.05
45 115.84 129.03 107.94 103.58 116.67
46 118.57 128.76 107.94 104.12 117.07
47 118.57 128.76 107.94 104.10 116.92
48 118.86 128.76 107.94 104.15 117.00
49 118.98 128.76 107.94 104.15 117.02
50 119.27 128.76 107.94 104.16 117.35
51 119.39 128.76 107.94 102.94 117.36
52 119.49 128.76 110.30 103.07 117.82
53 119.59 128.76 110.30 103.04 117.88
54 120.12 128.76 110.30 103.06 118.24
55 120.14 128.76 110.30 103.05 118.50
56 120.14 128.76 110.30 102.95 118.80
57 120.14 132.63 110.30 102.95 119.76
58 120.14 132.63 110.30 103.05 120.09
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Schouwburgabonnement Eendagsattracties
-174.1171 -0.2228 -0.0356
DVDhuren Cultuuruitgaven
1.9441 1.0454
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.1268 -1.4634 -0.0434 1.7505 3.2285
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -174.1171 42.5583 -4.091 0.000147 ***
Schouwburgabonnement -0.2228 0.1713 -1.301 0.198956
Eendagsattracties -0.0356 0.2315 -0.154 0.878377
DVDhuren 1.9441 0.5146 3.778 0.000402 ***
Cultuuruitgaven 1.0454 0.3839 2.723 0.008746 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.935 on 53 degrees of freedom
Multiple R-squared: 0.9186, Adjusted R-squared: 0.9125
F-statistic: 149.6 on 4 and 53 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.135981e-06 2.271962e-06 9.999989e-01
[2,] 9.702521e-09 1.940504e-08 1.000000e+00
[3,] 2.528241e-09 5.056481e-09 1.000000e+00
[4,] 5.540129e-11 1.108026e-10 1.000000e+00
[5,] 1.599181e-09 3.198362e-09 1.000000e+00
[6,] 2.972583e-10 5.945166e-10 1.000000e+00
[7,] 1.931458e-11 3.862916e-11 1.000000e+00
[8,] 1.385988e-12 2.771977e-12 1.000000e+00
[9,] 2.496448e-10 4.992897e-10 1.000000e+00
[10,] 1.211676e-10 2.423352e-10 1.000000e+00
[11,] 2.397152e-11 4.794305e-11 1.000000e+00
[12,] 6.103547e-09 1.220709e-08 1.000000e+00
[13,] 1.552407e-09 3.104813e-09 1.000000e+00
[14,] 3.876226e-10 7.752453e-10 1.000000e+00
[15,] 2.051004e-10 4.102008e-10 1.000000e+00
[16,] 1.689891e-10 3.379782e-10 1.000000e+00
[17,] 2.465146e-10 4.930291e-10 1.000000e+00
[18,] 1.303233e-10 2.606466e-10 1.000000e+00
[19,] 5.859396e-11 1.171879e-10 1.000000e+00
[20,] 1.534419e-11 3.068838e-11 1.000000e+00
[21,] 1.250774e-11 2.501547e-11 1.000000e+00
[22,] 1.909262e-11 3.818524e-11 1.000000e+00
[23,] 2.166965e-11 4.333931e-11 1.000000e+00
[24,] 1.417037e-11 2.834075e-11 1.000000e+00
[25,] 5.515939e-12 1.103188e-11 1.000000e+00
[26,] 2.452925e-12 4.905849e-12 1.000000e+00
[27,] 1.265891e-12 2.531783e-12 1.000000e+00
[28,] 9.015430e-11 1.803086e-10 1.000000e+00
[29,] 8.167483e-10 1.633497e-09 1.000000e+00
[30,] 2.708693e-09 5.417385e-09 1.000000e+00
[31,] 4.079292e-09 8.158585e-09 1.000000e+00
[32,] 1.192465e-08 2.384930e-08 1.000000e+00
[33,] 5.985933e-09 1.197187e-08 1.000000e+00
[34,] 4.096084e-09 8.192168e-09 1.000000e+00
[35,] 1.805304e-09 3.610609e-09 1.000000e+00
[36,] 4.641813e-07 9.283626e-07 9.999995e-01
[37,] 2.255562e-01 4.511123e-01 7.744438e-01
[38,] 9.999335e-01 1.330868e-04 6.654341e-05
[39,] 9.999847e-01 3.069481e-05 1.534740e-05
[40,] 9.999863e-01 2.747210e-05 1.373605e-05
[41,] 9.999295e-01 1.410544e-04 7.052720e-05
[42,] 9.994782e-01 1.043585e-03 5.217925e-04
[43,] 9.959076e-01 8.184737e-03 4.092369e-03
> postscript(file="/var/www/rcomp/tmp/1iciv1291989886.ps",horizontal=F,onefile=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/2iciv1291989886.ps",horizontal=F,onefile=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/3iciv1291989886.ps",horizontal=F,onefile=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/4s3hg1291989886.ps",horizontal=F,onefile=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/5s3hg1291989886.ps",horizontal=F,onefile=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 7
2.6910091 1.7966856 1.8639975 2.2406588 1.7636120 1.7113435 1.6410997
8 9 10 11 12 13 14
1.8984273 1.9819219 1.5016993 1.1653318 0.7402417 0.3243224 0.1106589
15 16 17 18 19 20 21
-0.7752125 -1.2994233 -1.5431735 -1.5431735 -0.6672379 -1.4842836 -1.1895561
22 23 24 25 26 27 28
-0.9336393 0.5037485 0.4187954 -0.1973666 -0.5722335 -0.9999438 -0.4572363
29 30 31 32 33 34 35
-0.5990510 -1.3000234 -2.2522677 -2.8988050 -2.3519384 -2.2923000 -1.6245497
36 37 38 39 40 41 42
-1.4009383 -1.6745836 -1.7489441 -2.1764628 -2.6222942 -2.7941430 -3.3895121
43 44 45 46 47 48 49
-4.1268186 -0.9962903 -0.7842351 0.4176156 0.6133038 0.7224673 0.8215599
50 51 52 53 54 55 56
0.7471467 3.2285414 2.6789469 2.7745489 2.8893332 2.6569786 2.5377817
57 58
2.3966226 1.8572370
> postscript(file="/var/www/rcomp/tmp/6luy11291989886.ps",horizontal=F,onefile=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 2.6910091 NA
1 1.7966856 2.6910091
2 1.8639975 1.7966856
3 2.2406588 1.8639975
4 1.7636120 2.2406588
5 1.7113435 1.7636120
6 1.6410997 1.7113435
7 1.8984273 1.6410997
8 1.9819219 1.8984273
9 1.5016993 1.9819219
10 1.1653318 1.5016993
11 0.7402417 1.1653318
12 0.3243224 0.7402417
13 0.1106589 0.3243224
14 -0.7752125 0.1106589
15 -1.2994233 -0.7752125
16 -1.5431735 -1.2994233
17 -1.5431735 -1.5431735
18 -0.6672379 -1.5431735
19 -1.4842836 -0.6672379
20 -1.1895561 -1.4842836
21 -0.9336393 -1.1895561
22 0.5037485 -0.9336393
23 0.4187954 0.5037485
24 -0.1973666 0.4187954
25 -0.5722335 -0.1973666
26 -0.9999438 -0.5722335
27 -0.4572363 -0.9999438
28 -0.5990510 -0.4572363
29 -1.3000234 -0.5990510
30 -2.2522677 -1.3000234
31 -2.8988050 -2.2522677
32 -2.3519384 -2.8988050
33 -2.2923000 -2.3519384
34 -1.6245497 -2.2923000
35 -1.4009383 -1.6245497
36 -1.6745836 -1.4009383
37 -1.7489441 -1.6745836
38 -2.1764628 -1.7489441
39 -2.6222942 -2.1764628
40 -2.7941430 -2.6222942
41 -3.3895121 -2.7941430
42 -4.1268186 -3.3895121
43 -0.9962903 -4.1268186
44 -0.7842351 -0.9962903
45 0.4176156 -0.7842351
46 0.6133038 0.4176156
47 0.7224673 0.6133038
48 0.8215599 0.7224673
49 0.7471467 0.8215599
50 3.2285414 0.7471467
51 2.6789469 3.2285414
52 2.7745489 2.6789469
53 2.8893332 2.7745489
54 2.6569786 2.8893332
55 2.5377817 2.6569786
56 2.3966226 2.5377817
57 1.8572370 2.3966226
58 NA 1.8572370
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.7966856 2.6910091
[2,] 1.8639975 1.7966856
[3,] 2.2406588 1.8639975
[4,] 1.7636120 2.2406588
[5,] 1.7113435 1.7636120
[6,] 1.6410997 1.7113435
[7,] 1.8984273 1.6410997
[8,] 1.9819219 1.8984273
[9,] 1.5016993 1.9819219
[10,] 1.1653318 1.5016993
[11,] 0.7402417 1.1653318
[12,] 0.3243224 0.7402417
[13,] 0.1106589 0.3243224
[14,] -0.7752125 0.1106589
[15,] -1.2994233 -0.7752125
[16,] -1.5431735 -1.2994233
[17,] -1.5431735 -1.5431735
[18,] -0.6672379 -1.5431735
[19,] -1.4842836 -0.6672379
[20,] -1.1895561 -1.4842836
[21,] -0.9336393 -1.1895561
[22,] 0.5037485 -0.9336393
[23,] 0.4187954 0.5037485
[24,] -0.1973666 0.4187954
[25,] -0.5722335 -0.1973666
[26,] -0.9999438 -0.5722335
[27,] -0.4572363 -0.9999438
[28,] -0.5990510 -0.4572363
[29,] -1.3000234 -0.5990510
[30,] -2.2522677 -1.3000234
[31,] -2.8988050 -2.2522677
[32,] -2.3519384 -2.8988050
[33,] -2.2923000 -2.3519384
[34,] -1.6245497 -2.2923000
[35,] -1.4009383 -1.6245497
[36,] -1.6745836 -1.4009383
[37,] -1.7489441 -1.6745836
[38,] -2.1764628 -1.7489441
[39,] -2.6222942 -2.1764628
[40,] -2.7941430 -2.6222942
[41,] -3.3895121 -2.7941430
[42,] -4.1268186 -3.3895121
[43,] -0.9962903 -4.1268186
[44,] -0.7842351 -0.9962903
[45,] 0.4176156 -0.7842351
[46,] 0.6133038 0.4176156
[47,] 0.7224673 0.6133038
[48,] 0.8215599 0.7224673
[49,] 0.7471467 0.8215599
[50,] 3.2285414 0.7471467
[51,] 2.6789469 3.2285414
[52,] 2.7745489 2.6789469
[53,] 2.8893332 2.7745489
[54,] 2.6569786 2.8893332
[55,] 2.5377817 2.6569786
[56,] 2.3966226 2.5377817
[57,] 1.8572370 2.3966226
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.7966856 2.6910091
2 1.8639975 1.7966856
3 2.2406588 1.8639975
4 1.7636120 2.2406588
5 1.7113435 1.7636120
6 1.6410997 1.7113435
7 1.8984273 1.6410997
8 1.9819219 1.8984273
9 1.5016993 1.9819219
10 1.1653318 1.5016993
11 0.7402417 1.1653318
12 0.3243224 0.7402417
13 0.1106589 0.3243224
14 -0.7752125 0.1106589
15 -1.2994233 -0.7752125
16 -1.5431735 -1.2994233
17 -1.5431735 -1.5431735
18 -0.6672379 -1.5431735
19 -1.4842836 -0.6672379
20 -1.1895561 -1.4842836
21 -0.9336393 -1.1895561
22 0.5037485 -0.9336393
23 0.4187954 0.5037485
24 -0.1973666 0.4187954
25 -0.5722335 -0.1973666
26 -0.9999438 -0.5722335
27 -0.4572363 -0.9999438
28 -0.5990510 -0.4572363
29 -1.3000234 -0.5990510
30 -2.2522677 -1.3000234
31 -2.8988050 -2.2522677
32 -2.3519384 -2.8988050
33 -2.2923000 -2.3519384
34 -1.6245497 -2.2923000
35 -1.4009383 -1.6245497
36 -1.6745836 -1.4009383
37 -1.7489441 -1.6745836
38 -2.1764628 -1.7489441
39 -2.6222942 -2.1764628
40 -2.7941430 -2.6222942
41 -3.3895121 -2.7941430
42 -4.1268186 -3.3895121
43 -0.9962903 -4.1268186
44 -0.7842351 -0.9962903
45 0.4176156 -0.7842351
46 0.6133038 0.4176156
47 0.7224673 0.6133038
48 0.8215599 0.7224673
49 0.7471467 0.8215599
50 3.2285414 0.7471467
51 2.6789469 3.2285414
52 2.7745489 2.6789469
53 2.8893332 2.7745489
54 2.6569786 2.8893332
55 2.5377817 2.6569786
56 2.3966226 2.5377817
57 1.8572370 2.3966226
> 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/7luy11291989886.ps",horizontal=F,onefile=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/8dmxm1291989886.ps",horizontal=F,onefile=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/9dmxm1291989886.ps",horizontal=F,onefile=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/10dmxm1291989886.ps",horizontal=F,onefile=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/1126gp1291989887.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/12vffs1291989887.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/132gu41291989887.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/14c7b71291989887.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/15yqav1291989887.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/16ch7m1291989887.tab")
+ }
>
> try(system("convert tmp/1iciv1291989886.ps tmp/1iciv1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/2iciv1291989886.ps tmp/2iciv1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/3iciv1291989886.ps tmp/3iciv1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/4s3hg1291989886.ps tmp/4s3hg1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/5s3hg1291989886.ps tmp/5s3hg1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/6luy11291989886.ps tmp/6luy11291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/7luy11291989886.ps tmp/7luy11291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dmxm1291989886.ps tmp/8dmxm1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/9dmxm1291989886.ps tmp/9dmxm1291989886.png",intern=TRUE))
character(0)
> try(system("convert tmp/10dmxm1291989886.ps tmp/10dmxm1291989886.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.190 1.600 4.763