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(101.76
+ ,101.82
+ ,107.34
+ ,93.63
+ ,99.85
+ ,102.37
+ ,101.68
+ ,107.34
+ ,93.63
+ ,99.91
+ ,102.38
+ ,101.68
+ ,107.34
+ ,93.63
+ ,99.87
+ ,102.86
+ ,102.45
+ ,107.34
+ ,96.13
+ ,99.86
+ ,102.87
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.10
+ ,102.92
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.10
+ ,102.95
+ ,102.45
+ ,107.34
+ ,96.13
+ ,100.12
+ ,103.02
+ ,102.45
+ ,107.34
+ ,96.13
+ ,99.95
+ ,104.08
+ ,102.45
+ ,112.60
+ ,96.13
+ ,99.94
+ ,104.16
+ ,102.52
+ ,112.60
+ ,96.13
+ ,100.18
+ ,104.24
+ ,102.52
+ ,112.60
+ ,96.13
+ ,100.31
+ ,104.33
+ ,102.85
+ ,112.60
+ ,96.13
+ ,100.65
+ ,104.73
+ ,102.85
+ ,112.61
+ ,96.13
+ ,100.65
+ ,104.86
+ ,102.85
+ ,112.61
+ ,96.13
+ ,100.69
+ ,105.03
+ ,103.25
+ ,112.61
+ ,96.13
+ ,101.26
+ ,105.62
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.26
+ ,105.63
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.63
+ ,103.25
+ ,112.61
+ ,98.73
+ ,101.38
+ ,105.94
+ ,104.45
+ ,112.61
+ ,98.73
+ ,101.38
+ ,106.61
+ ,104.45
+ ,112.61
+ ,98.73
+ ,101.44
+ ,107.69
+ ,104.45
+ ,118.65
+ ,98.73
+ ,101.40
+ ,107.78
+ ,104.80
+ ,118.65
+ ,98.73
+ ,101.40
+ ,107.93
+ ,104.80
+ ,118.65
+ ,98.73
+ ,100.58
+ ,108.48
+ ,105.29
+ ,118.65
+ ,98.73
+ ,100.58
+ ,108.14
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.58
+ ,108.48
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.59
+ ,108.48
+ ,105.29
+ ,114.29
+ ,98.73
+ ,100.81
+ ,108.89
+ ,106.04
+ ,114.29
+ ,101.67
+ ,100.75
+ ,108.93
+ ,105.94
+ ,114.29
+ ,101.67
+ ,100.75
+ ,109.21
+ ,105.94
+ ,114.29
+ ,101.67
+ ,100.96
+ ,109.47
+ ,105.94
+ ,114.29
+ ,101.67
+ ,101.31
+ ,109.80
+ ,106.28
+ ,114.29
+ ,101.67
+ ,101.64
+ ,111.73
+ ,106.48
+ ,123.33
+ ,101.67
+ ,101.46
+ ,111.85
+ ,107.19
+ ,123.33
+ ,101.67
+ ,101.73
+ ,112.12
+ ,108.14
+ ,123.33
+ ,101.67
+ ,101.73
+ ,112.15
+ ,108.22
+ ,123.33
+ ,101.67
+ ,101.64
+ ,112.17
+ ,108.22
+ ,123.33
+ ,101.67
+ ,101.77
+ ,112.67
+ ,108.61
+ ,123.33
+ ,101.67
+ ,101.74
+ ,112.80
+ ,108.61
+ ,123.33
+ ,101.67
+ ,101.89
+ ,113.44
+ ,108.61
+ ,123.33
+ ,107.94
+ ,101.89
+ ,113.53
+ ,108.61
+ ,123.33
+ ,107.94
+ ,101.93
+ ,114.53
+ ,109.06
+ ,123.33
+ ,107.94
+ ,101.93
+ ,114.51
+ ,109.06
+ ,123.33
+ ,107.94
+ ,102.32
+ ,115.05
+ ,112.93
+ ,123.33
+ ,107.94
+ ,102.41
+ ,116.67
+ ,115.84
+ ,129.03
+ ,107.94
+ ,103.58
+ ,117.07
+ ,118.57
+ ,128.76
+ ,107.94
+ ,104.12
+ ,116.92
+ ,118.57
+ ,128.76
+ ,107.94
+ ,104.10
+ ,117.00
+ ,118.86
+ ,128.76
+ ,107.94
+ ,104.15
+ ,117.02
+ ,118.98
+ ,128.76
+ ,107.94
+ ,104.15
+ ,117.35
+ ,119.27
+ ,128.76
+ ,107.94
+ ,104.16
+ ,117.36
+ ,119.39
+ ,128.76
+ ,107.94
+ ,102.94
+ ,117.82
+ ,119.49
+ ,128.76
+ ,110.30
+ ,103.07
+ ,117.88
+ ,119.59
+ ,128.76
+ ,110.30
+ ,103.04
+ ,118.24
+ ,120.12
+ ,128.76
+ ,110.30
+ ,103.06
+ ,118.50
+ ,120.14
+ ,128.76
+ ,110.30
+ ,103.05
+ ,118.80
+ ,120.14
+ ,128.76
+ ,110.30
+ ,102.95
+ ,119.76
+ ,120.14
+ ,132.63
+ ,110.30
+ ,102.95
+ ,120.09
+ ,120.14
+ ,132.63
+ ,110.30
+ ,103.05)
+ ,dim=c(5
+ ,58)
+ ,dimnames=list(c('Cultuur'
+ ,'Bioscoop'
+ ,'Schouwburg'
+ ,'EendagsA'
+ ,'HuurDVD')
+ ,1:58))
> y <- array(NA,dim=c(5,58),dimnames=list(c('Cultuur','Bioscoop','Schouwburg','EendagsA','HuurDVD'),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 = '5'
> #'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
HuurDVD Cultuur Bioscoop Schouwburg EendagsA
1 99.85 101.76 101.82 107.34 93.63
2 99.91 102.37 101.68 107.34 93.63
3 99.87 102.38 101.68 107.34 93.63
4 99.86 102.86 102.45 107.34 96.13
5 100.10 102.87 102.45 107.34 96.13
6 100.10 102.92 102.45 107.34 96.13
7 100.12 102.95 102.45 107.34 96.13
8 99.95 103.02 102.45 107.34 96.13
9 99.94 104.08 102.45 112.60 96.13
10 100.18 104.16 102.52 112.60 96.13
11 100.31 104.24 102.52 112.60 96.13
12 100.65 104.33 102.85 112.60 96.13
13 100.65 104.73 102.85 112.61 96.13
14 100.69 104.86 102.85 112.61 96.13
15 101.26 105.03 103.25 112.61 96.13
16 101.26 105.62 103.25 112.61 98.73
17 101.38 105.63 103.25 112.61 98.73
18 101.38 105.63 103.25 112.61 98.73
19 101.38 105.94 104.45 112.61 98.73
20 101.44 106.61 104.45 112.61 98.73
21 101.40 107.69 104.45 118.65 98.73
22 101.40 107.78 104.80 118.65 98.73
23 100.58 107.93 104.80 118.65 98.73
24 100.58 108.48 105.29 118.65 98.73
25 100.58 108.14 105.29 114.29 98.73
26 100.59 108.48 105.29 114.29 98.73
27 100.81 108.48 105.29 114.29 98.73
28 100.75 108.89 106.04 114.29 101.67
29 100.75 108.93 105.94 114.29 101.67
30 100.96 109.21 105.94 114.29 101.67
31 101.31 109.47 105.94 114.29 101.67
32 101.64 109.80 106.28 114.29 101.67
33 101.46 111.73 106.48 123.33 101.67
34 101.73 111.85 107.19 123.33 101.67
35 101.73 112.12 108.14 123.33 101.67
36 101.64 112.15 108.22 123.33 101.67
37 101.77 112.17 108.22 123.33 101.67
38 101.74 112.67 108.61 123.33 101.67
39 101.89 112.80 108.61 123.33 101.67
40 101.89 113.44 108.61 123.33 107.94
41 101.93 113.53 108.61 123.33 107.94
42 101.93 114.53 109.06 123.33 107.94
43 102.32 114.51 109.06 123.33 107.94
44 102.41 115.05 112.93 123.33 107.94
45 103.58 116.67 115.84 129.03 107.94
46 104.12 117.07 118.57 128.76 107.94
47 104.10 116.92 118.57 128.76 107.94
48 104.15 117.00 118.86 128.76 107.94
49 104.15 117.02 118.98 128.76 107.94
50 104.16 117.35 119.27 128.76 107.94
51 102.94 117.36 119.39 128.76 107.94
52 103.07 117.82 119.49 128.76 110.30
53 103.04 117.88 119.59 128.76 110.30
54 103.06 118.24 120.12 128.76 110.30
55 103.05 118.50 120.14 128.76 110.30
56 102.95 118.80 120.14 128.76 110.30
57 102.95 119.76 120.14 132.63 110.30
58 103.05 120.09 120.14 132.63 110.30
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Cultuur Bioscoop Schouwburg EendagsA
83.13513 -0.09344 0.10914 0.08696 0.06465
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.7717 -0.2877 -0.1175 0.2653 0.8074
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 83.13513 1.83816 45.227 < 2e-16 ***
Cultuur -0.09344 0.09627 -0.971 0.336171
Bioscoop 0.10914 0.02889 3.778 0.000402 ***
Schouwburg 0.08696 0.03946 2.204 0.031919 *
EendagsA 0.06465 0.05414 1.194 0.237718
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4585 on 53 degrees of freedom
Multiple R-squared: 0.8781, Adjusted R-squared: 0.8689
F-statistic: 95.41 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,] 2.896587e-02 5.793174e-02 0.971034129
[2,] 7.462131e-03 1.492426e-02 0.992537869
[3,] 2.161794e-03 4.323587e-03 0.997838206
[4,] 6.337612e-04 1.267522e-03 0.999366239
[5,] 2.829838e-04 5.659676e-04 0.999717016
[6,] 1.065135e-04 2.130269e-04 0.999893487
[7,] 2.599189e-05 5.198378e-05 0.999974008
[8,] 5.476782e-06 1.095356e-05 0.999994523
[9,] 7.700641e-04 1.540128e-03 0.999229936
[10,] 1.198719e-03 2.397438e-03 0.998801281
[11,] 8.772956e-04 1.754591e-03 0.999122704
[12,] 7.787540e-04 1.557508e-03 0.999221246
[13,] 2.186396e-03 4.372793e-03 0.997813604
[14,] 2.308048e-03 4.616096e-03 0.997691952
[15,] 1.594989e-03 3.189978e-03 0.998405011
[16,] 4.222484e-02 8.444969e-02 0.957775157
[17,] 1.742259e-01 3.484519e-01 0.825774058
[18,] 2.410199e-01 4.820398e-01 0.758980093
[19,] 2.276013e-01 4.552026e-01 0.772398681
[20,] 1.744395e-01 3.488789e-01 0.825560532
[21,] 2.343291e-01 4.686583e-01 0.765670855
[22,] 2.976389e-01 5.952779e-01 0.702361059
[23,] 2.976915e-01 5.953830e-01 0.702308520
[24,] 2.442849e-01 4.885699e-01 0.755715074
[25,] 2.281592e-01 4.563184e-01 0.771840824
[26,] 2.019294e-01 4.038587e-01 0.798070626
[27,] 1.609031e-01 3.218061e-01 0.839096941
[28,] 1.440522e-01 2.881044e-01 0.855947788
[29,] 1.400248e-01 2.800496e-01 0.859975209
[30,] 1.467766e-01 2.935532e-01 0.853223408
[31,] 1.628060e-01 3.256120e-01 0.837193988
[32,] 6.332761e-01 7.334478e-01 0.366723900
[33,] 6.330628e-01 7.338744e-01 0.366937187
[34,] 6.483888e-01 7.032224e-01 0.351611218
[35,] 5.859191e-01 8.281618e-01 0.414080887
[36,] 5.157649e-01 9.684702e-01 0.484235082
[37,] 4.498940e-01 8.997881e-01 0.550105964
[38,] 5.843850e-01 8.312300e-01 0.415615011
[39,] 4.884990e-01 9.769981e-01 0.511500953
[40,] 3.823258e-01 7.646515e-01 0.617674244
[41,] 2.781638e-01 5.563275e-01 0.721836248
[42,] 2.505083e-01 5.010166e-01 0.749491702
[43,] 9.924938e-01 1.501237e-02 0.007506186
> postscript(file="/var/www/html/rcomp/tmp/18pnh1291974250.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/html/rcomp/tmp/21h5l1291974250.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/html/rcomp/tmp/31h5l1291974250.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/html/rcomp/tmp/41h5l1291974250.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/html/rcomp/tmp/5uqmo1291974250.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
-0.277198644 -0.144923388 -0.183989022 -0.394808616 -0.153874250 -0.149202420
7 8 9 10 11 12
-0.126399323 -0.289858761 -0.658234820 -0.418399360 -0.280924432 0.031470230
13 14 15 16 17 18
0.067975250 0.120122007 0.662352130 0.549379299 0.670313665 0.670313665
19 20 21 22 23 24
0.568316715 0.690919232 0.226581734 0.196793691 -0.609190820 -0.611276964
25 26 27 28 29 30
-0.263892140 -0.222123698 -0.002123698 -0.295748912 -0.281097924 -0.044935678
31 32 33 34 35 36
0.329357836 0.653085929 -0.154542789 0.049183578 -0.029267025 -0.125194746
37 38 39 40 41 42
0.006673986 -0.019170464 0.142976294 -0.202604916 -0.154195623 -0.109869890
43 44 45 46 47 48
0.278261378 -0.003636260 0.504465436 0.807380529 0.773365040 0.799190747
49 50 51 52 53 54
0.787963249 0.797148104 -0.435013760 -0.425529910 -0.460837239 -0.465041745
55 56 57 58
-0.452930936 -0.524899958 -0.771742833 -0.640908757
> postscript(file="/var/www/html/rcomp/tmp/6uqmo1291974250.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 -0.277198644 NA
1 -0.144923388 -0.277198644
2 -0.183989022 -0.144923388
3 -0.394808616 -0.183989022
4 -0.153874250 -0.394808616
5 -0.149202420 -0.153874250
6 -0.126399323 -0.149202420
7 -0.289858761 -0.126399323
8 -0.658234820 -0.289858761
9 -0.418399360 -0.658234820
10 -0.280924432 -0.418399360
11 0.031470230 -0.280924432
12 0.067975250 0.031470230
13 0.120122007 0.067975250
14 0.662352130 0.120122007
15 0.549379299 0.662352130
16 0.670313665 0.549379299
17 0.670313665 0.670313665
18 0.568316715 0.670313665
19 0.690919232 0.568316715
20 0.226581734 0.690919232
21 0.196793691 0.226581734
22 -0.609190820 0.196793691
23 -0.611276964 -0.609190820
24 -0.263892140 -0.611276964
25 -0.222123698 -0.263892140
26 -0.002123698 -0.222123698
27 -0.295748912 -0.002123698
28 -0.281097924 -0.295748912
29 -0.044935678 -0.281097924
30 0.329357836 -0.044935678
31 0.653085929 0.329357836
32 -0.154542789 0.653085929
33 0.049183578 -0.154542789
34 -0.029267025 0.049183578
35 -0.125194746 -0.029267025
36 0.006673986 -0.125194746
37 -0.019170464 0.006673986
38 0.142976294 -0.019170464
39 -0.202604916 0.142976294
40 -0.154195623 -0.202604916
41 -0.109869890 -0.154195623
42 0.278261378 -0.109869890
43 -0.003636260 0.278261378
44 0.504465436 -0.003636260
45 0.807380529 0.504465436
46 0.773365040 0.807380529
47 0.799190747 0.773365040
48 0.787963249 0.799190747
49 0.797148104 0.787963249
50 -0.435013760 0.797148104
51 -0.425529910 -0.435013760
52 -0.460837239 -0.425529910
53 -0.465041745 -0.460837239
54 -0.452930936 -0.465041745
55 -0.524899958 -0.452930936
56 -0.771742833 -0.524899958
57 -0.640908757 -0.771742833
58 NA -0.640908757
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.144923388 -0.277198644
[2,] -0.183989022 -0.144923388
[3,] -0.394808616 -0.183989022
[4,] -0.153874250 -0.394808616
[5,] -0.149202420 -0.153874250
[6,] -0.126399323 -0.149202420
[7,] -0.289858761 -0.126399323
[8,] -0.658234820 -0.289858761
[9,] -0.418399360 -0.658234820
[10,] -0.280924432 -0.418399360
[11,] 0.031470230 -0.280924432
[12,] 0.067975250 0.031470230
[13,] 0.120122007 0.067975250
[14,] 0.662352130 0.120122007
[15,] 0.549379299 0.662352130
[16,] 0.670313665 0.549379299
[17,] 0.670313665 0.670313665
[18,] 0.568316715 0.670313665
[19,] 0.690919232 0.568316715
[20,] 0.226581734 0.690919232
[21,] 0.196793691 0.226581734
[22,] -0.609190820 0.196793691
[23,] -0.611276964 -0.609190820
[24,] -0.263892140 -0.611276964
[25,] -0.222123698 -0.263892140
[26,] -0.002123698 -0.222123698
[27,] -0.295748912 -0.002123698
[28,] -0.281097924 -0.295748912
[29,] -0.044935678 -0.281097924
[30,] 0.329357836 -0.044935678
[31,] 0.653085929 0.329357836
[32,] -0.154542789 0.653085929
[33,] 0.049183578 -0.154542789
[34,] -0.029267025 0.049183578
[35,] -0.125194746 -0.029267025
[36,] 0.006673986 -0.125194746
[37,] -0.019170464 0.006673986
[38,] 0.142976294 -0.019170464
[39,] -0.202604916 0.142976294
[40,] -0.154195623 -0.202604916
[41,] -0.109869890 -0.154195623
[42,] 0.278261378 -0.109869890
[43,] -0.003636260 0.278261378
[44,] 0.504465436 -0.003636260
[45,] 0.807380529 0.504465436
[46,] 0.773365040 0.807380529
[47,] 0.799190747 0.773365040
[48,] 0.787963249 0.799190747
[49,] 0.797148104 0.787963249
[50,] -0.435013760 0.797148104
[51,] -0.425529910 -0.435013760
[52,] -0.460837239 -0.425529910
[53,] -0.465041745 -0.460837239
[54,] -0.452930936 -0.465041745
[55,] -0.524899958 -0.452930936
[56,] -0.771742833 -0.524899958
[57,] -0.640908757 -0.771742833
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.144923388 -0.277198644
2 -0.183989022 -0.144923388
3 -0.394808616 -0.183989022
4 -0.153874250 -0.394808616
5 -0.149202420 -0.153874250
6 -0.126399323 -0.149202420
7 -0.289858761 -0.126399323
8 -0.658234820 -0.289858761
9 -0.418399360 -0.658234820
10 -0.280924432 -0.418399360
11 0.031470230 -0.280924432
12 0.067975250 0.031470230
13 0.120122007 0.067975250
14 0.662352130 0.120122007
15 0.549379299 0.662352130
16 0.670313665 0.549379299
17 0.670313665 0.670313665
18 0.568316715 0.670313665
19 0.690919232 0.568316715
20 0.226581734 0.690919232
21 0.196793691 0.226581734
22 -0.609190820 0.196793691
23 -0.611276964 -0.609190820
24 -0.263892140 -0.611276964
25 -0.222123698 -0.263892140
26 -0.002123698 -0.222123698
27 -0.295748912 -0.002123698
28 -0.281097924 -0.295748912
29 -0.044935678 -0.281097924
30 0.329357836 -0.044935678
31 0.653085929 0.329357836
32 -0.154542789 0.653085929
33 0.049183578 -0.154542789
34 -0.029267025 0.049183578
35 -0.125194746 -0.029267025
36 0.006673986 -0.125194746
37 -0.019170464 0.006673986
38 0.142976294 -0.019170464
39 -0.202604916 0.142976294
40 -0.154195623 -0.202604916
41 -0.109869890 -0.154195623
42 0.278261378 -0.109869890
43 -0.003636260 0.278261378
44 0.504465436 -0.003636260
45 0.807380529 0.504465436
46 0.773365040 0.807380529
47 0.799190747 0.773365040
48 0.787963249 0.799190747
49 0.797148104 0.787963249
50 -0.435013760 0.797148104
51 -0.425529910 -0.435013760
52 -0.460837239 -0.425529910
53 -0.465041745 -0.460837239
54 -0.452930936 -0.465041745
55 -0.524899958 -0.452930936
56 -0.771742833 -0.524899958
57 -0.640908757 -0.771742833
> 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/7nz3q1291974250.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/html/rcomp/tmp/8nz3q1291974250.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/html/rcomp/tmp/9x9lb1291974250.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/html/rcomp/tmp/10x9lb1291974250.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/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/11bi0k1291974250.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/124s051291974250.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/13bteh1291974250.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/14wtv51291974250.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/15iuub1291974250.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/16luay1291974250.tab")
+ }
>
> try(system("convert tmp/18pnh1291974250.ps tmp/18pnh1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/21h5l1291974250.ps tmp/21h5l1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/31h5l1291974250.ps tmp/31h5l1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/41h5l1291974250.ps tmp/41h5l1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/5uqmo1291974250.ps tmp/5uqmo1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/6uqmo1291974250.ps tmp/6uqmo1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/7nz3q1291974250.ps tmp/7nz3q1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/8nz3q1291974250.ps tmp/8nz3q1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/9x9lb1291974250.ps tmp/9x9lb1291974250.png",intern=TRUE))
character(0)
> try(system("convert tmp/10x9lb1291974250.ps tmp/10x9lb1291974250.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.555 1.691 5.952