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(100.5 + ,98.60 + ,96.33 + ,106.29 + ,96.90 + ,96.33 + ,101.09 + ,95.10 + ,95.05 + ,104.53 + ,97.00 + ,96.84 + ,122.74 + ,112.70 + ,96.92 + ,109.84 + ,102.90 + ,97.44 + ,101.99 + ,97.40 + ,97.78 + ,125.12 + ,111.40 + ,97.69 + ,103.5 + ,87.40 + ,96.67 + ,102.8 + ,96.80 + ,98.29 + ,118.72 + ,114.10 + ,98.20 + ,119.01 + ,110.30 + ,98.71 + ,118.61 + ,103.90 + ,98.54 + ,120.43 + ,101.60 + ,98.20 + ,111.83 + ,94.60 + ,100.80 + ,116.79 + ,95.90 + ,101.33 + ,131.71 + ,104.70 + ,101.88 + ,120.57 + ,102.80 + ,101.85 + ,117.83 + ,98.10 + ,102.04 + ,130.8 + ,113.90 + ,102.22 + ,107.46 + ,80.90 + ,102.63 + ,112.09 + ,95.70 + ,102.65 + ,129.47 + ,113.20 + ,102.54 + ,119.72 + ,105.90 + ,102.37 + ,134.81 + ,108.80 + ,102.68 + ,135.8 + ,102.30 + ,102.76 + ,129.27 + ,99.00 + ,102.82 + ,126.94 + ,100.70 + ,103.31 + ,153.45 + ,115.50 + ,103.23 + ,121.86 + ,100.70 + ,103.60 + ,133.47 + ,109.90 + ,103.95 + ,135.34 + ,114.60 + ,103.93 + ,117.1 + ,85.40 + ,104.25 + ,120.65 + ,100.50 + ,104.38 + ,132.49 + ,114.80 + ,104.36 + ,137.6 + ,116.50 + ,104.32 + ,138.69 + ,112.90 + ,104.58 + ,125.53 + ,102.00 + ,104.68 + ,133.09 + ,106.00 + ,104.92 + ,129.08 + ,105.30 + ,105.46 + ,145.94 + ,118.80 + ,105.23 + ,129.07 + ,106.10 + ,105.58 + ,139.69 + ,109.30 + ,105.34 + ,142.09 + ,117.20 + ,105.28 + ,137.29 + ,92.50 + ,105.70 + ,127.03 + ,104.20 + ,105.67 + ,137.25 + ,112.50 + ,105.71 + ,156.87 + ,122.40 + ,106.19 + ,150.89 + ,113.30 + ,106.93 + ,139.14 + ,100.00 + ,107.44 + ,158.3 + ,110.70 + ,107.85 + ,149 + ,112.80 + ,108.71 + ,158.36 + ,109.80 + ,109.32 + ,168.06 + ,117.30 + ,109.49 + ,153.38 + ,109.10 + ,110.20 + ,173.86 + ,115.90 + ,110.62 + ,162.47 + ,96.00 + ,111.22 + ,145.17 + ,99.80 + ,110.88 + ,168.89 + ,116.80 + ,111.15 + ,166.64 + ,115.70 + ,111.29 + ,140.07 + ,99.40 + ,111.09 + ,128.84 + ,94.30 + ,111.24 + ,123.41 + ,91.00 + ,111.45 + ,120.3 + ,93.20 + ,111.75 + ,129.67 + ,103.10 + ,111.07 + ,118.1 + ,94.10 + ,111.17 + ,113.91 + ,91.80 + ,110.96 + ,131.09 + ,102.70 + ,110.50 + ,119.15 + ,82.60 + ,110.48 + ,122.3 + ,89.10 + ,110.66) + ,dim=c(3 + ,70) + ,dimnames=list(c('Invoer' + ,'TIP' + ,'CONS') + ,1:70)) > y <- array(NA,dim=c(3,70),dimnames=list(c('Invoer','TIP','CONS'),1:70)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo 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 Invoer TIP CONS 1 100.50 98.6 96.33 2 106.29 96.9 96.33 3 101.09 95.1 95.05 4 104.53 97.0 96.84 5 122.74 112.7 96.92 6 109.84 102.9 97.44 7 101.99 97.4 97.78 8 125.12 111.4 97.69 9 103.50 87.4 96.67 10 102.80 96.8 98.29 11 118.72 114.1 98.20 12 119.01 110.3 98.71 13 118.61 103.9 98.54 14 120.43 101.6 98.20 15 111.83 94.6 100.80 16 116.79 95.9 101.33 17 131.71 104.7 101.88 18 120.57 102.8 101.85 19 117.83 98.1 102.04 20 130.80 113.9 102.22 21 107.46 80.9 102.63 22 112.09 95.7 102.65 23 129.47 113.2 102.54 24 119.72 105.9 102.37 25 134.81 108.8 102.68 26 135.80 102.3 102.76 27 129.27 99.0 102.82 28 126.94 100.7 103.31 29 153.45 115.5 103.23 30 121.86 100.7 103.60 31 133.47 109.9 103.95 32 135.34 114.6 103.93 33 117.10 85.4 104.25 34 120.65 100.5 104.38 35 132.49 114.8 104.36 36 137.60 116.5 104.32 37 138.69 112.9 104.58 38 125.53 102.0 104.68 39 133.09 106.0 104.92 40 129.08 105.3 105.46 41 145.94 118.8 105.23 42 129.07 106.1 105.58 43 139.69 109.3 105.34 44 142.09 117.2 105.28 45 137.29 92.5 105.70 46 127.03 104.2 105.67 47 137.25 112.5 105.71 48 156.87 122.4 106.19 49 150.89 113.3 106.93 50 139.14 100.0 107.44 51 158.30 110.7 107.85 52 149.00 112.8 108.71 53 158.36 109.8 109.32 54 168.06 117.3 109.49 55 153.38 109.1 110.20 56 173.86 115.9 110.62 57 162.47 96.0 111.22 58 145.17 99.8 110.88 59 168.89 116.8 111.15 60 166.64 115.7 111.29 61 140.07 99.4 111.09 62 128.84 94.3 111.24 63 123.41 91.0 111.45 64 120.30 93.2 111.75 65 129.67 103.1 111.07 66 118.10 94.1 111.17 67 113.91 91.8 110.96 68 131.09 102.7 110.50 69 119.15 82.6 110.48 70 122.30 89.1 110.66 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) TIP CONS -227.017 1.157 2.268 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -16.9780 -5.4947 -0.5072 4.9712 26.1324 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -227.0169 24.0408 -9.443 6.2e-14 *** TIP 1.1571 0.1054 10.983 < 2e-16 *** CONS 2.2682 0.2083 10.890 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.285 on 67 degrees of freedom Multiple R-squared: 0.7872, Adjusted R-squared: 0.7809 F-statistic: 123.9 on 2 and 67 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,] 7.208858e-02 1.441772e-01 0.9279114 [2,] 2.486282e-02 4.972563e-02 0.9751372 [3,] 1.459896e-02 2.919792e-02 0.9854010 [4,] 8.062220e-02 1.612444e-01 0.9193778 [5,] 4.849666e-02 9.699332e-02 0.9515033 [6,] 3.061866e-02 6.123731e-02 0.9693813 [7,] 1.518673e-02 3.037346e-02 0.9848133 [8,] 1.382527e-02 2.765054e-02 0.9861747 [9,] 2.412133e-02 4.824266e-02 0.9758787 [10,] 1.257391e-02 2.514782e-02 0.9874261 [11,] 6.995215e-03 1.399043e-02 0.9930048 [12,] 7.420323e-03 1.484065e-02 0.9925797 [13,] 4.408894e-03 8.817788e-03 0.9955911 [14,] 2.262006e-03 4.524012e-03 0.9977380 [15,] 1.240585e-03 2.481170e-03 0.9987594 [16,] 6.842948e-04 1.368590e-03 0.9993157 [17,] 6.376427e-04 1.275285e-03 0.9993624 [18,] 3.629955e-04 7.259911e-04 0.9996370 [19,] 3.102603e-04 6.205207e-04 0.9996897 [20,] 3.093365e-04 6.186731e-04 0.9996907 [21,] 1.388847e-03 2.777695e-03 0.9986112 [22,] 1.540722e-03 3.081443e-03 0.9984593 [23,] 8.648288e-04 1.729658e-03 0.9991352 [24,] 5.568752e-03 1.113750e-02 0.9944312 [25,] 4.022568e-03 8.045137e-03 0.9959774 [26,] 2.417797e-03 4.835593e-03 0.9975822 [27,] 1.728018e-03 3.456037e-03 0.9982720 [28,] 1.815985e-03 3.631970e-03 0.9981840 [29,] 1.627950e-03 3.255899e-03 0.9983721 [30,] 1.847872e-03 3.695744e-03 0.9981521 [31,] 1.326459e-03 2.652918e-03 0.9986735 [32,] 7.425507e-04 1.485101e-03 0.9992574 [33,] 4.380647e-04 8.761294e-04 0.9995619 [34,] 2.248321e-04 4.496643e-04 0.9997752 [35,] 1.436724e-04 2.873448e-04 0.9998563 [36,] 8.848361e-05 1.769672e-04 0.9999115 [37,] 6.761189e-05 1.352238e-04 0.9999324 [38,] 3.632399e-05 7.264799e-05 0.9999637 [39,] 3.048393e-05 6.096785e-05 0.9999695 [40,] 5.405120e-04 1.081024e-03 0.9994595 [41,] 4.205324e-04 8.410649e-04 0.9995795 [42,] 3.755532e-04 7.511064e-04 0.9996244 [43,] 5.649318e-04 1.129864e-03 0.9994351 [44,] 5.095260e-04 1.019052e-03 0.9994905 [45,] 2.914355e-04 5.828710e-04 0.9997086 [46,] 4.540597e-04 9.081193e-04 0.9995459 [47,] 4.213666e-04 8.427333e-04 0.9995786 [48,] 3.285051e-04 6.570102e-04 0.9996715 [49,] 3.106779e-04 6.213558e-04 0.9996893 [50,] 1.499642e-04 2.999285e-04 0.9998500 [51,] 2.675339e-04 5.350679e-04 0.9997325 [52,] 1.159884e-01 2.319769e-01 0.8840116 [53,] 1.300680e-01 2.601361e-01 0.8699320 [54,] 1.337931e-01 2.675862e-01 0.8662069 [55,] 4.240902e-01 8.481803e-01 0.5759098 [56,] 7.572738e-01 4.854524e-01 0.2427262 [57,] 8.163086e-01 3.673829e-01 0.1836914 [58,] 8.209130e-01 3.581740e-01 0.1790870 [59,] 8.453856e-01 3.092288e-01 0.1546144 > postscript(file="/var/www/html/rcomp/tmp/1flzt1261150401.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/2z8e01261150401.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/3cj791261150401.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/4gkt51261150401.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/5bk7k1261150401.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 = 70 Frequency = 1 1 2 3 4 5 6 -5.07216753 2.68491173 2.47103488 -0.34759570 -0.48560956 -3.22545535 7 8 9 10 11 12 -5.48257331 1.65209105 10.11621556 -5.13510692 -9.02889054 -5.49868672 13 14 15 16 17 18 1.89238711 7.14492756 0.74726982 3.00087127 6.49081729 -2.38263549 19 20 21 22 23 24 -0.11520343 -5.83575075 8.07875506 -4.46177015 -7.08161028 -7.99914155 25 26 27 28 29 30 3.03210161 11.36182868 8.51418291 3.10567135 12.67196906 -2.63211511 31 32 33 34 35 36 -2.46136544 -5.98439646 8.83724927 -5.37991278 -10.04115610 -6.80750620 37 38 39 40 41 42 -2.14166617 -2.91603971 -0.52883650 -4.95370645 -3.19293728 -6.16157831 43 44 45 46 47 48 1.30005926 -5.30498002 17.52286828 -6.20721858 -5.68192297 1.39398310 49 50 51 52 53 54 4.26515308 6.74785865 12.59685639 -1.08374214 10.36395440 11.00006458 55 56 57 58 59 60 4.19788654 15.85691324 26.13237414 5.20657136 8.64335687 7.34862078 61 62 63 64 65 66 0.09308541 -5.57591118 -7.66379134 -13.99989207 -14.54284016 -15.92571405 67 68 69 70 -16.97804340 -11.36710735 -0.00392327 -4.78338993 > postscript(file="/var/www/html/rcomp/tmp/6b2cm1261150401.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 = 70 Frequency = 1 lag(myerror, k = 1) myerror 0 -5.07216753 NA 1 2.68491173 -5.07216753 2 2.47103488 2.68491173 3 -0.34759570 2.47103488 4 -0.48560956 -0.34759570 5 -3.22545535 -0.48560956 6 -5.48257331 -3.22545535 7 1.65209105 -5.48257331 8 10.11621556 1.65209105 9 -5.13510692 10.11621556 10 -9.02889054 -5.13510692 11 -5.49868672 -9.02889054 12 1.89238711 -5.49868672 13 7.14492756 1.89238711 14 0.74726982 7.14492756 15 3.00087127 0.74726982 16 6.49081729 3.00087127 17 -2.38263549 6.49081729 18 -0.11520343 -2.38263549 19 -5.83575075 -0.11520343 20 8.07875506 -5.83575075 21 -4.46177015 8.07875506 22 -7.08161028 -4.46177015 23 -7.99914155 -7.08161028 24 3.03210161 -7.99914155 25 11.36182868 3.03210161 26 8.51418291 11.36182868 27 3.10567135 8.51418291 28 12.67196906 3.10567135 29 -2.63211511 12.67196906 30 -2.46136544 -2.63211511 31 -5.98439646 -2.46136544 32 8.83724927 -5.98439646 33 -5.37991278 8.83724927 34 -10.04115610 -5.37991278 35 -6.80750620 -10.04115610 36 -2.14166617 -6.80750620 37 -2.91603971 -2.14166617 38 -0.52883650 -2.91603971 39 -4.95370645 -0.52883650 40 -3.19293728 -4.95370645 41 -6.16157831 -3.19293728 42 1.30005926 -6.16157831 43 -5.30498002 1.30005926 44 17.52286828 -5.30498002 45 -6.20721858 17.52286828 46 -5.68192297 -6.20721858 47 1.39398310 -5.68192297 48 4.26515308 1.39398310 49 6.74785865 4.26515308 50 12.59685639 6.74785865 51 -1.08374214 12.59685639 52 10.36395440 -1.08374214 53 11.00006458 10.36395440 54 4.19788654 11.00006458 55 15.85691324 4.19788654 56 26.13237414 15.85691324 57 5.20657136 26.13237414 58 8.64335687 5.20657136 59 7.34862078 8.64335687 60 0.09308541 7.34862078 61 -5.57591118 0.09308541 62 -7.66379134 -5.57591118 63 -13.99989207 -7.66379134 64 -14.54284016 -13.99989207 65 -15.92571405 -14.54284016 66 -16.97804340 -15.92571405 67 -11.36710735 -16.97804340 68 -0.00392327 -11.36710735 69 -4.78338993 -0.00392327 70 NA -4.78338993 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.68491173 -5.07216753 [2,] 2.47103488 2.68491173 [3,] -0.34759570 2.47103488 [4,] -0.48560956 -0.34759570 [5,] -3.22545535 -0.48560956 [6,] -5.48257331 -3.22545535 [7,] 1.65209105 -5.48257331 [8,] 10.11621556 1.65209105 [9,] -5.13510692 10.11621556 [10,] -9.02889054 -5.13510692 [11,] -5.49868672 -9.02889054 [12,] 1.89238711 -5.49868672 [13,] 7.14492756 1.89238711 [14,] 0.74726982 7.14492756 [15,] 3.00087127 0.74726982 [16,] 6.49081729 3.00087127 [17,] -2.38263549 6.49081729 [18,] -0.11520343 -2.38263549 [19,] -5.83575075 -0.11520343 [20,] 8.07875506 -5.83575075 [21,] -4.46177015 8.07875506 [22,] -7.08161028 -4.46177015 [23,] -7.99914155 -7.08161028 [24,] 3.03210161 -7.99914155 [25,] 11.36182868 3.03210161 [26,] 8.51418291 11.36182868 [27,] 3.10567135 8.51418291 [28,] 12.67196906 3.10567135 [29,] -2.63211511 12.67196906 [30,] -2.46136544 -2.63211511 [31,] -5.98439646 -2.46136544 [32,] 8.83724927 -5.98439646 [33,] -5.37991278 8.83724927 [34,] -10.04115610 -5.37991278 [35,] -6.80750620 -10.04115610 [36,] -2.14166617 -6.80750620 [37,] -2.91603971 -2.14166617 [38,] -0.52883650 -2.91603971 [39,] -4.95370645 -0.52883650 [40,] -3.19293728 -4.95370645 [41,] -6.16157831 -3.19293728 [42,] 1.30005926 -6.16157831 [43,] -5.30498002 1.30005926 [44,] 17.52286828 -5.30498002 [45,] -6.20721858 17.52286828 [46,] -5.68192297 -6.20721858 [47,] 1.39398310 -5.68192297 [48,] 4.26515308 1.39398310 [49,] 6.74785865 4.26515308 [50,] 12.59685639 6.74785865 [51,] -1.08374214 12.59685639 [52,] 10.36395440 -1.08374214 [53,] 11.00006458 10.36395440 [54,] 4.19788654 11.00006458 [55,] 15.85691324 4.19788654 [56,] 26.13237414 15.85691324 [57,] 5.20657136 26.13237414 [58,] 8.64335687 5.20657136 [59,] 7.34862078 8.64335687 [60,] 0.09308541 7.34862078 [61,] -5.57591118 0.09308541 [62,] -7.66379134 -5.57591118 [63,] -13.99989207 -7.66379134 [64,] -14.54284016 -13.99989207 [65,] -15.92571405 -14.54284016 [66,] -16.97804340 -15.92571405 [67,] -11.36710735 -16.97804340 [68,] -0.00392327 -11.36710735 [69,] -4.78338993 -0.00392327 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.68491173 -5.07216753 2 2.47103488 2.68491173 3 -0.34759570 2.47103488 4 -0.48560956 -0.34759570 5 -3.22545535 -0.48560956 6 -5.48257331 -3.22545535 7 1.65209105 -5.48257331 8 10.11621556 1.65209105 9 -5.13510692 10.11621556 10 -9.02889054 -5.13510692 11 -5.49868672 -9.02889054 12 1.89238711 -5.49868672 13 7.14492756 1.89238711 14 0.74726982 7.14492756 15 3.00087127 0.74726982 16 6.49081729 3.00087127 17 -2.38263549 6.49081729 18 -0.11520343 -2.38263549 19 -5.83575075 -0.11520343 20 8.07875506 -5.83575075 21 -4.46177015 8.07875506 22 -7.08161028 -4.46177015 23 -7.99914155 -7.08161028 24 3.03210161 -7.99914155 25 11.36182868 3.03210161 26 8.51418291 11.36182868 27 3.10567135 8.51418291 28 12.67196906 3.10567135 29 -2.63211511 12.67196906 30 -2.46136544 -2.63211511 31 -5.98439646 -2.46136544 32 8.83724927 -5.98439646 33 -5.37991278 8.83724927 34 -10.04115610 -5.37991278 35 -6.80750620 -10.04115610 36 -2.14166617 -6.80750620 37 -2.91603971 -2.14166617 38 -0.52883650 -2.91603971 39 -4.95370645 -0.52883650 40 -3.19293728 -4.95370645 41 -6.16157831 -3.19293728 42 1.30005926 -6.16157831 43 -5.30498002 1.30005926 44 17.52286828 -5.30498002 45 -6.20721858 17.52286828 46 -5.68192297 -6.20721858 47 1.39398310 -5.68192297 48 4.26515308 1.39398310 49 6.74785865 4.26515308 50 12.59685639 6.74785865 51 -1.08374214 12.59685639 52 10.36395440 -1.08374214 53 11.00006458 10.36395440 54 4.19788654 11.00006458 55 15.85691324 4.19788654 56 26.13237414 15.85691324 57 5.20657136 26.13237414 58 8.64335687 5.20657136 59 7.34862078 8.64335687 60 0.09308541 7.34862078 61 -5.57591118 0.09308541 62 -7.66379134 -5.57591118 63 -13.99989207 -7.66379134 64 -14.54284016 -13.99989207 65 -15.92571405 -14.54284016 66 -16.97804340 -15.92571405 67 -11.36710735 -16.97804340 68 -0.00392327 -11.36710735 69 -4.78338993 -0.00392327 > 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/7vbw01261150401.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/8ktir1261150401.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/9d2nz1261150401.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/10cwdj1261150401.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/118u2t1261150401.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/12ivnr1261150401.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/1339sb1261150401.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/143h3i1261150401.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/15nh491261150401.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/16l1hl1261150401.tab") + } > > try(system("convert tmp/1flzt1261150401.ps tmp/1flzt1261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/2z8e01261150401.ps tmp/2z8e01261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/3cj791261150401.ps tmp/3cj791261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/4gkt51261150401.ps tmp/4gkt51261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/5bk7k1261150401.ps tmp/5bk7k1261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/6b2cm1261150401.ps tmp/6b2cm1261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/7vbw01261150401.ps tmp/7vbw01261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/8ktir1261150401.ps tmp/8ktir1261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/9d2nz1261150401.ps tmp/9d2nz1261150401.png",intern=TRUE)) character(0) > try(system("convert tmp/10cwdj1261150401.ps tmp/10cwdj1261150401.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.601 1.581 6.687