R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(68897,38683,44720,39525,45315,50380,40600,36279,42438,38064,31879,11379,70249,39253,47060,41697,38708,49267,39018,32228,40870,39383,34571,12066,70938,34077,45409,40809,37013,44953,37848,32745,39401,34931,33008,8620,68906,39556,50669,36432,40891,48428,36222,33425,39401,37967,34801,12657,69116,41519,51321,38529,41547,52073,38401,40898,40439,41888,37898,8771,68184,50530,47221,41756,45633,48138,39486,39341,41117,41629,29722,7054,56676,34870,35117,30169,30936,35699,33228,27733,33666,35429,27438,8170),dim=c(1,84),dimnames=list(c(''),1:84)) > y <- array(NA,dim=c(1,84),dimnames=list(c(''),1:84)) > 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 = '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 > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 68897 1 0 0 0 0 0 0 0 0 0 0 2 38683 0 1 0 0 0 0 0 0 0 0 0 3 44720 0 0 1 0 0 0 0 0 0 0 0 4 39525 0 0 0 1 0 0 0 0 0 0 0 5 45315 0 0 0 0 1 0 0 0 0 0 0 6 50380 0 0 0 0 0 1 0 0 0 0 0 7 40600 0 0 0 0 0 0 1 0 0 0 0 8 36279 0 0 0 0 0 0 0 1 0 0 0 9 42438 0 0 0 0 0 0 0 0 1 0 0 10 38064 0 0 0 0 0 0 0 0 0 1 0 11 31879 0 0 0 0 0 0 0 0 0 0 1 12 11379 0 0 0 0 0 0 0 0 0 0 0 13 70249 1 0 0 0 0 0 0 0 0 0 0 14 39253 0 1 0 0 0 0 0 0 0 0 0 15 47060 0 0 1 0 0 0 0 0 0 0 0 16 41697 0 0 0 1 0 0 0 0 0 0 0 17 38708 0 0 0 0 1 0 0 0 0 0 0 18 49267 0 0 0 0 0 1 0 0 0 0 0 19 39018 0 0 0 0 0 0 1 0 0 0 0 20 32228 0 0 0 0 0 0 0 1 0 0 0 21 40870 0 0 0 0 0 0 0 0 1 0 0 22 39383 0 0 0 0 0 0 0 0 0 1 0 23 34571 0 0 0 0 0 0 0 0 0 0 1 24 12066 0 0 0 0 0 0 0 0 0 0 0 25 70938 1 0 0 0 0 0 0 0 0 0 0 26 34077 0 1 0 0 0 0 0 0 0 0 0 27 45409 0 0 1 0 0 0 0 0 0 0 0 28 40809 0 0 0 1 0 0 0 0 0 0 0 29 37013 0 0 0 0 1 0 0 0 0 0 0 30 44953 0 0 0 0 0 1 0 0 0 0 0 31 37848 0 0 0 0 0 0 1 0 0 0 0 32 32745 0 0 0 0 0 0 0 1 0 0 0 33 39401 0 0 0 0 0 0 0 0 1 0 0 34 34931 0 0 0 0 0 0 0 0 0 1 0 35 33008 0 0 0 0 0 0 0 0 0 0 1 36 8620 0 0 0 0 0 0 0 0 0 0 0 37 68906 1 0 0 0 0 0 0 0 0 0 0 38 39556 0 1 0 0 0 0 0 0 0 0 0 39 50669 0 0 1 0 0 0 0 0 0 0 0 40 36432 0 0 0 1 0 0 0 0 0 0 0 41 40891 0 0 0 0 1 0 0 0 0 0 0 42 48428 0 0 0 0 0 1 0 0 0 0 0 43 36222 0 0 0 0 0 0 1 0 0 0 0 44 33425 0 0 0 0 0 0 0 1 0 0 0 45 39401 0 0 0 0 0 0 0 0 1 0 0 46 37967 0 0 0 0 0 0 0 0 0 1 0 47 34801 0 0 0 0 0 0 0 0 0 0 1 48 12657 0 0 0 0 0 0 0 0 0 0 0 49 69116 1 0 0 0 0 0 0 0 0 0 0 50 41519 0 1 0 0 0 0 0 0 0 0 0 51 51321 0 0 1 0 0 0 0 0 0 0 0 52 38529 0 0 0 1 0 0 0 0 0 0 0 53 41547 0 0 0 0 1 0 0 0 0 0 0 54 52073 0 0 0 0 0 1 0 0 0 0 0 55 38401 0 0 0 0 0 0 1 0 0 0 0 56 40898 0 0 0 0 0 0 0 1 0 0 0 57 40439 0 0 0 0 0 0 0 0 1 0 0 58 41888 0 0 0 0 0 0 0 0 0 1 0 59 37898 0 0 0 0 0 0 0 0 0 0 1 60 8771 0 0 0 0 0 0 0 0 0 0 0 61 68184 1 0 0 0 0 0 0 0 0 0 0 62 50530 0 1 0 0 0 0 0 0 0 0 0 63 47221 0 0 1 0 0 0 0 0 0 0 0 64 41756 0 0 0 1 0 0 0 0 0 0 0 65 45633 0 0 0 0 1 0 0 0 0 0 0 66 48138 0 0 0 0 0 1 0 0 0 0 0 67 39486 0 0 0 0 0 0 1 0 0 0 0 68 39341 0 0 0 0 0 0 0 1 0 0 0 69 41117 0 0 0 0 0 0 0 0 1 0 0 70 41629 0 0 0 0 0 0 0 0 0 1 0 71 29722 0 0 0 0 0 0 0 0 0 0 1 72 7054 0 0 0 0 0 0 0 0 0 0 0 73 56676 1 0 0 0 0 0 0 0 0 0 0 74 34870 0 1 0 0 0 0 0 0 0 0 0 75 35117 0 0 1 0 0 0 0 0 0 0 0 76 30169 0 0 0 1 0 0 0 0 0 0 0 77 30936 0 0 0 0 1 0 0 0 0 0 0 78 35699 0 0 0 0 0 1 0 0 0 0 0 79 33228 0 0 0 0 0 0 1 0 0 0 0 80 27733 0 0 0 0 0 0 0 1 0 0 0 81 33666 0 0 0 0 0 0 0 0 1 0 0 82 35429 0 0 0 0 0 0 0 0 0 1 0 83 27438 0 0 0 0 0 0 0 0 0 0 1 84 8170 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 9817 57750 29967 36114 28600 30189 M6 M7 M8 M9 M10 M11 37174 28012 24847 29802 28653 22943 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11292.1 -1616.9 852.5 2255.9 10746.0 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9817 1593 6.161 3.73e-08 *** M1 57750 2253 25.630 < 2e-16 *** M2 29967 2253 13.300 < 2e-16 *** M3 36114 2253 16.028 < 2e-16 *** M4 28600 2253 12.693 < 2e-16 *** M5 30189 2253 13.398 < 2e-16 *** M6 37174 2253 16.498 < 2e-16 *** M7 28012 2253 12.432 < 2e-16 *** M8 24847 2253 11.027 < 2e-16 *** M9 29802 2253 13.226 < 2e-16 *** M10 28653 2253 12.716 < 2e-16 *** M11 22943 2253 10.182 1.37e-15 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4215 on 72 degrees of freedom Multiple R-squared: 0.9096, Adjusted R-squared: 0.8958 F-statistic: 65.9 on 11 and 72 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 1.987956e-02 3.975913e-02 0.9801204 [2,] 1.009469e-02 2.018937e-02 0.9899053 [3,] 6.820425e-02 1.364085e-01 0.9317957 [4,] 3.163971e-02 6.327942e-02 0.9683603 [5,] 1.466423e-02 2.932847e-02 0.9853358 [6,] 1.297207e-02 2.594415e-02 0.9870279 [7,] 6.056280e-03 1.211256e-02 0.9939437 [8,] 2.623486e-03 5.246971e-03 0.9973765 [9,] 1.497540e-03 2.995080e-03 0.9985025 [10,] 5.973001e-04 1.194600e-03 0.9994027 [11,] 2.790688e-04 5.581377e-04 0.9997209 [12,] 7.227474e-04 1.445495e-03 0.9992773 [13,] 2.933802e-04 5.867605e-04 0.9997066 [14,] 1.224881e-04 2.449763e-04 0.9998775 [15,] 2.457192e-04 4.914384e-04 0.9997543 [16,] 3.621465e-04 7.242930e-04 0.9996379 [17,] 1.879658e-04 3.759317e-04 0.9998120 [18,] 9.149522e-05 1.829904e-04 0.9999085 [19,] 4.895410e-05 9.790819e-05 0.9999510 [20,] 4.722817e-05 9.445633e-05 0.9999528 [21,] 1.915512e-05 3.831025e-05 0.9999808 [22,] 1.262330e-05 2.524660e-05 0.9999874 [23,] 6.015785e-06 1.203157e-05 0.9999940 [24,] 3.291661e-06 6.583322e-06 0.9999967 [25,] 6.922183e-06 1.384437e-05 0.9999931 [26,] 7.080846e-06 1.416169e-05 0.9999929 [27,] 2.913738e-06 5.827476e-06 0.9999971 [28,] 1.224764e-06 2.449528e-06 0.9999988 [29,] 7.430293e-07 1.486059e-06 0.9999993 [30,] 2.938358e-07 5.876716e-07 0.9999997 [31,] 1.213084e-07 2.426168e-07 0.9999999 [32,] 4.422160e-08 8.844320e-08 1.0000000 [33,] 1.954131e-08 3.908261e-08 1.0000000 [34,] 1.039097e-08 2.078194e-08 1.0000000 [35,] 5.450719e-09 1.090144e-08 1.0000000 [36,] 4.243938e-09 8.487875e-09 1.0000000 [37,] 1.373605e-08 2.747209e-08 1.0000000 [38,] 5.248796e-09 1.049759e-08 1.0000000 [39,] 2.041300e-09 4.082599e-09 1.0000000 [40,] 5.678036e-09 1.135607e-08 1.0000000 [41,] 1.910169e-09 3.820338e-09 1.0000000 [42,] 2.050797e-08 4.101593e-08 1.0000000 [43,] 7.654789e-09 1.530958e-08 1.0000000 [44,] 6.907134e-09 1.381427e-08 1.0000000 [45,] 1.840787e-08 3.681573e-08 1.0000000 [46,] 7.628581e-09 1.525716e-08 1.0000000 [47,] 1.317445e-08 2.634891e-08 1.0000000 [48,] 1.112575e-05 2.225149e-05 0.9999889 [49,] 3.028422e-05 6.056844e-05 0.9999697 [50,] 9.642606e-05 1.928521e-04 0.9999036 [51,] 2.099297e-03 4.198594e-03 0.9979007 [52,] 1.662907e-02 3.325813e-02 0.9833709 [53,] 1.803802e-02 3.607605e-02 0.9819620 [54,] 1.923803e-01 3.847606e-01 0.8076197 [55,] 4.188972e-01 8.377944e-01 0.5811028 > postscript(file="/var/wessaorg/rcomp/tmp/1wdib1322488165.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/2zi1n1322488165.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/39tql1322488165.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/4441e1322488165.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/50whw1322488165.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 = 84 Frequency = 1 1 2 3 4 5 6 1330.4286 -1101.0000 -1211.0000 1108.2857 5308.8571 3388.8571 7 8 9 10 11 12 2771.0000 1614.8571 2819.1429 -406.1429 -880.5714 1562.2857 13 14 15 16 17 18 2682.4286 -531.0000 1129.0000 3280.2857 -1298.1429 2275.8571 19 20 21 22 23 24 1189.0000 -2436.1429 1251.1429 912.8571 1811.4286 2249.2857 25 26 27 28 29 30 3371.4286 -5707.0000 -522.0000 2392.2857 -2993.1429 -2038.1429 31 32 33 34 35 36 19.0000 -1919.1429 -217.8571 -3539.1429 248.4286 -1196.7143 37 38 39 40 41 42 1339.4286 -228.0000 4738.0000 -1984.7143 884.8571 1436.8571 43 44 45 46 47 48 -1607.0000 -1239.1429 -217.8571 -503.1429 2041.4286 2840.2857 49 50 51 52 53 54 1549.4286 1735.0000 5390.0000 112.2857 1540.8571 5081.8571 55 56 57 58 59 60 572.0000 6233.8571 820.1429 3417.8571 5138.4286 -1045.7143 61 62 63 64 65 66 617.4286 10746.0000 1290.0000 3339.2857 5626.8571 1146.8571 67 68 69 70 71 72 1657.0000 4676.8571 1498.1429 3158.8571 -3037.5714 -2762.7143 73 74 75 76 77 78 -10890.5714 -4914.0000 -10814.0000 -8247.7143 -9070.1429 -11292.1429 79 80 81 82 83 84 -4601.0000 -6931.1429 -5952.8571 -3041.1429 -5321.5714 -1646.7143 > postscript(file="/var/wessaorg/rcomp/tmp/6rg001322488165.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 1330.4286 NA 1 -1101.0000 1330.4286 2 -1211.0000 -1101.0000 3 1108.2857 -1211.0000 4 5308.8571 1108.2857 5 3388.8571 5308.8571 6 2771.0000 3388.8571 7 1614.8571 2771.0000 8 2819.1429 1614.8571 9 -406.1429 2819.1429 10 -880.5714 -406.1429 11 1562.2857 -880.5714 12 2682.4286 1562.2857 13 -531.0000 2682.4286 14 1129.0000 -531.0000 15 3280.2857 1129.0000 16 -1298.1429 3280.2857 17 2275.8571 -1298.1429 18 1189.0000 2275.8571 19 -2436.1429 1189.0000 20 1251.1429 -2436.1429 21 912.8571 1251.1429 22 1811.4286 912.8571 23 2249.2857 1811.4286 24 3371.4286 2249.2857 25 -5707.0000 3371.4286 26 -522.0000 -5707.0000 27 2392.2857 -522.0000 28 -2993.1429 2392.2857 29 -2038.1429 -2993.1429 30 19.0000 -2038.1429 31 -1919.1429 19.0000 32 -217.8571 -1919.1429 33 -3539.1429 -217.8571 34 248.4286 -3539.1429 35 -1196.7143 248.4286 36 1339.4286 -1196.7143 37 -228.0000 1339.4286 38 4738.0000 -228.0000 39 -1984.7143 4738.0000 40 884.8571 -1984.7143 41 1436.8571 884.8571 42 -1607.0000 1436.8571 43 -1239.1429 -1607.0000 44 -217.8571 -1239.1429 45 -503.1429 -217.8571 46 2041.4286 -503.1429 47 2840.2857 2041.4286 48 1549.4286 2840.2857 49 1735.0000 1549.4286 50 5390.0000 1735.0000 51 112.2857 5390.0000 52 1540.8571 112.2857 53 5081.8571 1540.8571 54 572.0000 5081.8571 55 6233.8571 572.0000 56 820.1429 6233.8571 57 3417.8571 820.1429 58 5138.4286 3417.8571 59 -1045.7143 5138.4286 60 617.4286 -1045.7143 61 10746.0000 617.4286 62 1290.0000 10746.0000 63 3339.2857 1290.0000 64 5626.8571 3339.2857 65 1146.8571 5626.8571 66 1657.0000 1146.8571 67 4676.8571 1657.0000 68 1498.1429 4676.8571 69 3158.8571 1498.1429 70 -3037.5714 3158.8571 71 -2762.7143 -3037.5714 72 -10890.5714 -2762.7143 73 -4914.0000 -10890.5714 74 -10814.0000 -4914.0000 75 -8247.7143 -10814.0000 76 -9070.1429 -8247.7143 77 -11292.1429 -9070.1429 78 -4601.0000 -11292.1429 79 -6931.1429 -4601.0000 80 -5952.8571 -6931.1429 81 -3041.1429 -5952.8571 82 -5321.5714 -3041.1429 83 -1646.7143 -5321.5714 84 NA -1646.7143 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1101.0000 1330.4286 [2,] -1211.0000 -1101.0000 [3,] 1108.2857 -1211.0000 [4,] 5308.8571 1108.2857 [5,] 3388.8571 5308.8571 [6,] 2771.0000 3388.8571 [7,] 1614.8571 2771.0000 [8,] 2819.1429 1614.8571 [9,] -406.1429 2819.1429 [10,] -880.5714 -406.1429 [11,] 1562.2857 -880.5714 [12,] 2682.4286 1562.2857 [13,] -531.0000 2682.4286 [14,] 1129.0000 -531.0000 [15,] 3280.2857 1129.0000 [16,] -1298.1429 3280.2857 [17,] 2275.8571 -1298.1429 [18,] 1189.0000 2275.8571 [19,] -2436.1429 1189.0000 [20,] 1251.1429 -2436.1429 [21,] 912.8571 1251.1429 [22,] 1811.4286 912.8571 [23,] 2249.2857 1811.4286 [24,] 3371.4286 2249.2857 [25,] -5707.0000 3371.4286 [26,] -522.0000 -5707.0000 [27,] 2392.2857 -522.0000 [28,] -2993.1429 2392.2857 [29,] -2038.1429 -2993.1429 [30,] 19.0000 -2038.1429 [31,] -1919.1429 19.0000 [32,] -217.8571 -1919.1429 [33,] -3539.1429 -217.8571 [34,] 248.4286 -3539.1429 [35,] -1196.7143 248.4286 [36,] 1339.4286 -1196.7143 [37,] -228.0000 1339.4286 [38,] 4738.0000 -228.0000 [39,] -1984.7143 4738.0000 [40,] 884.8571 -1984.7143 [41,] 1436.8571 884.8571 [42,] -1607.0000 1436.8571 [43,] -1239.1429 -1607.0000 [44,] -217.8571 -1239.1429 [45,] -503.1429 -217.8571 [46,] 2041.4286 -503.1429 [47,] 2840.2857 2041.4286 [48,] 1549.4286 2840.2857 [49,] 1735.0000 1549.4286 [50,] 5390.0000 1735.0000 [51,] 112.2857 5390.0000 [52,] 1540.8571 112.2857 [53,] 5081.8571 1540.8571 [54,] 572.0000 5081.8571 [55,] 6233.8571 572.0000 [56,] 820.1429 6233.8571 [57,] 3417.8571 820.1429 [58,] 5138.4286 3417.8571 [59,] -1045.7143 5138.4286 [60,] 617.4286 -1045.7143 [61,] 10746.0000 617.4286 [62,] 1290.0000 10746.0000 [63,] 3339.2857 1290.0000 [64,] 5626.8571 3339.2857 [65,] 1146.8571 5626.8571 [66,] 1657.0000 1146.8571 [67,] 4676.8571 1657.0000 [68,] 1498.1429 4676.8571 [69,] 3158.8571 1498.1429 [70,] -3037.5714 3158.8571 [71,] -2762.7143 -3037.5714 [72,] -10890.5714 -2762.7143 [73,] -4914.0000 -10890.5714 [74,] -10814.0000 -4914.0000 [75,] -8247.7143 -10814.0000 [76,] -9070.1429 -8247.7143 [77,] -11292.1429 -9070.1429 [78,] -4601.0000 -11292.1429 [79,] -6931.1429 -4601.0000 [80,] -5952.8571 -6931.1429 [81,] -3041.1429 -5952.8571 [82,] -5321.5714 -3041.1429 [83,] -1646.7143 -5321.5714 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1101.0000 1330.4286 2 -1211.0000 -1101.0000 3 1108.2857 -1211.0000 4 5308.8571 1108.2857 5 3388.8571 5308.8571 6 2771.0000 3388.8571 7 1614.8571 2771.0000 8 2819.1429 1614.8571 9 -406.1429 2819.1429 10 -880.5714 -406.1429 11 1562.2857 -880.5714 12 2682.4286 1562.2857 13 -531.0000 2682.4286 14 1129.0000 -531.0000 15 3280.2857 1129.0000 16 -1298.1429 3280.2857 17 2275.8571 -1298.1429 18 1189.0000 2275.8571 19 -2436.1429 1189.0000 20 1251.1429 -2436.1429 21 912.8571 1251.1429 22 1811.4286 912.8571 23 2249.2857 1811.4286 24 3371.4286 2249.2857 25 -5707.0000 3371.4286 26 -522.0000 -5707.0000 27 2392.2857 -522.0000 28 -2993.1429 2392.2857 29 -2038.1429 -2993.1429 30 19.0000 -2038.1429 31 -1919.1429 19.0000 32 -217.8571 -1919.1429 33 -3539.1429 -217.8571 34 248.4286 -3539.1429 35 -1196.7143 248.4286 36 1339.4286 -1196.7143 37 -228.0000 1339.4286 38 4738.0000 -228.0000 39 -1984.7143 4738.0000 40 884.8571 -1984.7143 41 1436.8571 884.8571 42 -1607.0000 1436.8571 43 -1239.1429 -1607.0000 44 -217.8571 -1239.1429 45 -503.1429 -217.8571 46 2041.4286 -503.1429 47 2840.2857 2041.4286 48 1549.4286 2840.2857 49 1735.0000 1549.4286 50 5390.0000 1735.0000 51 112.2857 5390.0000 52 1540.8571 112.2857 53 5081.8571 1540.8571 54 572.0000 5081.8571 55 6233.8571 572.0000 56 820.1429 6233.8571 57 3417.8571 820.1429 58 5138.4286 3417.8571 59 -1045.7143 5138.4286 60 617.4286 -1045.7143 61 10746.0000 617.4286 62 1290.0000 10746.0000 63 3339.2857 1290.0000 64 5626.8571 3339.2857 65 1146.8571 5626.8571 66 1657.0000 1146.8571 67 4676.8571 1657.0000 68 1498.1429 4676.8571 69 3158.8571 1498.1429 70 -3037.5714 3158.8571 71 -2762.7143 -3037.5714 72 -10890.5714 -2762.7143 73 -4914.0000 -10890.5714 74 -10814.0000 -4914.0000 75 -8247.7143 -10814.0000 76 -9070.1429 -8247.7143 77 -11292.1429 -9070.1429 78 -4601.0000 -11292.1429 79 -6931.1429 -4601.0000 80 -5952.8571 -6931.1429 81 -3041.1429 -5952.8571 82 -5321.5714 -3041.1429 83 -1646.7143 -5321.5714 > 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/7pu5l1322488165.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/8di3a1322488165.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/9wmmw1322488165.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') hat values (leverages) are all = 0.1428571 and there are no factor predictors; no plot no. 5 > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/wessaorg/rcomp/tmp/104nje1322488165.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/11g90k1322488165.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/12e1ze1322488165.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/13yhbq1322488165.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/14xbqm1322488165.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/156v8k1322488165.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/16ebub1322488166.tab") + } > > try(system("convert tmp/1wdib1322488165.ps tmp/1wdib1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/2zi1n1322488165.ps tmp/2zi1n1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/39tql1322488165.ps tmp/39tql1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/4441e1322488165.ps tmp/4441e1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/50whw1322488165.ps tmp/50whw1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/6rg001322488165.ps tmp/6rg001322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/7pu5l1322488165.ps tmp/7pu5l1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/8di3a1322488165.ps tmp/8di3a1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/9wmmw1322488165.ps tmp/9wmmw1322488165.png",intern=TRUE)) character(0) > try(system("convert tmp/104nje1322488165.ps tmp/104nje1322488165.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.471 0.515 4.014