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(37,30,47,35,30,43,82,40,47,19,52,136,80,42,54,66,81,63,137,72,107,58,36,52,79,77,54,84,48,96,83,66,61,53,30,74,69,59,42,65,70,100,63,105,82,81,75,102,121,98,76,77,63,37,35,23,40,29,37,51,20,28,13,22,25,13,16,13,16,17,25,14,8,7,10,7,10,3),dim=c(1,78),dimnames=list(c('Months'),1:78)) > y <- array(NA,dim=c(1,78),dimnames=list(c('Months'),1:78)) > 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 = 'Include Monthly 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 Months M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 37 1 0 0 0 0 0 0 0 0 0 0 1 2 30 0 1 0 0 0 0 0 0 0 0 0 2 3 47 0 0 1 0 0 0 0 0 0 0 0 3 4 35 0 0 0 1 0 0 0 0 0 0 0 4 5 30 0 0 0 0 1 0 0 0 0 0 0 5 6 43 0 0 0 0 0 1 0 0 0 0 0 6 7 82 0 0 0 0 0 0 1 0 0 0 0 7 8 40 0 0 0 0 0 0 0 1 0 0 0 8 9 47 0 0 0 0 0 0 0 0 1 0 0 9 10 19 0 0 0 0 0 0 0 0 0 1 0 10 11 52 0 0 0 0 0 0 0 0 0 0 1 11 12 136 0 0 0 0 0 0 0 0 0 0 0 12 13 80 1 0 0 0 0 0 0 0 0 0 0 13 14 42 0 1 0 0 0 0 0 0 0 0 0 14 15 54 0 0 1 0 0 0 0 0 0 0 0 15 16 66 0 0 0 1 0 0 0 0 0 0 0 16 17 81 0 0 0 0 1 0 0 0 0 0 0 17 18 63 0 0 0 0 0 1 0 0 0 0 0 18 19 137 0 0 0 0 0 0 1 0 0 0 0 19 20 72 0 0 0 0 0 0 0 1 0 0 0 20 21 107 0 0 0 0 0 0 0 0 1 0 0 21 22 58 0 0 0 0 0 0 0 0 0 1 0 22 23 36 0 0 0 0 0 0 0 0 0 0 1 23 24 52 0 0 0 0 0 0 0 0 0 0 0 24 25 79 1 0 0 0 0 0 0 0 0 0 0 25 26 77 0 1 0 0 0 0 0 0 0 0 0 26 27 54 0 0 1 0 0 0 0 0 0 0 0 27 28 84 0 0 0 1 0 0 0 0 0 0 0 28 29 48 0 0 0 0 1 0 0 0 0 0 0 29 30 96 0 0 0 0 0 1 0 0 0 0 0 30 31 83 0 0 0 0 0 0 1 0 0 0 0 31 32 66 0 0 0 0 0 0 0 1 0 0 0 32 33 61 0 0 0 0 0 0 0 0 1 0 0 33 34 53 0 0 0 0 0 0 0 0 0 1 0 34 35 30 0 0 0 0 0 0 0 0 0 0 1 35 36 74 0 0 0 0 0 0 0 0 0 0 0 36 37 69 1 0 0 0 0 0 0 0 0 0 0 37 38 59 0 1 0 0 0 0 0 0 0 0 0 38 39 42 0 0 1 0 0 0 0 0 0 0 0 39 40 65 0 0 0 1 0 0 0 0 0 0 0 40 41 70 0 0 0 0 1 0 0 0 0 0 0 41 42 100 0 0 0 0 0 1 0 0 0 0 0 42 43 63 0 0 0 0 0 0 1 0 0 0 0 43 44 105 0 0 0 0 0 0 0 1 0 0 0 44 45 82 0 0 0 0 0 0 0 0 1 0 0 45 46 81 0 0 0 0 0 0 0 0 0 1 0 46 47 75 0 0 0 0 0 0 0 0 0 0 1 47 48 102 0 0 0 0 0 0 0 0 0 0 0 48 49 121 1 0 0 0 0 0 0 0 0 0 0 49 50 98 0 1 0 0 0 0 0 0 0 0 0 50 51 76 0 0 1 0 0 0 0 0 0 0 0 51 52 77 0 0 0 1 0 0 0 0 0 0 0 52 53 63 0 0 0 0 1 0 0 0 0 0 0 53 54 37 0 0 0 0 0 1 0 0 0 0 0 54 55 35 0 0 0 0 0 0 1 0 0 0 0 55 56 23 0 0 0 0 0 0 0 1 0 0 0 56 57 40 0 0 0 0 0 0 0 0 1 0 0 57 58 29 0 0 0 0 0 0 0 0 0 1 0 58 59 37 0 0 0 0 0 0 0 0 0 0 1 59 60 51 0 0 0 0 0 0 0 0 0 0 0 60 61 20 1 0 0 0 0 0 0 0 0 0 0 61 62 28 0 1 0 0 0 0 0 0 0 0 0 62 63 13 0 0 1 0 0 0 0 0 0 0 0 63 64 22 0 0 0 1 0 0 0 0 0 0 0 64 65 25 0 0 0 0 1 0 0 0 0 0 0 65 66 13 0 0 0 0 0 1 0 0 0 0 0 66 67 16 0 0 0 0 0 0 1 0 0 0 0 67 68 13 0 0 0 0 0 0 0 1 0 0 0 68 69 16 0 0 0 0 0 0 0 0 1 0 0 69 70 17 0 0 0 0 0 0 0 0 0 1 0 70 71 25 0 0 0 0 0 0 0 0 0 0 1 71 72 14 0 0 0 0 0 0 0 0 0 0 0 72 73 8 1 0 0 0 0 0 0 0 0 0 0 73 74 7 0 1 0 0 0 0 0 0 0 0 0 74 75 10 0 0 1 0 0 0 0 0 0 0 0 75 76 7 0 0 0 1 0 0 0 0 0 0 0 76 77 10 0 0 0 0 1 0 0 0 0 0 0 77 78 3 0 0 0 0 0 1 0 0 0 0 0 78 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 97.3269 -15.4318 -25.2454 -31.0591 -21.8727 -25.4006 M6 M7 M8 M9 M10 M11 -20.7857 -5.2413 -20.7930 -14.5114 -29.8965 -29.6149 t -0.6149 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -44.280 -20.999 -2.904 13.727 69.236 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 97.3269 13.4786 7.221 7.06e-10 *** M1 -15.4318 16.3208 -0.946 0.3479 M2 -25.2454 16.3148 -1.547 0.1266 M3 -31.0591 16.3101 -1.904 0.0613 . M4 -21.8727 16.3068 -1.341 0.1845 M5 -25.4006 16.3048 -1.558 0.1241 M6 -20.7857 16.3041 -1.275 0.2069 M7 -5.2413 16.9357 -0.309 0.7579 M8 -20.7930 16.9299 -1.228 0.2238 M9 -14.5114 16.9254 -0.857 0.3944 M10 -29.8965 16.9222 -1.767 0.0820 . M11 -29.6149 16.9202 -1.750 0.0848 . t -0.6149 0.1478 -4.160 9.51e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 29.31 on 65 degrees of freedom Multiple R-squared: 0.2785, Adjusted R-squared: 0.1453 F-statistic: 2.09 on 12 and 65 DF, p-value: 0.02970 > 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.12408882 2.481776e-01 8.759112e-01 [2,] 0.11814355 2.362871e-01 8.818565e-01 [3,] 0.06065998 1.213200e-01 9.393400e-01 [4,] 0.07037434 1.407487e-01 9.296257e-01 [5,] 0.03422120 6.844240e-02 9.657788e-01 [6,] 0.03827911 7.655822e-02 9.617209e-01 [7,] 0.02015077 4.030154e-02 9.798492e-01 [8,] 0.09235386 1.847077e-01 9.076461e-01 [9,] 0.81358712 3.728258e-01 1.864129e-01 [10,] 0.76021654 4.795669e-01 2.397835e-01 [11,] 0.69933623 6.013275e-01 3.006638e-01 [12,] 0.68473221 6.305356e-01 3.152678e-01 [13,] 0.60695948 7.860810e-01 3.930405e-01 [14,] 0.66578565 6.684287e-01 3.342143e-01 [15,] 0.60592728 7.881454e-01 3.940727e-01 [16,] 0.66444037 6.711193e-01 3.355596e-01 [17,] 0.61270765 7.745847e-01 3.872923e-01 [18,] 0.62801904 7.439619e-01 3.719810e-01 [19,] 0.60069434 7.986113e-01 3.993057e-01 [20,] 0.75035459 4.992908e-01 2.496454e-01 [21,] 0.78143812 4.371238e-01 2.185619e-01 [22,] 0.78414078 4.317184e-01 2.158592e-01 [23,] 0.81503609 3.699278e-01 1.849639e-01 [24,] 0.90404736 1.919053e-01 9.595264e-02 [25,] 0.92046301 1.590740e-01 7.953699e-02 [26,] 0.92803361 1.439328e-01 7.196639e-02 [27,] 0.91027160 1.794568e-01 8.972840e-02 [28,] 0.92909751 1.418050e-01 7.090249e-02 [29,] 0.95373368 9.253265e-02 4.626632e-02 [30,] 0.92990049 1.401990e-01 7.009951e-02 [31,] 0.90907375 1.818525e-01 9.092625e-02 [32,] 0.87909646 2.418071e-01 1.209035e-01 [33,] 0.85493608 2.901278e-01 1.450639e-01 [34,] 0.98637639 2.724723e-02 1.362361e-02 [35,] 0.99789550 4.208994e-03 2.104497e-03 [36,] 0.99932901 1.341983e-03 6.709914e-04 [37,] 0.99996434 7.131647e-05 3.565823e-05 [38,] 0.99998994 2.011084e-05 1.005542e-05 [39,] 0.99998287 3.425934e-05 1.712967e-05 [40,] 0.99997070 5.860797e-05 2.930399e-05 [41,] 0.99993426 1.314705e-04 6.573523e-05 [42,] 0.99983998 3.200498e-04 1.600249e-04 [43,] 0.99941505 1.169903e-03 5.849513e-04 [44,] 0.99785351 4.292972e-03 2.146486e-03 [45,] 0.99970951 5.809717e-04 2.904859e-04 [46,] 0.99835276 3.294482e-03 1.647241e-03 [47,] 0.99599892 8.002164e-03 4.001082e-03 > postscript(file="/var/www/html/rcomp/tmp/1p4c61291146830.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/www/html/rcomp/tmp/20vt91291146830.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/www/html/rcomp/tmp/30vt91291146830.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/www/html/rcomp/tmp/40vt91291146830.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/www/html/rcomp/tmp/50vt91291146830.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 = 78 Frequency = 1 1 2 3 4 5 6 -44.2802198 -40.8516484 -17.4230769 -37.9945055 -38.8516484 -29.8516484 7 8 9 10 11 12 -5.7811355 -31.6144689 -30.2811355 -42.2811355 -8.9478022 46.0521978 13 14 15 16 17 18 6.0989011 -21.4725275 -3.0439560 0.3846154 19.5274725 -2.4725275 19 20 21 22 23 24 56.5979853 7.7646520 37.0979853 4.0979853 -17.5686813 -30.5686813 25 26 27 28 29 30 12.4780220 20.9065934 4.3351648 25.7637363 -6.0934066 37.9065934 31 32 33 34 35 36 9.9771062 9.1437729 -1.5228938 6.4771062 -16.1895604 -1.1895604 37 38 39 40 41 42 9.8571429 10.2857143 -0.2857143 14.1428571 23.2857143 49.2857143 43 44 45 46 47 48 -2.6437729 55.5228938 26.8562271 41.8562271 36.1895604 34.1895604 49 50 51 52 53 54 69.2362637 56.6648352 41.0934066 33.5219780 23.6648352 -6.3351648 55 56 57 58 59 60 -23.2646520 -19.0979853 -7.7646520 -2.7646520 5.5686813 -9.4313187 61 62 63 64 65 66 -24.3846154 -5.9560440 -14.5274725 -14.0989011 -6.9560440 -22.9560440 67 68 69 70 71 72 -34.8855311 -21.7188645 -24.3855311 -7.3855311 0.9478022 -39.0521978 73 74 75 76 77 78 -29.0054945 -19.5769231 -10.1483516 -21.7197802 -14.5769231 -25.5769231 > postscript(file="/var/www/html/rcomp/tmp/6a4au1291146830.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 = 78 Frequency = 1 lag(myerror, k = 1) myerror 0 -44.2802198 NA 1 -40.8516484 -44.2802198 2 -17.4230769 -40.8516484 3 -37.9945055 -17.4230769 4 -38.8516484 -37.9945055 5 -29.8516484 -38.8516484 6 -5.7811355 -29.8516484 7 -31.6144689 -5.7811355 8 -30.2811355 -31.6144689 9 -42.2811355 -30.2811355 10 -8.9478022 -42.2811355 11 46.0521978 -8.9478022 12 6.0989011 46.0521978 13 -21.4725275 6.0989011 14 -3.0439560 -21.4725275 15 0.3846154 -3.0439560 16 19.5274725 0.3846154 17 -2.4725275 19.5274725 18 56.5979853 -2.4725275 19 7.7646520 56.5979853 20 37.0979853 7.7646520 21 4.0979853 37.0979853 22 -17.5686813 4.0979853 23 -30.5686813 -17.5686813 24 12.4780220 -30.5686813 25 20.9065934 12.4780220 26 4.3351648 20.9065934 27 25.7637363 4.3351648 28 -6.0934066 25.7637363 29 37.9065934 -6.0934066 30 9.9771062 37.9065934 31 9.1437729 9.9771062 32 -1.5228938 9.1437729 33 6.4771062 -1.5228938 34 -16.1895604 6.4771062 35 -1.1895604 -16.1895604 36 9.8571429 -1.1895604 37 10.2857143 9.8571429 38 -0.2857143 10.2857143 39 14.1428571 -0.2857143 40 23.2857143 14.1428571 41 49.2857143 23.2857143 42 -2.6437729 49.2857143 43 55.5228938 -2.6437729 44 26.8562271 55.5228938 45 41.8562271 26.8562271 46 36.1895604 41.8562271 47 34.1895604 36.1895604 48 69.2362637 34.1895604 49 56.6648352 69.2362637 50 41.0934066 56.6648352 51 33.5219780 41.0934066 52 23.6648352 33.5219780 53 -6.3351648 23.6648352 54 -23.2646520 -6.3351648 55 -19.0979853 -23.2646520 56 -7.7646520 -19.0979853 57 -2.7646520 -7.7646520 58 5.5686813 -2.7646520 59 -9.4313187 5.5686813 60 -24.3846154 -9.4313187 61 -5.9560440 -24.3846154 62 -14.5274725 -5.9560440 63 -14.0989011 -14.5274725 64 -6.9560440 -14.0989011 65 -22.9560440 -6.9560440 66 -34.8855311 -22.9560440 67 -21.7188645 -34.8855311 68 -24.3855311 -21.7188645 69 -7.3855311 -24.3855311 70 0.9478022 -7.3855311 71 -39.0521978 0.9478022 72 -29.0054945 -39.0521978 73 -19.5769231 -29.0054945 74 -10.1483516 -19.5769231 75 -21.7197802 -10.1483516 76 -14.5769231 -21.7197802 77 -25.5769231 -14.5769231 78 NA -25.5769231 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -40.8516484 -44.2802198 [2,] -17.4230769 -40.8516484 [3,] -37.9945055 -17.4230769 [4,] -38.8516484 -37.9945055 [5,] -29.8516484 -38.8516484 [6,] -5.7811355 -29.8516484 [7,] -31.6144689 -5.7811355 [8,] -30.2811355 -31.6144689 [9,] -42.2811355 -30.2811355 [10,] -8.9478022 -42.2811355 [11,] 46.0521978 -8.9478022 [12,] 6.0989011 46.0521978 [13,] -21.4725275 6.0989011 [14,] -3.0439560 -21.4725275 [15,] 0.3846154 -3.0439560 [16,] 19.5274725 0.3846154 [17,] -2.4725275 19.5274725 [18,] 56.5979853 -2.4725275 [19,] 7.7646520 56.5979853 [20,] 37.0979853 7.7646520 [21,] 4.0979853 37.0979853 [22,] -17.5686813 4.0979853 [23,] -30.5686813 -17.5686813 [24,] 12.4780220 -30.5686813 [25,] 20.9065934 12.4780220 [26,] 4.3351648 20.9065934 [27,] 25.7637363 4.3351648 [28,] -6.0934066 25.7637363 [29,] 37.9065934 -6.0934066 [30,] 9.9771062 37.9065934 [31,] 9.1437729 9.9771062 [32,] -1.5228938 9.1437729 [33,] 6.4771062 -1.5228938 [34,] -16.1895604 6.4771062 [35,] -1.1895604 -16.1895604 [36,] 9.8571429 -1.1895604 [37,] 10.2857143 9.8571429 [38,] -0.2857143 10.2857143 [39,] 14.1428571 -0.2857143 [40,] 23.2857143 14.1428571 [41,] 49.2857143 23.2857143 [42,] -2.6437729 49.2857143 [43,] 55.5228938 -2.6437729 [44,] 26.8562271 55.5228938 [45,] 41.8562271 26.8562271 [46,] 36.1895604 41.8562271 [47,] 34.1895604 36.1895604 [48,] 69.2362637 34.1895604 [49,] 56.6648352 69.2362637 [50,] 41.0934066 56.6648352 [51,] 33.5219780 41.0934066 [52,] 23.6648352 33.5219780 [53,] -6.3351648 23.6648352 [54,] -23.2646520 -6.3351648 [55,] -19.0979853 -23.2646520 [56,] -7.7646520 -19.0979853 [57,] -2.7646520 -7.7646520 [58,] 5.5686813 -2.7646520 [59,] -9.4313187 5.5686813 [60,] -24.3846154 -9.4313187 [61,] -5.9560440 -24.3846154 [62,] -14.5274725 -5.9560440 [63,] -14.0989011 -14.5274725 [64,] -6.9560440 -14.0989011 [65,] -22.9560440 -6.9560440 [66,] -34.8855311 -22.9560440 [67,] -21.7188645 -34.8855311 [68,] -24.3855311 -21.7188645 [69,] -7.3855311 -24.3855311 [70,] 0.9478022 -7.3855311 [71,] -39.0521978 0.9478022 [72,] -29.0054945 -39.0521978 [73,] -19.5769231 -29.0054945 [74,] -10.1483516 -19.5769231 [75,] -21.7197802 -10.1483516 [76,] -14.5769231 -21.7197802 [77,] -25.5769231 -14.5769231 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -40.8516484 -44.2802198 2 -17.4230769 -40.8516484 3 -37.9945055 -17.4230769 4 -38.8516484 -37.9945055 5 -29.8516484 -38.8516484 6 -5.7811355 -29.8516484 7 -31.6144689 -5.7811355 8 -30.2811355 -31.6144689 9 -42.2811355 -30.2811355 10 -8.9478022 -42.2811355 11 46.0521978 -8.9478022 12 6.0989011 46.0521978 13 -21.4725275 6.0989011 14 -3.0439560 -21.4725275 15 0.3846154 -3.0439560 16 19.5274725 0.3846154 17 -2.4725275 19.5274725 18 56.5979853 -2.4725275 19 7.7646520 56.5979853 20 37.0979853 7.7646520 21 4.0979853 37.0979853 22 -17.5686813 4.0979853 23 -30.5686813 -17.5686813 24 12.4780220 -30.5686813 25 20.9065934 12.4780220 26 4.3351648 20.9065934 27 25.7637363 4.3351648 28 -6.0934066 25.7637363 29 37.9065934 -6.0934066 30 9.9771062 37.9065934 31 9.1437729 9.9771062 32 -1.5228938 9.1437729 33 6.4771062 -1.5228938 34 -16.1895604 6.4771062 35 -1.1895604 -16.1895604 36 9.8571429 -1.1895604 37 10.2857143 9.8571429 38 -0.2857143 10.2857143 39 14.1428571 -0.2857143 40 23.2857143 14.1428571 41 49.2857143 23.2857143 42 -2.6437729 49.2857143 43 55.5228938 -2.6437729 44 26.8562271 55.5228938 45 41.8562271 26.8562271 46 36.1895604 41.8562271 47 34.1895604 36.1895604 48 69.2362637 34.1895604 49 56.6648352 69.2362637 50 41.0934066 56.6648352 51 33.5219780 41.0934066 52 23.6648352 33.5219780 53 -6.3351648 23.6648352 54 -23.2646520 -6.3351648 55 -19.0979853 -23.2646520 56 -7.7646520 -19.0979853 57 -2.7646520 -7.7646520 58 5.5686813 -2.7646520 59 -9.4313187 5.5686813 60 -24.3846154 -9.4313187 61 -5.9560440 -24.3846154 62 -14.5274725 -5.9560440 63 -14.0989011 -14.5274725 64 -6.9560440 -14.0989011 65 -22.9560440 -6.9560440 66 -34.8855311 -22.9560440 67 -21.7188645 -34.8855311 68 -24.3855311 -21.7188645 69 -7.3855311 -24.3855311 70 0.9478022 -7.3855311 71 -39.0521978 0.9478022 72 -29.0054945 -39.0521978 73 -19.5769231 -29.0054945 74 -10.1483516 -19.5769231 75 -21.7197802 -10.1483516 76 -14.5769231 -21.7197802 77 -25.5769231 -14.5769231 > 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/7leax1291146830.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/www/html/rcomp/tmp/8leax1291146830.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/www/html/rcomp/tmp/9leax1291146830.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/www/html/rcomp/tmp/10wn901291146830.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/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/11h5p61291146830.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/1236ou1291146830.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/13hgm21291146830.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/142gk81291146830.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/15grlr1291146831.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/161rkf1291146831.tab") + } > > try(system("convert tmp/1p4c61291146830.ps tmp/1p4c61291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/20vt91291146830.ps tmp/20vt91291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/30vt91291146830.ps tmp/30vt91291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/40vt91291146830.ps tmp/40vt91291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/50vt91291146830.ps tmp/50vt91291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/6a4au1291146830.ps tmp/6a4au1291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/7leax1291146830.ps tmp/7leax1291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/8leax1291146830.ps tmp/8leax1291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/9leax1291146830.ps tmp/9leax1291146830.png",intern=TRUE)) character(0) > try(system("convert tmp/10wn901291146830.ps tmp/10wn901291146830.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.637 1.628 6.436