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 + ,1 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,1 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,1 + ,1 + ,0 + ,1 + ,1 + ,0 + ,1 + ,1 + ,1 + ,1 + ,1 + ,1 + ,1 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,1 + ,1 + ,1 + ,1 + ,1 + ,1 + ,0 + ,0 + ,0 + ,1 + ,0 + ,1 + ,0 + ,1 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,1 + ,0 + ,0 + ,0 + ,1 + ,1 + ,0 + ,1 + ,1 + ,0 + ,0 + ,1 + ,0 + ,0 + ,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,1 + ,1 + ,1 + ,1 + ,1 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,1 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,1 + ,0 + ,0 + ,1 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,1 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0 + ,1 + ,0 + ,1 + ,1 + ,0 + ,1 + ,1 + ,1 + ,0 + ,1 + ,0 + ,1 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,1 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0) + ,dim=c(6 + ,86) + ,dimnames=list(c('UseLimit' + ,'T40' + ,'Used' + ,'CorrectAnalysis' + ,'Useful' + ,'Outcome') + ,1:86)) > y <- array(NA,dim=c(6,86),dimnames=list(c('UseLimit','T40','Used','CorrectAnalysis','Useful','Outcome'),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 = '1' > par3 <- 'No Linear Trend' > par2 <- 'Do not include Seasonal Dummies' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 UseLimit T40 Used CorrectAnalysis Useful Outcome 1 1 1 0 0 0 1 2 0 0 0 0 0 0 3 0 0 0 0 0 0 4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 0 0 0 0 1 78 0 0 1 0 1 1 79 0 1 1 1 0 1 80 0 1 0 0 1 0 81 0 0 0 0 0 0 82 1 0 1 0 0 1 83 0 0 0 0 0 0 84 0 0 1 1 0 0 85 0 0 0 0 1 1 86 1 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) T40 Used CorrectAnalysis 0.23513 0.28917 -0.11038 -0.02083 Useful Outcome 0.09638 -0.06214 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.6207 -0.2351 -0.1730 0.4757 0.9374 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.23513 0.07787 3.020 0.0034 ** T40 0.28917 0.11357 2.546 0.0128 * Used -0.11038 0.11979 -0.921 0.3596 CorrectAnalysis -0.02083 0.18651 -0.112 0.9113 Useful 0.09638 0.10577 0.911 0.3649 Outcome -0.06214 0.09732 -0.639 0.5250 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4426 on 80 degrees of freedom Multiple R-squared: 0.09442, Adjusted R-squared: 0.03782 F-statistic: 1.668 on 5 and 80 DF, p-value: 0.1519 > 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.3326225 0.6652449 0.6673775 [2,] 0.8224197 0.3551607 0.1775803 [3,] 0.8129486 0.3741028 0.1870514 [4,] 0.7253215 0.5493570 0.2746785 [5,] 0.6220099 0.7559802 0.3779901 [6,] 0.5734536 0.8530927 0.4265464 [7,] 0.4698225 0.9396451 0.5301775 [8,] 0.4767720 0.9535439 0.5232280 [9,] 0.3991963 0.7983925 0.6008037 [10,] 0.3671058 0.7342117 0.6328942 [11,] 0.2906989 0.5813977 0.7093011 [12,] 0.3569199 0.7138399 0.6430801 [13,] 0.3201079 0.6402159 0.6798921 [14,] 0.6668595 0.6662811 0.3331405 [15,] 0.7409562 0.5180876 0.2590438 [16,] 0.7561276 0.4877449 0.2438724 [17,] 0.7066672 0.5866655 0.2933328 [18,] 0.6529883 0.6940235 0.3470117 [19,] 0.8027215 0.3945569 0.1972785 [20,] 0.7726022 0.4547957 0.2273978 [21,] 0.7279472 0.5441056 0.2720528 [22,] 0.7524165 0.4951669 0.2475835 [23,] 0.7089248 0.5821504 0.2910752 [24,] 0.8092121 0.3815757 0.1907879 [25,] 0.8465532 0.3068935 0.1534468 [26,] 0.8612832 0.2774337 0.1387168 [27,] 0.8324615 0.3350770 0.1675385 [28,] 0.7990039 0.4019921 0.2009961 [29,] 0.8083007 0.3833987 0.1916993 [30,] 0.7706310 0.4587379 0.2293690 [31,] 0.7599359 0.4801283 0.2400641 [32,] 0.8215334 0.3569332 0.1784666 [33,] 0.7783677 0.4432645 0.2216323 [34,] 0.7297254 0.5405493 0.2702746 [35,] 0.8333825 0.3332351 0.1666175 [36,] 0.8430457 0.3139086 0.1569543 [37,] 0.8252801 0.3494398 0.1747199 [38,] 0.7980389 0.4039222 0.2019611 [39,] 0.7578562 0.4842876 0.2421438 [40,] 0.7098855 0.5802289 0.2901145 [41,] 0.6679900 0.6640201 0.3320100 [42,] 0.6164345 0.7671309 0.3835655 [43,] 0.6356639 0.7286721 0.3643361 [44,] 0.6920831 0.6158338 0.3079169 [45,] 0.6359943 0.7280113 0.3640057 [46,] 0.5720410 0.8559179 0.4279590 [47,] 0.5168544 0.9662912 0.4831456 [48,] 0.6049125 0.7901751 0.3950875 [49,] 0.5366951 0.9266099 0.4633049 [50,] 0.4720443 0.9440886 0.5279557 [51,] 0.4087784 0.8175567 0.5912216 [52,] 0.6381652 0.7236695 0.3618348 [53,] 0.6325853 0.7348294 0.3674147 [54,] 0.5632170 0.8735661 0.4367830 [55,] 0.5090943 0.9818114 0.4909057 [56,] 0.5806493 0.8387015 0.4193507 [57,] 0.5288723 0.9422554 0.4711277 [58,] 0.4830757 0.9661514 0.5169243 [59,] 0.4352991 0.8705982 0.5647009 [60,] 0.6166225 0.7667549 0.3833775 [61,] 0.5295737 0.9408527 0.4704263 [62,] 0.6217656 0.7564688 0.3782344 [63,] 0.5714364 0.8571272 0.4285636 [64,] 0.4689847 0.9379693 0.5310153 [65,] 0.5912592 0.8174815 0.4087408 [66,] 0.5311682 0.9376636 0.4688318 [67,] 0.4266234 0.8532468 0.5733766 [68,] 0.3152496 0.6304993 0.6847504 [69,] 0.2435982 0.4871965 0.7564018 > postscript(file="/var/wessaorg/rcomp/tmp/1ufwa1356127055.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/25lyg1356127055.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/3qpcp1356127055.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/4hme91356127055.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/5hsau1356127055.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 0.53783853 -0.23513434 -0.23513434 -0.23513434 -0.23513434 0.73062553 7 8 9 10 11 12 -0.23513434 -0.52430186 -0.17299395 0.76486566 0.47569814 -0.23513434 13 14 15 16 17 18 -0.22113220 0.47569814 -0.15899181 -0.44815934 0.51053270 0.47569814 19 20 21 22 23 24 -0.17299395 -0.42732691 0.66848514 0.84100819 -0.26937447 0.73062553 25 26 27 28 29 30 -0.35177882 -0.22113220 0.82700605 -0.12475168 -0.17299395 -0.33151486 31 32 33 34 35 36 -0.23513434 0.76486566 0.66848514 -0.46216147 -0.23513434 -0.23513434 37 38 39 40 41 42 0.48970027 -0.06261129 -0.26937447 -0.62068239 -0.13815938 -0.06261129 43 44 45 46 47 48 0.73062553 0.47569814 -0.33151486 -0.26937447 -0.23513434 -0.17299395 49 50 51 52 53 54 -0.26937447 -0.23513434 -0.41391921 0.51053270 -0.17299395 -0.10391925 55 56 57 58 59 60 -0.23513434 -0.35177882 -0.15899181 -0.17299395 -0.17299395 0.57267309 61 62 63 64 65 66 0.53783853 -0.22113220 -0.23513434 0.53783853 -0.23513434 -0.23513434 67 68 69 70 71 72 -0.48946730 0.76486566 -0.17299395 -0.12475168 -0.23513434 -0.17299395 73 74 75 76 77 78 -0.06261129 0.87524832 -0.17299395 -0.55854199 -0.17299395 -0.15899181 79 80 81 82 83 84 -0.33094639 -0.62068239 -0.23513434 0.93738871 -0.23513434 -0.10391925 85 86 -0.26937447 0.76486566 > postscript(file="/var/wessaorg/rcomp/tmp/6xkmq1356127055.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.53783853 NA 1 -0.23513434 0.53783853 2 -0.23513434 -0.23513434 3 -0.23513434 -0.23513434 4 -0.23513434 -0.23513434 5 0.73062553 -0.23513434 6 -0.23513434 0.73062553 7 -0.52430186 -0.23513434 8 -0.17299395 -0.52430186 9 0.76486566 -0.17299395 10 0.47569814 0.76486566 11 -0.23513434 0.47569814 12 -0.22113220 -0.23513434 13 0.47569814 -0.22113220 14 -0.15899181 0.47569814 15 -0.44815934 -0.15899181 16 0.51053270 -0.44815934 17 0.47569814 0.51053270 18 -0.17299395 0.47569814 19 -0.42732691 -0.17299395 20 0.66848514 -0.42732691 21 0.84100819 0.66848514 22 -0.26937447 0.84100819 23 0.73062553 -0.26937447 24 -0.35177882 0.73062553 25 -0.22113220 -0.35177882 26 0.82700605 -0.22113220 27 -0.12475168 0.82700605 28 -0.17299395 -0.12475168 29 -0.33151486 -0.17299395 30 -0.23513434 -0.33151486 31 0.76486566 -0.23513434 32 0.66848514 0.76486566 33 -0.46216147 0.66848514 34 -0.23513434 -0.46216147 35 -0.23513434 -0.23513434 36 0.48970027 -0.23513434 37 -0.06261129 0.48970027 38 -0.26937447 -0.06261129 39 -0.62068239 -0.26937447 40 -0.13815938 -0.62068239 41 -0.06261129 -0.13815938 42 0.73062553 -0.06261129 43 0.47569814 0.73062553 44 -0.33151486 0.47569814 45 -0.26937447 -0.33151486 46 -0.23513434 -0.26937447 47 -0.17299395 -0.23513434 48 -0.26937447 -0.17299395 49 -0.23513434 -0.26937447 50 -0.41391921 -0.23513434 51 0.51053270 -0.41391921 52 -0.17299395 0.51053270 53 -0.10391925 -0.17299395 54 -0.23513434 -0.10391925 55 -0.35177882 -0.23513434 56 -0.15899181 -0.35177882 57 -0.17299395 -0.15899181 58 -0.17299395 -0.17299395 59 0.57267309 -0.17299395 60 0.53783853 0.57267309 61 -0.22113220 0.53783853 62 -0.23513434 -0.22113220 63 0.53783853 -0.23513434 64 -0.23513434 0.53783853 65 -0.23513434 -0.23513434 66 -0.48946730 -0.23513434 67 0.76486566 -0.48946730 68 -0.17299395 0.76486566 69 -0.12475168 -0.17299395 70 -0.23513434 -0.12475168 71 -0.17299395 -0.23513434 72 -0.06261129 -0.17299395 73 0.87524832 -0.06261129 74 -0.17299395 0.87524832 75 -0.55854199 -0.17299395 76 -0.17299395 -0.55854199 77 -0.15899181 -0.17299395 78 -0.33094639 -0.15899181 79 -0.62068239 -0.33094639 80 -0.23513434 -0.62068239 81 0.93738871 -0.23513434 82 -0.23513434 0.93738871 83 -0.10391925 -0.23513434 84 -0.26937447 -0.10391925 85 0.76486566 -0.26937447 86 NA 0.76486566 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.23513434 0.53783853 [2,] -0.23513434 -0.23513434 [3,] -0.23513434 -0.23513434 [4,] -0.23513434 -0.23513434 [5,] 0.73062553 -0.23513434 [6,] -0.23513434 0.73062553 [7,] -0.52430186 -0.23513434 [8,] -0.17299395 -0.52430186 [9,] 0.76486566 -0.17299395 [10,] 0.47569814 0.76486566 [11,] -0.23513434 0.47569814 [12,] -0.22113220 -0.23513434 [13,] 0.47569814 -0.22113220 [14,] -0.15899181 0.47569814 [15,] -0.44815934 -0.15899181 [16,] 0.51053270 -0.44815934 [17,] 0.47569814 0.51053270 [18,] -0.17299395 0.47569814 [19,] -0.42732691 -0.17299395 [20,] 0.66848514 -0.42732691 [21,] 0.84100819 0.66848514 [22,] -0.26937447 0.84100819 [23,] 0.73062553 -0.26937447 [24,] -0.35177882 0.73062553 [25,] -0.22113220 -0.35177882 [26,] 0.82700605 -0.22113220 [27,] -0.12475168 0.82700605 [28,] -0.17299395 -0.12475168 [29,] -0.33151486 -0.17299395 [30,] -0.23513434 -0.33151486 [31,] 0.76486566 -0.23513434 [32,] 0.66848514 0.76486566 [33,] -0.46216147 0.66848514 [34,] -0.23513434 -0.46216147 [35,] -0.23513434 -0.23513434 [36,] 0.48970027 -0.23513434 [37,] -0.06261129 0.48970027 [38,] -0.26937447 -0.06261129 [39,] -0.62068239 -0.26937447 [40,] -0.13815938 -0.62068239 [41,] -0.06261129 -0.13815938 [42,] 0.73062553 -0.06261129 [43,] 0.47569814 0.73062553 [44,] -0.33151486 0.47569814 [45,] -0.26937447 -0.33151486 [46,] -0.23513434 -0.26937447 [47,] -0.17299395 -0.23513434 [48,] -0.26937447 -0.17299395 [49,] -0.23513434 -0.26937447 [50,] -0.41391921 -0.23513434 [51,] 0.51053270 -0.41391921 [52,] -0.17299395 0.51053270 [53,] -0.10391925 -0.17299395 [54,] -0.23513434 -0.10391925 [55,] -0.35177882 -0.23513434 [56,] -0.15899181 -0.35177882 [57,] -0.17299395 -0.15899181 [58,] -0.17299395 -0.17299395 [59,] 0.57267309 -0.17299395 [60,] 0.53783853 0.57267309 [61,] -0.22113220 0.53783853 [62,] -0.23513434 -0.22113220 [63,] 0.53783853 -0.23513434 [64,] -0.23513434 0.53783853 [65,] -0.23513434 -0.23513434 [66,] -0.48946730 -0.23513434 [67,] 0.76486566 -0.48946730 [68,] -0.17299395 0.76486566 [69,] -0.12475168 -0.17299395 [70,] -0.23513434 -0.12475168 [71,] -0.17299395 -0.23513434 [72,] -0.06261129 -0.17299395 [73,] 0.87524832 -0.06261129 [74,] -0.17299395 0.87524832 [75,] -0.55854199 -0.17299395 [76,] -0.17299395 -0.55854199 [77,] -0.15899181 -0.17299395 [78,] -0.33094639 -0.15899181 [79,] -0.62068239 -0.33094639 [80,] -0.23513434 -0.62068239 [81,] 0.93738871 -0.23513434 [82,] -0.23513434 0.93738871 [83,] -0.10391925 -0.23513434 [84,] -0.26937447 -0.10391925 [85,] 0.76486566 -0.26937447 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.23513434 0.53783853 2 -0.23513434 -0.23513434 3 -0.23513434 -0.23513434 4 -0.23513434 -0.23513434 5 0.73062553 -0.23513434 6 -0.23513434 0.73062553 7 -0.52430186 -0.23513434 8 -0.17299395 -0.52430186 9 0.76486566 -0.17299395 10 0.47569814 0.76486566 11 -0.23513434 0.47569814 12 -0.22113220 -0.23513434 13 0.47569814 -0.22113220 14 -0.15899181 0.47569814 15 -0.44815934 -0.15899181 16 0.51053270 -0.44815934 17 0.47569814 0.51053270 18 -0.17299395 0.47569814 19 -0.42732691 -0.17299395 20 0.66848514 -0.42732691 21 0.84100819 0.66848514 22 -0.26937447 0.84100819 23 0.73062553 -0.26937447 24 -0.35177882 0.73062553 25 -0.22113220 -0.35177882 26 0.82700605 -0.22113220 27 -0.12475168 0.82700605 28 -0.17299395 -0.12475168 29 -0.33151486 -0.17299395 30 -0.23513434 -0.33151486 31 0.76486566 -0.23513434 32 0.66848514 0.76486566 33 -0.46216147 0.66848514 34 -0.23513434 -0.46216147 35 -0.23513434 -0.23513434 36 0.48970027 -0.23513434 37 -0.06261129 0.48970027 38 -0.26937447 -0.06261129 39 -0.62068239 -0.26937447 40 -0.13815938 -0.62068239 41 -0.06261129 -0.13815938 42 0.73062553 -0.06261129 43 0.47569814 0.73062553 44 -0.33151486 0.47569814 45 -0.26937447 -0.33151486 46 -0.23513434 -0.26937447 47 -0.17299395 -0.23513434 48 -0.26937447 -0.17299395 49 -0.23513434 -0.26937447 50 -0.41391921 -0.23513434 51 0.51053270 -0.41391921 52 -0.17299395 0.51053270 53 -0.10391925 -0.17299395 54 -0.23513434 -0.10391925 55 -0.35177882 -0.23513434 56 -0.15899181 -0.35177882 57 -0.17299395 -0.15899181 58 -0.17299395 -0.17299395 59 0.57267309 -0.17299395 60 0.53783853 0.57267309 61 -0.22113220 0.53783853 62 -0.23513434 -0.22113220 63 0.53783853 -0.23513434 64 -0.23513434 0.53783853 65 -0.23513434 -0.23513434 66 -0.48946730 -0.23513434 67 0.76486566 -0.48946730 68 -0.17299395 0.76486566 69 -0.12475168 -0.17299395 70 -0.23513434 -0.12475168 71 -0.17299395 -0.23513434 72 -0.06261129 -0.17299395 73 0.87524832 -0.06261129 74 -0.17299395 0.87524832 75 -0.55854199 -0.17299395 76 -0.17299395 -0.55854199 77 -0.15899181 -0.17299395 78 -0.33094639 -0.15899181 79 -0.62068239 -0.33094639 80 -0.23513434 -0.62068239 81 0.93738871 -0.23513434 82 -0.23513434 0.93738871 83 -0.10391925 -0.23513434 84 -0.26937447 -0.10391925 85 0.76486566 -0.26937447 > 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/73dhk1356127055.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/84kva1356127055.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/9jfes1356127055.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/10spxt1356127055.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/110k3u1356127055.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/12zmhz1356127055.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/139vkr1356127055.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/147zgy1356127055.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/15ju041356127055.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/1666vg1356127055.tab") + } > > try(system("convert tmp/1ufwa1356127055.ps tmp/1ufwa1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/25lyg1356127055.ps tmp/25lyg1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/3qpcp1356127055.ps tmp/3qpcp1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/4hme91356127055.ps tmp/4hme91356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/5hsau1356127055.ps tmp/5hsau1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/6xkmq1356127055.ps tmp/6xkmq1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/73dhk1356127055.ps tmp/73dhk1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/84kva1356127055.ps tmp/84kva1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/9jfes1356127055.ps tmp/9jfes1356127055.png",intern=TRUE)) character(0) > try(system("convert tmp/10spxt1356127055.ps tmp/10spxt1356127055.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.024 0.856 6.901