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(147768,0,137507,0,136919,0,136151,0,133001,0,125554,0,119647,0,114158,0,116193,0,152803,0,161761,0,160942,0,149470,0,139208,0,134588,0,130322,0,126611,0,122401,0,117352,0,112135,0,112879,0,148729,0,157230,0,157221,0,146681,0,136524,0,132111,1,125326,1,122716,1,116615,1,113719,1,110737,1,112093,1,143565,1,149946,1,149147,1,134339,1,122683,1,115614,1,116566,1,111272,1,104609,1,101802,1,94542,1,93051,1,124129,1,130374,1,123946,1,114971,1,105531,1,104919,0,104782,0,101281,0,94545,0,93248,0,84031,0,87486,0,115867,0,120327,0,117008,0,108811,0),dim=c(2,61),dimnames=list(c('jonger_dan_25','plan'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('jonger_dan_25','plan'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '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 jonger_dan_25 plan M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 147768 0 1 0 0 0 0 0 0 0 0 0 0 1 2 137507 0 0 1 0 0 0 0 0 0 0 0 0 2 3 136919 0 0 0 1 0 0 0 0 0 0 0 0 3 4 136151 0 0 0 0 1 0 0 0 0 0 0 0 4 5 133001 0 0 0 0 0 1 0 0 0 0 0 0 5 6 125554 0 0 0 0 0 0 1 0 0 0 0 0 6 7 119647 0 0 0 0 0 0 0 1 0 0 0 0 7 8 114158 0 0 0 0 0 0 0 0 1 0 0 0 8 9 116193 0 0 0 0 0 0 0 0 0 1 0 0 9 10 152803 0 0 0 0 0 0 0 0 0 0 1 0 10 11 161761 0 0 0 0 0 0 0 0 0 0 0 1 11 12 160942 0 0 0 0 0 0 0 0 0 0 0 0 12 13 149470 0 1 0 0 0 0 0 0 0 0 0 0 13 14 139208 0 0 1 0 0 0 0 0 0 0 0 0 14 15 134588 0 0 0 1 0 0 0 0 0 0 0 0 15 16 130322 0 0 0 0 1 0 0 0 0 0 0 0 16 17 126611 0 0 0 0 0 1 0 0 0 0 0 0 17 18 122401 0 0 0 0 0 0 1 0 0 0 0 0 18 19 117352 0 0 0 0 0 0 0 1 0 0 0 0 19 20 112135 0 0 0 0 0 0 0 0 1 0 0 0 20 21 112879 0 0 0 0 0 0 0 0 0 1 0 0 21 22 148729 0 0 0 0 0 0 0 0 0 0 1 0 22 23 157230 0 0 0 0 0 0 0 0 0 0 0 1 23 24 157221 0 0 0 0 0 0 0 0 0 0 0 0 24 25 146681 0 1 0 0 0 0 0 0 0 0 0 0 25 26 136524 0 0 1 0 0 0 0 0 0 0 0 0 26 27 132111 1 0 0 1 0 0 0 0 0 0 0 0 27 28 125326 1 0 0 0 1 0 0 0 0 0 0 0 28 29 122716 1 0 0 0 0 1 0 0 0 0 0 0 29 30 116615 1 0 0 0 0 0 1 0 0 0 0 0 30 31 113719 1 0 0 0 0 0 0 1 0 0 0 0 31 32 110737 1 0 0 0 0 0 0 0 1 0 0 0 32 33 112093 1 0 0 0 0 0 0 0 0 1 0 0 33 34 143565 1 0 0 0 0 0 0 0 0 0 1 0 34 35 149946 1 0 0 0 0 0 0 0 0 0 0 1 35 36 149147 1 0 0 0 0 0 0 0 0 0 0 0 36 37 134339 1 1 0 0 0 0 0 0 0 0 0 0 37 38 122683 1 0 1 0 0 0 0 0 0 0 0 0 38 39 115614 1 0 0 1 0 0 0 0 0 0 0 0 39 40 116566 1 0 0 0 1 0 0 0 0 0 0 0 40 41 111272 1 0 0 0 0 1 0 0 0 0 0 0 41 42 104609 1 0 0 0 0 0 1 0 0 0 0 0 42 43 101802 1 0 0 0 0 0 0 1 0 0 0 0 43 44 94542 1 0 0 0 0 0 0 0 1 0 0 0 44 45 93051 1 0 0 0 0 0 0 0 0 1 0 0 45 46 124129 1 0 0 0 0 0 0 0 0 0 1 0 46 47 130374 1 0 0 0 0 0 0 0 0 0 0 1 47 48 123946 1 0 0 0 0 0 0 0 0 0 0 0 48 49 114971 1 1 0 0 0 0 0 0 0 0 0 0 49 50 105531 1 0 1 0 0 0 0 0 0 0 0 0 50 51 104919 0 0 0 1 0 0 0 0 0 0 0 0 51 52 104782 0 0 0 0 1 0 0 0 0 0 0 0 52 53 101281 0 0 0 0 0 1 0 0 0 0 0 0 53 54 94545 0 0 0 0 0 0 1 0 0 0 0 0 54 55 93248 0 0 0 0 0 0 0 1 0 0 0 0 55 56 84031 0 0 0 0 0 0 0 0 1 0 0 0 56 57 87486 0 0 0 0 0 0 0 0 0 1 0 0 57 58 115867 0 0 0 0 0 0 0 0 0 0 1 0 58 59 120327 0 0 0 0 0 0 0 0 0 0 0 1 59 60 117008 0 0 0 0 0 0 0 0 0 0 0 0 60 61 108811 0 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) plan M1 M2 M3 M4 167547.7 3044.9 -11542.1 -20893.5 -23600.8 -25048.5 M5 M6 M7 M8 M9 M10 -27948.5 -33426.8 -36264.9 -41544.7 -39571.8 -6140.5 M11 t 1521.7 -753.1 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10496 -3336 719 2738 9504 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 167547.7 2597.1 64.513 < 2e-16 *** plan 3044.8 1396.8 2.180 0.034306 * M1 -11542.1 3028.0 -3.812 0.000400 *** M2 -20893.5 3181.0 -6.568 3.70e-08 *** M3 -23600.8 3176.4 -7.430 1.83e-09 *** M4 -25048.5 3172.3 -7.896 3.64e-10 *** M5 -27948.5 3168.6 -8.820 1.56e-11 *** M6 -33426.8 3165.4 -10.560 5.36e-14 *** M7 -36264.9 3162.8 -11.466 3.23e-15 *** M8 -41544.7 3160.6 -13.145 < 2e-16 *** M9 -39571.8 3158.8 -12.527 < 2e-16 *** M10 -6140.5 3157.6 -1.945 0.057815 . M11 1521.7 3156.9 0.482 0.632032 t -753.1 39.3 -19.165 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4991 on 47 degrees of freedom Multiple R-squared: 0.9466, Adjusted R-squared: 0.9318 F-statistic: 64.05 on 13 and 47 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,] 0.39196428 0.78392856 0.60803572 [2,] 0.24791616 0.49583232 0.75208384 [3,] 0.17380454 0.34760907 0.82619546 [4,] 0.13145256 0.26290512 0.86854744 [5,] 0.14678758 0.29357516 0.85321242 [6,] 0.13567536 0.27135072 0.86432464 [7,] 0.12189441 0.24378883 0.87810559 [8,] 0.08307395 0.16614791 0.91692605 [9,] 0.07985658 0.15971316 0.92014342 [10,] 0.10308373 0.20616746 0.89691627 [11,] 0.06339332 0.12678664 0.93660668 [12,] 0.12768877 0.25537754 0.87231123 [13,] 0.15056544 0.30113088 0.84943456 [14,] 0.19708419 0.39416838 0.80291581 [15,] 0.49520335 0.99040671 0.50479665 [16,] 0.57186010 0.85627980 0.42813990 [17,] 0.60733481 0.78533039 0.39266519 [18,] 0.54712025 0.90575949 0.45287975 [19,] 0.55722555 0.88554891 0.44277445 [20,] 0.89336238 0.21327524 0.10663762 [21,] 0.92017627 0.15964746 0.07982373 [22,] 0.93290374 0.13419252 0.06709626 [23,] 0.97361775 0.05276450 0.02638225 [24,] 0.98023764 0.03952473 0.01976236 [25,] 0.97295463 0.05409074 0.02704537 [26,] 0.96324390 0.07351220 0.03675610 [27,] 0.91762822 0.16474356 0.08237178 [28,] 0.91022426 0.17955148 0.08977574 > postscript(file="/var/www/html/rcomp/tmp/1j40b1227723907.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/262g01227723907.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/3j9bo1227723907.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/40i0u1227723907.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/56wyp1227723907.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 = 61 Frequency = 1 1 2 3 4 5 6 -7484.3980 -7640.8717 -4768.4717 -3335.6717 -2832.4717 -4048.0717 7 8 9 10 11 12 -6363.8717 -5819.8717 -5004.6717 -1072.8717 976.1283 2431.9283 13 14 15 16 17 18 3255.2079 3097.7342 1938.1342 -127.0658 -184.8658 1836.5342 19 20 21 22 23 24 378.7342 1194.7342 718.9342 3890.7342 5482.7342 7748.5342 25 26 27 28 29 30 9503.8138 9451.3400 5453.8899 869.6899 1912.8899 2043.2899 31 32 33 34 35 36 2738.4899 5789.4899 5925.6899 4719.4899 4191.4899 5667.2899 37 38 39 40 41 42 3154.5695 1603.0958 -2005.5042 1147.2958 -493.5042 -925.1042 43 44 45 46 47 48 -140.9042 -1367.9042 -4078.7042 -5678.9042 -6342.9042 -10496.1042 49 50 51 52 53 54 -7175.8246 -6511.2983 -618.0482 1445.7518 1597.9518 1093.3518 55 56 57 58 59 60 3387.5518 203.5518 2438.7518 -1858.4482 -4307.4482 -5351.6482 61 -1253.3686 > postscript(file="/var/www/html/rcomp/tmp/6ui3m1227723907.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -7484.3980 NA 1 -7640.8717 -7484.3980 2 -4768.4717 -7640.8717 3 -3335.6717 -4768.4717 4 -2832.4717 -3335.6717 5 -4048.0717 -2832.4717 6 -6363.8717 -4048.0717 7 -5819.8717 -6363.8717 8 -5004.6717 -5819.8717 9 -1072.8717 -5004.6717 10 976.1283 -1072.8717 11 2431.9283 976.1283 12 3255.2079 2431.9283 13 3097.7342 3255.2079 14 1938.1342 3097.7342 15 -127.0658 1938.1342 16 -184.8658 -127.0658 17 1836.5342 -184.8658 18 378.7342 1836.5342 19 1194.7342 378.7342 20 718.9342 1194.7342 21 3890.7342 718.9342 22 5482.7342 3890.7342 23 7748.5342 5482.7342 24 9503.8138 7748.5342 25 9451.3400 9503.8138 26 5453.8899 9451.3400 27 869.6899 5453.8899 28 1912.8899 869.6899 29 2043.2899 1912.8899 30 2738.4899 2043.2899 31 5789.4899 2738.4899 32 5925.6899 5789.4899 33 4719.4899 5925.6899 34 4191.4899 4719.4899 35 5667.2899 4191.4899 36 3154.5695 5667.2899 37 1603.0958 3154.5695 38 -2005.5042 1603.0958 39 1147.2958 -2005.5042 40 -493.5042 1147.2958 41 -925.1042 -493.5042 42 -140.9042 -925.1042 43 -1367.9042 -140.9042 44 -4078.7042 -1367.9042 45 -5678.9042 -4078.7042 46 -6342.9042 -5678.9042 47 -10496.1042 -6342.9042 48 -7175.8246 -10496.1042 49 -6511.2983 -7175.8246 50 -618.0482 -6511.2983 51 1445.7518 -618.0482 52 1597.9518 1445.7518 53 1093.3518 1597.9518 54 3387.5518 1093.3518 55 203.5518 3387.5518 56 2438.7518 203.5518 57 -1858.4482 2438.7518 58 -4307.4482 -1858.4482 59 -5351.6482 -4307.4482 60 -1253.3686 -5351.6482 61 NA -1253.3686 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -7640.8717 -7484.3980 [2,] -4768.4717 -7640.8717 [3,] -3335.6717 -4768.4717 [4,] -2832.4717 -3335.6717 [5,] -4048.0717 -2832.4717 [6,] -6363.8717 -4048.0717 [7,] -5819.8717 -6363.8717 [8,] -5004.6717 -5819.8717 [9,] -1072.8717 -5004.6717 [10,] 976.1283 -1072.8717 [11,] 2431.9283 976.1283 [12,] 3255.2079 2431.9283 [13,] 3097.7342 3255.2079 [14,] 1938.1342 3097.7342 [15,] -127.0658 1938.1342 [16,] -184.8658 -127.0658 [17,] 1836.5342 -184.8658 [18,] 378.7342 1836.5342 [19,] 1194.7342 378.7342 [20,] 718.9342 1194.7342 [21,] 3890.7342 718.9342 [22,] 5482.7342 3890.7342 [23,] 7748.5342 5482.7342 [24,] 9503.8138 7748.5342 [25,] 9451.3400 9503.8138 [26,] 5453.8899 9451.3400 [27,] 869.6899 5453.8899 [28,] 1912.8899 869.6899 [29,] 2043.2899 1912.8899 [30,] 2738.4899 2043.2899 [31,] 5789.4899 2738.4899 [32,] 5925.6899 5789.4899 [33,] 4719.4899 5925.6899 [34,] 4191.4899 4719.4899 [35,] 5667.2899 4191.4899 [36,] 3154.5695 5667.2899 [37,] 1603.0958 3154.5695 [38,] -2005.5042 1603.0958 [39,] 1147.2958 -2005.5042 [40,] -493.5042 1147.2958 [41,] -925.1042 -493.5042 [42,] -140.9042 -925.1042 [43,] -1367.9042 -140.9042 [44,] -4078.7042 -1367.9042 [45,] -5678.9042 -4078.7042 [46,] -6342.9042 -5678.9042 [47,] -10496.1042 -6342.9042 [48,] -7175.8246 -10496.1042 [49,] -6511.2983 -7175.8246 [50,] -618.0482 -6511.2983 [51,] 1445.7518 -618.0482 [52,] 1597.9518 1445.7518 [53,] 1093.3518 1597.9518 [54,] 3387.5518 1093.3518 [55,] 203.5518 3387.5518 [56,] 2438.7518 203.5518 [57,] -1858.4482 2438.7518 [58,] -4307.4482 -1858.4482 [59,] -5351.6482 -4307.4482 [60,] -1253.3686 -5351.6482 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -7640.8717 -7484.3980 2 -4768.4717 -7640.8717 3 -3335.6717 -4768.4717 4 -2832.4717 -3335.6717 5 -4048.0717 -2832.4717 6 -6363.8717 -4048.0717 7 -5819.8717 -6363.8717 8 -5004.6717 -5819.8717 9 -1072.8717 -5004.6717 10 976.1283 -1072.8717 11 2431.9283 976.1283 12 3255.2079 2431.9283 13 3097.7342 3255.2079 14 1938.1342 3097.7342 15 -127.0658 1938.1342 16 -184.8658 -127.0658 17 1836.5342 -184.8658 18 378.7342 1836.5342 19 1194.7342 378.7342 20 718.9342 1194.7342 21 3890.7342 718.9342 22 5482.7342 3890.7342 23 7748.5342 5482.7342 24 9503.8138 7748.5342 25 9451.3400 9503.8138 26 5453.8899 9451.3400 27 869.6899 5453.8899 28 1912.8899 869.6899 29 2043.2899 1912.8899 30 2738.4899 2043.2899 31 5789.4899 2738.4899 32 5925.6899 5789.4899 33 4719.4899 5925.6899 34 4191.4899 4719.4899 35 5667.2899 4191.4899 36 3154.5695 5667.2899 37 1603.0958 3154.5695 38 -2005.5042 1603.0958 39 1147.2958 -2005.5042 40 -493.5042 1147.2958 41 -925.1042 -493.5042 42 -140.9042 -925.1042 43 -1367.9042 -140.9042 44 -4078.7042 -1367.9042 45 -5678.9042 -4078.7042 46 -6342.9042 -5678.9042 47 -10496.1042 -6342.9042 48 -7175.8246 -10496.1042 49 -6511.2983 -7175.8246 50 -618.0482 -6511.2983 51 1445.7518 -618.0482 52 1597.9518 1445.7518 53 1093.3518 1597.9518 54 3387.5518 1093.3518 55 203.5518 3387.5518 56 2438.7518 203.5518 57 -1858.4482 2438.7518 58 -4307.4482 -1858.4482 59 -5351.6482 -4307.4482 60 -1253.3686 -5351.6482 > 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/7lbdc1227723907.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/8lp0u1227723907.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/9vmsj1227723907.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') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10j9071227723907.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/11tvxw1227723907.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/12yq0a1227723907.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/139qvs1227723907.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/148l4l1227723907.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/15nxu71227723907.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/16v5yb1227723908.tab") + } > > system("convert tmp/1j40b1227723907.ps tmp/1j40b1227723907.png") > system("convert tmp/262g01227723907.ps tmp/262g01227723907.png") > system("convert tmp/3j9bo1227723907.ps tmp/3j9bo1227723907.png") > system("convert tmp/40i0u1227723907.ps tmp/40i0u1227723907.png") > system("convert tmp/56wyp1227723907.ps tmp/56wyp1227723907.png") > system("convert tmp/6ui3m1227723907.ps tmp/6ui3m1227723907.png") > system("convert tmp/7lbdc1227723907.ps tmp/7lbdc1227723907.png") > system("convert tmp/8lp0u1227723907.ps tmp/8lp0u1227723907.png") > system("convert tmp/9vmsj1227723907.ps tmp/9vmsj1227723907.png") > system("convert tmp/10j9071227723907.ps tmp/10j9071227723907.png") > > > proc.time() user system elapsed 2.345 1.587 2.994