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
+ ,101.76
+ ,6
+ ,101.68
+ ,107.34
+ ,93.63
+ ,102.37
+ ,6
+ ,101.68
+ ,107.34
+ ,93.63
+ ,102.38
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,102.86
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,102.87
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,102.92
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,102.95
+ ,6
+ ,102.45
+ ,107.34
+ ,96.13
+ ,103.02
+ ,6
+ ,102.45
+ ,112.60
+ ,96.13
+ ,104.08
+ ,6
+ ,102.52
+ ,112.60
+ ,96.13
+ ,104.16
+ ,6
+ ,102.52
+ ,112.60
+ ,96.13
+ ,104.24
+ ,6
+ ,102.85
+ ,112.60
+ ,96.13
+ ,104.33
+ ,7
+ ,102.85
+ ,112.61
+ ,96.13
+ ,104.73
+ ,7
+ ,102.85
+ ,112.61
+ ,96.13
+ ,104.86
+ ,7
+ ,103.25
+ ,112.61
+ ,96.13
+ ,105.03
+ ,7
+ ,103.25
+ ,112.61
+ ,98.73
+ ,105.62
+ ,7
+ ,103.25
+ ,112.61
+ ,98.73
+ ,105.63
+ ,7
+ ,103.25
+ ,112.61
+ ,98.73
+ ,105.63
+ ,7
+ ,104.45
+ ,112.61
+ ,98.73
+ ,105.94
+ ,7
+ ,104.45
+ ,112.61
+ ,98.73
+ ,106.61
+ ,7
+ ,104.45
+ ,118.65
+ ,98.73
+ ,107.69
+ ,7
+ ,104.80
+ ,118.65
+ ,98.73
+ ,107.78
+ ,7
+ ,104.80
+ ,118.65
+ ,98.73
+ ,107.93
+ ,7
+ ,105.29
+ ,118.65
+ ,98.73
+ ,108.48
+ ,8
+ ,105.29
+ ,114.29
+ ,98.73
+ ,108.14
+ ,8
+ ,105.29
+ ,114.29
+ ,98.73
+ ,108.48
+ ,8
+ ,105.29
+ ,114.29
+ ,98.73
+ ,108.48
+ ,8
+ ,106.04
+ ,114.29
+ ,101.67
+ ,108.89
+ ,8
+ ,105.94
+ ,114.29
+ ,101.67
+ ,108.93
+ ,8
+ ,105.94
+ ,114.29
+ ,101.67
+ ,109.21
+ ,8
+ ,105.94
+ ,114.29
+ ,101.67
+ ,109.47
+ ,8
+ ,106.28
+ ,114.29
+ ,101.67
+ ,109.80
+ ,8
+ ,106.48
+ ,123.33
+ ,101.67
+ ,111.73
+ ,8
+ ,107.19
+ ,123.33
+ ,101.67
+ ,111.85
+ ,8
+ ,108.14
+ ,123.33
+ ,101.67
+ ,112.12
+ ,8
+ ,108.22
+ ,123.33
+ ,101.67
+ ,112.15
+ ,9
+ ,108.22
+ ,123.33
+ ,101.67
+ ,112.17
+ ,9
+ ,108.61
+ ,123.33
+ ,101.67
+ ,112.67
+ ,9
+ ,108.61
+ ,123.33
+ ,101.67
+ ,112.80
+ ,9
+ ,108.61
+ ,123.33
+ ,107.94
+ ,113.44
+ ,9
+ ,108.61
+ ,123.33
+ ,107.94
+ ,113.53
+ ,9
+ ,109.06
+ ,123.33
+ ,107.94
+ ,114.53
+ ,9
+ ,109.06
+ ,123.33
+ ,107.94
+ ,114.51
+ ,9
+ ,112.93
+ ,123.33
+ ,107.94
+ ,115.05
+ ,9
+ ,115.84
+ ,129.03
+ ,107.94
+ ,116.67
+ ,9
+ ,118.57
+ ,128.76
+ ,107.94
+ ,117.07
+ ,9
+ ,118.57
+ ,128.76
+ ,107.94
+ ,116.92
+ ,9
+ ,118.86
+ ,128.76
+ ,107.94
+ ,117.00
+ ,10
+ ,118.98
+ ,128.76
+ ,107.94
+ ,117.02
+ ,10
+ ,119.27
+ ,128.76
+ ,107.94
+ ,117.35
+ ,10
+ ,119.39
+ ,128.76
+ ,107.94
+ ,117.36
+ ,10
+ ,119.49
+ ,128.76
+ ,110.30
+ ,117.82
+ ,10
+ ,119.59
+ ,128.76
+ ,110.30
+ ,117.88
+ ,10
+ ,120.12
+ ,128.76
+ ,110.30
+ ,118.24
+ ,10
+ ,120.14
+ ,128.76
+ ,110.30
+ ,118.50
+ ,10
+ ,120.14
+ ,128.76
+ ,110.30
+ ,118.80
+ ,10
+ ,120.14
+ ,132.63
+ ,110.30
+ ,119.76
+ ,10
+ ,120.14
+ ,132.63
+ ,110.30
+ ,120.09)
+ ,dim=c(5
+ ,58)
+ ,dimnames=list(c('Jaar'
+ ,'Bioscoop'
+ ,'Schouwburg'
+ ,'Eendagattractie'
+ ,'Cultuuruitgaves')
+ ,1:58))
> y <- array(NA,dim=c(5,58),dimnames=list(c('Jaar','Bioscoop','Schouwburg','Eendagattractie','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 = '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
Cultuuruitgaves Jaar Bioscoop Schouwburg Eendagattractie t
1 101.76 6 101.82 107.34 93.63 1
2 102.37 6 101.68 107.34 93.63 2
3 102.38 6 101.68 107.34 93.63 3
4 102.86 6 102.45 107.34 96.13 4
5 102.87 6 102.45 107.34 96.13 5
6 102.92 6 102.45 107.34 96.13 6
7 102.95 6 102.45 107.34 96.13 7
8 103.02 6 102.45 107.34 96.13 8
9 104.08 6 102.45 112.60 96.13 9
10 104.16 6 102.52 112.60 96.13 10
11 104.24 6 102.52 112.60 96.13 11
12 104.33 6 102.85 112.60 96.13 12
13 104.73 7 102.85 112.61 96.13 13
14 104.86 7 102.85 112.61 96.13 14
15 105.03 7 103.25 112.61 96.13 15
16 105.62 7 103.25 112.61 98.73 16
17 105.63 7 103.25 112.61 98.73 17
18 105.63 7 103.25 112.61 98.73 18
19 105.94 7 104.45 112.61 98.73 19
20 106.61 7 104.45 112.61 98.73 20
21 107.69 7 104.45 118.65 98.73 21
22 107.78 7 104.80 118.65 98.73 22
23 107.93 7 104.80 118.65 98.73 23
24 108.48 7 105.29 118.65 98.73 24
25 108.14 8 105.29 114.29 98.73 25
26 108.48 8 105.29 114.29 98.73 26
27 108.48 8 105.29 114.29 98.73 27
28 108.89 8 106.04 114.29 101.67 28
29 108.93 8 105.94 114.29 101.67 29
30 109.21 8 105.94 114.29 101.67 30
31 109.47 8 105.94 114.29 101.67 31
32 109.80 8 106.28 114.29 101.67 32
33 111.73 8 106.48 123.33 101.67 33
34 111.85 8 107.19 123.33 101.67 34
35 112.12 8 108.14 123.33 101.67 35
36 112.15 8 108.22 123.33 101.67 36
37 112.17 9 108.22 123.33 101.67 37
38 112.67 9 108.61 123.33 101.67 38
39 112.80 9 108.61 123.33 101.67 39
40 113.44 9 108.61 123.33 107.94 40
41 113.53 9 108.61 123.33 107.94 41
42 114.53 9 109.06 123.33 107.94 42
43 114.51 9 109.06 123.33 107.94 43
44 115.05 9 112.93 123.33 107.94 44
45 116.67 9 115.84 129.03 107.94 45
46 117.07 9 118.57 128.76 107.94 46
47 116.92 9 118.57 128.76 107.94 47
48 117.00 9 118.86 128.76 107.94 48
49 117.02 10 118.98 128.76 107.94 49
50 117.35 10 119.27 128.76 107.94 50
51 117.36 10 119.39 128.76 107.94 51
52 117.82 10 119.49 128.76 110.30 52
53 117.88 10 119.59 128.76 110.30 53
54 118.24 10 120.12 128.76 110.30 54
55 118.50 10 120.14 128.76 110.30 55
56 118.80 10 120.14 128.76 110.30 56
57 119.76 10 120.14 132.63 110.30 57
58 120.09 10 120.14 132.63 110.30 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Jaar Bioscoop Schouwburg
60.44504 0.07648 0.10335 0.17128
Eendagattractie t
0.12340 0.17063
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.56360 -0.24431 -0.03068 0.21183 0.67713
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 60.44504 3.90181 15.492 < 2e-16 ***
Jaar 0.07648 0.15456 0.495 0.622812
Bioscoop 0.10335 0.01826 5.659 6.61e-07 ***
Schouwburg 0.17128 0.02069 8.278 4.65e-11 ***
Eendagattractie 0.12340 0.03220 3.833 0.000344 ***
t 0.17063 0.02084 8.187 6.45e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3025 on 52 degrees of freedom
Multiple R-squared: 0.9973, Adjusted R-squared: 0.9971
F-statistic: 3861 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,] 0.001095937 0.002191875 0.99890406
[2,] 0.055350091 0.110700183 0.94464991
[3,] 0.033177102 0.066354204 0.96682290
[4,] 0.183718037 0.367436074 0.81628196
[5,] 0.109250945 0.218501889 0.89074906
[6,] 0.060576969 0.121153938 0.93942303
[7,] 0.049872084 0.099744169 0.95012792
[8,] 0.029055407 0.058110814 0.97094459
[9,] 0.015091392 0.030182784 0.98490861
[10,] 0.011401269 0.022802537 0.98859873
[11,] 0.011922434 0.023844867 0.98807757
[12,] 0.127630714 0.255261428 0.87236929
[13,] 0.160502102 0.321004204 0.83949790
[14,] 0.149828076 0.299656152 0.85017192
[15,] 0.226253080 0.452506160 0.77374692
[16,] 0.357585727 0.715171454 0.64241427
[17,] 0.396793864 0.793587729 0.60320614
[18,] 0.592131031 0.815737938 0.40786897
[19,] 0.597196025 0.805607949 0.40280397
[20,] 0.515568232 0.968863537 0.48443177
[21,] 0.444367753 0.888735507 0.55563225
[22,] 0.393306431 0.786612861 0.60669357
[23,] 0.383066267 0.766132534 0.61693373
[24,] 0.369814099 0.739628198 0.63018590
[25,] 0.575548342 0.848903316 0.42445166
[26,] 0.503987931 0.992024139 0.49601207
[27,] 0.484630818 0.969261636 0.51536918
[28,] 0.644299460 0.711401079 0.35570054
[29,] 0.737512867 0.524974266 0.26248713
[30,] 0.672588612 0.654822776 0.32741139
[31,] 0.661045022 0.677909956 0.33895498
[32,] 0.654183118 0.691633765 0.34581688
[33,] 0.955655681 0.088688639 0.04434432
[34,] 0.957213445 0.085573109 0.04278655
[35,] 0.955302179 0.089395642 0.04469782
[36,] 0.946516297 0.106967407 0.05348370
[37,] 0.919096359 0.161807281 0.08090364
[38,] 0.989023991 0.021952017 0.01097601
[39,] 0.983041208 0.033917584 0.01695879
[40,] 0.954322767 0.091354465 0.04567723
[41,] 0.897117813 0.205764373 0.10288219
> postscript(file="/var/www/html/rcomp/tmp/11por1290175924.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/21por1290175924.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/3tznu1290175924.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/4tznu1290175924.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/5tznu1290175924.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.22328389 0.67712743 0.51650220 0.43779953 0.27717429 0.15654906
7 8 9 10 11 12
0.01592382 -0.08470142 -0.09626586 -0.19412548 -0.28475072 -0.39948095
13 14 15 16 17 18
-0.24829896 -0.28892420 -0.33088882 -0.23235313 -0.39297837 -0.56360361
19 20 21 22 23 24
-0.54824700 -0.04887224 -0.17403602 -0.29083322 -0.31145846 0.01727556
25 26 27 28 29 30
0.17695647 0.34633123 0.17570600 -0.02522555 -0.14551594 -0.03614118
31 32 33 34 35 36
0.05323359 0.17746987 0.36779275 0.24379011 0.24498383 0.09609072
37 38 39 40 41 42
-0.13101448 0.15805439 0.11742915 -0.18691187 -0.26753711 0.51533085
43 44 45 46 47 48
0.32470561 0.29412184 0.46644965 0.45992905 0.13930381 0.01870752
49 50 51 52 53 54
-0.22079949 -0.09139578 -0.26442283 -0.27660608 -0.39756616 -0.26296609
55 56 57 58
-0.17565829 -0.04628353 0.08023293 0.23960769
> postscript(file="/var/www/html/rcomp/tmp/64q4x1290175924.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.22328389 NA
1 0.67712743 0.22328389
2 0.51650220 0.67712743
3 0.43779953 0.51650220
4 0.27717429 0.43779953
5 0.15654906 0.27717429
6 0.01592382 0.15654906
7 -0.08470142 0.01592382
8 -0.09626586 -0.08470142
9 -0.19412548 -0.09626586
10 -0.28475072 -0.19412548
11 -0.39948095 -0.28475072
12 -0.24829896 -0.39948095
13 -0.28892420 -0.24829896
14 -0.33088882 -0.28892420
15 -0.23235313 -0.33088882
16 -0.39297837 -0.23235313
17 -0.56360361 -0.39297837
18 -0.54824700 -0.56360361
19 -0.04887224 -0.54824700
20 -0.17403602 -0.04887224
21 -0.29083322 -0.17403602
22 -0.31145846 -0.29083322
23 0.01727556 -0.31145846
24 0.17695647 0.01727556
25 0.34633123 0.17695647
26 0.17570600 0.34633123
27 -0.02522555 0.17570600
28 -0.14551594 -0.02522555
29 -0.03614118 -0.14551594
30 0.05323359 -0.03614118
31 0.17746987 0.05323359
32 0.36779275 0.17746987
33 0.24379011 0.36779275
34 0.24498383 0.24379011
35 0.09609072 0.24498383
36 -0.13101448 0.09609072
37 0.15805439 -0.13101448
38 0.11742915 0.15805439
39 -0.18691187 0.11742915
40 -0.26753711 -0.18691187
41 0.51533085 -0.26753711
42 0.32470561 0.51533085
43 0.29412184 0.32470561
44 0.46644965 0.29412184
45 0.45992905 0.46644965
46 0.13930381 0.45992905
47 0.01870752 0.13930381
48 -0.22079949 0.01870752
49 -0.09139578 -0.22079949
50 -0.26442283 -0.09139578
51 -0.27660608 -0.26442283
52 -0.39756616 -0.27660608
53 -0.26296609 -0.39756616
54 -0.17565829 -0.26296609
55 -0.04628353 -0.17565829
56 0.08023293 -0.04628353
57 0.23960769 0.08023293
58 NA 0.23960769
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.67712743 0.22328389
[2,] 0.51650220 0.67712743
[3,] 0.43779953 0.51650220
[4,] 0.27717429 0.43779953
[5,] 0.15654906 0.27717429
[6,] 0.01592382 0.15654906
[7,] -0.08470142 0.01592382
[8,] -0.09626586 -0.08470142
[9,] -0.19412548 -0.09626586
[10,] -0.28475072 -0.19412548
[11,] -0.39948095 -0.28475072
[12,] -0.24829896 -0.39948095
[13,] -0.28892420 -0.24829896
[14,] -0.33088882 -0.28892420
[15,] -0.23235313 -0.33088882
[16,] -0.39297837 -0.23235313
[17,] -0.56360361 -0.39297837
[18,] -0.54824700 -0.56360361
[19,] -0.04887224 -0.54824700
[20,] -0.17403602 -0.04887224
[21,] -0.29083322 -0.17403602
[22,] -0.31145846 -0.29083322
[23,] 0.01727556 -0.31145846
[24,] 0.17695647 0.01727556
[25,] 0.34633123 0.17695647
[26,] 0.17570600 0.34633123
[27,] -0.02522555 0.17570600
[28,] -0.14551594 -0.02522555
[29,] -0.03614118 -0.14551594
[30,] 0.05323359 -0.03614118
[31,] 0.17746987 0.05323359
[32,] 0.36779275 0.17746987
[33,] 0.24379011 0.36779275
[34,] 0.24498383 0.24379011
[35,] 0.09609072 0.24498383
[36,] -0.13101448 0.09609072
[37,] 0.15805439 -0.13101448
[38,] 0.11742915 0.15805439
[39,] -0.18691187 0.11742915
[40,] -0.26753711 -0.18691187
[41,] 0.51533085 -0.26753711
[42,] 0.32470561 0.51533085
[43,] 0.29412184 0.32470561
[44,] 0.46644965 0.29412184
[45,] 0.45992905 0.46644965
[46,] 0.13930381 0.45992905
[47,] 0.01870752 0.13930381
[48,] -0.22079949 0.01870752
[49,] -0.09139578 -0.22079949
[50,] -0.26442283 -0.09139578
[51,] -0.27660608 -0.26442283
[52,] -0.39756616 -0.27660608
[53,] -0.26296609 -0.39756616
[54,] -0.17565829 -0.26296609
[55,] -0.04628353 -0.17565829
[56,] 0.08023293 -0.04628353
[57,] 0.23960769 0.08023293
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.67712743 0.22328389
2 0.51650220 0.67712743
3 0.43779953 0.51650220
4 0.27717429 0.43779953
5 0.15654906 0.27717429
6 0.01592382 0.15654906
7 -0.08470142 0.01592382
8 -0.09626586 -0.08470142
9 -0.19412548 -0.09626586
10 -0.28475072 -0.19412548
11 -0.39948095 -0.28475072
12 -0.24829896 -0.39948095
13 -0.28892420 -0.24829896
14 -0.33088882 -0.28892420
15 -0.23235313 -0.33088882
16 -0.39297837 -0.23235313
17 -0.56360361 -0.39297837
18 -0.54824700 -0.56360361
19 -0.04887224 -0.54824700
20 -0.17403602 -0.04887224
21 -0.29083322 -0.17403602
22 -0.31145846 -0.29083322
23 0.01727556 -0.31145846
24 0.17695647 0.01727556
25 0.34633123 0.17695647
26 0.17570600 0.34633123
27 -0.02522555 0.17570600
28 -0.14551594 -0.02522555
29 -0.03614118 -0.14551594
30 0.05323359 -0.03614118
31 0.17746987 0.05323359
32 0.36779275 0.17746987
33 0.24379011 0.36779275
34 0.24498383 0.24379011
35 0.09609072 0.24498383
36 -0.13101448 0.09609072
37 0.15805439 -0.13101448
38 0.11742915 0.15805439
39 -0.18691187 0.11742915
40 -0.26753711 -0.18691187
41 0.51533085 -0.26753711
42 0.32470561 0.51533085
43 0.29412184 0.32470561
44 0.46644965 0.29412184
45 0.45992905 0.46644965
46 0.13930381 0.45992905
47 0.01870752 0.13930381
48 -0.22079949 0.01870752
49 -0.09139578 -0.22079949
50 -0.26442283 -0.09139578
51 -0.27660608 -0.26442283
52 -0.39756616 -0.27660608
53 -0.26296609 -0.39756616
54 -0.17565829 -0.26296609
55 -0.04628353 -0.17565829
56 0.08023293 -0.04628353
57 0.23960769 0.08023293
> 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/74q4x1290175924.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/8fzli1290175924.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/9fzli1290175924.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/10qrll1290175924.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/11b9j91290175924.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/12es0x1290175924.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/13s1g51290175924.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/14wkwb1290175924.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/15zkdz1290175924.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/16dutq1290175924.tab")
+ }
>
> try(system("convert tmp/11por1290175924.ps tmp/11por1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/21por1290175924.ps tmp/21por1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/3tznu1290175924.ps tmp/3tznu1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/4tznu1290175924.ps tmp/4tznu1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/5tznu1290175924.ps tmp/5tznu1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/64q4x1290175924.ps tmp/64q4x1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/74q4x1290175924.ps tmp/74q4x1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/8fzli1290175924.ps tmp/8fzli1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/9fzli1290175924.ps tmp/9fzli1290175924.png",intern=TRUE))
character(0)
> try(system("convert tmp/10qrll1290175924.ps tmp/10qrll1290175924.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.554 1.624 10.983