R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(122.7 + ,119.4 + ,104 + ,126.6 + ,126.2 + ,129.8 + ,113.1 + ,128.5 + ,125.9 + ,131.9 + ,117.3 + ,127.1 + ,133.2 + ,129.8 + ,120.5 + ,135.9 + ,131 + ,131.6 + ,119.9 + ,133.2 + ,133.8 + ,134.3 + ,120.5 + ,126.4 + ,142.4 + ,136.7 + ,124.7 + ,146.2 + ,134.2 + ,134.7 + ,118.9 + ,137.1 + ,124.1 + ,138.1 + ,120.2 + ,123.9 + ,118.7 + ,132.4 + ,116.5 + ,118.2 + ,114.3 + ,125 + ,110.9 + ,114.2 + ,107.8 + ,117.7 + ,108.6 + ,106.9 + ,104.4 + ,112 + ,108.6 + ,103.1 + ,98.1 + ,106.3 + ,104.9 + ,96.2 + ,97.1 + ,100.5 + ,102.1 + ,95.9 + ,95.3 + ,95.6 + ,98 + ,94.8 + ,94.3 + ,89.5 + ,93.1 + ,94.9 + ,95.6 + ,87.7 + ,96.4 + ,96 + ,105 + ,88.2 + ,103.7 + ,106.4 + ,98.3 + ,88.7 + ,93.5 + ,99.9 + ,93.1 + ,91.4 + ,87.9 + ,94.2 + ,96.6 + ,95.7 + ,91.8 + ,97.6 + ,93.1 + ,96.8 + ,89.3 + ,93.6 + ,94.9 + ,93.8 + ,85.1 + ,96.8 + ,90.8 + ,91 + ,82.6 + ,92.4 + ,84.6 + ,86.8 + ,80.4 + ,85.3 + ,88.4 + ,91.5 + ,80.6 + ,89.6 + ,80.4 + ,89.3 + ,72.3 + ,81.3 + ,84.6 + ,97.9 + ,69.4 + ,86.7 + ,73.2 + ,95.7 + ,65.1 + ,73.3 + ,64.6 + ,86.9 + ,62.6 + ,63.4 + ,60.5 + ,82 + ,59.2 + ,59.3 + ,56.4 + ,83.2 + ,58.2 + ,54.2 + ,58.5 + ,85.7 + ,60.1 + ,56.3 + ,56.7 + ,77.8 + ,63.1 + ,54 + ,69.6 + ,79.4 + ,69.4 + ,69 + ,89.1 + ,83.4 + ,79.2 + ,91.5 + ,121.3 + ,102.8 + ,96.7 + ,127.3 + ,137.2 + ,108.7 + ,105 + ,145.5 + ,157.5 + ,120.3 + ,113.2 + ,168.7 + ,155.4 + ,121.9 + ,112.3 + ,166 + ,146.2 + ,112.7 + ,112.9 + ,155 + ,131.5 + ,113.1 + ,113.2 + ,136.4 + ,125.8 + ,115.7 + ,112.6 + ,129 + ,116.7 + ,113.5 + ,106.9 + ,118.8 + ,111.2 + ,103.1 + ,101.3 + ,113.7 + ,107.9 + ,95.5 + ,92.7 + ,111.7 + ,110 + ,88.5 + ,96.2 + ,114.2 + ,100.9 + ,86.2 + ,98.5 + ,102.4 + ,94.8 + ,83.8 + ,96.2 + ,95.3 + ,88.5 + ,76.4 + ,97.3 + ,87.7 + ,92.4 + ,76 + ,103 + ,91.5 + ,87.2 + ,75.7 + ,102.6 + ,85 + ,84.4 + ,71.5 + ,108.1 + ,80.7 + ,84.4 + ,69.7 + ,107.7 + ,80.9 + ,79.2 + ,72.1 + ,101.6 + ,75.4 + ,75.8 + ,72.6 + ,98.3 + ,71.7 + ,71.4 + ,70.2 + ,96.6 + ,66.6 + ,78.7 + ,69.4 + ,96.8 + ,75.8 + ,75.3 + ,68 + ,94.5 + ,72.1) + ,dim=c(4 + ,60) + ,dimnames=list(c('Algemeen' + ,'Levensmiddelen' + ,'Industrie' + ,'Energie') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Algemeen','Levensmiddelen','Industrie','Energie'),1:60)) > 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 = '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 Algemeen Levensmiddelen Industrie Energie t 1 122.7 119.4 104.0 126.6 1 2 126.2 129.8 113.1 128.5 2 3 125.9 131.9 117.3 127.1 3 4 133.2 129.8 120.5 135.9 4 5 131.0 131.6 119.9 133.2 5 6 133.8 134.3 120.5 126.4 6 7 142.4 136.7 124.7 146.2 7 8 134.2 134.7 118.9 137.1 8 9 124.1 138.1 120.2 123.9 9 10 118.7 132.4 116.5 118.2 10 11 114.3 125.0 110.9 114.2 11 12 107.8 117.7 108.6 106.9 12 13 104.4 112.0 108.6 103.1 13 14 98.1 106.3 104.9 96.2 14 15 97.1 100.5 102.1 95.9 15 16 95.3 95.6 98.0 94.8 16 17 94.3 89.5 93.1 94.9 17 18 95.6 87.7 96.4 96.0 18 19 105.0 88.2 103.7 106.4 19 20 98.3 88.7 93.5 99.9 20 21 93.1 91.4 87.9 94.2 21 22 96.6 95.7 91.8 97.6 22 23 93.1 96.8 89.3 93.6 23 24 94.9 93.8 85.1 96.8 24 25 90.8 91.0 82.6 92.4 25 26 84.6 86.8 80.4 85.3 26 27 88.4 91.5 80.6 89.6 27 28 80.4 89.3 72.3 81.3 28 29 84.6 97.9 69.4 86.7 29 30 73.2 95.7 65.1 73.3 30 31 64.6 86.9 62.6 63.4 31 32 60.5 82.0 59.2 59.3 32 33 56.4 83.2 58.2 54.2 33 34 58.5 85.7 60.1 56.3 34 35 56.7 77.8 63.1 54.0 35 36 69.6 79.4 69.4 69.0 36 37 89.1 83.4 79.2 91.5 37 38 121.3 102.8 96.7 127.3 38 39 137.2 108.7 105.0 145.5 39 40 157.5 120.3 113.2 168.7 40 41 155.4 121.9 112.3 166.0 41 42 146.2 112.7 112.9 155.0 42 43 131.5 113.1 113.2 136.4 43 44 125.8 115.7 112.6 129.0 44 45 116.7 113.5 106.9 118.8 45 46 111.2 103.1 101.3 113.7 46 47 107.9 95.5 92.7 111.7 47 48 110.0 88.5 96.2 114.2 48 49 100.9 86.2 98.5 102.4 49 50 94.8 83.8 96.2 95.3 50 51 88.5 76.4 97.3 87.7 51 52 92.4 76.0 103.0 91.5 52 53 87.2 75.7 102.6 85.0 53 54 84.4 71.5 108.1 80.7 54 55 84.4 69.7 107.7 80.9 55 56 79.2 72.1 101.6 75.4 56 57 75.8 72.6 98.3 71.7 57 58 71.4 70.2 96.6 66.6 58 59 78.7 69.4 96.8 75.8 59 60 75.3 68.0 94.5 72.1 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Levensmiddelen Industrie Energie t -1.806498 0.075918 0.165414 0.778152 0.002403 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.8952 -0.2740 0.0165 0.0761 7.1055 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.806498 1.423790 -1.269 0.210 Levensmiddelen 0.075918 0.017412 4.360 5.75e-05 *** Industrie 0.165414 0.011731 14.100 < 2e-16 *** Energie 0.778152 0.010905 71.358 < 2e-16 *** t 0.002403 0.013029 0.184 0.854 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.009 on 55 degrees of freedom Multiple R-squared: 0.9985, Adjusted R-squared: 0.9984 F-statistic: 9053 on 4 and 55 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.0000000 5.329675e-60 2.664837e-60 [2,] 1.0000000 1.052000e-64 5.259998e-65 [3,] 1.0000000 4.747500e-64 2.373750e-64 [4,] 1.0000000 4.280483e-62 2.140241e-62 [5,] 1.0000000 1.892434e-60 9.462171e-61 [6,] 1.0000000 7.196820e-59 3.598410e-59 [7,] 1.0000000 5.041763e-57 2.520881e-57 [8,] 1.0000000 2.398999e-55 1.199499e-55 [9,] 1.0000000 3.602881e-54 1.801441e-54 [10,] 1.0000000 5.096010e-53 2.548005e-53 [11,] 1.0000000 2.360867e-51 1.180434e-51 [12,] 1.0000000 1.317743e-49 6.588714e-50 [13,] 1.0000000 3.806279e-48 1.903140e-48 [14,] 1.0000000 1.224321e-46 6.121607e-47 [15,] 1.0000000 5.054014e-45 2.527007e-45 [16,] 1.0000000 1.510850e-43 7.554252e-44 [17,] 1.0000000 2.430057e-42 1.215028e-42 [18,] 1.0000000 9.678119e-41 4.839060e-41 [19,] 1.0000000 2.669879e-39 1.334939e-39 [20,] 1.0000000 1.227909e-38 6.139546e-39 [21,] 1.0000000 6.884896e-38 3.442448e-38 [22,] 1.0000000 1.670663e-36 8.353317e-37 [23,] 1.0000000 1.063689e-35 5.318445e-36 [24,] 1.0000000 1.856466e-34 9.282328e-35 [25,] 1.0000000 8.331570e-33 4.165785e-33 [26,] 1.0000000 3.773739e-31 1.886869e-31 [27,] 1.0000000 1.568327e-29 7.841636e-30 [28,] 1.0000000 4.559239e-28 2.279620e-28 [29,] 1.0000000 1.646991e-26 8.234954e-27 [30,] 1.0000000 5.331881e-25 2.665940e-25 [31,] 1.0000000 1.148755e-24 5.743774e-25 [32,] 1.0000000 3.327343e-23 1.663672e-23 [33,] 1.0000000 7.297366e-22 3.648683e-22 [34,] 1.0000000 6.960795e-21 3.480397e-21 [35,] 1.0000000 3.191699e-19 1.595850e-19 [36,] 1.0000000 1.119550e-19 5.597752e-20 [37,] 1.0000000 6.228038e-18 3.114019e-18 [38,] 1.0000000 3.624775e-16 1.812387e-16 [39,] 1.0000000 1.004017e-14 5.020087e-15 [40,] 1.0000000 4.746630e-13 2.373315e-13 [41,] 1.0000000 1.462205e-11 7.311025e-12 [42,] 1.0000000 6.664096e-10 3.332048e-10 [43,] 1.0000000 3.171647e-08 1.585823e-08 [44,] 0.9999994 1.243645e-06 6.218227e-07 [45,] 0.9999822 3.550011e-05 1.775005e-05 > postscript(file="/var/wessaorg/rcomp/tmp/19p5a1322130961.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/wessaorg/rcomp/tmp/2abla1322130961.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/wessaorg/rcomp/tmp/3omow1322130961.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/wessaorg/rcomp/tmp/4v95w1322130961.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/wessaorg/rcomp/tmp/5wfz71322130961.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 = 60 Frequency = 1 1 2 3 4 5 6 -0.277613848 -0.553323084 -0.620480955 -0.540514829 -0.679312553 7.105488191 7 8 9 10 11 12 -0.581260442 -0.591244824 -0.895206092 -0.817377906 -0.619059706 -0.506299247 13 14 15 16 17 18 -0.518991246 -0.407381064 -0.272852686 -0.169091179 0.024321554 0.056738591 19 20 21 22 23 24 0.116076799 0.120924181 0.075325270 -0.044356652 -0.104127681 0.125878289 25 26 27 28 29 30 0.073449337 0.078691295 0.140337575 0.136550676 -0.041067699 -0.137937355 31 32 33 34 35 36 0.044977708 0.067404365 0.007887244 -0.032716435 0.058142173 0.119886647 37 38 39 40 41 42 0.184340486 0.156546946 0.070929238 0.078360247 0.104370403 0.060836034 43 44 45 46 47 48 -0.247937258 -0.290156811 -0.345532107 -0.163492144 0.089948572 0.194645684 49 50 51 52 53 54 0.068592398 0.053722802 0.045112786 0.073240951 0.017765190 -0.029505777 55 56 57 58 59 60 0.015279781 -0.080466939 -0.095801232 -0.066222592 0.100031246 0.063527682 > postscript(file="/var/wessaorg/rcomp/tmp/6goer1322130961.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.277613848 NA 1 -0.553323084 -0.277613848 2 -0.620480955 -0.553323084 3 -0.540514829 -0.620480955 4 -0.679312553 -0.540514829 5 7.105488191 -0.679312553 6 -0.581260442 7.105488191 7 -0.591244824 -0.581260442 8 -0.895206092 -0.591244824 9 -0.817377906 -0.895206092 10 -0.619059706 -0.817377906 11 -0.506299247 -0.619059706 12 -0.518991246 -0.506299247 13 -0.407381064 -0.518991246 14 -0.272852686 -0.407381064 15 -0.169091179 -0.272852686 16 0.024321554 -0.169091179 17 0.056738591 0.024321554 18 0.116076799 0.056738591 19 0.120924181 0.116076799 20 0.075325270 0.120924181 21 -0.044356652 0.075325270 22 -0.104127681 -0.044356652 23 0.125878289 -0.104127681 24 0.073449337 0.125878289 25 0.078691295 0.073449337 26 0.140337575 0.078691295 27 0.136550676 0.140337575 28 -0.041067699 0.136550676 29 -0.137937355 -0.041067699 30 0.044977708 -0.137937355 31 0.067404365 0.044977708 32 0.007887244 0.067404365 33 -0.032716435 0.007887244 34 0.058142173 -0.032716435 35 0.119886647 0.058142173 36 0.184340486 0.119886647 37 0.156546946 0.184340486 38 0.070929238 0.156546946 39 0.078360247 0.070929238 40 0.104370403 0.078360247 41 0.060836034 0.104370403 42 -0.247937258 0.060836034 43 -0.290156811 -0.247937258 44 -0.345532107 -0.290156811 45 -0.163492144 -0.345532107 46 0.089948572 -0.163492144 47 0.194645684 0.089948572 48 0.068592398 0.194645684 49 0.053722802 0.068592398 50 0.045112786 0.053722802 51 0.073240951 0.045112786 52 0.017765190 0.073240951 53 -0.029505777 0.017765190 54 0.015279781 -0.029505777 55 -0.080466939 0.015279781 56 -0.095801232 -0.080466939 57 -0.066222592 -0.095801232 58 0.100031246 -0.066222592 59 0.063527682 0.100031246 60 NA 0.063527682 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.553323084 -0.277613848 [2,] -0.620480955 -0.553323084 [3,] -0.540514829 -0.620480955 [4,] -0.679312553 -0.540514829 [5,] 7.105488191 -0.679312553 [6,] -0.581260442 7.105488191 [7,] -0.591244824 -0.581260442 [8,] -0.895206092 -0.591244824 [9,] -0.817377906 -0.895206092 [10,] -0.619059706 -0.817377906 [11,] -0.506299247 -0.619059706 [12,] -0.518991246 -0.506299247 [13,] -0.407381064 -0.518991246 [14,] -0.272852686 -0.407381064 [15,] -0.169091179 -0.272852686 [16,] 0.024321554 -0.169091179 [17,] 0.056738591 0.024321554 [18,] 0.116076799 0.056738591 [19,] 0.120924181 0.116076799 [20,] 0.075325270 0.120924181 [21,] -0.044356652 0.075325270 [22,] -0.104127681 -0.044356652 [23,] 0.125878289 -0.104127681 [24,] 0.073449337 0.125878289 [25,] 0.078691295 0.073449337 [26,] 0.140337575 0.078691295 [27,] 0.136550676 0.140337575 [28,] -0.041067699 0.136550676 [29,] -0.137937355 -0.041067699 [30,] 0.044977708 -0.137937355 [31,] 0.067404365 0.044977708 [32,] 0.007887244 0.067404365 [33,] -0.032716435 0.007887244 [34,] 0.058142173 -0.032716435 [35,] 0.119886647 0.058142173 [36,] 0.184340486 0.119886647 [37,] 0.156546946 0.184340486 [38,] 0.070929238 0.156546946 [39,] 0.078360247 0.070929238 [40,] 0.104370403 0.078360247 [41,] 0.060836034 0.104370403 [42,] -0.247937258 0.060836034 [43,] -0.290156811 -0.247937258 [44,] -0.345532107 -0.290156811 [45,] -0.163492144 -0.345532107 [46,] 0.089948572 -0.163492144 [47,] 0.194645684 0.089948572 [48,] 0.068592398 0.194645684 [49,] 0.053722802 0.068592398 [50,] 0.045112786 0.053722802 [51,] 0.073240951 0.045112786 [52,] 0.017765190 0.073240951 [53,] -0.029505777 0.017765190 [54,] 0.015279781 -0.029505777 [55,] -0.080466939 0.015279781 [56,] -0.095801232 -0.080466939 [57,] -0.066222592 -0.095801232 [58,] 0.100031246 -0.066222592 [59,] 0.063527682 0.100031246 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.553323084 -0.277613848 2 -0.620480955 -0.553323084 3 -0.540514829 -0.620480955 4 -0.679312553 -0.540514829 5 7.105488191 -0.679312553 6 -0.581260442 7.105488191 7 -0.591244824 -0.581260442 8 -0.895206092 -0.591244824 9 -0.817377906 -0.895206092 10 -0.619059706 -0.817377906 11 -0.506299247 -0.619059706 12 -0.518991246 -0.506299247 13 -0.407381064 -0.518991246 14 -0.272852686 -0.407381064 15 -0.169091179 -0.272852686 16 0.024321554 -0.169091179 17 0.056738591 0.024321554 18 0.116076799 0.056738591 19 0.120924181 0.116076799 20 0.075325270 0.120924181 21 -0.044356652 0.075325270 22 -0.104127681 -0.044356652 23 0.125878289 -0.104127681 24 0.073449337 0.125878289 25 0.078691295 0.073449337 26 0.140337575 0.078691295 27 0.136550676 0.140337575 28 -0.041067699 0.136550676 29 -0.137937355 -0.041067699 30 0.044977708 -0.137937355 31 0.067404365 0.044977708 32 0.007887244 0.067404365 33 -0.032716435 0.007887244 34 0.058142173 -0.032716435 35 0.119886647 0.058142173 36 0.184340486 0.119886647 37 0.156546946 0.184340486 38 0.070929238 0.156546946 39 0.078360247 0.070929238 40 0.104370403 0.078360247 41 0.060836034 0.104370403 42 -0.247937258 0.060836034 43 -0.290156811 -0.247937258 44 -0.345532107 -0.290156811 45 -0.163492144 -0.345532107 46 0.089948572 -0.163492144 47 0.194645684 0.089948572 48 0.068592398 0.194645684 49 0.053722802 0.068592398 50 0.045112786 0.053722802 51 0.073240951 0.045112786 52 0.017765190 0.073240951 53 -0.029505777 0.017765190 54 0.015279781 -0.029505777 55 -0.080466939 0.015279781 56 -0.095801232 -0.080466939 57 -0.066222592 -0.095801232 58 0.100031246 -0.066222592 59 0.063527682 0.100031246 > 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/wessaorg/rcomp/tmp/7ppe61322130961.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/wessaorg/rcomp/tmp/8ygu81322130961.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/wessaorg/rcomp/tmp/950ig1322130961.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/wessaorg/rcomp/tmp/10b3q01322130961.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11qewl1322130961.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/wessaorg/rcomp/tmp/12o1ik1322130961.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/wessaorg/rcomp/tmp/13hhsy1322130961.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/wessaorg/rcomp/tmp/1466pv1322130961.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/wessaorg/rcomp/tmp/15w42u1322130961.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/wessaorg/rcomp/tmp/16kx2q1322130961.tab") + } > > try(system("convert tmp/19p5a1322130961.ps tmp/19p5a1322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/2abla1322130961.ps tmp/2abla1322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/3omow1322130961.ps tmp/3omow1322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/4v95w1322130961.ps tmp/4v95w1322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/5wfz71322130961.ps tmp/5wfz71322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/6goer1322130961.ps tmp/6goer1322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/7ppe61322130961.ps tmp/7ppe61322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/8ygu81322130961.ps tmp/8ygu81322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/950ig1322130961.ps tmp/950ig1322130961.png",intern=TRUE)) character(0) > try(system("convert tmp/10b3q01322130961.ps tmp/10b3q01322130961.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.152 0.545 3.741