R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(1671,0,1385,0,1632,0,1313,0,1300,0,1431,0,1398,0,1198,0,1292,0,1434,0,1660,0,1837,0,1455,0,1315,0,1642,0,1069,0,1209,0,1586,0,1122,0,1063,0,1125,0,1414,0,1347,0,1403,0,1299,0,1547,0,1515,0,1247,0,1639,0,1296,0,1063,0,1282,0,1365,0,1268,0,1532,0,1455,0,1393,0,1515,0,1510,0,1225,0,1577,0,1417,0,1224,0,1693,0,1633,0,1639,0,1914,0,1586,0,1552,0,2081,0,1500,0,1437,0,1470,0,1849,0,1387,0,1592,0,1589,0,1798,0,1935,0,1887,0,2027,0,2080,0,1556,0,1682,0,1785,0,1869,0,1781,0,2082,0,2570,1,1862,0,1936,0,1504,0,1765,0,1607,0,1577,0,1493,0,1615,0,1700,0,1335,0,1523,0,1621,0,1539,0,1637,0,1523,0,1418,0,1819,0,1594,0,1359,0,1261,0,1722,0,1407,0,1380,0,1642,0,1681,0,1542,0,1704,0,1431,0),dim=c(2,97),dimnames=list(c('Gebouwen','Dummy'),1:97)) > y <- array(NA,dim=c(2,97),dimnames=list(c('Gebouwen','Dummy'),1:97)) > 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 Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Gebouwen Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 1671 0 1 0 0 0 0 0 0 0 0 0 0 2 1385 0 0 1 0 0 0 0 0 0 0 0 0 3 1632 0 0 0 1 0 0 0 0 0 0 0 0 4 1313 0 0 0 0 1 0 0 0 0 0 0 0 5 1300 0 0 0 0 0 1 0 0 0 0 0 0 6 1431 0 0 0 0 0 0 1 0 0 0 0 0 7 1398 0 0 0 0 0 0 0 1 0 0 0 0 8 1198 0 0 0 0 0 0 0 0 1 0 0 0 9 1292 0 0 0 0 0 0 0 0 0 1 0 0 10 1434 0 0 0 0 0 0 0 0 0 0 1 0 11 1660 0 0 0 0 0 0 0 0 0 0 0 1 12 1837 0 0 0 0 0 0 0 0 0 0 0 0 13 1455 0 1 0 0 0 0 0 0 0 0 0 0 14 1315 0 0 1 0 0 0 0 0 0 0 0 0 15 1642 0 0 0 1 0 0 0 0 0 0 0 0 16 1069 0 0 0 0 1 0 0 0 0 0 0 0 17 1209 0 0 0 0 0 1 0 0 0 0 0 0 18 1586 0 0 0 0 0 0 1 0 0 0 0 0 19 1122 0 0 0 0 0 0 0 1 0 0 0 0 20 1063 0 0 0 0 0 0 0 0 1 0 0 0 21 1125 0 0 0 0 0 0 0 0 0 1 0 0 22 1414 0 0 0 0 0 0 0 0 0 0 1 0 23 1347 0 0 0 0 0 0 0 0 0 0 0 1 24 1403 0 0 0 0 0 0 0 0 0 0 0 0 25 1299 0 1 0 0 0 0 0 0 0 0 0 0 26 1547 0 0 1 0 0 0 0 0 0 0 0 0 27 1515 0 0 0 1 0 0 0 0 0 0 0 0 28 1247 0 0 0 0 1 0 0 0 0 0 0 0 29 1639 0 0 0 0 0 1 0 0 0 0 0 0 30 1296 0 0 0 0 0 0 1 0 0 0 0 0 31 1063 0 0 0 0 0 0 0 1 0 0 0 0 32 1282 0 0 0 0 0 0 0 0 1 0 0 0 33 1365 0 0 0 0 0 0 0 0 0 1 0 0 34 1268 0 0 0 0 0 0 0 0 0 0 1 0 35 1532 0 0 0 0 0 0 0 0 0 0 0 1 36 1455 0 0 0 0 0 0 0 0 0 0 0 0 37 1393 0 1 0 0 0 0 0 0 0 0 0 0 38 1515 0 0 1 0 0 0 0 0 0 0 0 0 39 1510 0 0 0 1 0 0 0 0 0 0 0 0 40 1225 0 0 0 0 1 0 0 0 0 0 0 0 41 1577 0 0 0 0 0 1 0 0 0 0 0 0 42 1417 0 0 0 0 0 0 1 0 0 0 0 0 43 1224 0 0 0 0 0 0 0 1 0 0 0 0 44 1693 0 0 0 0 0 0 0 0 1 0 0 0 45 1633 0 0 0 0 0 0 0 0 0 1 0 0 46 1639 0 0 0 0 0 0 0 0 0 0 1 0 47 1914 0 0 0 0 0 0 0 0 0 0 0 1 48 1586 0 0 0 0 0 0 0 0 0 0 0 0 49 1552 0 1 0 0 0 0 0 0 0 0 0 0 50 2081 0 0 1 0 0 0 0 0 0 0 0 0 51 1500 0 0 0 1 0 0 0 0 0 0 0 0 52 1437 0 0 0 0 1 0 0 0 0 0 0 0 53 1470 0 0 0 0 0 1 0 0 0 0 0 0 54 1849 0 0 0 0 0 0 1 0 0 0 0 0 55 1387 0 0 0 0 0 0 0 1 0 0 0 0 56 1592 0 0 0 0 0 0 0 0 1 0 0 0 57 1589 0 0 0 0 0 0 0 0 0 1 0 0 58 1798 0 0 0 0 0 0 0 0 0 0 1 0 59 1935 0 0 0 0 0 0 0 0 0 0 0 1 60 1887 0 0 0 0 0 0 0 0 0 0 0 0 61 2027 0 1 0 0 0 0 0 0 0 0 0 0 62 2080 0 0 1 0 0 0 0 0 0 0 0 0 63 1556 0 0 0 1 0 0 0 0 0 0 0 0 64 1682 0 0 0 0 1 0 0 0 0 0 0 0 65 1785 0 0 0 0 0 1 0 0 0 0 0 0 66 1869 0 0 0 0 0 0 1 0 0 0 0 0 67 1781 0 0 0 0 0 0 0 1 0 0 0 0 68 2082 0 0 0 0 0 0 0 0 1 0 0 0 69 2570 1 0 0 0 0 0 0 0 0 1 0 0 70 1862 0 0 0 0 0 0 0 0 0 0 1 0 71 1936 0 0 0 0 0 0 0 0 0 0 0 1 72 1504 0 0 0 0 0 0 0 0 0 0 0 0 73 1765 0 1 0 0 0 0 0 0 0 0 0 0 74 1607 0 0 1 0 0 0 0 0 0 0 0 0 75 1577 0 0 0 1 0 0 0 0 0 0 0 0 76 1493 0 0 0 0 1 0 0 0 0 0 0 0 77 1615 0 0 0 0 0 1 0 0 0 0 0 0 78 1700 0 0 0 0 0 0 1 0 0 0 0 0 79 1335 0 0 0 0 0 0 0 1 0 0 0 0 80 1523 0 0 0 0 0 0 0 0 1 0 0 0 81 1621 0 0 0 0 0 0 0 0 0 1 0 0 82 1539 0 0 0 0 0 0 0 0 0 0 1 0 83 1637 0 0 0 0 0 0 0 0 0 0 0 1 84 1523 0 0 0 0 0 0 0 0 0 0 0 0 85 1418 0 1 0 0 0 0 0 0 0 0 0 0 86 1819 0 0 1 0 0 0 0 0 0 0 0 0 87 1594 0 0 0 1 0 0 0 0 0 0 0 0 88 1359 0 0 0 0 1 0 0 0 0 0 0 0 89 1261 0 0 0 0 0 1 0 0 0 0 0 0 90 1722 0 0 0 0 0 0 1 0 0 0 0 0 91 1407 0 0 0 0 0 0 0 1 0 0 0 0 92 1380 0 0 0 0 0 0 0 0 1 0 0 0 93 1642 0 0 0 0 0 0 0 0 0 1 0 0 94 1681 0 0 0 0 0 0 0 0 0 0 1 0 95 1542 0 0 0 0 0 0 0 0 0 0 0 1 96 1704 0 0 0 0 0 0 0 0 0 0 0 0 97 1431 0 1 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) Dummy M1 M2 M3 M4 1612.375 1103.286 -55.597 56.250 -46.625 -259.250 M5 M6 M7 M8 M9 M10 -130.375 -3.625 -272.750 -135.750 -145.661 -33.000 M11 75.500 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -413.6 -153.6 -12.0 133.0 605.4 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1612.375 77.896 20.699 < 2e-16 *** Dummy 1103.286 235.535 4.684 1.07e-05 *** M1 -55.597 107.058 -0.519 0.6049 M2 56.250 110.161 0.511 0.6110 M3 -46.625 110.161 -0.423 0.6732 M4 -259.250 110.161 -2.353 0.0209 * M5 -130.375 110.161 -1.183 0.2400 M6 -3.625 110.161 -0.033 0.9738 M7 -272.750 110.161 -2.476 0.0153 * M8 -135.750 110.161 -1.232 0.2213 M9 -145.661 114.028 -1.277 0.2050 M10 -33.000 110.161 -0.300 0.7653 M11 75.500 110.161 0.685 0.4950 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 220.3 on 84 degrees of freedom Multiple R-squared: 0.3466, Adjusted R-squared: 0.2533 F-statistic: 3.714 on 12 and 84 DF, p-value: 0.0001671 > 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.22694281 0.453885615 0.773057193 [2,] 0.12649437 0.252988732 0.873505634 [3,] 0.08261309 0.165226182 0.917386909 [4,] 0.10399048 0.207980951 0.896009524 [5,] 0.08041604 0.160832085 0.919583957 [6,] 0.06800898 0.136017960 0.931991020 [7,] 0.03817459 0.076349185 0.961825408 [8,] 0.06870649 0.137412975 0.931293512 [9,] 0.16144522 0.322890434 0.838554783 [10,] 0.18995337 0.379906739 0.810046630 [11,] 0.18178125 0.363562508 0.818218746 [12,] 0.14013434 0.280268677 0.859865661 [13,] 0.10280180 0.205603600 0.897198200 [14,] 0.17251913 0.345038256 0.827480872 [15,] 0.19306877 0.386137549 0.806931226 [16,] 0.20305686 0.406113725 0.796943138 [17,] 0.20430914 0.408618283 0.795690859 [18,] 0.18863106 0.377262128 0.811368936 [19,] 0.21405408 0.428108163 0.785945919 [20,] 0.18430574 0.368611474 0.815694263 [21,] 0.16823973 0.336479464 0.831760268 [22,] 0.14758970 0.295179399 0.852410300 [23,] 0.15701818 0.314036369 0.842981816 [24,] 0.12311598 0.246231965 0.876884018 [25,] 0.10781802 0.215636031 0.892181985 [26,] 0.09913110 0.198262204 0.900868898 [27,] 0.10424989 0.208499785 0.895750107 [28,] 0.09228390 0.184567792 0.907716104 [29,] 0.23590520 0.471810397 0.764094801 [30,] 0.29241471 0.584829411 0.707585294 [31,] 0.29370840 0.587416802 0.706291599 [32,] 0.36957826 0.739156524 0.630421738 [33,] 0.31067656 0.621353128 0.689323436 [34,] 0.26665815 0.533316302 0.733341849 [35,] 0.52948386 0.941032282 0.470516141 [36,] 0.46926311 0.938526213 0.530736894 [37,] 0.43744656 0.874893115 0.562553442 [38,] 0.37688288 0.753765751 0.623117125 [39,] 0.41686733 0.833734667 0.583132666 [40,] 0.37920813 0.758416263 0.620791869 [41,] 0.35911417 0.718228349 0.640885826 [42,] 0.32361249 0.647224972 0.676387514 [43,] 0.32683503 0.653670051 0.673164974 [44,] 0.34200529 0.684010581 0.657994709 [45,] 0.38402824 0.768056478 0.615971761 [46,] 0.62949864 0.741002723 0.370501362 [47,] 0.74363862 0.512722754 0.256361377 [48,] 0.68013765 0.639724692 0.319862346 [49,] 0.71312021 0.573759586 0.286879793 [50,] 0.76451100 0.470977991 0.235488995 [51,] 0.74831788 0.503364250 0.251682125 [52,] 0.85548451 0.289030989 0.144515495 [53,] 0.99023124 0.019537514 0.009768757 [54,] 0.98235842 0.035283167 0.017641583 [55,] 0.98504329 0.029913425 0.014956712 [56,] 0.99367008 0.012659831 0.006329915 [57,] 0.98929570 0.021408593 0.010704296 [58,] 0.99684736 0.006305279 0.003152639 [59,] 0.99642736 0.007145274 0.003572637 [60,] 0.99144132 0.017117354 0.008558677 [61,] 0.98521592 0.029568154 0.014784077 [62,] 0.99766812 0.004663755 0.002331878 [63,] 0.99269386 0.014612281 0.007306141 [64,] 0.98090793 0.038184136 0.019092068 [65,] 0.96742785 0.065144304 0.032572152 [66,] 0.90686165 0.186276706 0.093138353 > postscript(file="/var/www/html/rcomp/tmp/17ulb1227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/25nb11227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3jbip1227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4aiiw1227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5yy7a1227463757.ps",horizontal=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 = 97 Frequency = 1 1 2 3 4 5 1.142222e+02 -2.836250e+02 6.625000e+01 -4.012500e+01 -1.820000e+02 6 7 8 9 10 -1.777500e+02 5.837500e+01 -2.786250e+02 -1.747143e+02 -1.453750e+02 11 12 13 14 15 -2.787500e+01 2.246250e+02 -1.017778e+02 -3.536250e+02 7.625000e+01 16 17 18 19 20 -2.841250e+02 -2.730000e+02 -2.275000e+01 -2.176250e+02 -4.136250e+02 21 22 23 24 25 -3.417143e+02 -1.653750e+02 -3.408750e+02 -2.093750e+02 -2.577778e+02 26 27 28 29 30 -1.216250e+02 -5.075000e+01 -1.061250e+02 1.570000e+02 -3.127500e+02 31 32 33 34 35 -2.766250e+02 -1.946250e+02 -1.017143e+02 -3.113750e+02 -1.558750e+02 36 37 38 39 40 -1.573750e+02 -1.637778e+02 -1.536250e+02 -5.575000e+01 -1.281250e+02 41 42 43 44 45 9.500000e+01 -1.917500e+02 -1.156250e+02 2.163750e+02 1.662857e+02 46 47 48 49 50 5.962500e+01 2.261250e+02 -2.637500e+01 -4.777778e+00 4.123750e+02 51 52 53 54 55 -6.575000e+01 8.387500e+01 -1.200000e+01 2.402500e+02 4.737500e+01 56 57 58 59 60 1.153750e+02 1.222857e+02 2.186250e+02 2.471250e+02 2.746250e+02 61 62 63 64 65 4.702222e+02 4.113750e+02 -9.750000e+00 3.288750e+02 3.030000e+02 66 67 68 69 70 2.602500e+02 4.413750e+02 6.053750e+02 9.219292e-13 2.826250e+02 71 72 73 74 75 2.481250e+02 -1.083750e+02 2.082222e+02 -6.162500e+01 1.125000e+01 76 77 78 79 80 1.398750e+02 1.330000e+02 9.125000e+01 -4.625000e+00 4.637500e+01 81 82 83 84 85 1.542857e+02 -4.037500e+01 -5.087500e+01 -8.937500e+01 -1.387778e+02 86 87 88 89 90 1.503750e+02 2.825000e+01 5.875000e+00 -2.210000e+02 1.132500e+02 91 92 93 94 95 6.737500e+01 -9.662500e+01 1.752857e+02 1.016250e+02 -1.458750e+02 96 97 9.162500e+01 -1.257778e+02 > postscript(file="/var/www/html/rcomp/tmp/6m7vl1227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 97 Frequency = 1 lag(myerror, k = 1) myerror 0 1.142222e+02 NA 1 -2.836250e+02 1.142222e+02 2 6.625000e+01 -2.836250e+02 3 -4.012500e+01 6.625000e+01 4 -1.820000e+02 -4.012500e+01 5 -1.777500e+02 -1.820000e+02 6 5.837500e+01 -1.777500e+02 7 -2.786250e+02 5.837500e+01 8 -1.747143e+02 -2.786250e+02 9 -1.453750e+02 -1.747143e+02 10 -2.787500e+01 -1.453750e+02 11 2.246250e+02 -2.787500e+01 12 -1.017778e+02 2.246250e+02 13 -3.536250e+02 -1.017778e+02 14 7.625000e+01 -3.536250e+02 15 -2.841250e+02 7.625000e+01 16 -2.730000e+02 -2.841250e+02 17 -2.275000e+01 -2.730000e+02 18 -2.176250e+02 -2.275000e+01 19 -4.136250e+02 -2.176250e+02 20 -3.417143e+02 -4.136250e+02 21 -1.653750e+02 -3.417143e+02 22 -3.408750e+02 -1.653750e+02 23 -2.093750e+02 -3.408750e+02 24 -2.577778e+02 -2.093750e+02 25 -1.216250e+02 -2.577778e+02 26 -5.075000e+01 -1.216250e+02 27 -1.061250e+02 -5.075000e+01 28 1.570000e+02 -1.061250e+02 29 -3.127500e+02 1.570000e+02 30 -2.766250e+02 -3.127500e+02 31 -1.946250e+02 -2.766250e+02 32 -1.017143e+02 -1.946250e+02 33 -3.113750e+02 -1.017143e+02 34 -1.558750e+02 -3.113750e+02 35 -1.573750e+02 -1.558750e+02 36 -1.637778e+02 -1.573750e+02 37 -1.536250e+02 -1.637778e+02 38 -5.575000e+01 -1.536250e+02 39 -1.281250e+02 -5.575000e+01 40 9.500000e+01 -1.281250e+02 41 -1.917500e+02 9.500000e+01 42 -1.156250e+02 -1.917500e+02 43 2.163750e+02 -1.156250e+02 44 1.662857e+02 2.163750e+02 45 5.962500e+01 1.662857e+02 46 2.261250e+02 5.962500e+01 47 -2.637500e+01 2.261250e+02 48 -4.777778e+00 -2.637500e+01 49 4.123750e+02 -4.777778e+00 50 -6.575000e+01 4.123750e+02 51 8.387500e+01 -6.575000e+01 52 -1.200000e+01 8.387500e+01 53 2.402500e+02 -1.200000e+01 54 4.737500e+01 2.402500e+02 55 1.153750e+02 4.737500e+01 56 1.222857e+02 1.153750e+02 57 2.186250e+02 1.222857e+02 58 2.471250e+02 2.186250e+02 59 2.746250e+02 2.471250e+02 60 4.702222e+02 2.746250e+02 61 4.113750e+02 4.702222e+02 62 -9.750000e+00 4.113750e+02 63 3.288750e+02 -9.750000e+00 64 3.030000e+02 3.288750e+02 65 2.602500e+02 3.030000e+02 66 4.413750e+02 2.602500e+02 67 6.053750e+02 4.413750e+02 68 9.219292e-13 6.053750e+02 69 2.826250e+02 9.219292e-13 70 2.481250e+02 2.826250e+02 71 -1.083750e+02 2.481250e+02 72 2.082222e+02 -1.083750e+02 73 -6.162500e+01 2.082222e+02 74 1.125000e+01 -6.162500e+01 75 1.398750e+02 1.125000e+01 76 1.330000e+02 1.398750e+02 77 9.125000e+01 1.330000e+02 78 -4.625000e+00 9.125000e+01 79 4.637500e+01 -4.625000e+00 80 1.542857e+02 4.637500e+01 81 -4.037500e+01 1.542857e+02 82 -5.087500e+01 -4.037500e+01 83 -8.937500e+01 -5.087500e+01 84 -1.387778e+02 -8.937500e+01 85 1.503750e+02 -1.387778e+02 86 2.825000e+01 1.503750e+02 87 5.875000e+00 2.825000e+01 88 -2.210000e+02 5.875000e+00 89 1.132500e+02 -2.210000e+02 90 6.737500e+01 1.132500e+02 91 -9.662500e+01 6.737500e+01 92 1.752857e+02 -9.662500e+01 93 1.016250e+02 1.752857e+02 94 -1.458750e+02 1.016250e+02 95 9.162500e+01 -1.458750e+02 96 -1.257778e+02 9.162500e+01 97 NA -1.257778e+02 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.836250e+02 1.142222e+02 [2,] 6.625000e+01 -2.836250e+02 [3,] -4.012500e+01 6.625000e+01 [4,] -1.820000e+02 -4.012500e+01 [5,] -1.777500e+02 -1.820000e+02 [6,] 5.837500e+01 -1.777500e+02 [7,] -2.786250e+02 5.837500e+01 [8,] -1.747143e+02 -2.786250e+02 [9,] -1.453750e+02 -1.747143e+02 [10,] -2.787500e+01 -1.453750e+02 [11,] 2.246250e+02 -2.787500e+01 [12,] -1.017778e+02 2.246250e+02 [13,] -3.536250e+02 -1.017778e+02 [14,] 7.625000e+01 -3.536250e+02 [15,] -2.841250e+02 7.625000e+01 [16,] -2.730000e+02 -2.841250e+02 [17,] -2.275000e+01 -2.730000e+02 [18,] -2.176250e+02 -2.275000e+01 [19,] -4.136250e+02 -2.176250e+02 [20,] -3.417143e+02 -4.136250e+02 [21,] -1.653750e+02 -3.417143e+02 [22,] -3.408750e+02 -1.653750e+02 [23,] -2.093750e+02 -3.408750e+02 [24,] -2.577778e+02 -2.093750e+02 [25,] -1.216250e+02 -2.577778e+02 [26,] -5.075000e+01 -1.216250e+02 [27,] -1.061250e+02 -5.075000e+01 [28,] 1.570000e+02 -1.061250e+02 [29,] -3.127500e+02 1.570000e+02 [30,] -2.766250e+02 -3.127500e+02 [31,] -1.946250e+02 -2.766250e+02 [32,] -1.017143e+02 -1.946250e+02 [33,] -3.113750e+02 -1.017143e+02 [34,] -1.558750e+02 -3.113750e+02 [35,] -1.573750e+02 -1.558750e+02 [36,] -1.637778e+02 -1.573750e+02 [37,] -1.536250e+02 -1.637778e+02 [38,] -5.575000e+01 -1.536250e+02 [39,] -1.281250e+02 -5.575000e+01 [40,] 9.500000e+01 -1.281250e+02 [41,] -1.917500e+02 9.500000e+01 [42,] -1.156250e+02 -1.917500e+02 [43,] 2.163750e+02 -1.156250e+02 [44,] 1.662857e+02 2.163750e+02 [45,] 5.962500e+01 1.662857e+02 [46,] 2.261250e+02 5.962500e+01 [47,] -2.637500e+01 2.261250e+02 [48,] -4.777778e+00 -2.637500e+01 [49,] 4.123750e+02 -4.777778e+00 [50,] -6.575000e+01 4.123750e+02 [51,] 8.387500e+01 -6.575000e+01 [52,] -1.200000e+01 8.387500e+01 [53,] 2.402500e+02 -1.200000e+01 [54,] 4.737500e+01 2.402500e+02 [55,] 1.153750e+02 4.737500e+01 [56,] 1.222857e+02 1.153750e+02 [57,] 2.186250e+02 1.222857e+02 [58,] 2.471250e+02 2.186250e+02 [59,] 2.746250e+02 2.471250e+02 [60,] 4.702222e+02 2.746250e+02 [61,] 4.113750e+02 4.702222e+02 [62,] -9.750000e+00 4.113750e+02 [63,] 3.288750e+02 -9.750000e+00 [64,] 3.030000e+02 3.288750e+02 [65,] 2.602500e+02 3.030000e+02 [66,] 4.413750e+02 2.602500e+02 [67,] 6.053750e+02 4.413750e+02 [68,] 9.219292e-13 6.053750e+02 [69,] 2.826250e+02 9.219292e-13 [70,] 2.481250e+02 2.826250e+02 [71,] -1.083750e+02 2.481250e+02 [72,] 2.082222e+02 -1.083750e+02 [73,] -6.162500e+01 2.082222e+02 [74,] 1.125000e+01 -6.162500e+01 [75,] 1.398750e+02 1.125000e+01 [76,] 1.330000e+02 1.398750e+02 [77,] 9.125000e+01 1.330000e+02 [78,] -4.625000e+00 9.125000e+01 [79,] 4.637500e+01 -4.625000e+00 [80,] 1.542857e+02 4.637500e+01 [81,] -4.037500e+01 1.542857e+02 [82,] -5.087500e+01 -4.037500e+01 [83,] -8.937500e+01 -5.087500e+01 [84,] -1.387778e+02 -8.937500e+01 [85,] 1.503750e+02 -1.387778e+02 [86,] 2.825000e+01 1.503750e+02 [87,] 5.875000e+00 2.825000e+01 [88,] -2.210000e+02 5.875000e+00 [89,] 1.132500e+02 -2.210000e+02 [90,] 6.737500e+01 1.132500e+02 [91,] -9.662500e+01 6.737500e+01 [92,] 1.752857e+02 -9.662500e+01 [93,] 1.016250e+02 1.752857e+02 [94,] -1.458750e+02 1.016250e+02 [95,] 9.162500e+01 -1.458750e+02 [96,] -1.257778e+02 9.162500e+01 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.836250e+02 1.142222e+02 2 6.625000e+01 -2.836250e+02 3 -4.012500e+01 6.625000e+01 4 -1.820000e+02 -4.012500e+01 5 -1.777500e+02 -1.820000e+02 6 5.837500e+01 -1.777500e+02 7 -2.786250e+02 5.837500e+01 8 -1.747143e+02 -2.786250e+02 9 -1.453750e+02 -1.747143e+02 10 -2.787500e+01 -1.453750e+02 11 2.246250e+02 -2.787500e+01 12 -1.017778e+02 2.246250e+02 13 -3.536250e+02 -1.017778e+02 14 7.625000e+01 -3.536250e+02 15 -2.841250e+02 7.625000e+01 16 -2.730000e+02 -2.841250e+02 17 -2.275000e+01 -2.730000e+02 18 -2.176250e+02 -2.275000e+01 19 -4.136250e+02 -2.176250e+02 20 -3.417143e+02 -4.136250e+02 21 -1.653750e+02 -3.417143e+02 22 -3.408750e+02 -1.653750e+02 23 -2.093750e+02 -3.408750e+02 24 -2.577778e+02 -2.093750e+02 25 -1.216250e+02 -2.577778e+02 26 -5.075000e+01 -1.216250e+02 27 -1.061250e+02 -5.075000e+01 28 1.570000e+02 -1.061250e+02 29 -3.127500e+02 1.570000e+02 30 -2.766250e+02 -3.127500e+02 31 -1.946250e+02 -2.766250e+02 32 -1.017143e+02 -1.946250e+02 33 -3.113750e+02 -1.017143e+02 34 -1.558750e+02 -3.113750e+02 35 -1.573750e+02 -1.558750e+02 36 -1.637778e+02 -1.573750e+02 37 -1.536250e+02 -1.637778e+02 38 -5.575000e+01 -1.536250e+02 39 -1.281250e+02 -5.575000e+01 40 9.500000e+01 -1.281250e+02 41 -1.917500e+02 9.500000e+01 42 -1.156250e+02 -1.917500e+02 43 2.163750e+02 -1.156250e+02 44 1.662857e+02 2.163750e+02 45 5.962500e+01 1.662857e+02 46 2.261250e+02 5.962500e+01 47 -2.637500e+01 2.261250e+02 48 -4.777778e+00 -2.637500e+01 49 4.123750e+02 -4.777778e+00 50 -6.575000e+01 4.123750e+02 51 8.387500e+01 -6.575000e+01 52 -1.200000e+01 8.387500e+01 53 2.402500e+02 -1.200000e+01 54 4.737500e+01 2.402500e+02 55 1.153750e+02 4.737500e+01 56 1.222857e+02 1.153750e+02 57 2.186250e+02 1.222857e+02 58 2.471250e+02 2.186250e+02 59 2.746250e+02 2.471250e+02 60 4.702222e+02 2.746250e+02 61 4.113750e+02 4.702222e+02 62 -9.750000e+00 4.113750e+02 63 3.288750e+02 -9.750000e+00 64 3.030000e+02 3.288750e+02 65 2.602500e+02 3.030000e+02 66 4.413750e+02 2.602500e+02 67 6.053750e+02 4.413750e+02 68 9.219292e-13 6.053750e+02 69 2.826250e+02 9.219292e-13 70 2.481250e+02 2.826250e+02 71 -1.083750e+02 2.481250e+02 72 2.082222e+02 -1.083750e+02 73 -6.162500e+01 2.082222e+02 74 1.125000e+01 -6.162500e+01 75 1.398750e+02 1.125000e+01 76 1.330000e+02 1.398750e+02 77 9.125000e+01 1.330000e+02 78 -4.625000e+00 9.125000e+01 79 4.637500e+01 -4.625000e+00 80 1.542857e+02 4.637500e+01 81 -4.037500e+01 1.542857e+02 82 -5.087500e+01 -4.037500e+01 83 -8.937500e+01 -5.087500e+01 84 -1.387778e+02 -8.937500e+01 85 1.503750e+02 -1.387778e+02 86 2.825000e+01 1.503750e+02 87 5.875000e+00 2.825000e+01 88 -2.210000e+02 5.875000e+00 89 1.132500e+02 -2.210000e+02 90 6.737500e+01 1.132500e+02 91 -9.662500e+01 6.737500e+01 92 1.752857e+02 -9.662500e+01 93 1.016250e+02 1.752857e+02 94 -1.458750e+02 1.016250e+02 95 9.162500e+01 -1.458750e+02 96 -1.257778e+02 9.162500e+01 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7npu61227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8443e1227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9zvx91227463757.ps",horizontal=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') Warning message: In dropInf(r.w/(s * sqrt(1 - hii))) : Not plotting observations with leverage one: 69 > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10e4hi1227463757.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11zugy1227463757.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/126noj1227463758.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/13167u1227463758.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/1405ql1227463758.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/15isv51227463758.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/166dbz1227463758.tab") + } > > system("convert tmp/17ulb1227463757.ps tmp/17ulb1227463757.png") > system("convert tmp/25nb11227463757.ps tmp/25nb11227463757.png") > system("convert tmp/3jbip1227463757.ps tmp/3jbip1227463757.png") > system("convert tmp/4aiiw1227463757.ps tmp/4aiiw1227463757.png") > system("convert tmp/5yy7a1227463757.ps tmp/5yy7a1227463757.png") > system("convert tmp/6m7vl1227463757.ps tmp/6m7vl1227463757.png") > system("convert tmp/7npu61227463757.ps tmp/7npu61227463757.png") > system("convert tmp/8443e1227463757.ps tmp/8443e1227463757.png") > system("convert tmp/9zvx91227463757.ps tmp/9zvx91227463757.png") > system("convert tmp/10e4hi1227463757.ps tmp/10e4hi1227463757.png") > > > proc.time() user system elapsed 2.939 1.604 3.345