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.0 + ,114.1 + ,141.7 + ,100.0 + ,93.5 + ,110.3 + ,153.4 + ,117.5 + ,88.2 + ,103.9 + ,145 + ,95.5 + ,89.2 + ,101.6 + ,137.7 + ,100.2 + ,91.4 + ,94.6 + ,148.3 + ,104.9 + ,92.5 + ,95.9 + ,152.2 + ,115.9 + ,91.4 + ,104.7 + ,169.4 + ,125.1 + ,88.2 + ,102.8 + ,168.6 + ,129.9 + ,87.1 + ,98.1 + ,161.1 + ,136.8 + ,84.9 + ,113.9 + ,174.1 + ,136.0 + ,92.5 + ,80.9 + ,179 + ,107.6 + ,93.5 + ,95.7 + ,190.6 + ,117.9 + ,93.5 + ,113.2 + ,190 + ,119.3 + ,91.4 + ,105.9 + ,181.6 + ,123.9 + ,90.3 + ,108.8 + ,174.8 + ,113.7 + ,91.4 + ,102.3 + ,180.5 + ,131.9 + ,93.5 + ,99 + ,196.8 + ,159.6 + ,93.5 + ,100.7 + ,193.8 + ,124.3 + ,92.5 + ,115.5 + ,197 + ,138.3 + ,91.4 + ,100.7 + ,216.3 + ,104.9 + ,89.2 + ,109.9 + ,221.4 + ,132.0 + ,86.0 + ,114.6 + ,217.9 + ,118.1 + ,88.2 + ,85.4 + ,229.7 + ,114.0 + ,87.1 + ,100.5 + ,227.4 + ,106.5 + ,87.1 + ,114.8 + ,204.2 + ,110.4 + ,86.0 + ,116.5 + ,196.6 + ,115.0 + ,84.9 + ,112.9 + ,198.8 + ,95.5 + ,84.9 + ,102 + ,207.5 + ,105.8 + ,86.0 + ,106 + ,190.7 + ,109.1 + ,86.0 + ,105.3 + ,201.6 + ,105.6 + ,84.9 + ,118.8 + ,210.5 + ,118.2 + ,86.0 + ,106.1 + ,223.5 + ,107.2 + ,82.8 + ,109.3 + ,223.8 + ,102.1 + ,77.4 + ,117.2 + ,231.2 + ,126.5 + ,80.6 + ,92.5 + ,244 + ,111.7 + ,78.5 + ,104.2 + ,234.7 + ,99.3 + ,75.3 + ,112.5 + ,250.2 + ,88.1 + ,75.3 + ,122.4 + ,265.7 + ,117.7 + ,75.3 + ,113.3 + ,287.6 + ,96.0 + ,77.4 + ,100 + ,283.3 + ,95.7 + ,78.5 + ,110.7 + ,295.4 + ,117.2 + ,76.3 + ,112.8 + ,312.3 + ,113.2 + ,73.1 + ,109.8 + ,333.8 + ,101.7 + ,68.8 + ,117.3 + ,347.7 + ,129.8 + ,65.6 + ,109.1 + ,383.2 + ,96.2 + ,69.9 + ,115.9 + ,407.1 + ,121.9 + ,82.8 + ,96 + ,413.6 + ,106.1 + ,84.9 + ,99.8 + ,362.7 + ,99.6 + ,80.6 + ,116.8 + ,321.9 + ,112.8 + ,74.2 + ,115.7 + ,239.4 + ,99.4 + ,71.0 + ,99.4 + ,191 + ,84.8 + ,74.2 + ,94.3 + ,159.7 + ,96.6 + ,82.8 + ,91 + ,163.4 + ,83.0 + ,86.0 + ,93.2 + ,157.6 + ,80.9 + ,86.0 + ,103.1 + ,166.2 + ,104.2 + ,82.8 + ,94.1 + ,176.7 + ,91.1 + ,78.5 + ,91.8 + ,198.3 + ,84.8 + ,79.6 + ,102.7 + ,226.2 + ,117.3 + ,87.1 + ,82.6 + ,216.2 + ,98.1 + ,89.2 + ,89.1 + ,235.9 + ,112.5) + ,dim=c(4 + ,60) + ,dimnames=list(c('wrk' + ,'indpr' + ,'grn' + ,'bw') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('wrk','indpr','grn','bw'),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 = '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 wrk indpr grn bw 1 100.0 114.1 141.7 100.0 2 93.5 110.3 153.4 117.5 3 88.2 103.9 145.0 95.5 4 89.2 101.6 137.7 100.2 5 91.4 94.6 148.3 104.9 6 92.5 95.9 152.2 115.9 7 91.4 104.7 169.4 125.1 8 88.2 102.8 168.6 129.9 9 87.1 98.1 161.1 136.8 10 84.9 113.9 174.1 136.0 11 92.5 80.9 179.0 107.6 12 93.5 95.7 190.6 117.9 13 93.5 113.2 190.0 119.3 14 91.4 105.9 181.6 123.9 15 90.3 108.8 174.8 113.7 16 91.4 102.3 180.5 131.9 17 93.5 99.0 196.8 159.6 18 93.5 100.7 193.8 124.3 19 92.5 115.5 197.0 138.3 20 91.4 100.7 216.3 104.9 21 89.2 109.9 221.4 132.0 22 86.0 114.6 217.9 118.1 23 88.2 85.4 229.7 114.0 24 87.1 100.5 227.4 106.5 25 87.1 114.8 204.2 110.4 26 86.0 116.5 196.6 115.0 27 84.9 112.9 198.8 95.5 28 84.9 102.0 207.5 105.8 29 86.0 106.0 190.7 109.1 30 86.0 105.3 201.6 105.6 31 84.9 118.8 210.5 118.2 32 86.0 106.1 223.5 107.2 33 82.8 109.3 223.8 102.1 34 77.4 117.2 231.2 126.5 35 80.6 92.5 244.0 111.7 36 78.5 104.2 234.7 99.3 37 75.3 112.5 250.2 88.1 38 75.3 122.4 265.7 117.7 39 75.3 113.3 287.6 96.0 40 77.4 100.0 283.3 95.7 41 78.5 110.7 295.4 117.2 42 76.3 112.8 312.3 113.2 43 73.1 109.8 333.8 101.7 44 68.8 117.3 347.7 129.8 45 65.6 109.1 383.2 96.2 46 69.9 115.9 407.1 121.9 47 82.8 96.0 413.6 106.1 48 84.9 99.8 362.7 99.6 49 80.6 116.8 321.9 112.8 50 74.2 115.7 239.4 99.4 51 71.0 99.4 191.0 84.8 52 74.2 94.3 159.7 96.6 53 82.8 91.0 163.4 83.0 54 86.0 93.2 157.6 80.9 55 86.0 103.1 166.2 104.2 56 82.8 94.1 176.7 91.1 57 78.5 91.8 198.3 84.8 58 79.6 102.7 226.2 117.3 59 87.1 82.6 216.2 98.1 60 89.2 89.1 235.9 112.5 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) indpr grn bw 95.98180 -0.16234 -0.06474 0.17827 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -13.3548 -2.6574 0.7625 2.6763 13.8880 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 95.98180 7.72749 12.421 < 2e-16 *** indpr -0.16234 0.07366 -2.204 0.03167 * grn -0.06474 0.01028 -6.297 4.98e-08 *** bw 0.17827 0.04461 3.996 0.00019 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.03 on 56 degrees of freedom Multiple R-squared: 0.5565, Adjusted R-squared: 0.5328 F-statistic: 23.43 on 3 and 56 DF, p-value: 5.918e-10 > 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.445034141 0.89006828 0.55496586 [2,] 0.354710840 0.70942168 0.64528916 [3,] 0.284078189 0.56815638 0.71592181 [4,] 0.376360967 0.75272193 0.62363903 [5,] 0.328608853 0.65721771 0.67139115 [6,] 0.246729364 0.49345873 0.75327064 [7,] 0.190222342 0.38044468 0.80977766 [8,] 0.126493273 0.25298655 0.87350673 [9,] 0.100643083 0.20128617 0.89935692 [10,] 0.068800954 0.13760191 0.93119905 [11,] 0.101748563 0.20349713 0.89825144 [12,] 0.071028326 0.14205665 0.92897167 [13,] 0.047864546 0.09572909 0.95213545 [14,] 0.052538857 0.10507771 0.94746114 [15,] 0.042173498 0.08434700 0.95782650 [16,] 0.057153335 0.11430667 0.94284667 [17,] 0.040599782 0.08119956 0.95940022 [18,] 0.034081546 0.06816309 0.96591845 [19,] 0.033609716 0.06721943 0.96639028 [20,] 0.034459803 0.06891961 0.96554020 [21,] 0.043807255 0.08761451 0.95619275 [22,] 0.039945752 0.07989150 0.96005425 [23,] 0.036081000 0.07216200 0.96391900 [24,] 0.032475960 0.06495192 0.96752404 [25,] 0.038895920 0.07779184 0.96110408 [26,] 0.040820377 0.08164075 0.95917962 [27,] 0.046217876 0.09243575 0.95378212 [28,] 0.081477347 0.16295469 0.91852265 [29,] 0.083841207 0.16768241 0.91615879 [30,] 0.078001523 0.15600305 0.92199848 [31,] 0.071355211 0.14271042 0.92864479 [32,] 0.059708770 0.11941754 0.94029123 [33,] 0.044321004 0.08864201 0.95567900 [34,] 0.028317813 0.05663563 0.97168219 [35,] 0.019003764 0.03800753 0.98099624 [36,] 0.012212021 0.02442404 0.98778798 [37,] 0.007003085 0.01400617 0.99299691 [38,] 0.009354842 0.01870968 0.99064516 [39,] 0.018774018 0.03754804 0.98122598 [40,] 0.055883446 0.11176689 0.94411655 [41,] 0.160503355 0.32100671 0.83949665 [42,] 0.176360781 0.35272156 0.82363922 [43,] 0.168360940 0.33672188 0.83163906 [44,] 0.154786506 0.30957301 0.84521349 [45,] 0.277203407 0.55440681 0.72279659 [46,] 0.937814337 0.12437133 0.06218566 [47,] 0.898051548 0.20389690 0.10194845 > postscript(file="/var/www/html/rcomp/tmp/1rygz1261145091.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/2wxqh1261145091.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/3bsgl1261145091.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/4ualr1261145091.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/5i2i71261145091.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 = 60 Frequency = 1 1 2 3 4 5 6 13.88797111 4.40888167 1.44800045 0.76414091 1.67619741 1.27877599 7 8 9 10 11 12 1.08084127 -3.33508201 -6.91368866 -5.56450141 2.05846885 4.37589696 13 14 15 16 17 18 6.92836208 2.27943026 3.02829531 0.19765234 -2.12079266 4.25383633 19 20 21 22 23 24 3.36783020 7.06896368 1.86156494 1.67588119 0.63052568 3.16991216 25 26 27 28 29 30 3.29404045 1.15793054 3.09219373 0.04982202 0.12320089 1.33920304 31 32 33 34 35 36 0.76077007 2.60171077 0.84978056 -7.13842139 -4.48104497 -3.07328555 37 38 39 40 41 42 -1.92576952 -4.59187886 -0.78284044 -1.06682825 -1.27921758 -1.33108201 43 44 45 46 47 48 -1.57602957 -8.76793177 -5.01089002 -2.64115422 10.26582565 10.84603925 49 50 51 52 53 54 4.31110251 -5.21995237 -11.59686671 -13.35480461 -2.62651163 0.92948419 55 56 57 58 59 60 -1.06025795 -2.70616540 -4.85800052 -5.97594132 1.03642778 2.89997915 > postscript(file="/var/www/html/rcomp/tmp/6zpjk1261145091.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 13.88797111 NA 1 4.40888167 13.88797111 2 1.44800045 4.40888167 3 0.76414091 1.44800045 4 1.67619741 0.76414091 5 1.27877599 1.67619741 6 1.08084127 1.27877599 7 -3.33508201 1.08084127 8 -6.91368866 -3.33508201 9 -5.56450141 -6.91368866 10 2.05846885 -5.56450141 11 4.37589696 2.05846885 12 6.92836208 4.37589696 13 2.27943026 6.92836208 14 3.02829531 2.27943026 15 0.19765234 3.02829531 16 -2.12079266 0.19765234 17 4.25383633 -2.12079266 18 3.36783020 4.25383633 19 7.06896368 3.36783020 20 1.86156494 7.06896368 21 1.67588119 1.86156494 22 0.63052568 1.67588119 23 3.16991216 0.63052568 24 3.29404045 3.16991216 25 1.15793054 3.29404045 26 3.09219373 1.15793054 27 0.04982202 3.09219373 28 0.12320089 0.04982202 29 1.33920304 0.12320089 30 0.76077007 1.33920304 31 2.60171077 0.76077007 32 0.84978056 2.60171077 33 -7.13842139 0.84978056 34 -4.48104497 -7.13842139 35 -3.07328555 -4.48104497 36 -1.92576952 -3.07328555 37 -4.59187886 -1.92576952 38 -0.78284044 -4.59187886 39 -1.06682825 -0.78284044 40 -1.27921758 -1.06682825 41 -1.33108201 -1.27921758 42 -1.57602957 -1.33108201 43 -8.76793177 -1.57602957 44 -5.01089002 -8.76793177 45 -2.64115422 -5.01089002 46 10.26582565 -2.64115422 47 10.84603925 10.26582565 48 4.31110251 10.84603925 49 -5.21995237 4.31110251 50 -11.59686671 -5.21995237 51 -13.35480461 -11.59686671 52 -2.62651163 -13.35480461 53 0.92948419 -2.62651163 54 -1.06025795 0.92948419 55 -2.70616540 -1.06025795 56 -4.85800052 -2.70616540 57 -5.97594132 -4.85800052 58 1.03642778 -5.97594132 59 2.89997915 1.03642778 60 NA 2.89997915 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.40888167 13.88797111 [2,] 1.44800045 4.40888167 [3,] 0.76414091 1.44800045 [4,] 1.67619741 0.76414091 [5,] 1.27877599 1.67619741 [6,] 1.08084127 1.27877599 [7,] -3.33508201 1.08084127 [8,] -6.91368866 -3.33508201 [9,] -5.56450141 -6.91368866 [10,] 2.05846885 -5.56450141 [11,] 4.37589696 2.05846885 [12,] 6.92836208 4.37589696 [13,] 2.27943026 6.92836208 [14,] 3.02829531 2.27943026 [15,] 0.19765234 3.02829531 [16,] -2.12079266 0.19765234 [17,] 4.25383633 -2.12079266 [18,] 3.36783020 4.25383633 [19,] 7.06896368 3.36783020 [20,] 1.86156494 7.06896368 [21,] 1.67588119 1.86156494 [22,] 0.63052568 1.67588119 [23,] 3.16991216 0.63052568 [24,] 3.29404045 3.16991216 [25,] 1.15793054 3.29404045 [26,] 3.09219373 1.15793054 [27,] 0.04982202 3.09219373 [28,] 0.12320089 0.04982202 [29,] 1.33920304 0.12320089 [30,] 0.76077007 1.33920304 [31,] 2.60171077 0.76077007 [32,] 0.84978056 2.60171077 [33,] -7.13842139 0.84978056 [34,] -4.48104497 -7.13842139 [35,] -3.07328555 -4.48104497 [36,] -1.92576952 -3.07328555 [37,] -4.59187886 -1.92576952 [38,] -0.78284044 -4.59187886 [39,] -1.06682825 -0.78284044 [40,] -1.27921758 -1.06682825 [41,] -1.33108201 -1.27921758 [42,] -1.57602957 -1.33108201 [43,] -8.76793177 -1.57602957 [44,] -5.01089002 -8.76793177 [45,] -2.64115422 -5.01089002 [46,] 10.26582565 -2.64115422 [47,] 10.84603925 10.26582565 [48,] 4.31110251 10.84603925 [49,] -5.21995237 4.31110251 [50,] -11.59686671 -5.21995237 [51,] -13.35480461 -11.59686671 [52,] -2.62651163 -13.35480461 [53,] 0.92948419 -2.62651163 [54,] -1.06025795 0.92948419 [55,] -2.70616540 -1.06025795 [56,] -4.85800052 -2.70616540 [57,] -5.97594132 -4.85800052 [58,] 1.03642778 -5.97594132 [59,] 2.89997915 1.03642778 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.40888167 13.88797111 2 1.44800045 4.40888167 3 0.76414091 1.44800045 4 1.67619741 0.76414091 5 1.27877599 1.67619741 6 1.08084127 1.27877599 7 -3.33508201 1.08084127 8 -6.91368866 -3.33508201 9 -5.56450141 -6.91368866 10 2.05846885 -5.56450141 11 4.37589696 2.05846885 12 6.92836208 4.37589696 13 2.27943026 6.92836208 14 3.02829531 2.27943026 15 0.19765234 3.02829531 16 -2.12079266 0.19765234 17 4.25383633 -2.12079266 18 3.36783020 4.25383633 19 7.06896368 3.36783020 20 1.86156494 7.06896368 21 1.67588119 1.86156494 22 0.63052568 1.67588119 23 3.16991216 0.63052568 24 3.29404045 3.16991216 25 1.15793054 3.29404045 26 3.09219373 1.15793054 27 0.04982202 3.09219373 28 0.12320089 0.04982202 29 1.33920304 0.12320089 30 0.76077007 1.33920304 31 2.60171077 0.76077007 32 0.84978056 2.60171077 33 -7.13842139 0.84978056 34 -4.48104497 -7.13842139 35 -3.07328555 -4.48104497 36 -1.92576952 -3.07328555 37 -4.59187886 -1.92576952 38 -0.78284044 -4.59187886 39 -1.06682825 -0.78284044 40 -1.27921758 -1.06682825 41 -1.33108201 -1.27921758 42 -1.57602957 -1.33108201 43 -8.76793177 -1.57602957 44 -5.01089002 -8.76793177 45 -2.64115422 -5.01089002 46 10.26582565 -2.64115422 47 10.84603925 10.26582565 48 4.31110251 10.84603925 49 -5.21995237 4.31110251 50 -11.59686671 -5.21995237 51 -13.35480461 -11.59686671 52 -2.62651163 -13.35480461 53 0.92948419 -2.62651163 54 -1.06025795 0.92948419 55 -2.70616540 -1.06025795 56 -4.85800052 -2.70616540 57 -5.97594132 -4.85800052 58 1.03642778 -5.97594132 59 2.89997915 1.03642778 > 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/7k6621261145091.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/87wvr1261145091.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/91ot21261145091.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/10tgng1261145091.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/111u3i1261145091.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/120q9a1261145091.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/1367jd1261145091.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/14oqz81261145091.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/155swc1261145091.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/165z2e1261145091.tab") + } > > try(system("convert tmp/1rygz1261145091.ps tmp/1rygz1261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/2wxqh1261145091.ps tmp/2wxqh1261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/3bsgl1261145091.ps tmp/3bsgl1261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/4ualr1261145091.ps tmp/4ualr1261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/5i2i71261145091.ps tmp/5i2i71261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/6zpjk1261145091.ps tmp/6zpjk1261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/7k6621261145091.ps tmp/7k6621261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/87wvr1261145091.ps tmp/87wvr1261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/91ot21261145091.ps tmp/91ot21261145091.png",intern=TRUE)) character(0) > try(system("convert tmp/10tgng1261145091.ps tmp/10tgng1261145091.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.585 1.644 24.210