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.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' + ,'Vrijetijdsbesteding') + ,1:58)) > y <- array(NA,dim=c(5,58),dimnames=list(c('Bioscoop','Schouwburgabonnement','Eendagsattracties','DVDhuren','Vrijetijdsbesteding'),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 = '2' > #'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 Schouwburgabonnement Bioscoop Eendagsattracties DVDhuren Vrijetijdsbesteding 1 107.34 101.82 93.63 99.85 101.76 2 107.34 101.68 93.63 99.91 102.37 3 107.34 101.68 93.63 99.87 102.38 4 107.34 102.45 96.13 99.86 102.86 5 107.34 102.45 96.13 100.10 102.87 6 107.34 102.45 96.13 100.10 102.92 7 107.34 102.45 96.13 100.12 102.95 8 107.34 102.45 96.13 99.95 103.02 9 112.60 102.45 96.13 99.94 104.08 10 112.60 102.52 96.13 100.18 104.16 11 112.60 102.52 96.13 100.31 104.24 12 112.60 102.85 96.13 100.65 104.33 13 112.61 102.85 96.13 100.65 104.73 14 112.61 102.85 96.13 100.69 104.86 15 112.61 103.25 96.13 101.26 105.03 16 112.61 103.25 98.73 101.26 105.62 17 112.61 103.25 98.73 101.38 105.63 18 112.61 103.25 98.73 101.38 105.63 19 112.61 104.45 98.73 101.38 105.94 20 112.61 104.45 98.73 101.44 106.61 21 118.65 104.45 98.73 101.40 107.69 22 118.65 104.80 98.73 101.40 107.78 23 118.65 104.80 98.73 100.58 107.93 24 118.65 105.29 98.73 100.58 108.48 25 114.29 105.29 98.73 100.58 108.14 26 114.29 105.29 98.73 100.59 108.48 27 114.29 105.29 98.73 100.81 108.48 28 114.29 106.04 101.67 100.75 108.89 29 114.29 105.94 101.67 100.75 108.93 30 114.29 105.94 101.67 100.96 109.21 31 114.29 105.94 101.67 101.31 109.47 32 114.29 106.28 101.67 101.64 109.80 33 123.33 106.48 101.67 101.46 111.73 34 123.33 107.19 101.67 101.73 111.85 35 123.33 108.14 101.67 101.73 112.12 36 123.33 108.22 101.67 101.64 112.15 37 123.33 108.22 101.67 101.77 112.17 38 123.33 108.61 101.67 101.74 112.67 39 123.33 108.61 101.67 101.89 112.80 40 123.33 108.61 107.94 101.89 113.44 41 123.33 108.61 107.94 101.93 113.53 42 123.33 109.06 107.94 101.93 114.53 43 123.33 109.06 107.94 102.32 114.51 44 123.33 112.93 107.94 102.41 115.05 45 129.03 115.84 107.94 103.58 116.67 46 128.76 118.57 107.94 104.12 117.07 47 128.76 118.57 107.94 104.10 116.92 48 128.76 118.86 107.94 104.15 117.00 49 128.76 118.98 107.94 104.15 117.02 50 128.76 119.27 107.94 104.16 117.35 51 128.76 119.39 107.94 102.94 117.36 52 128.76 119.49 110.30 103.07 117.82 53 128.76 119.59 110.30 103.04 117.88 54 128.76 120.12 110.30 103.06 118.24 55 128.76 120.14 110.30 103.05 118.50 56 128.76 120.14 110.30 102.95 118.80 57 132.63 120.14 110.30 102.95 119.76 58 132.63 120.14 110.30 103.05 120.09 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Bioscoop Eendagsattracties -111.1542 -0.1388 -0.6660 DVDhuren Vrijetijdsbesteding 0.9651 1.9488 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.15865 -0.74346 -0.05514 0.82941 2.71758 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -111.1542 35.3791 -3.142 0.00275 ** Bioscoop -0.1388 0.1067 -1.301 0.19896 Eendagsattracties -0.6660 0.1582 -4.209 9.96e-05 *** DVDhuren 0.9651 0.4380 2.204 0.03192 * Vrijetijdsbesteding 1.9488 0.1818 10.722 6.94e-15 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.527 on 53 degrees of freedom Multiple R-squared: 0.9647, Adjusted R-squared: 0.962 F-statistic: 361.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,] 0.000000000 0.000000000 1.0000000000 [2,] 0.002218635 0.004437269 0.9977813653 [3,] 0.003876373 0.007752745 0.9961236274 [4,] 0.001257448 0.002514896 0.9987425519 [5,] 0.014496870 0.028993739 0.9855031304 [6,] 0.032963837 0.065927673 0.9670361633 [7,] 0.034752845 0.069505690 0.9652471552 [8,] 0.018791655 0.037583310 0.9812083449 [9,] 0.010369170 0.020738340 0.9896308300 [10,] 0.005226574 0.010453149 0.9947734256 [11,] 0.002520050 0.005040099 0.9974799505 [12,] 0.001527009 0.003054019 0.9984729907 [13,] 0.007827099 0.015654198 0.9921729008 [14,] 0.007906739 0.015813477 0.9920932613 [15,] 0.011706375 0.023412750 0.9882936252 [16,] 0.059274857 0.118549714 0.9407251428 [17,] 0.236330329 0.472660658 0.7636696709 [18,] 0.676766888 0.646466225 0.3232331124 [19,] 0.879834479 0.240331042 0.1201655212 [20,] 0.928304399 0.143391201 0.0716956006 [21,] 0.903892395 0.192215210 0.0961076051 [22,] 0.877887457 0.244225086 0.1221125428 [23,] 0.856072400 0.287855201 0.1439276005 [24,] 0.901723495 0.196553009 0.0982765047 [25,] 0.998274467 0.003451067 0.0017255335 [26,] 0.997863283 0.004273433 0.0021367166 [27,] 0.997935158 0.004129685 0.0020648425 [28,] 0.998280666 0.003438667 0.0017193337 [29,] 0.997974123 0.004051754 0.0020258768 [30,] 0.997359625 0.005280750 0.0026403749 [31,] 0.994698590 0.010602821 0.0053014103 [32,] 0.989486427 0.021027146 0.0105135729 [33,] 0.996701281 0.006597438 0.0032987188 [34,] 0.999438916 0.001122167 0.0005610836 [35,] 0.998554568 0.002890865 0.0014454324 [36,] 0.996316696 0.007366608 0.0036833042 [37,] 0.999141553 0.001716895 0.0008584475 [38,] 0.999364530 0.001270940 0.0006354699 [39,] 0.998773355 0.002453290 0.0012266448 [40,] 0.997214090 0.005571821 0.0027859104 [41,] 0.990601599 0.018796801 0.0093984007 [42,] 0.968934383 0.062131234 0.0310656169 [43,] 0.913630977 0.172738046 0.0863690232 > postscript(file="/var/www/html/rcomp/tmp/1973j1291990497.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/21h251291990497.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/31h251291990497.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/4uq1p1291990497.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/5uq1p1291990497.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.31308281 -0.95300516 -0.93388693 -0.08772117 -0.33884362 -0.43628152 7 8 9 10 11 12 -0.51404717 -0.48638554 2.71758238 2.33976529 2.05839576 1.60067357 13 14 15 16 17 18 0.83117034 0.53922599 -0.28666184 0.29518704 0.15988203 0.15988203 19 20 21 22 23 24 -0.27763143 -1.64120804 2.33273907 2.20594296 2.70504838 1.70126041 25 26 27 28 29 30 -1.99616185 -2.66839104 -2.88072300 -1.55962087 -1.65145466 -2.39978742 31 32 33 34 35 36 -3.24426536 -4.15864969 1.32174034 0.92587273 0.53160094 0.57110804 37 38 39 40 41 42 0.40666399 -0.48461517 -0.88272551 2.04592825 1.83193421 -0.05434826 43 44 45 46 47 48 -0.39177976 -0.99368222 0.82411850 -0.36754466 -0.05592805 -0.21982392 49 50 51 52 53 54 -0.24213893 -0.85461850 0.32003131 0.88379183 0.80970417 0.16243071 55 56 57 58 -0.33181824 -0.81993113 1.17926114 0.43965645 > postscript(file="/var/www/html/rcomp/tmp/6uq1p1291990497.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.31308281 NA 1 -0.95300516 0.31308281 2 -0.93388693 -0.95300516 3 -0.08772117 -0.93388693 4 -0.33884362 -0.08772117 5 -0.43628152 -0.33884362 6 -0.51404717 -0.43628152 7 -0.48638554 -0.51404717 8 2.71758238 -0.48638554 9 2.33976529 2.71758238 10 2.05839576 2.33976529 11 1.60067357 2.05839576 12 0.83117034 1.60067357 13 0.53922599 0.83117034 14 -0.28666184 0.53922599 15 0.29518704 -0.28666184 16 0.15988203 0.29518704 17 0.15988203 0.15988203 18 -0.27763143 0.15988203 19 -1.64120804 -0.27763143 20 2.33273907 -1.64120804 21 2.20594296 2.33273907 22 2.70504838 2.20594296 23 1.70126041 2.70504838 24 -1.99616185 1.70126041 25 -2.66839104 -1.99616185 26 -2.88072300 -2.66839104 27 -1.55962087 -2.88072300 28 -1.65145466 -1.55962087 29 -2.39978742 -1.65145466 30 -3.24426536 -2.39978742 31 -4.15864969 -3.24426536 32 1.32174034 -4.15864969 33 0.92587273 1.32174034 34 0.53160094 0.92587273 35 0.57110804 0.53160094 36 0.40666399 0.57110804 37 -0.48461517 0.40666399 38 -0.88272551 -0.48461517 39 2.04592825 -0.88272551 40 1.83193421 2.04592825 41 -0.05434826 1.83193421 42 -0.39177976 -0.05434826 43 -0.99368222 -0.39177976 44 0.82411850 -0.99368222 45 -0.36754466 0.82411850 46 -0.05592805 -0.36754466 47 -0.21982392 -0.05592805 48 -0.24213893 -0.21982392 49 -0.85461850 -0.24213893 50 0.32003131 -0.85461850 51 0.88379183 0.32003131 52 0.80970417 0.88379183 53 0.16243071 0.80970417 54 -0.33181824 0.16243071 55 -0.81993113 -0.33181824 56 1.17926114 -0.81993113 57 0.43965645 1.17926114 58 NA 0.43965645 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.95300516 0.31308281 [2,] -0.93388693 -0.95300516 [3,] -0.08772117 -0.93388693 [4,] -0.33884362 -0.08772117 [5,] -0.43628152 -0.33884362 [6,] -0.51404717 -0.43628152 [7,] -0.48638554 -0.51404717 [8,] 2.71758238 -0.48638554 [9,] 2.33976529 2.71758238 [10,] 2.05839576 2.33976529 [11,] 1.60067357 2.05839576 [12,] 0.83117034 1.60067357 [13,] 0.53922599 0.83117034 [14,] -0.28666184 0.53922599 [15,] 0.29518704 -0.28666184 [16,] 0.15988203 0.29518704 [17,] 0.15988203 0.15988203 [18,] -0.27763143 0.15988203 [19,] -1.64120804 -0.27763143 [20,] 2.33273907 -1.64120804 [21,] 2.20594296 2.33273907 [22,] 2.70504838 2.20594296 [23,] 1.70126041 2.70504838 [24,] -1.99616185 1.70126041 [25,] -2.66839104 -1.99616185 [26,] -2.88072300 -2.66839104 [27,] -1.55962087 -2.88072300 [28,] -1.65145466 -1.55962087 [29,] -2.39978742 -1.65145466 [30,] -3.24426536 -2.39978742 [31,] -4.15864969 -3.24426536 [32,] 1.32174034 -4.15864969 [33,] 0.92587273 1.32174034 [34,] 0.53160094 0.92587273 [35,] 0.57110804 0.53160094 [36,] 0.40666399 0.57110804 [37,] -0.48461517 0.40666399 [38,] -0.88272551 -0.48461517 [39,] 2.04592825 -0.88272551 [40,] 1.83193421 2.04592825 [41,] -0.05434826 1.83193421 [42,] -0.39177976 -0.05434826 [43,] -0.99368222 -0.39177976 [44,] 0.82411850 -0.99368222 [45,] -0.36754466 0.82411850 [46,] -0.05592805 -0.36754466 [47,] -0.21982392 -0.05592805 [48,] -0.24213893 -0.21982392 [49,] -0.85461850 -0.24213893 [50,] 0.32003131 -0.85461850 [51,] 0.88379183 0.32003131 [52,] 0.80970417 0.88379183 [53,] 0.16243071 0.80970417 [54,] -0.33181824 0.16243071 [55,] -0.81993113 -0.33181824 [56,] 1.17926114 -0.81993113 [57,] 0.43965645 1.17926114 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.95300516 0.31308281 2 -0.93388693 -0.95300516 3 -0.08772117 -0.93388693 4 -0.33884362 -0.08772117 5 -0.43628152 -0.33884362 6 -0.51404717 -0.43628152 7 -0.48638554 -0.51404717 8 2.71758238 -0.48638554 9 2.33976529 2.71758238 10 2.05839576 2.33976529 11 1.60067357 2.05839576 12 0.83117034 1.60067357 13 0.53922599 0.83117034 14 -0.28666184 0.53922599 15 0.29518704 -0.28666184 16 0.15988203 0.29518704 17 0.15988203 0.15988203 18 -0.27763143 0.15988203 19 -1.64120804 -0.27763143 20 2.33273907 -1.64120804 21 2.20594296 2.33273907 22 2.70504838 2.20594296 23 1.70126041 2.70504838 24 -1.99616185 1.70126041 25 -2.66839104 -1.99616185 26 -2.88072300 -2.66839104 27 -1.55962087 -2.88072300 28 -1.65145466 -1.55962087 29 -2.39978742 -1.65145466 30 -3.24426536 -2.39978742 31 -4.15864969 -3.24426536 32 1.32174034 -4.15864969 33 0.92587273 1.32174034 34 0.53160094 0.92587273 35 0.57110804 0.53160094 36 0.40666399 0.57110804 37 -0.48461517 0.40666399 38 -0.88272551 -0.48461517 39 2.04592825 -0.88272551 40 1.83193421 2.04592825 41 -0.05434826 1.83193421 42 -0.39177976 -0.05434826 43 -0.99368222 -0.39177976 44 0.82411850 -0.99368222 45 -0.36754466 0.82411850 46 -0.05592805 -0.36754466 47 -0.21982392 -0.05592805 48 -0.24213893 -0.21982392 49 -0.85461850 -0.24213893 50 0.32003131 -0.85461850 51 0.88379183 0.32003131 52 0.80970417 0.88379183 53 0.16243071 0.80970417 54 -0.33181824 0.16243071 55 -0.81993113 -0.33181824 56 1.17926114 -0.81993113 57 0.43965645 1.17926114 > 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/7nh1s1291990497.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/8fqid1291990497.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/9fqid1291990497.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/10fqid1291990497.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/11b0ym1291990497.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/12mrxp1291990497.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/13tac11291990497.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/14ebb71291990497.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/1572ar1291990497.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/163uqi1291990497.tab") + } > > try(system("convert tmp/1973j1291990497.ps tmp/1973j1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/21h251291990497.ps tmp/21h251291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/31h251291990497.ps tmp/31h251291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/4uq1p1291990497.ps tmp/4uq1p1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/5uq1p1291990497.ps tmp/5uq1p1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/6uq1p1291990497.ps tmp/6uq1p1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/7nh1s1291990497.ps tmp/7nh1s1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/8fqid1291990497.ps tmp/8fqid1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/9fqid1291990497.ps tmp/9fqid1291990497.png",intern=TRUE)) character(0) > try(system("convert tmp/10fqid1291990497.ps tmp/10fqid1291990497.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.567 1.680 8.883