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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0),dim=c(3,86),dimnames=list(c('T40','used','correctanalysis'),1:86)) > y <- array(NA,dim=c(3,86),dimnames=list(c('T40','used','correctanalysis'),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 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '3' > par3 <- 'No Linear Trend' > par2 <- 'Do not include Seasonal Dummies' > par1 <- '3' > #'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 correctanalysis T40 used 1 0 1 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 7 0 0 0 8 0 1 0 9 0 0 0 10 0 0 0 11 0 1 0 12 0 0 0 13 0 0 1 14 0 1 0 15 0 0 1 16 0 1 1 17 1 1 1 18 0 1 0 19 0 0 0 20 1 1 1 21 0 0 0 22 0 0 1 23 0 0 0 24 0 0 0 25 0 1 1 26 0 0 1 27 0 0 0 28 0 0 1 29 0 0 0 30 0 0 0 31 0 0 0 32 0 0 0 33 0 0 0 34 0 1 0 35 0 0 0 36 0 0 0 37 0 1 1 38 0 0 1 39 0 0 0 40 0 1 0 41 1 0 1 42 0 0 1 43 0 0 0 44 0 1 0 45 0 0 0 46 0 0 0 47 0 0 0 48 0 0 0 49 0 0 0 50 0 0 0 51 0 1 1 52 1 1 1 53 0 0 0 54 1 0 1 55 0 0 0 56 0 1 1 57 0 0 1 58 0 0 0 59 0 0 0 60 1 1 1 61 0 1 0 62 0 0 1 63 0 0 0 64 0 1 0 65 0 0 0 66 0 0 0 67 1 1 1 68 0 0 0 69 0 0 0 70 0 0 1 71 0 0 0 72 0 0 0 73 0 0 1 74 0 0 1 75 0 0 0 76 0 1 0 77 0 0 0 78 0 0 1 79 1 1 1 80 0 1 0 81 0 0 0 82 0 0 1 83 0 0 0 84 1 0 1 85 0 0 0 86 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) T40 used -0.03148 0.15216 0.29313 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.41381 -0.12068 0.03148 0.03148 0.73835 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.03148 0.03706 -0.850 0.3980 T40 0.15216 0.06530 2.330 0.0222 * used 0.29313 0.06168 4.752 8.34e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2628 on 83 degrees of freedom Multiple R-squared: 0.2886, Adjusted R-squared: 0.2715 F-statistic: 16.84 on 2 and 83 DF, p-value: 7.27e-07 > 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.000000000 0.00000000 1.0000000 [2,] 0.000000000 0.00000000 1.0000000 [3,] 0.000000000 0.00000000 1.0000000 [4,] 0.000000000 0.00000000 1.0000000 [5,] 0.000000000 0.00000000 1.0000000 [6,] 0.000000000 0.00000000 1.0000000 [7,] 0.000000000 0.00000000 1.0000000 [8,] 0.000000000 0.00000000 1.0000000 [9,] 0.000000000 0.00000000 1.0000000 [10,] 0.000000000 0.00000000 1.0000000 [11,] 0.000000000 0.00000000 1.0000000 [12,] 0.181671911 0.36334382 0.8183281 [13,] 0.135926785 0.27185357 0.8640732 [14,] 0.095217918 0.19043584 0.9047821 [15,] 0.361835225 0.72367045 0.6381648 [16,] 0.293158885 0.58631777 0.7068411 [17,] 0.293859049 0.58771810 0.7061410 [18,] 0.234256015 0.46851203 0.7657440 [19,] 0.182369697 0.36473939 0.8176303 [20,] 0.256645916 0.51329183 0.7433541 [21,] 0.235986164 0.47197233 0.7640138 [22,] 0.185669172 0.37133834 0.8143308 [23,] 0.167322395 0.33464479 0.8326776 [24,] 0.128010294 0.25602059 0.8719897 [25,] 0.095778372 0.19155674 0.9042216 [26,] 0.070074206 0.14014841 0.9299258 [27,] 0.050126814 0.10025363 0.9498732 [28,] 0.035056539 0.07011308 0.9649435 [29,] 0.026503016 0.05300603 0.9734970 [30,] 0.017850374 0.03570075 0.9821496 [31,] 0.011752839 0.02350568 0.9882472 [32,] 0.018293728 0.03658746 0.9817063 [33,] 0.016163339 0.03232668 0.9838367 [34,] 0.010664597 0.02132919 0.9893354 [35,] 0.007644919 0.01528984 0.9923551 [36,] 0.150924195 0.30184839 0.8490758 [37,] 0.147107321 0.29421464 0.8528927 [38,] 0.113677420 0.22735484 0.8863226 [39,] 0.092071153 0.18414231 0.9079288 [40,] 0.068603902 0.13720780 0.9313961 [41,] 0.050050422 0.10010084 0.9499496 [42,] 0.035739105 0.07147821 0.9642609 [43,] 0.024969365 0.04993873 0.9750306 [44,] 0.017063061 0.03412612 0.9829369 [45,] 0.011401351 0.02280270 0.9885986 [46,] 0.022932766 0.04586553 0.9770672 [47,] 0.088538775 0.17707755 0.9114612 [48,] 0.065664605 0.13132921 0.9343354 [49,] 0.330860521 0.66172104 0.6691395 [50,] 0.274802840 0.54960568 0.7251972 [51,] 0.430336155 0.86067231 0.5696638 [52,] 0.435978250 0.87195650 0.5640217 [53,] 0.373372357 0.74674471 0.6266276 [54,] 0.313930375 0.62786075 0.6860696 [55,] 0.475523603 0.95104721 0.5244764 [56,] 0.449137353 0.89827471 0.5508626 [57,] 0.452158834 0.90431767 0.5478412 [58,] 0.383728826 0.76745765 0.6162712 [59,] 0.376996764 0.75399353 0.6230032 [60,] 0.310318688 0.62063738 0.6896813 [61,] 0.248896115 0.49779223 0.7511039 [62,] 0.372894689 0.74578938 0.6271053 [63,] 0.301626606 0.60325321 0.6983734 [64,] 0.236446852 0.47289370 0.7635531 [65,] 0.229219777 0.45843955 0.7707802 [66,] 0.171371844 0.34274369 0.8286282 [67,] 0.123190112 0.24638022 0.8768099 [68,] 0.127178636 0.25435727 0.8728214 [69,] 0.161275608 0.32255122 0.8387244 [70,] 0.109516193 0.21903239 0.8904838 [71,] 0.084310526 0.16862105 0.9156895 [72,] 0.050390672 0.10078134 0.9496093 [73,] 0.107619932 0.21523986 0.8923801 [74,] 0.124644892 0.24928978 0.8753551 [75,] 0.064495261 0.12899052 0.9355047 > postscript(file="/var/wessaorg/rcomp/tmp/1w9fs1356054425.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/2xudd1356054425.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/3cj3l1356054425.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/42wv81356054425.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/5lvdz1356054425.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 6 7 -0.1206752 0.0314805 0.0314805 0.0314805 0.0314805 0.0314805 0.0314805 8 9 10 11 12 13 14 -0.1206752 0.0314805 0.0314805 -0.1206752 0.0314805 -0.2616531 -0.1206752 15 16 17 18 19 20 21 -0.2616531 -0.4138088 0.5861912 -0.1206752 0.0314805 0.5861912 0.0314805 22 23 24 25 26 27 28 -0.2616531 0.0314805 0.0314805 -0.4138088 -0.2616531 0.0314805 -0.2616531 29 30 31 32 33 34 35 0.0314805 0.0314805 0.0314805 0.0314805 0.0314805 -0.1206752 0.0314805 36 37 38 39 40 41 42 0.0314805 -0.4138088 -0.2616531 0.0314805 -0.1206752 0.7383469 -0.2616531 43 44 45 46 47 48 49 0.0314805 -0.1206752 0.0314805 0.0314805 0.0314805 0.0314805 0.0314805 50 51 52 53 54 55 56 0.0314805 -0.4138088 0.5861912 0.0314805 0.7383469 0.0314805 -0.4138088 57 58 59 60 61 62 63 -0.2616531 0.0314805 0.0314805 0.5861912 -0.1206752 -0.2616531 0.0314805 64 65 66 67 68 69 70 -0.1206752 0.0314805 0.0314805 0.5861912 0.0314805 0.0314805 -0.2616531 71 72 73 74 75 76 77 0.0314805 0.0314805 -0.2616531 -0.2616531 0.0314805 -0.1206752 0.0314805 78 79 80 81 82 83 84 -0.2616531 0.5861912 -0.1206752 0.0314805 -0.2616531 0.0314805 0.7383469 85 86 0.0314805 0.0314805 > postscript(file="/var/wessaorg/rcomp/tmp/6zz481356054425.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.1206752 NA 1 0.0314805 -0.1206752 2 0.0314805 0.0314805 3 0.0314805 0.0314805 4 0.0314805 0.0314805 5 0.0314805 0.0314805 6 0.0314805 0.0314805 7 -0.1206752 0.0314805 8 0.0314805 -0.1206752 9 0.0314805 0.0314805 10 -0.1206752 0.0314805 11 0.0314805 -0.1206752 12 -0.2616531 0.0314805 13 -0.1206752 -0.2616531 14 -0.2616531 -0.1206752 15 -0.4138088 -0.2616531 16 0.5861912 -0.4138088 17 -0.1206752 0.5861912 18 0.0314805 -0.1206752 19 0.5861912 0.0314805 20 0.0314805 0.5861912 21 -0.2616531 0.0314805 22 0.0314805 -0.2616531 23 0.0314805 0.0314805 24 -0.4138088 0.0314805 25 -0.2616531 -0.4138088 26 0.0314805 -0.2616531 27 -0.2616531 0.0314805 28 0.0314805 -0.2616531 29 0.0314805 0.0314805 30 0.0314805 0.0314805 31 0.0314805 0.0314805 32 0.0314805 0.0314805 33 -0.1206752 0.0314805 34 0.0314805 -0.1206752 35 0.0314805 0.0314805 36 -0.4138088 0.0314805 37 -0.2616531 -0.4138088 38 0.0314805 -0.2616531 39 -0.1206752 0.0314805 40 0.7383469 -0.1206752 41 -0.2616531 0.7383469 42 0.0314805 -0.2616531 43 -0.1206752 0.0314805 44 0.0314805 -0.1206752 45 0.0314805 0.0314805 46 0.0314805 0.0314805 47 0.0314805 0.0314805 48 0.0314805 0.0314805 49 0.0314805 0.0314805 50 -0.4138088 0.0314805 51 0.5861912 -0.4138088 52 0.0314805 0.5861912 53 0.7383469 0.0314805 54 0.0314805 0.7383469 55 -0.4138088 0.0314805 56 -0.2616531 -0.4138088 57 0.0314805 -0.2616531 58 0.0314805 0.0314805 59 0.5861912 0.0314805 60 -0.1206752 0.5861912 61 -0.2616531 -0.1206752 62 0.0314805 -0.2616531 63 -0.1206752 0.0314805 64 0.0314805 -0.1206752 65 0.0314805 0.0314805 66 0.5861912 0.0314805 67 0.0314805 0.5861912 68 0.0314805 0.0314805 69 -0.2616531 0.0314805 70 0.0314805 -0.2616531 71 0.0314805 0.0314805 72 -0.2616531 0.0314805 73 -0.2616531 -0.2616531 74 0.0314805 -0.2616531 75 -0.1206752 0.0314805 76 0.0314805 -0.1206752 77 -0.2616531 0.0314805 78 0.5861912 -0.2616531 79 -0.1206752 0.5861912 80 0.0314805 -0.1206752 81 -0.2616531 0.0314805 82 0.0314805 -0.2616531 83 0.7383469 0.0314805 84 0.0314805 0.7383469 85 0.0314805 0.0314805 86 NA 0.0314805 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0314805 -0.1206752 [2,] 0.0314805 0.0314805 [3,] 0.0314805 0.0314805 [4,] 0.0314805 0.0314805 [5,] 0.0314805 0.0314805 [6,] 0.0314805 0.0314805 [7,] -0.1206752 0.0314805 [8,] 0.0314805 -0.1206752 [9,] 0.0314805 0.0314805 [10,] -0.1206752 0.0314805 [11,] 0.0314805 -0.1206752 [12,] -0.2616531 0.0314805 [13,] -0.1206752 -0.2616531 [14,] -0.2616531 -0.1206752 [15,] -0.4138088 -0.2616531 [16,] 0.5861912 -0.4138088 [17,] -0.1206752 0.5861912 [18,] 0.0314805 -0.1206752 [19,] 0.5861912 0.0314805 [20,] 0.0314805 0.5861912 [21,] -0.2616531 0.0314805 [22,] 0.0314805 -0.2616531 [23,] 0.0314805 0.0314805 [24,] -0.4138088 0.0314805 [25,] -0.2616531 -0.4138088 [26,] 0.0314805 -0.2616531 [27,] -0.2616531 0.0314805 [28,] 0.0314805 -0.2616531 [29,] 0.0314805 0.0314805 [30,] 0.0314805 0.0314805 [31,] 0.0314805 0.0314805 [32,] 0.0314805 0.0314805 [33,] -0.1206752 0.0314805 [34,] 0.0314805 -0.1206752 [35,] 0.0314805 0.0314805 [36,] -0.4138088 0.0314805 [37,] -0.2616531 -0.4138088 [38,] 0.0314805 -0.2616531 [39,] -0.1206752 0.0314805 [40,] 0.7383469 -0.1206752 [41,] -0.2616531 0.7383469 [42,] 0.0314805 -0.2616531 [43,] -0.1206752 0.0314805 [44,] 0.0314805 -0.1206752 [45,] 0.0314805 0.0314805 [46,] 0.0314805 0.0314805 [47,] 0.0314805 0.0314805 [48,] 0.0314805 0.0314805 [49,] 0.0314805 0.0314805 [50,] -0.4138088 0.0314805 [51,] 0.5861912 -0.4138088 [52,] 0.0314805 0.5861912 [53,] 0.7383469 0.0314805 [54,] 0.0314805 0.7383469 [55,] -0.4138088 0.0314805 [56,] -0.2616531 -0.4138088 [57,] 0.0314805 -0.2616531 [58,] 0.0314805 0.0314805 [59,] 0.5861912 0.0314805 [60,] -0.1206752 0.5861912 [61,] -0.2616531 -0.1206752 [62,] 0.0314805 -0.2616531 [63,] -0.1206752 0.0314805 [64,] 0.0314805 -0.1206752 [65,] 0.0314805 0.0314805 [66,] 0.5861912 0.0314805 [67,] 0.0314805 0.5861912 [68,] 0.0314805 0.0314805 [69,] -0.2616531 0.0314805 [70,] 0.0314805 -0.2616531 [71,] 0.0314805 0.0314805 [72,] -0.2616531 0.0314805 [73,] -0.2616531 -0.2616531 [74,] 0.0314805 -0.2616531 [75,] -0.1206752 0.0314805 [76,] 0.0314805 -0.1206752 [77,] -0.2616531 0.0314805 [78,] 0.5861912 -0.2616531 [79,] -0.1206752 0.5861912 [80,] 0.0314805 -0.1206752 [81,] -0.2616531 0.0314805 [82,] 0.0314805 -0.2616531 [83,] 0.7383469 0.0314805 [84,] 0.0314805 0.7383469 [85,] 0.0314805 0.0314805 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0314805 -0.1206752 2 0.0314805 0.0314805 3 0.0314805 0.0314805 4 0.0314805 0.0314805 5 0.0314805 0.0314805 6 0.0314805 0.0314805 7 -0.1206752 0.0314805 8 0.0314805 -0.1206752 9 0.0314805 0.0314805 10 -0.1206752 0.0314805 11 0.0314805 -0.1206752 12 -0.2616531 0.0314805 13 -0.1206752 -0.2616531 14 -0.2616531 -0.1206752 15 -0.4138088 -0.2616531 16 0.5861912 -0.4138088 17 -0.1206752 0.5861912 18 0.0314805 -0.1206752 19 0.5861912 0.0314805 20 0.0314805 0.5861912 21 -0.2616531 0.0314805 22 0.0314805 -0.2616531 23 0.0314805 0.0314805 24 -0.4138088 0.0314805 25 -0.2616531 -0.4138088 26 0.0314805 -0.2616531 27 -0.2616531 0.0314805 28 0.0314805 -0.2616531 29 0.0314805 0.0314805 30 0.0314805 0.0314805 31 0.0314805 0.0314805 32 0.0314805 0.0314805 33 -0.1206752 0.0314805 34 0.0314805 -0.1206752 35 0.0314805 0.0314805 36 -0.4138088 0.0314805 37 -0.2616531 -0.4138088 38 0.0314805 -0.2616531 39 -0.1206752 0.0314805 40 0.7383469 -0.1206752 41 -0.2616531 0.7383469 42 0.0314805 -0.2616531 43 -0.1206752 0.0314805 44 0.0314805 -0.1206752 45 0.0314805 0.0314805 46 0.0314805 0.0314805 47 0.0314805 0.0314805 48 0.0314805 0.0314805 49 0.0314805 0.0314805 50 -0.4138088 0.0314805 51 0.5861912 -0.4138088 52 0.0314805 0.5861912 53 0.7383469 0.0314805 54 0.0314805 0.7383469 55 -0.4138088 0.0314805 56 -0.2616531 -0.4138088 57 0.0314805 -0.2616531 58 0.0314805 0.0314805 59 0.5861912 0.0314805 60 -0.1206752 0.5861912 61 -0.2616531 -0.1206752 62 0.0314805 -0.2616531 63 -0.1206752 0.0314805 64 0.0314805 -0.1206752 65 0.0314805 0.0314805 66 0.5861912 0.0314805 67 0.0314805 0.5861912 68 0.0314805 0.0314805 69 -0.2616531 0.0314805 70 0.0314805 -0.2616531 71 0.0314805 0.0314805 72 -0.2616531 0.0314805 73 -0.2616531 -0.2616531 74 0.0314805 -0.2616531 75 -0.1206752 0.0314805 76 0.0314805 -0.1206752 77 -0.2616531 0.0314805 78 0.5861912 -0.2616531 79 -0.1206752 0.5861912 80 0.0314805 -0.1206752 81 -0.2616531 0.0314805 82 0.0314805 -0.2616531 83 0.7383469 0.0314805 84 0.0314805 0.7383469 85 0.0314805 0.0314805 > 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/7yorg1356054425.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/8mrti1356054425.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/9e38s1356054425.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/10gl961356054425.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/11lwpm1356054425.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/128xtu1356054425.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/13tj141356054425.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/146yif1356054425.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/152jbu1356054425.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/16hgi91356054425.tab") + } > > try(system("convert tmp/1w9fs1356054425.ps tmp/1w9fs1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/2xudd1356054425.ps tmp/2xudd1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/3cj3l1356054425.ps tmp/3cj3l1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/42wv81356054425.ps tmp/42wv81356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/5lvdz1356054425.ps tmp/5lvdz1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/6zz481356054425.ps tmp/6zz481356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/7yorg1356054425.ps tmp/7yorg1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/8mrti1356054425.ps tmp/8mrti1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/9e38s1356054425.ps tmp/9e38s1356054425.png",intern=TRUE)) character(0) > try(system("convert tmp/10gl961356054425.ps tmp/10gl961356054425.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.706 1.106 7.821