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(1,3,0,3,0,3,0,3,0,3,0,3,0,3,1,3,0,3,0,3,1,3,0,3,0,3,1,3,0,3,1,3,1,4,1,3,0,3,1,4,0,3,0,3,0,3,0,3,1,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,1,3,0,3,0,3,1,3,0,3,0,3,1,3,0,4,0,3,0,3,1,3,0,3,0,3,0,3,0,3,0,3,0,3,1,3,1,4,0,3,0,4,0,3,1,3,0,3,0,3,0,3,1,4,1,3,0,3,0,3,1,3,0,3,0,3,1,4,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,1,3,0,3,0,3,1,4,1,3,0,3,0,3,0,3,0,4,0,3,0,3),dim=c(2,86),dimnames=list(c('T40','CA'),1:86)) > y <- array(NA,dim=c(2,86),dimnames=list(c('T40','CA'),1:86)) > 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 = '2' > par3 <- 'Linear Trend' > par2 <- 'Do not include Seasonal Dummies' > par1 <- '2' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 CA T40 t 1 3 1 1 2 3 0 2 3 3 0 3 4 3 0 4 5 3 0 5 6 3 0 6 7 3 0 7 8 3 1 8 9 3 0 9 10 3 0 10 11 3 1 11 12 3 0 12 13 3 0 13 14 3 1 14 15 3 0 15 16 3 1 16 17 4 1 17 18 3 1 18 19 3 0 19 20 4 1 20 21 3 0 21 22 3 0 22 23 3 0 23 24 3 0 24 25 3 1 25 26 3 0 26 27 3 0 27 28 3 0 28 29 3 0 29 30 3 0 30 31 3 0 31 32 3 0 32 33 3 0 33 34 3 1 34 35 3 0 35 36 3 0 36 37 3 1 37 38 3 0 38 39 3 0 39 40 3 1 40 41 4 0 41 42 3 0 42 43 3 0 43 44 3 1 44 45 3 0 45 46 3 0 46 47 3 0 47 48 3 0 48 49 3 0 49 50 3 0 50 51 3 1 51 52 4 1 52 53 3 0 53 54 4 0 54 55 3 0 55 56 3 1 56 57 3 0 57 58 3 0 58 59 3 0 59 60 4 1 60 61 3 1 61 62 3 0 62 63 3 0 63 64 3 1 64 65 3 0 65 66 3 0 66 67 4 1 67 68 3 0 68 69 3 0 69 70 3 0 70 71 3 0 71 72 3 0 72 73 3 0 73 74 3 0 74 75 3 0 75 76 3 1 76 77 3 0 77 78 3 0 78 79 4 1 79 80 3 1 80 81 3 0 81 82 3 0 82 83 3 0 83 84 4 0 84 85 3 0 85 86 3 0 86 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) T40 t 2.965267 0.220866 0.001846 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.33384 -0.11343 -0.05481 -0.00450 0.95903 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.965267 0.067781 43.748 < 2e-16 *** T40 0.220866 0.071508 3.089 0.00273 ** t 0.001846 0.001275 1.448 0.15136 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2927 on 83 degrees of freedom Multiple R-squared: 0.1174, Adjusted R-squared: 0.09612 F-statistic: 5.519 on 2 and 83 DF, p-value: 0.005617 > 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.445725e-96 2.891449e-96 1.0000000 [2,] 2.799189e-128 5.598378e-128 1.0000000 [3,] 4.385881e-75 8.771763e-75 1.0000000 [4,] 1.038672e-92 2.077344e-92 1.0000000 [5,] 6.887476e-109 1.377495e-108 1.0000000 [6,] 5.805509e-129 1.161102e-128 1.0000000 [7,] 2.892343e-140 5.784685e-140 1.0000000 [8,] 3.704521e-154 7.409042e-154 1.0000000 [9,] 4.362963e-167 8.725926e-167 1.0000000 [10,] 3.144655e-182 6.289310e-182 1.0000000 [11,] 0.000000e+00 0.000000e+00 1.0000000 [12,] 1.107571e-01 2.215142e-01 0.8892429 [13,] 1.034752e-01 2.069504e-01 0.8965248 [14,] 7.424766e-02 1.484953e-01 0.9257523 [15,] 3.754327e-01 7.508654e-01 0.6245673 [16,] 3.297939e-01 6.595877e-01 0.6702061 [17,] 2.794407e-01 5.588813e-01 0.7205593 [18,] 2.298336e-01 4.596672e-01 0.7701664 [19,] 1.839805e-01 3.679610e-01 0.8160195 [20,] 1.900754e-01 3.801507e-01 0.8099246 [21,] 1.469076e-01 2.938152e-01 0.8530924 [22,] 1.107963e-01 2.215927e-01 0.8892037 [23,] 8.155702e-02 1.631140e-01 0.9184430 [24,] 5.860206e-02 1.172041e-01 0.9413979 [25,] 4.110819e-02 8.221638e-02 0.9588918 [26,] 2.815477e-02 5.630954e-02 0.9718452 [27,] 1.882907e-02 3.765814e-02 0.9811709 [28,] 1.229725e-02 2.459450e-02 0.9877027 [29,] 1.138159e-02 2.276318e-02 0.9886184 [30,] 7.219284e-03 1.443857e-02 0.9927807 [31,] 4.475887e-03 8.951773e-03 0.9955241 [32,] 3.853317e-03 7.706634e-03 0.9961467 [33,] 2.330365e-03 4.660730e-03 0.9976696 [34,] 1.380015e-03 2.760030e-03 0.9986200 [35,] 1.171478e-03 2.342956e-03 0.9988285 [36,] 9.092120e-02 1.818424e-01 0.9090788 [37,] 6.856118e-02 1.371224e-01 0.9314388 [38,] 5.060176e-02 1.012035e-01 0.9493982 [39,] 4.828230e-02 9.656460e-02 0.9517177 [40,] 3.470733e-02 6.941465e-02 0.9652927 [41,] 2.442628e-02 4.885256e-02 0.9755737 [42,] 1.683227e-02 3.366453e-02 0.9831677 [43,] 1.136042e-02 2.272083e-02 0.9886396 [44,] 7.513307e-03 1.502661e-02 0.9924867 [45,] 4.873303e-03 9.746607e-03 0.9951267 [46,] 5.133223e-03 1.026645e-02 0.9948668 [47,] 3.556819e-02 7.113638e-02 0.9644318 [48,] 2.529954e-02 5.059907e-02 0.9747005 [49,] 2.989686e-01 5.979372e-01 0.7010314 [50,] 2.503924e-01 5.007848e-01 0.7496076 [51,] 2.573512e-01 5.147023e-01 0.7426488 [52,] 2.097676e-01 4.195352e-01 0.7902324 [53,] 1.671862e-01 3.343724e-01 0.8328138 [54,] 1.301222e-01 2.602443e-01 0.8698778 [55,] 3.472979e-01 6.945959e-01 0.6527021 [56,] 3.428493e-01 6.856986e-01 0.6571507 [57,] 2.842085e-01 5.684170e-01 0.7157915 [58,] 2.299320e-01 4.598640e-01 0.7700680 [59,] 2.520775e-01 5.041549e-01 0.7479225 [60,] 1.984624e-01 3.969248e-01 0.8015376 [61,] 1.517248e-01 3.034497e-01 0.8482752 [62,] 3.816047e-01 7.632095e-01 0.6183953 [63,] 3.132995e-01 6.265991e-01 0.6867005 [64,] 2.494202e-01 4.988405e-01 0.7505798 [65,] 1.918799e-01 3.837599e-01 0.8081201 [66,] 1.420980e-01 2.841960e-01 0.8579020 [67,] 1.008674e-01 2.017347e-01 0.8991326 [68,] 6.830764e-02 1.366153e-01 0.9316924 [69,] 4.391500e-02 8.783000e-02 0.9560850 [70,] 2.670852e-02 5.341704e-02 0.9732915 [71,] 2.473767e-02 4.947535e-02 0.9752623 [72,] 1.310521e-02 2.621042e-02 0.9868948 [73,] 6.537365e-03 1.307473e-02 0.9934626 [74,] 4.722403e-02 9.444806e-02 0.9527760 [75,] 2.306370e-02 4.612741e-02 0.9769363 > postscript(file="/var/fisher/rcomp/tmp/1ga7j1356043420.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/fisher/rcomp/tmp/205uy1356043420.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/fisher/rcomp/tmp/33v3c1356043420.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/fisher/rcomp/tmp/4go161356043420.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/fisher/rcomp/tmp/5oj3v1356043420.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 = 86 Frequency = 1 1 2 3 4 5 -0.1879801580 0.0310399427 0.0291936251 0.0273473076 0.0255009900 6 7 8 9 10 0.0236546724 0.0218083548 -0.2009043811 0.0181157196 0.0162694021 11 12 13 14 15 -0.2064433339 0.0125767669 0.0107304493 -0.2119822866 0.0070378141 16 17 18 19 20 -0.2156749218 0.7824787606 -0.2193675570 -0.0003474562 0.7769398079 21 22 23 24 25 -0.0040400913 -0.0058864089 -0.0077327265 -0.0095790441 -0.2322917800 26 27 28 29 30 -0.0132716793 -0.0151179968 -0.0169643144 -0.0188106320 -0.0206569496 31 32 33 34 35 -0.0225032672 -0.0243495848 -0.0261959023 -0.2489086383 -0.0298885375 36 37 38 39 40 -0.0317348551 -0.2544475910 -0.0354274902 -0.0372738078 -0.2599865438 41 42 43 44 45 0.9590335570 -0.0428127606 -0.0446590782 -0.2673718141 -0.0483517133 46 47 48 49 50 -0.0501980309 -0.0520443485 -0.0538906661 -0.0557369837 -0.0575833012 51 52 53 54 55 -0.2802960372 0.7178576452 -0.0631222540 0.9350314284 -0.0668148892 56 57 58 59 60 -0.2895276251 -0.0705075243 -0.0723538419 -0.0742001595 0.7030871046 61 62 63 64 65 -0.2987592130 -0.0797391122 -0.0815854298 -0.3042981657 -0.0852780650 66 67 68 69 70 -0.0871243826 0.6901628815 -0.0908170177 -0.0926633353 -0.0945096529 71 72 73 74 75 -0.0963559705 -0.0982022881 -0.1000486056 -0.1018949232 -0.1037412408 76 77 78 79 80 -0.3264539767 -0.1074338760 -0.1092801935 0.6680070705 -0.3338392471 81 82 83 84 85 -0.1148191463 -0.1166654639 -0.1185117815 0.8796419010 -0.1222044166 86 -0.1240507342 > postscript(file="/var/fisher/rcomp/tmp/6l8gt1356043420.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 = 86 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.1879801580 NA 1 0.0310399427 -0.1879801580 2 0.0291936251 0.0310399427 3 0.0273473076 0.0291936251 4 0.0255009900 0.0273473076 5 0.0236546724 0.0255009900 6 0.0218083548 0.0236546724 7 -0.2009043811 0.0218083548 8 0.0181157196 -0.2009043811 9 0.0162694021 0.0181157196 10 -0.2064433339 0.0162694021 11 0.0125767669 -0.2064433339 12 0.0107304493 0.0125767669 13 -0.2119822866 0.0107304493 14 0.0070378141 -0.2119822866 15 -0.2156749218 0.0070378141 16 0.7824787606 -0.2156749218 17 -0.2193675570 0.7824787606 18 -0.0003474562 -0.2193675570 19 0.7769398079 -0.0003474562 20 -0.0040400913 0.7769398079 21 -0.0058864089 -0.0040400913 22 -0.0077327265 -0.0058864089 23 -0.0095790441 -0.0077327265 24 -0.2322917800 -0.0095790441 25 -0.0132716793 -0.2322917800 26 -0.0151179968 -0.0132716793 27 -0.0169643144 -0.0151179968 28 -0.0188106320 -0.0169643144 29 -0.0206569496 -0.0188106320 30 -0.0225032672 -0.0206569496 31 -0.0243495848 -0.0225032672 32 -0.0261959023 -0.0243495848 33 -0.2489086383 -0.0261959023 34 -0.0298885375 -0.2489086383 35 -0.0317348551 -0.0298885375 36 -0.2544475910 -0.0317348551 37 -0.0354274902 -0.2544475910 38 -0.0372738078 -0.0354274902 39 -0.2599865438 -0.0372738078 40 0.9590335570 -0.2599865438 41 -0.0428127606 0.9590335570 42 -0.0446590782 -0.0428127606 43 -0.2673718141 -0.0446590782 44 -0.0483517133 -0.2673718141 45 -0.0501980309 -0.0483517133 46 -0.0520443485 -0.0501980309 47 -0.0538906661 -0.0520443485 48 -0.0557369837 -0.0538906661 49 -0.0575833012 -0.0557369837 50 -0.2802960372 -0.0575833012 51 0.7178576452 -0.2802960372 52 -0.0631222540 0.7178576452 53 0.9350314284 -0.0631222540 54 -0.0668148892 0.9350314284 55 -0.2895276251 -0.0668148892 56 -0.0705075243 -0.2895276251 57 -0.0723538419 -0.0705075243 58 -0.0742001595 -0.0723538419 59 0.7030871046 -0.0742001595 60 -0.2987592130 0.7030871046 61 -0.0797391122 -0.2987592130 62 -0.0815854298 -0.0797391122 63 -0.3042981657 -0.0815854298 64 -0.0852780650 -0.3042981657 65 -0.0871243826 -0.0852780650 66 0.6901628815 -0.0871243826 67 -0.0908170177 0.6901628815 68 -0.0926633353 -0.0908170177 69 -0.0945096529 -0.0926633353 70 -0.0963559705 -0.0945096529 71 -0.0982022881 -0.0963559705 72 -0.1000486056 -0.0982022881 73 -0.1018949232 -0.1000486056 74 -0.1037412408 -0.1018949232 75 -0.3264539767 -0.1037412408 76 -0.1074338760 -0.3264539767 77 -0.1092801935 -0.1074338760 78 0.6680070705 -0.1092801935 79 -0.3338392471 0.6680070705 80 -0.1148191463 -0.3338392471 81 -0.1166654639 -0.1148191463 82 -0.1185117815 -0.1166654639 83 0.8796419010 -0.1185117815 84 -0.1222044166 0.8796419010 85 -0.1240507342 -0.1222044166 86 NA -0.1240507342 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0310399427 -0.1879801580 [2,] 0.0291936251 0.0310399427 [3,] 0.0273473076 0.0291936251 [4,] 0.0255009900 0.0273473076 [5,] 0.0236546724 0.0255009900 [6,] 0.0218083548 0.0236546724 [7,] -0.2009043811 0.0218083548 [8,] 0.0181157196 -0.2009043811 [9,] 0.0162694021 0.0181157196 [10,] -0.2064433339 0.0162694021 [11,] 0.0125767669 -0.2064433339 [12,] 0.0107304493 0.0125767669 [13,] -0.2119822866 0.0107304493 [14,] 0.0070378141 -0.2119822866 [15,] -0.2156749218 0.0070378141 [16,] 0.7824787606 -0.2156749218 [17,] -0.2193675570 0.7824787606 [18,] -0.0003474562 -0.2193675570 [19,] 0.7769398079 -0.0003474562 [20,] -0.0040400913 0.7769398079 [21,] -0.0058864089 -0.0040400913 [22,] -0.0077327265 -0.0058864089 [23,] -0.0095790441 -0.0077327265 [24,] -0.2322917800 -0.0095790441 [25,] -0.0132716793 -0.2322917800 [26,] -0.0151179968 -0.0132716793 [27,] -0.0169643144 -0.0151179968 [28,] -0.0188106320 -0.0169643144 [29,] -0.0206569496 -0.0188106320 [30,] -0.0225032672 -0.0206569496 [31,] -0.0243495848 -0.0225032672 [32,] -0.0261959023 -0.0243495848 [33,] -0.2489086383 -0.0261959023 [34,] -0.0298885375 -0.2489086383 [35,] -0.0317348551 -0.0298885375 [36,] -0.2544475910 -0.0317348551 [37,] -0.0354274902 -0.2544475910 [38,] -0.0372738078 -0.0354274902 [39,] -0.2599865438 -0.0372738078 [40,] 0.9590335570 -0.2599865438 [41,] -0.0428127606 0.9590335570 [42,] -0.0446590782 -0.0428127606 [43,] -0.2673718141 -0.0446590782 [44,] -0.0483517133 -0.2673718141 [45,] -0.0501980309 -0.0483517133 [46,] -0.0520443485 -0.0501980309 [47,] -0.0538906661 -0.0520443485 [48,] -0.0557369837 -0.0538906661 [49,] -0.0575833012 -0.0557369837 [50,] -0.2802960372 -0.0575833012 [51,] 0.7178576452 -0.2802960372 [52,] -0.0631222540 0.7178576452 [53,] 0.9350314284 -0.0631222540 [54,] -0.0668148892 0.9350314284 [55,] -0.2895276251 -0.0668148892 [56,] -0.0705075243 -0.2895276251 [57,] -0.0723538419 -0.0705075243 [58,] -0.0742001595 -0.0723538419 [59,] 0.7030871046 -0.0742001595 [60,] -0.2987592130 0.7030871046 [61,] -0.0797391122 -0.2987592130 [62,] -0.0815854298 -0.0797391122 [63,] -0.3042981657 -0.0815854298 [64,] -0.0852780650 -0.3042981657 [65,] -0.0871243826 -0.0852780650 [66,] 0.6901628815 -0.0871243826 [67,] -0.0908170177 0.6901628815 [68,] -0.0926633353 -0.0908170177 [69,] -0.0945096529 -0.0926633353 [70,] -0.0963559705 -0.0945096529 [71,] -0.0982022881 -0.0963559705 [72,] -0.1000486056 -0.0982022881 [73,] -0.1018949232 -0.1000486056 [74,] -0.1037412408 -0.1018949232 [75,] -0.3264539767 -0.1037412408 [76,] -0.1074338760 -0.3264539767 [77,] -0.1092801935 -0.1074338760 [78,] 0.6680070705 -0.1092801935 [79,] -0.3338392471 0.6680070705 [80,] -0.1148191463 -0.3338392471 [81,] -0.1166654639 -0.1148191463 [82,] -0.1185117815 -0.1166654639 [83,] 0.8796419010 -0.1185117815 [84,] -0.1222044166 0.8796419010 [85,] -0.1240507342 -0.1222044166 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0310399427 -0.1879801580 2 0.0291936251 0.0310399427 3 0.0273473076 0.0291936251 4 0.0255009900 0.0273473076 5 0.0236546724 0.0255009900 6 0.0218083548 0.0236546724 7 -0.2009043811 0.0218083548 8 0.0181157196 -0.2009043811 9 0.0162694021 0.0181157196 10 -0.2064433339 0.0162694021 11 0.0125767669 -0.2064433339 12 0.0107304493 0.0125767669 13 -0.2119822866 0.0107304493 14 0.0070378141 -0.2119822866 15 -0.2156749218 0.0070378141 16 0.7824787606 -0.2156749218 17 -0.2193675570 0.7824787606 18 -0.0003474562 -0.2193675570 19 0.7769398079 -0.0003474562 20 -0.0040400913 0.7769398079 21 -0.0058864089 -0.0040400913 22 -0.0077327265 -0.0058864089 23 -0.0095790441 -0.0077327265 24 -0.2322917800 -0.0095790441 25 -0.0132716793 -0.2322917800 26 -0.0151179968 -0.0132716793 27 -0.0169643144 -0.0151179968 28 -0.0188106320 -0.0169643144 29 -0.0206569496 -0.0188106320 30 -0.0225032672 -0.0206569496 31 -0.0243495848 -0.0225032672 32 -0.0261959023 -0.0243495848 33 -0.2489086383 -0.0261959023 34 -0.0298885375 -0.2489086383 35 -0.0317348551 -0.0298885375 36 -0.2544475910 -0.0317348551 37 -0.0354274902 -0.2544475910 38 -0.0372738078 -0.0354274902 39 -0.2599865438 -0.0372738078 40 0.9590335570 -0.2599865438 41 -0.0428127606 0.9590335570 42 -0.0446590782 -0.0428127606 43 -0.2673718141 -0.0446590782 44 -0.0483517133 -0.2673718141 45 -0.0501980309 -0.0483517133 46 -0.0520443485 -0.0501980309 47 -0.0538906661 -0.0520443485 48 -0.0557369837 -0.0538906661 49 -0.0575833012 -0.0557369837 50 -0.2802960372 -0.0575833012 51 0.7178576452 -0.2802960372 52 -0.0631222540 0.7178576452 53 0.9350314284 -0.0631222540 54 -0.0668148892 0.9350314284 55 -0.2895276251 -0.0668148892 56 -0.0705075243 -0.2895276251 57 -0.0723538419 -0.0705075243 58 -0.0742001595 -0.0723538419 59 0.7030871046 -0.0742001595 60 -0.2987592130 0.7030871046 61 -0.0797391122 -0.2987592130 62 -0.0815854298 -0.0797391122 63 -0.3042981657 -0.0815854298 64 -0.0852780650 -0.3042981657 65 -0.0871243826 -0.0852780650 66 0.6901628815 -0.0871243826 67 -0.0908170177 0.6901628815 68 -0.0926633353 -0.0908170177 69 -0.0945096529 -0.0926633353 70 -0.0963559705 -0.0945096529 71 -0.0982022881 -0.0963559705 72 -0.1000486056 -0.0982022881 73 -0.1018949232 -0.1000486056 74 -0.1037412408 -0.1018949232 75 -0.3264539767 -0.1037412408 76 -0.1074338760 -0.3264539767 77 -0.1092801935 -0.1074338760 78 0.6680070705 -0.1092801935 79 -0.3338392471 0.6680070705 80 -0.1148191463 -0.3338392471 81 -0.1166654639 -0.1148191463 82 -0.1185117815 -0.1166654639 83 0.8796419010 -0.1185117815 84 -0.1222044166 0.8796419010 85 -0.1240507342 -0.1222044166 > 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/fisher/rcomp/tmp/7ur9h1356043420.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/fisher/rcomp/tmp/8cgco1356043420.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/fisher/rcomp/tmp/9vi6m1356043420.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/fisher/rcomp/tmp/10se5a1356043420.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11lma11356043420.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/fisher/rcomp/tmp/12ptfj1356043420.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/fisher/rcomp/tmp/134pex1356043420.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/fisher/rcomp/tmp/14zo1i1356043420.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/fisher/rcomp/tmp/157bia1356043421.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/fisher/rcomp/tmp/160m4h1356043421.tab") + } > > try(system("convert tmp/1ga7j1356043420.ps tmp/1ga7j1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/205uy1356043420.ps tmp/205uy1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/33v3c1356043420.ps tmp/33v3c1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/4go161356043420.ps tmp/4go161356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/5oj3v1356043420.ps tmp/5oj3v1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/6l8gt1356043420.ps tmp/6l8gt1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/7ur9h1356043420.ps tmp/7ur9h1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/8cgco1356043420.ps tmp/8cgco1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/9vi6m1356043420.ps tmp/9vi6m1356043420.png",intern=TRUE)) character(0) > try(system("convert tmp/10se5a1356043420.ps tmp/10se5a1356043420.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.202 1.659 7.883