R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(998 + ,1.2 + ,613 + ,-1906 + ,-2.3 + ,-0.6 + ,499 + ,2.3 + ,998 + ,-706 + ,1.2 + ,-1.1 + ,59 + ,1.3 + ,499 + ,326 + ,2.3 + ,-0.6 + ,175 + ,1.4 + ,59 + ,146 + ,1.3 + ,-2 + ,-413 + ,-1.5 + ,175 + ,625 + ,1.4 + ,0 + ,-223 + ,1.4 + ,-413 + ,104 + ,-1.5 + ,-1.1 + ,110 + ,-0.9 + ,-223 + ,65 + ,1.4 + ,3.4 + ,13 + ,-0.6 + ,110 + ,25 + ,-0.9 + ,0.8 + ,74 + ,1.8 + ,13 + ,3 + ,-0.6 + ,-3.2 + ,643 + ,-3.9 + ,74 + ,-393 + ,1.8 + ,3.1 + ,44 + ,2.4 + ,643 + ,-358 + ,-3.9 + ,-1.7 + ,216 + ,1.1 + ,44 + ,613 + ,2.4 + ,-2.3 + ,-1189 + ,-2.3 + ,216 + ,998 + ,1.1 + ,1.2 + ,-47 + ,-4.3 + ,-1189 + ,499 + ,-2.3 + ,2.3 + ,279 + ,1 + ,-47 + ,59 + ,-4.3 + ,1.3 + ,374 + ,0.8 + ,279 + ,175 + ,1 + ,1.4 + ,13 + ,0.3 + ,374 + ,-413 + ,0.8 + ,-1.5 + ,152 + ,2.2 + ,13 + ,-223 + ,0.3 + ,1.4 + ,-27 + ,1.7 + ,152 + ,110 + ,2.2 + ,-0.9 + ,334 + ,1.8 + ,-27 + ,13 + ,1.7 + ,-0.6 + ,411 + ,0.6 + ,334 + ,74 + ,1.8 + ,1.8 + ,33 + ,-2.6 + ,411 + ,643 + ,0.6 + ,-3.9 + ,313 + ,-0.3 + ,33 + ,44 + ,-2.6 + ,2.4 + ,751 + ,0.1 + ,313 + ,216 + ,-0.3 + ,1.1 + ,446 + ,0.9 + ,751 + ,-1189 + ,0.1 + ,-2.3 + ,-329 + ,2.2 + ,446 + ,-47 + ,0.9 + ,-4.3 + ,-560 + ,-2.2 + ,-329 + ,279 + ,2.2 + ,1 + ,-783 + ,0.4 + ,-560 + ,374 + ,-2.2 + ,0.8 + ,-371 + ,-1.1 + ,-783 + ,13 + ,0.4 + ,0.3 + ,-308 + ,-3 + ,-371 + ,152 + ,-1.1 + ,2.2 + ,-264 + ,-2.1 + ,-308 + ,-27 + ,-3 + ,1.7 + ,-787 + ,-1.5 + ,-264 + ,334 + ,-2.1 + ,1.8 + ,-486 + ,0.5 + ,-787 + ,411 + ,-1.5 + ,0.6 + ,-243 + ,3.8 + ,-486 + ,33 + ,0.5 + ,-2.6 + ,-416 + ,-1.9 + ,-243 + ,313 + ,3.8 + ,-0.3 + ,-992 + ,-1.6 + ,-416 + ,751 + ,-1.9 + ,0.1 + ,-316 + ,1.5 + ,-992 + ,446 + ,-1.6 + ,0.9 + ,825 + ,-2.6 + ,-316 + ,-329 + ,1.5 + ,2.2 + ,1513 + ,0.6 + ,825 + ,-560 + ,-2.6 + ,-2.2 + ,138 + ,-0.4 + ,1513 + ,-783 + ,0.6 + ,0.4 + ,363 + ,0.6 + ,138 + ,-371 + ,-0.4 + ,-1.1 + ,180 + ,2 + ,363 + ,-308 + ,0.6 + ,-3 + ,-493 + ,1 + ,180 + ,-264 + ,2 + ,-2.1 + ,-325 + ,-2.1 + ,-493 + ,-787 + ,1 + ,-1.5 + ,-225 + ,0.8 + ,-325 + ,-486 + ,-2.1 + ,0.5 + ,-115 + ,2.4 + ,-225 + ,-243 + ,0.8 + ,3.8 + ,-145 + ,-0.3 + ,-115 + ,-416 + ,2.4 + ,-1.9 + ,-68 + ,0.6 + ,-145 + ,-992 + ,-0.3 + ,-1.6 + ,-335 + ,-3 + ,-68 + ,-316 + ,0.6 + ,1.5 + ,-832 + ,-0.1 + ,-335 + ,825 + ,-3 + ,-2.6 + ,-931 + ,-2.7 + ,-832 + ,1513 + ,-0.1 + ,0.6 + ,-149 + ,-1.4 + ,-931 + ,138 + ,-2.7 + ,-0.4 + ,-251 + ,0.8 + ,-149 + ,363 + ,-1.4 + ,0.6 + ,-43 + ,-1 + ,-251 + ,180 + ,0.8 + ,2 + ,1484 + ,4.6 + ,-43 + ,-493 + ,-1 + ,1 + ,195 + ,-0.5 + ,1484 + ,-325 + ,4.6 + ,-2.1 + ,170 + ,1.8 + ,195 + ,-225 + ,-0.5 + ,0.8 + ,-277 + ,0.1 + ,170 + ,-115 + ,1.8 + ,2.4 + ,-57 + ,3 + ,-277 + ,-145 + ,0.1 + ,-0.3 + ,-665 + ,2.4 + ,-57 + ,-68 + ,3 + ,0.6 + ,-220 + ,5.5 + ,-665 + ,-335 + ,2.4 + ,-3 + ,534 + ,4.5 + ,-220 + ,-832 + ,5.5 + ,-0.1 + ,-449 + ,3.5 + ,534 + ,-931 + ,4.5 + ,-2.7 + ,158 + ,5 + ,-449 + ,-149 + ,3.5 + ,-1.4 + ,-261 + ,0.4 + ,158 + ,-251 + ,5 + ,0.8 + ,-300 + ,0.2 + ,-261 + ,-43 + ,0.4 + ,-1 + ,-1276 + ,-5.8 + ,-300 + ,1484 + ,0.2 + ,4.6 + ,-108 + ,0.9 + ,-1276 + ,195 + ,-5.8 + ,-0.5 + ,-29 + ,-4.3 + ,-108 + ,170 + ,0.9 + ,1.8 + ,305 + ,-3.8 + ,-29 + ,-277 + ,-4.3 + ,0.1 + ,805 + ,-2.3 + ,305 + ,-57 + ,-3.8 + ,3 + ,-88 + ,-1.8 + ,805 + ,-665 + ,-2.3 + ,2.4) + ,dim=c(6 + ,72) + ,dimnames=list(c('N12S' + ,'N12T' + ,'N12S1' + ,'N12S12' + ,'N12T1' + ,'N12T12') + ,1:72)) > y <- array(NA,dim=c(6,72),dimnames=list(c('N12S','N12T','N12S1','N12S12','N12T1','N12T12'),1:72)) > 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' > #'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 > 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 N12S N12T N12S1 N12S12 N12T1 N12T12 1 998 1.2 613 -1906 -2.3 -0.6 2 499 2.3 998 -706 1.2 -1.1 3 59 1.3 499 326 2.3 -0.6 4 175 1.4 59 146 1.3 -2.0 5 -413 -1.5 175 625 1.4 0.0 6 -223 1.4 -413 104 -1.5 -1.1 7 110 -0.9 -223 65 1.4 3.4 8 13 -0.6 110 25 -0.9 0.8 9 74 1.8 13 3 -0.6 -3.2 10 643 -3.9 74 -393 1.8 3.1 11 44 2.4 643 -358 -3.9 -1.7 12 216 1.1 44 613 2.4 -2.3 13 -1189 -2.3 216 998 1.1 1.2 14 -47 -4.3 -1189 499 -2.3 2.3 15 279 1.0 -47 59 -4.3 1.3 16 374 0.8 279 175 1.0 1.4 17 13 0.3 374 -413 0.8 -1.5 18 152 2.2 13 -223 0.3 1.4 19 -27 1.7 152 110 2.2 -0.9 20 334 1.8 -27 13 1.7 -0.6 21 411 0.6 334 74 1.8 1.8 22 33 -2.6 411 643 0.6 -3.9 23 313 -0.3 33 44 -2.6 2.4 24 751 0.1 313 216 -0.3 1.1 25 446 0.9 751 -1189 0.1 -2.3 26 -329 2.2 446 -47 0.9 -4.3 27 -560 -2.2 -329 279 2.2 1.0 28 -783 0.4 -560 374 -2.2 0.8 29 -371 -1.1 -783 13 0.4 0.3 30 -308 -3.0 -371 152 -1.1 2.2 31 -264 -2.1 -308 -27 -3.0 1.7 32 -787 -1.5 -264 334 -2.1 1.8 33 -486 0.5 -787 411 -1.5 0.6 34 -243 3.8 -486 33 0.5 -2.6 35 -416 -1.9 -243 313 3.8 -0.3 36 -992 -1.6 -416 751 -1.9 0.1 37 -316 1.5 -992 446 -1.6 0.9 38 825 -2.6 -316 -329 1.5 2.2 39 1513 0.6 825 -560 -2.6 -2.2 40 138 -0.4 1513 -783 0.6 0.4 41 363 0.6 138 -371 -0.4 -1.1 42 180 2.0 363 -308 0.6 -3.0 43 -493 1.0 180 -264 2.0 -2.1 44 -325 -2.1 -493 -787 1.0 -1.5 45 -225 0.8 -325 -486 -2.1 0.5 46 -115 2.4 -225 -243 0.8 3.8 47 -145 -0.3 -115 -416 2.4 -1.9 48 -68 0.6 -145 -992 -0.3 -1.6 49 -335 -3.0 -68 -316 0.6 1.5 50 -832 -0.1 -335 825 -3.0 -2.6 51 -931 -2.7 -832 1513 -0.1 0.6 52 -149 -1.4 -931 138 -2.7 -0.4 53 -251 0.8 -149 363 -1.4 0.6 54 -43 -1.0 -251 180 0.8 2.0 55 1484 4.6 -43 -493 -1.0 1.0 56 195 -0.5 1484 -325 4.6 -2.1 57 170 1.8 195 -225 -0.5 0.8 58 -277 0.1 170 -115 1.8 2.4 59 -57 3.0 -277 -145 0.1 -0.3 60 -665 2.4 -57 -68 3.0 0.6 61 -220 5.5 -665 -335 2.4 -3.0 62 534 4.5 -220 -832 5.5 -0.1 63 -449 3.5 534 -931 4.5 -2.7 64 158 5.0 -449 -149 3.5 -1.4 65 -261 0.4 158 -251 5.0 0.8 66 -300 0.2 -261 -43 0.4 -1.0 67 -1276 -5.8 -300 1484 0.2 4.6 68 -108 0.9 -1276 195 -5.8 -0.5 69 -29 -4.3 -108 170 0.9 1.8 70 305 -3.8 -29 -277 -4.3 0.1 71 805 -2.3 305 -57 -3.8 3.0 72 -88 -1.8 805 -665 -2.3 2.4 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) N12T N12S1 N12S12 N12T1 N12T12 -52.4101 42.7706 0.2566 -0.4187 -41.6357 45.5257 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -762.9 -272.6 -31.2 198.6 1085.5 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -52.4101 49.7702 -1.053 0.296162 N12T 42.7706 26.4564 1.617 0.110725 N12S1 0.2566 0.1092 2.350 0.021761 * N12S12 -0.4187 0.1084 -3.864 0.000257 *** N12T1 -41.6357 22.5496 -1.846 0.069318 . N12T12 45.5257 29.6872 1.534 0.129929 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 417.3 on 66 degrees of freedom Multiple R-squared: 0.4084, Adjusted R-squared: 0.3635 F-statistic: 9.111 on 5 and 66 DF, p-value: 1.260e-06 > 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.03680609 0.07361218 0.9631939 [2,] 0.01662367 0.03324733 0.9833763 [3,] 0.01203873 0.02407746 0.9879613 [4,] 0.01709981 0.03419962 0.9829002 [5,] 0.09251275 0.18502550 0.9074873 [6,] 0.08289730 0.16579460 0.9171027 [7,] 0.14307612 0.28615224 0.8569239 [8,] 0.11751966 0.23503932 0.8824803 [9,] 0.09355604 0.18711207 0.9064440 [10,] 0.09092417 0.18184834 0.9090758 [11,] 0.06423244 0.12846488 0.9357676 [12,] 0.04391291 0.08782582 0.9560871 [13,] 0.03554838 0.07109676 0.9644516 [14,] 0.06293645 0.12587289 0.9370636 [15,] 0.05247517 0.10495033 0.9475248 [16,] 0.16214559 0.32429118 0.8378544 [17,] 0.12899470 0.25798940 0.8710053 [18,] 0.11799210 0.23598421 0.8820079 [19,] 0.14306897 0.28613793 0.8569310 [20,] 0.21815737 0.43631474 0.7818426 [21,] 0.18061513 0.36123026 0.8193849 [22,] 0.14559917 0.29119834 0.8544008 [23,] 0.11875611 0.23751222 0.8812439 [24,] 0.16716341 0.33432682 0.8328366 [25,] 0.12893424 0.25786848 0.8710658 [26,] 0.09486349 0.18972697 0.9051365 [27,] 0.07834045 0.15668090 0.9216596 [28,] 0.08430265 0.16860529 0.9156974 [29,] 0.06042631 0.12085262 0.9395737 [30,] 0.17379842 0.34759684 0.8262016 [31,] 0.58609809 0.82780381 0.4139019 [32,] 0.63341848 0.73316305 0.3665815 [33,] 0.59011558 0.81976883 0.4098844 [34,] 0.52982098 0.94035804 0.4701790 [35,] 0.54509510 0.90980981 0.4549049 [36,] 0.50487738 0.99024525 0.4951226 [37,] 0.51306844 0.97386311 0.4869316 [38,] 0.51990497 0.96019006 0.4800950 [39,] 0.45889937 0.91779874 0.5411006 [40,] 0.42397529 0.84795058 0.5760247 [41,] 0.38459180 0.76918359 0.6154082 [42,] 0.33366982 0.66733964 0.6663302 [43,] 0.27668759 0.55337517 0.7233124 [44,] 0.22114057 0.44228113 0.7788594 [45,] 0.16652625 0.33305250 0.8334738 [46,] 0.12361996 0.24723992 0.8763800 [47,] 0.42848149 0.85696297 0.5715185 [48,] 0.59634382 0.80731236 0.4036562 [49,] 0.53434417 0.93131166 0.4656558 [50,] 0.47582006 0.95164013 0.5241799 [51,] 0.36954957 0.73909913 0.6304504 [52,] 0.38198059 0.76396117 0.6180194 [53,] 0.26781641 0.53563282 0.7321836 [54,] 0.16927408 0.33854815 0.8307259 [55,] 0.14830219 0.29660438 0.8516978 > postscript(file="/var/www/rcomp/tmp/1u5fk1292407417.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/rcomp/tmp/2u5fk1292407417.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/rcomp/tmp/35ew51292407417.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/rcomp/tmp/45ew51292407417.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/rcomp/tmp/55ew51292407417.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 = 72 Frequency = 1 1 2 3 4 5 6 -24.7557700 1.3791951 187.3563355 358.7056941 -21.3380879 -93.3253690 7 8 9 10 11 12 188.8426051 -0.5765464 168.0445325 612.4800036 -406.1169282 671.3913981 13 14 15 16 17 18 -684.5755703 502.8820603 87.1872510 371.7839713 -114.7244530 -37.6438408 19 20 21 22 23 24 92.3313582 419.8905645 376.0319782 562.9341237 170.6834723 746.6987999 25 26 27 28 29 30 -121.7818929 -271.5705610 -166.1780145 -575.4223182 -62.1947418 -114.3928906 31 32 33 34 35 36 -256.3497473 -632.2194229 -170.7108667 -75.4139695 82.9619305 -533.6082433 37 38 39 40 41 42 5.9532256 894.2285102 1085.4764133 -501.7949811 232.4125041 86.3165362 43 44 45 46 47 48 -461.2163648 -275.8936139 -437.1182538 -348.9489136 -38.0199042 -359.0807039 49 50 51 52 53 54 -312.4573673 -350.4411248 52.4361231 165.7502838 -128.1800641 134.2130982 55 56 57 58 59 60 1057.1013316 39.0604668 -56.0650003 -354.9586408 -104.7222746 -631.4960801 61 62 63 64 65 66 -135.9708071 335.5540180 -762.8652621 258.8343348 -199.5830585 -145.0004283 67 68 69 70 71 72 -478.2347881 96.2500318 261.7455061 227.8038303 558.8626011 -648.6372233 > postscript(file="/var/www/rcomp/tmp/6ynv81292407417.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 -24.7557700 NA 1 1.3791951 -24.7557700 2 187.3563355 1.3791951 3 358.7056941 187.3563355 4 -21.3380879 358.7056941 5 -93.3253690 -21.3380879 6 188.8426051 -93.3253690 7 -0.5765464 188.8426051 8 168.0445325 -0.5765464 9 612.4800036 168.0445325 10 -406.1169282 612.4800036 11 671.3913981 -406.1169282 12 -684.5755703 671.3913981 13 502.8820603 -684.5755703 14 87.1872510 502.8820603 15 371.7839713 87.1872510 16 -114.7244530 371.7839713 17 -37.6438408 -114.7244530 18 92.3313582 -37.6438408 19 419.8905645 92.3313582 20 376.0319782 419.8905645 21 562.9341237 376.0319782 22 170.6834723 562.9341237 23 746.6987999 170.6834723 24 -121.7818929 746.6987999 25 -271.5705610 -121.7818929 26 -166.1780145 -271.5705610 27 -575.4223182 -166.1780145 28 -62.1947418 -575.4223182 29 -114.3928906 -62.1947418 30 -256.3497473 -114.3928906 31 -632.2194229 -256.3497473 32 -170.7108667 -632.2194229 33 -75.4139695 -170.7108667 34 82.9619305 -75.4139695 35 -533.6082433 82.9619305 36 5.9532256 -533.6082433 37 894.2285102 5.9532256 38 1085.4764133 894.2285102 39 -501.7949811 1085.4764133 40 232.4125041 -501.7949811 41 86.3165362 232.4125041 42 -461.2163648 86.3165362 43 -275.8936139 -461.2163648 44 -437.1182538 -275.8936139 45 -348.9489136 -437.1182538 46 -38.0199042 -348.9489136 47 -359.0807039 -38.0199042 48 -312.4573673 -359.0807039 49 -350.4411248 -312.4573673 50 52.4361231 -350.4411248 51 165.7502838 52.4361231 52 -128.1800641 165.7502838 53 134.2130982 -128.1800641 54 1057.1013316 134.2130982 55 39.0604668 1057.1013316 56 -56.0650003 39.0604668 57 -354.9586408 -56.0650003 58 -104.7222746 -354.9586408 59 -631.4960801 -104.7222746 60 -135.9708071 -631.4960801 61 335.5540180 -135.9708071 62 -762.8652621 335.5540180 63 258.8343348 -762.8652621 64 -199.5830585 258.8343348 65 -145.0004283 -199.5830585 66 -478.2347881 -145.0004283 67 96.2500318 -478.2347881 68 261.7455061 96.2500318 69 227.8038303 261.7455061 70 558.8626011 227.8038303 71 -648.6372233 558.8626011 72 NA -648.6372233 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.3791951 -24.7557700 [2,] 187.3563355 1.3791951 [3,] 358.7056941 187.3563355 [4,] -21.3380879 358.7056941 [5,] -93.3253690 -21.3380879 [6,] 188.8426051 -93.3253690 [7,] -0.5765464 188.8426051 [8,] 168.0445325 -0.5765464 [9,] 612.4800036 168.0445325 [10,] -406.1169282 612.4800036 [11,] 671.3913981 -406.1169282 [12,] -684.5755703 671.3913981 [13,] 502.8820603 -684.5755703 [14,] 87.1872510 502.8820603 [15,] 371.7839713 87.1872510 [16,] -114.7244530 371.7839713 [17,] -37.6438408 -114.7244530 [18,] 92.3313582 -37.6438408 [19,] 419.8905645 92.3313582 [20,] 376.0319782 419.8905645 [21,] 562.9341237 376.0319782 [22,] 170.6834723 562.9341237 [23,] 746.6987999 170.6834723 [24,] -121.7818929 746.6987999 [25,] -271.5705610 -121.7818929 [26,] -166.1780145 -271.5705610 [27,] -575.4223182 -166.1780145 [28,] -62.1947418 -575.4223182 [29,] -114.3928906 -62.1947418 [30,] -256.3497473 -114.3928906 [31,] -632.2194229 -256.3497473 [32,] -170.7108667 -632.2194229 [33,] -75.4139695 -170.7108667 [34,] 82.9619305 -75.4139695 [35,] -533.6082433 82.9619305 [36,] 5.9532256 -533.6082433 [37,] 894.2285102 5.9532256 [38,] 1085.4764133 894.2285102 [39,] -501.7949811 1085.4764133 [40,] 232.4125041 -501.7949811 [41,] 86.3165362 232.4125041 [42,] -461.2163648 86.3165362 [43,] -275.8936139 -461.2163648 [44,] -437.1182538 -275.8936139 [45,] -348.9489136 -437.1182538 [46,] -38.0199042 -348.9489136 [47,] -359.0807039 -38.0199042 [48,] -312.4573673 -359.0807039 [49,] -350.4411248 -312.4573673 [50,] 52.4361231 -350.4411248 [51,] 165.7502838 52.4361231 [52,] -128.1800641 165.7502838 [53,] 134.2130982 -128.1800641 [54,] 1057.1013316 134.2130982 [55,] 39.0604668 1057.1013316 [56,] -56.0650003 39.0604668 [57,] -354.9586408 -56.0650003 [58,] -104.7222746 -354.9586408 [59,] -631.4960801 -104.7222746 [60,] -135.9708071 -631.4960801 [61,] 335.5540180 -135.9708071 [62,] -762.8652621 335.5540180 [63,] 258.8343348 -762.8652621 [64,] -199.5830585 258.8343348 [65,] -145.0004283 -199.5830585 [66,] -478.2347881 -145.0004283 [67,] 96.2500318 -478.2347881 [68,] 261.7455061 96.2500318 [69,] 227.8038303 261.7455061 [70,] 558.8626011 227.8038303 [71,] -648.6372233 558.8626011 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.3791951 -24.7557700 2 187.3563355 1.3791951 3 358.7056941 187.3563355 4 -21.3380879 358.7056941 5 -93.3253690 -21.3380879 6 188.8426051 -93.3253690 7 -0.5765464 188.8426051 8 168.0445325 -0.5765464 9 612.4800036 168.0445325 10 -406.1169282 612.4800036 11 671.3913981 -406.1169282 12 -684.5755703 671.3913981 13 502.8820603 -684.5755703 14 87.1872510 502.8820603 15 371.7839713 87.1872510 16 -114.7244530 371.7839713 17 -37.6438408 -114.7244530 18 92.3313582 -37.6438408 19 419.8905645 92.3313582 20 376.0319782 419.8905645 21 562.9341237 376.0319782 22 170.6834723 562.9341237 23 746.6987999 170.6834723 24 -121.7818929 746.6987999 25 -271.5705610 -121.7818929 26 -166.1780145 -271.5705610 27 -575.4223182 -166.1780145 28 -62.1947418 -575.4223182 29 -114.3928906 -62.1947418 30 -256.3497473 -114.3928906 31 -632.2194229 -256.3497473 32 -170.7108667 -632.2194229 33 -75.4139695 -170.7108667 34 82.9619305 -75.4139695 35 -533.6082433 82.9619305 36 5.9532256 -533.6082433 37 894.2285102 5.9532256 38 1085.4764133 894.2285102 39 -501.7949811 1085.4764133 40 232.4125041 -501.7949811 41 86.3165362 232.4125041 42 -461.2163648 86.3165362 43 -275.8936139 -461.2163648 44 -437.1182538 -275.8936139 45 -348.9489136 -437.1182538 46 -38.0199042 -348.9489136 47 -359.0807039 -38.0199042 48 -312.4573673 -359.0807039 49 -350.4411248 -312.4573673 50 52.4361231 -350.4411248 51 165.7502838 52.4361231 52 -128.1800641 165.7502838 53 134.2130982 -128.1800641 54 1057.1013316 134.2130982 55 39.0604668 1057.1013316 56 -56.0650003 39.0604668 57 -354.9586408 -56.0650003 58 -104.7222746 -354.9586408 59 -631.4960801 -104.7222746 60 -135.9708071 -631.4960801 61 335.5540180 -135.9708071 62 -762.8652621 335.5540180 63 258.8343348 -762.8652621 64 -199.5830585 258.8343348 65 -145.0004283 -199.5830585 66 -478.2347881 -145.0004283 67 96.2500318 -478.2347881 68 261.7455061 96.2500318 69 227.8038303 261.7455061 70 558.8626011 227.8038303 71 -648.6372233 558.8626011 > 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/rcomp/tmp/7qxdt1292407417.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/rcomp/tmp/8qxdt1292407417.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/rcomp/tmp/9qxdt1292407417.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/rcomp/tmp/10j6uw1292407417.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/1157tk1292407417.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/rcomp/tmp/12q7981292407417.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/rcomp/tmp/134z7h1292407417.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/rcomp/tmp/14ph551292407417.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/rcomp/tmp/15t04a1292407417.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/rcomp/tmp/16jl9n1292407417.tab") + } > > try(system("convert tmp/1u5fk1292407417.ps tmp/1u5fk1292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/2u5fk1292407417.ps tmp/2u5fk1292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/35ew51292407417.ps tmp/35ew51292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/45ew51292407417.ps tmp/45ew51292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/55ew51292407417.ps tmp/55ew51292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/6ynv81292407417.ps tmp/6ynv81292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/7qxdt1292407417.ps tmp/7qxdt1292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/8qxdt1292407417.ps tmp/8qxdt1292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/9qxdt1292407417.ps tmp/9qxdt1292407417.png",intern=TRUE)) character(0) > try(system("convert tmp/10j6uw1292407417.ps tmp/10j6uw1292407417.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.200 1.730 4.905