R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(6.80 + ,225.00 + ,0.44 + ,0.67 + ,9.20 + ,6.30 + ,180.00 + ,0.44 + ,0.80 + ,11.70 + ,6.40 + ,190.00 + ,0.46 + ,0.76 + ,15.80 + ,6.20 + ,180.00 + ,0.42 + ,0.65 + ,8.60 + ,6.90 + ,205.00 + ,0.45 + ,0.90 + ,23.20 + ,6.40 + ,225.00 + ,0.43 + ,0.78 + ,27.40 + ,6.30 + ,185.00 + ,0.49 + ,0.77 + ,9.30 + ,6.80 + ,235.00 + ,0.47 + ,0.75 + ,16.00 + ,6.90 + ,235.00 + ,0.44 + ,0.82 + ,4.70 + ,6.70 + ,210.00 + ,0.48 + ,0.83 + ,12.50 + ,6.90 + ,245.00 + ,0.52 + ,0.63 + ,20.10 + ,6.90 + ,245.00 + ,0.49 + ,0.76 + ,9.10 + ,6.30 + ,185.00 + ,0.37 + ,0.71 + ,8.10 + ,6.10 + ,185.00 + ,0.42 + ,0.78 + ,8.60 + ,6.20 + ,180.00 + ,0.44 + ,0.78 + ,20.30 + ,6.80 + ,220.00 + ,0.50 + ,0.88 + ,25.00 + ,6.50 + ,194.00 + ,0.50 + ,0.83 + ,19.20 + ,7.60 + ,225.00 + ,0.43 + ,0.57 + ,3.30 + ,6.30 + ,210.00 + ,0.37 + ,0.82 + ,11.20 + ,7.10 + ,240.00 + ,0.50 + ,0.71 + ,10.50 + ,6.80 + ,225.00 + ,0.40 + ,0.77 + ,10.10 + ,7.30 + ,263.00 + ,0.48 + ,0.66 + ,7.20 + ,6.40 + ,210.00 + ,0.48 + ,0.24 + ,13.60 + ,6.80 + ,235.00 + ,0.43 + ,0.73 + ,9.00 + ,7.20 + ,230.00 + ,0.56 + ,0.72 + ,24.60 + ,6.40 + ,190.00 + ,0.44 + ,0.76 + ,12.60 + ,6.60 + ,220.00 + ,0.49 + ,0.75 + ,5.60 + ,6.80 + ,210.00 + ,0.40 + ,0.74 + ,8.70 + ,6.10 + ,180.00 + ,0.42 + ,0.71 + ,7.70 + ,6.50 + ,235.00 + ,0.49 + ,0.74 + ,24.10 + ,6.40 + ,185.00 + ,0.48 + ,0.86 + ,11.70 + ,6.00 + ,175.00 + ,0.39 + ,0.72 + ,7.70 + ,6.00 + ,192.00 + ,0.44 + ,0.79 + ,9.60 + ,7.30 + ,263.00 + ,0.48 + ,0.66 + ,7.20 + ,6.10 + ,180.00 + ,0.34 + ,0.82 + ,12.30 + ,6.70 + ,240.00 + ,0.52 + ,0.73 + ,8.90 + ,6.40 + ,210.00 + ,0.48 + ,0.85 + ,13.60 + ,5.80 + ,160.00 + ,0.41 + ,0.81 + ,11.20 + ,6.90 + ,230.00 + ,0.41 + ,0.60 + ,2.80 + ,7.00 + ,245.00 + ,0.41 + ,0.57 + ,3.20 + ,7.30 + ,228.00 + ,0.45 + ,0.73 + ,9.40 + ,5.90 + ,155.00 + ,0.29 + ,0.71 + ,11.90 + ,6.20 + ,200.00 + ,0.45 + ,0.80 + ,15.40 + ,6.80 + ,235.00 + ,0.55 + ,0.78 + ,7.40 + ,7.00 + ,235.00 + ,0.48 + ,0.74 + ,18.90 + ,5.90 + ,105.00 + ,0.36 + ,0.84 + ,7.90 + ,6.10 + ,180.00 + ,0.53 + ,0.79 + ,12.20 + ,5.70 + ,185.00 + ,0.35 + ,0.70 + ,11.00 + ,7.10 + ,245.00 + ,0.41 + ,0.78 + ,2.80 + ,5.80 + ,180.00 + ,0.43 + ,0.87 + ,11.80 + ,7.40 + ,240.00 + ,0.60 + ,0.71 + ,17.10 + ,6.80 + ,225.00 + ,0.48 + ,0.70 + ,11.60 + ,6.80 + ,215.00 + ,0.46 + ,0.73 + ,5.80 + ,7.00 + ,230.00 + ,0.44 + ,0.76 + ,8.30) + ,dim=c(5 + ,54) + ,dimnames=list(c('X1' + ,'X2' + ,'X3' + ,'X4' + ,'X5 ') + ,1:54)) > y <- array(NA,dim=c(5,54),dimnames=list(c('X1','X2','X3','X4','X5 '),1:54)) > 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' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 X1 X2 X3 X4 X5\r 1 6.8 225 0.44 0.67 9.2 2 6.3 180 0.44 0.80 11.7 3 6.4 190 0.46 0.76 15.8 4 6.2 180 0.42 0.65 8.6 5 6.9 205 0.45 0.90 23.2 6 6.4 225 0.43 0.78 27.4 7 6.3 185 0.49 0.77 9.3 8 6.8 235 0.47 0.75 16.0 9 6.9 235 0.44 0.82 4.7 10 6.7 210 0.48 0.83 12.5 11 6.9 245 0.52 0.63 20.1 12 6.9 245 0.49 0.76 9.1 13 6.3 185 0.37 0.71 8.1 14 6.1 185 0.42 0.78 8.6 15 6.2 180 0.44 0.78 20.3 16 6.8 220 0.50 0.88 25.0 17 6.5 194 0.50 0.83 19.2 18 7.6 225 0.43 0.57 3.3 19 6.3 210 0.37 0.82 11.2 20 7.1 240 0.50 0.71 10.5 21 6.8 225 0.40 0.77 10.1 22 7.3 263 0.48 0.66 7.2 23 6.4 210 0.48 0.24 13.6 24 6.8 235 0.43 0.73 9.0 25 7.2 230 0.56 0.72 24.6 26 6.4 190 0.44 0.76 12.6 27 6.6 220 0.49 0.75 5.6 28 6.8 210 0.40 0.74 8.7 29 6.1 180 0.42 0.71 7.7 30 6.5 235 0.49 0.74 24.1 31 6.4 185 0.48 0.86 11.7 32 6.0 175 0.39 0.72 7.7 33 6.0 192 0.44 0.79 9.6 34 7.3 263 0.48 0.66 7.2 35 6.1 180 0.34 0.82 12.3 36 6.7 240 0.52 0.73 8.9 37 6.4 210 0.48 0.85 13.6 38 5.8 160 0.41 0.81 11.2 39 6.9 230 0.41 0.60 2.8 40 7.0 245 0.41 0.57 3.2 41 7.3 228 0.45 0.73 9.4 42 5.9 155 0.29 0.71 11.9 43 6.2 200 0.45 0.80 15.4 44 6.8 235 0.55 0.78 7.4 45 7.0 235 0.48 0.74 18.9 46 5.9 105 0.36 0.84 7.9 47 6.1 180 0.53 0.79 12.2 48 5.7 185 0.35 0.70 11.0 49 7.1 245 0.41 0.78 2.8 50 5.8 180 0.43 0.87 11.8 51 7.4 240 0.60 0.71 17.1 52 6.8 225 0.48 0.70 11.6 53 6.8 215 0.46 0.73 5.8 54 7.0 230 0.44 0.76 8.3 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X2 X3 X4 `X5\\r` 3.788406 0.011522 1.122540 -0.038042 -0.008192 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.49609 -0.18586 0.01407 0.09178 0.78521 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.788406 0.448754 8.442 4.06e-11 *** X2 0.011522 0.001441 7.998 1.92e-10 *** X3 1.122540 0.783126 1.433 0.158 X4 -0.038042 0.377025 -0.101 0.920 `X5\\r` -0.008192 0.006628 -1.236 0.222 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2562 on 49 degrees of freedom Multiple R-squared: 0.7119, Adjusted R-squared: 0.6883 F-statistic: 30.27 on 4 and 49 DF, p-value: 1.061e-12 > 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.298835572 0.59767114 0.70116443 [2,] 0.310980190 0.62196038 0.68901981 [3,] 0.184277409 0.36855482 0.81572259 [4,] 0.121527816 0.24305563 0.87847218 [5,] 0.075764989 0.15152998 0.92423501 [6,] 0.040089126 0.08017825 0.95991087 [7,] 0.050393278 0.10078656 0.94960672 [8,] 0.027102168 0.05420434 0.97289783 [9,] 0.014397579 0.02879516 0.98560242 [10,] 0.007126953 0.01425391 0.99287305 [11,] 0.554378620 0.89124276 0.44562138 [12,] 0.519853133 0.96029373 0.48014687 [13,] 0.434075521 0.86815104 0.56592448 [14,] 0.353339667 0.70667933 0.64666033 [15,] 0.276374237 0.55274847 0.72362576 [16,] 0.284443985 0.56888797 0.71555602 [17,] 0.222953399 0.44590680 0.77704660 [18,] 0.269881591 0.53976318 0.73011841 [19,] 0.206577781 0.41315556 0.79342222 [20,] 0.197699479 0.39539896 0.80230052 [21,] 0.191362525 0.38272505 0.80863747 [22,] 0.157571049 0.31514210 0.84242895 [23,] 0.168225289 0.33645058 0.83177471 [24,] 0.126026820 0.25205364 0.87397318 [25,] 0.100467840 0.20093568 0.89953216 [26,] 0.142233542 0.28446708 0.85776646 [27,] 0.098294413 0.19658883 0.90170559 [28,] 0.065454750 0.13090950 0.93454525 [29,] 0.082058109 0.16411622 0.91794189 [30,] 0.061071304 0.12214261 0.93892870 [31,] 0.045096573 0.09019315 0.95490343 [32,] 0.027167356 0.05433471 0.97283264 [33,] 0.018686534 0.03737307 0.98131347 [34,] 0.046176357 0.09235271 0.95382364 [35,] 0.027691180 0.05538236 0.97230882 [36,] 0.018112534 0.03622507 0.98188747 [37,] 0.016111359 0.03222272 0.98388864 [38,] 0.025054400 0.05010880 0.97494560 [39,] 0.917170041 0.16565992 0.08282996 > postscript(file="/var/wessaorg/rcomp/tmp/1cavj1355174877.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/2r2r61355174877.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/3b99t1355174877.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/4aypz1355174877.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/5fufy1355174877.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 = 54 Frequency = 1 1 2 3 4 5 6 0.026121870 0.070030142 0.064427483 -0.038621277 0.468773816 -0.209369674 7 8 9 10 11 12 -0.064508589 -0.064022126 -0.020255060 0.087168766 -0.106344363 -0.157837097 13 14 15 16 17 18 0.058083009 -0.191284923 0.039722393 0.153804559 0.103955081 0.785208946 19 20 21 22 23 24 -0.200382146 0.098113637 0.082200690 0.026625968 -0.226264710 -0.077226914 25 26 27 28 29 30 0.361870242 0.060663178 -0.198844606 0.242417725 -0.143711741 -0.320496363 31 32 33 34 35 36 0.069801941 -0.152045983 -0.385815871 0.026625968 -0.012039684 -0.336683870 37 38 39 40 41 42 -0.203058947 -0.169572799 0.047095765 -0.023596024 0.484251966 0.124671465 43 44 45 46 47 48 -0.241320589 -0.223137151 0.148129491 0.594361644 -0.227282767 -0.496089175 49 50 51 52 53 54 0.081115957 -0.415262280 0.339928294 0.002022867 0.093318329 0.164563536 > postscript(file="/var/wessaorg/rcomp/tmp/6qyv41355174877.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 = 54 Frequency = 1 lag(myerror, k = 1) myerror 0 0.026121870 NA 1 0.070030142 0.026121870 2 0.064427483 0.070030142 3 -0.038621277 0.064427483 4 0.468773816 -0.038621277 5 -0.209369674 0.468773816 6 -0.064508589 -0.209369674 7 -0.064022126 -0.064508589 8 -0.020255060 -0.064022126 9 0.087168766 -0.020255060 10 -0.106344363 0.087168766 11 -0.157837097 -0.106344363 12 0.058083009 -0.157837097 13 -0.191284923 0.058083009 14 0.039722393 -0.191284923 15 0.153804559 0.039722393 16 0.103955081 0.153804559 17 0.785208946 0.103955081 18 -0.200382146 0.785208946 19 0.098113637 -0.200382146 20 0.082200690 0.098113637 21 0.026625968 0.082200690 22 -0.226264710 0.026625968 23 -0.077226914 -0.226264710 24 0.361870242 -0.077226914 25 0.060663178 0.361870242 26 -0.198844606 0.060663178 27 0.242417725 -0.198844606 28 -0.143711741 0.242417725 29 -0.320496363 -0.143711741 30 0.069801941 -0.320496363 31 -0.152045983 0.069801941 32 -0.385815871 -0.152045983 33 0.026625968 -0.385815871 34 -0.012039684 0.026625968 35 -0.336683870 -0.012039684 36 -0.203058947 -0.336683870 37 -0.169572799 -0.203058947 38 0.047095765 -0.169572799 39 -0.023596024 0.047095765 40 0.484251966 -0.023596024 41 0.124671465 0.484251966 42 -0.241320589 0.124671465 43 -0.223137151 -0.241320589 44 0.148129491 -0.223137151 45 0.594361644 0.148129491 46 -0.227282767 0.594361644 47 -0.496089175 -0.227282767 48 0.081115957 -0.496089175 49 -0.415262280 0.081115957 50 0.339928294 -0.415262280 51 0.002022867 0.339928294 52 0.093318329 0.002022867 53 0.164563536 0.093318329 54 NA 0.164563536 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.070030142 0.026121870 [2,] 0.064427483 0.070030142 [3,] -0.038621277 0.064427483 [4,] 0.468773816 -0.038621277 [5,] -0.209369674 0.468773816 [6,] -0.064508589 -0.209369674 [7,] -0.064022126 -0.064508589 [8,] -0.020255060 -0.064022126 [9,] 0.087168766 -0.020255060 [10,] -0.106344363 0.087168766 [11,] -0.157837097 -0.106344363 [12,] 0.058083009 -0.157837097 [13,] -0.191284923 0.058083009 [14,] 0.039722393 -0.191284923 [15,] 0.153804559 0.039722393 [16,] 0.103955081 0.153804559 [17,] 0.785208946 0.103955081 [18,] -0.200382146 0.785208946 [19,] 0.098113637 -0.200382146 [20,] 0.082200690 0.098113637 [21,] 0.026625968 0.082200690 [22,] -0.226264710 0.026625968 [23,] -0.077226914 -0.226264710 [24,] 0.361870242 -0.077226914 [25,] 0.060663178 0.361870242 [26,] -0.198844606 0.060663178 [27,] 0.242417725 -0.198844606 [28,] -0.143711741 0.242417725 [29,] -0.320496363 -0.143711741 [30,] 0.069801941 -0.320496363 [31,] -0.152045983 0.069801941 [32,] -0.385815871 -0.152045983 [33,] 0.026625968 -0.385815871 [34,] -0.012039684 0.026625968 [35,] -0.336683870 -0.012039684 [36,] -0.203058947 -0.336683870 [37,] -0.169572799 -0.203058947 [38,] 0.047095765 -0.169572799 [39,] -0.023596024 0.047095765 [40,] 0.484251966 -0.023596024 [41,] 0.124671465 0.484251966 [42,] -0.241320589 0.124671465 [43,] -0.223137151 -0.241320589 [44,] 0.148129491 -0.223137151 [45,] 0.594361644 0.148129491 [46,] -0.227282767 0.594361644 [47,] -0.496089175 -0.227282767 [48,] 0.081115957 -0.496089175 [49,] -0.415262280 0.081115957 [50,] 0.339928294 -0.415262280 [51,] 0.002022867 0.339928294 [52,] 0.093318329 0.002022867 [53,] 0.164563536 0.093318329 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.070030142 0.026121870 2 0.064427483 0.070030142 3 -0.038621277 0.064427483 4 0.468773816 -0.038621277 5 -0.209369674 0.468773816 6 -0.064508589 -0.209369674 7 -0.064022126 -0.064508589 8 -0.020255060 -0.064022126 9 0.087168766 -0.020255060 10 -0.106344363 0.087168766 11 -0.157837097 -0.106344363 12 0.058083009 -0.157837097 13 -0.191284923 0.058083009 14 0.039722393 -0.191284923 15 0.153804559 0.039722393 16 0.103955081 0.153804559 17 0.785208946 0.103955081 18 -0.200382146 0.785208946 19 0.098113637 -0.200382146 20 0.082200690 0.098113637 21 0.026625968 0.082200690 22 -0.226264710 0.026625968 23 -0.077226914 -0.226264710 24 0.361870242 -0.077226914 25 0.060663178 0.361870242 26 -0.198844606 0.060663178 27 0.242417725 -0.198844606 28 -0.143711741 0.242417725 29 -0.320496363 -0.143711741 30 0.069801941 -0.320496363 31 -0.152045983 0.069801941 32 -0.385815871 -0.152045983 33 0.026625968 -0.385815871 34 -0.012039684 0.026625968 35 -0.336683870 -0.012039684 36 -0.203058947 -0.336683870 37 -0.169572799 -0.203058947 38 0.047095765 -0.169572799 39 -0.023596024 0.047095765 40 0.484251966 -0.023596024 41 0.124671465 0.484251966 42 -0.241320589 0.124671465 43 -0.223137151 -0.241320589 44 0.148129491 -0.223137151 45 0.594361644 0.148129491 46 -0.227282767 0.594361644 47 -0.496089175 -0.227282767 48 0.081115957 -0.496089175 49 -0.415262280 0.081115957 50 0.339928294 -0.415262280 51 0.002022867 0.339928294 52 0.093318329 0.002022867 53 0.164563536 0.093318329 > 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/7jxtq1355174877.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/84qdl1355174877.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/9ko5l1355174877.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/10788c1355174877.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/11h8r41355174877.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/12c14e1355174877.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/13hyy91355174877.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/14t7av1355174877.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/15ync41355174877.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/16bylm1355174877.tab") + } > > try(system("convert tmp/1cavj1355174877.ps tmp/1cavj1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/2r2r61355174877.ps tmp/2r2r61355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/3b99t1355174877.ps tmp/3b99t1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/4aypz1355174877.ps tmp/4aypz1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/5fufy1355174877.ps tmp/5fufy1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/6qyv41355174877.ps tmp/6qyv41355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/7jxtq1355174877.ps tmp/7jxtq1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/84qdl1355174877.ps tmp/84qdl1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/9ko5l1355174877.ps tmp/9ko5l1355174877.png",intern=TRUE)) character(0) > try(system("convert tmp/10788c1355174877.ps tmp/10788c1355174877.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.079 0.884 6.974