R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(921365,0,987921,0,1132614,0,1332224,0,1418133,0,1411549,0,1695920,0,1636173,0,1539653,0,1395314,0,1127575,0,1036076,0,989236,0,1008380,0,1207763,0,1368839,0,1469798,0,1498721,0,1761769,0,1653214,0,1599104,0,1421179,0,1163995,0,1037735,0,1015407,0,1039210,0,1258049,0,1469445,0,1552346,0,1549144,0,1785895,0,1662335,0,1629440,0,1467430,0,1202209,0,1076982,0,1039367,1,1063449,1,1335135,1,1491602,1,1591972,1,1641248,1,1898849,1,1798580,1,1762444,1,1622044,1,1368955,1,1262973,1,1195650,1,1269530,1,1479279,1,1607819,1,1712466,1,1721766,1,1949843,1,1821326,1,1757802,1,1590367,1,1260647,1,1149235,1),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 921365 0 1 0 0 0 0 0 0 0 0 0 0 2 987921 0 0 1 0 0 0 0 0 0 0 0 0 3 1132614 0 0 0 1 0 0 0 0 0 0 0 0 4 1332224 0 0 0 0 1 0 0 0 0 0 0 0 5 1418133 0 0 0 0 0 1 0 0 0 0 0 0 6 1411549 0 0 0 0 0 0 1 0 0 0 0 0 7 1695920 0 0 0 0 0 0 0 1 0 0 0 0 8 1636173 0 0 0 0 0 0 0 0 1 0 0 0 9 1539653 0 0 0 0 0 0 0 0 0 1 0 0 10 1395314 0 0 0 0 0 0 0 0 0 0 1 0 11 1127575 0 0 0 0 0 0 0 0 0 0 0 1 12 1036076 0 0 0 0 0 0 0 0 0 0 0 0 13 989236 0 1 0 0 0 0 0 0 0 0 0 0 14 1008380 0 0 1 0 0 0 0 0 0 0 0 0 15 1207763 0 0 0 1 0 0 0 0 0 0 0 0 16 1368839 0 0 0 0 1 0 0 0 0 0 0 0 17 1469798 0 0 0 0 0 1 0 0 0 0 0 0 18 1498721 0 0 0 0 0 0 1 0 0 0 0 0 19 1761769 0 0 0 0 0 0 0 1 0 0 0 0 20 1653214 0 0 0 0 0 0 0 0 1 0 0 0 21 1599104 0 0 0 0 0 0 0 0 0 1 0 0 22 1421179 0 0 0 0 0 0 0 0 0 0 1 0 23 1163995 0 0 0 0 0 0 0 0 0 0 0 1 24 1037735 0 0 0 0 0 0 0 0 0 0 0 0 25 1015407 0 1 0 0 0 0 0 0 0 0 0 0 26 1039210 0 0 1 0 0 0 0 0 0 0 0 0 27 1258049 0 0 0 1 0 0 0 0 0 0 0 0 28 1469445 0 0 0 0 1 0 0 0 0 0 0 0 29 1552346 0 0 0 0 0 1 0 0 0 0 0 0 30 1549144 0 0 0 0 0 0 1 0 0 0 0 0 31 1785895 0 0 0 0 0 0 0 1 0 0 0 0 32 1662335 0 0 0 0 0 0 0 0 1 0 0 0 33 1629440 0 0 0 0 0 0 0 0 0 1 0 0 34 1467430 0 0 0 0 0 0 0 0 0 0 1 0 35 1202209 0 0 0 0 0 0 0 0 0 0 0 1 36 1076982 0 0 0 0 0 0 0 0 0 0 0 0 37 1039367 1 1 0 0 0 0 0 0 0 0 0 0 38 1063449 1 0 1 0 0 0 0 0 0 0 0 0 39 1335135 1 0 0 1 0 0 0 0 0 0 0 0 40 1491602 1 0 0 0 1 0 0 0 0 0 0 0 41 1591972 1 0 0 0 0 1 0 0 0 0 0 0 42 1641248 1 0 0 0 0 0 1 0 0 0 0 0 43 1898849 1 0 0 0 0 0 0 1 0 0 0 0 44 1798580 1 0 0 0 0 0 0 0 1 0 0 0 45 1762444 1 0 0 0 0 0 0 0 0 1 0 0 46 1622044 1 0 0 0 0 0 0 0 0 0 1 0 47 1368955 1 0 0 0 0 0 0 0 0 0 0 1 48 1262973 1 0 0 0 0 0 0 0 0 0 0 0 49 1195650 1 1 0 0 0 0 0 0 0 0 0 0 50 1269530 1 0 1 0 0 0 0 0 0 0 0 0 51 1479279 1 0 0 1 0 0 0 0 0 0 0 0 52 1607819 1 0 0 0 1 0 0 0 0 0 0 0 53 1712466 1 0 0 0 0 1 0 0 0 0 0 0 54 1721766 1 0 0 0 0 0 1 0 0 0 0 0 55 1949843 1 0 0 0 0 0 0 1 0 0 0 0 56 1821326 1 0 0 0 0 0 0 0 1 0 0 0 57 1757802 1 0 0 0 0 0 0 0 0 1 0 0 58 1590367 1 0 0 0 0 0 0 0 0 0 1 0 59 1260647 1 0 0 0 0 0 0 0 0 0 0 1 60 1149235 1 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) X M1 M2 M3 M4 1045196 168511 -80395 -38902 169968 341386 M5 M6 M7 M8 M9 M10 436343 451885 705855 601725 545088 386667 M11 112076 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -111355 -31410 1863 36464 95605 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1045196 24952 41.888 < 2e-16 *** X 168511 14311 11.775 1.27e-15 *** M1 -80395 34346 -2.341 0.02354 * M2 -38902 34346 -1.133 0.26311 M3 169968 34346 4.949 1.00e-05 *** M4 341386 34346 9.940 3.89e-13 *** M5 436343 34346 12.704 < 2e-16 *** M6 451885 34346 13.157 < 2e-16 *** M7 705855 34346 20.551 < 2e-16 *** M8 601725 34346 17.519 < 2e-16 *** M9 545088 34346 15.870 < 2e-16 *** M10 386667 34346 11.258 6.10e-15 *** M11 112076 34346 3.263 0.00206 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 54310 on 47 degrees of freedom Multiple R-squared: 0.9684, Adjusted R-squared: 0.9604 F-statistic: 120.1 on 12 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.44265418 0.88530836 0.5573458 [2,] 0.36274131 0.72548262 0.6372587 [3,] 0.41944562 0.83889124 0.5805544 [4,] 0.38007072 0.76014144 0.6199293 [5,] 0.26726584 0.53453168 0.7327342 [6,] 0.22939792 0.45879585 0.7706021 [7,] 0.16544771 0.33089543 0.8345523 [8,] 0.11751700 0.23503399 0.8824830 [9,] 0.07397793 0.14795586 0.9260221 [10,] 0.06914223 0.13828447 0.9308578 [11,] 0.04934069 0.09868139 0.9506593 [12,] 0.06836353 0.13672706 0.9316365 [13,] 0.13486903 0.26973806 0.8651310 [14,] 0.17430095 0.34860190 0.8256990 [15,] 0.17703615 0.35407230 0.8229639 [16,] 0.13859990 0.27719979 0.8614001 [17,] 0.09308949 0.18617898 0.9069105 [18,] 0.06978992 0.13957984 0.9302101 [19,] 0.05083636 0.10167271 0.9491636 [20,] 0.03511243 0.07022487 0.9648876 [21,] 0.02128612 0.04257224 0.9787139 [22,] 0.02670570 0.05341140 0.9732943 [23,] 0.08286650 0.16573300 0.9171335 [24,] 0.15243740 0.30487481 0.8475626 [25,] 0.19038722 0.38077444 0.8096128 [26,] 0.27734180 0.55468359 0.7226582 [27,] 0.29187720 0.58375439 0.7081228 [28,] 0.22910192 0.45820383 0.7708981 [29,] 0.13620832 0.27241664 0.8637917 > postscript(file="/var/www/html/rcomp/tmp/1nvfe1261310534.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/2lkdj1261310534.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/3xzb71261310534.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/4rayw1261310534.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/5pvto1261310534.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 = 60 Frequency = 1 1 2 3 4 5 6 -43435.7778 -18372.7778 -82549.7778 -54357.5778 -63405.7778 -85532.3778 7 8 9 10 11 12 -55130.9778 -10748.3778 -50631.3778 -36548.5778 -29696.9778 -9119.9778 13 14 15 16 17 18 24435.2222 2086.2222 -7400.7778 -17742.5778 -11740.7778 1639.6222 19 20 21 22 23 24 10718.0222 6292.6222 8819.6222 -10683.5778 6723.0222 -7460.9778 25 26 27 28 29 30 50606.2222 32916.2222 42885.2222 82863.4222 70807.2222 52062.6222 31 32 33 34 35 36 34844.0222 15413.6222 39155.6222 35567.4222 44937.0222 31786.0222 37 38 39 40 41 42 -93944.3333 -111355.3333 -48539.3333 -63490.1333 -58077.3333 -24343.9333 43 44 45 46 47 48 -20712.5333 -16851.9333 3649.0667 21670.8667 43172.4667 49266.4667 49 50 51 52 53 54 62338.6667 94725.6667 95604.6667 52726.8667 62416.6667 56174.0667 55 56 57 58 59 60 30281.4667 5894.0667 -992.9333 -10006.1333 -65135.5333 -64471.5333 > postscript(file="/var/www/html/rcomp/tmp/65njr1261310534.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -43435.7778 NA 1 -18372.7778 -43435.7778 2 -82549.7778 -18372.7778 3 -54357.5778 -82549.7778 4 -63405.7778 -54357.5778 5 -85532.3778 -63405.7778 6 -55130.9778 -85532.3778 7 -10748.3778 -55130.9778 8 -50631.3778 -10748.3778 9 -36548.5778 -50631.3778 10 -29696.9778 -36548.5778 11 -9119.9778 -29696.9778 12 24435.2222 -9119.9778 13 2086.2222 24435.2222 14 -7400.7778 2086.2222 15 -17742.5778 -7400.7778 16 -11740.7778 -17742.5778 17 1639.6222 -11740.7778 18 10718.0222 1639.6222 19 6292.6222 10718.0222 20 8819.6222 6292.6222 21 -10683.5778 8819.6222 22 6723.0222 -10683.5778 23 -7460.9778 6723.0222 24 50606.2222 -7460.9778 25 32916.2222 50606.2222 26 42885.2222 32916.2222 27 82863.4222 42885.2222 28 70807.2222 82863.4222 29 52062.6222 70807.2222 30 34844.0222 52062.6222 31 15413.6222 34844.0222 32 39155.6222 15413.6222 33 35567.4222 39155.6222 34 44937.0222 35567.4222 35 31786.0222 44937.0222 36 -93944.3333 31786.0222 37 -111355.3333 -93944.3333 38 -48539.3333 -111355.3333 39 -63490.1333 -48539.3333 40 -58077.3333 -63490.1333 41 -24343.9333 -58077.3333 42 -20712.5333 -24343.9333 43 -16851.9333 -20712.5333 44 3649.0667 -16851.9333 45 21670.8667 3649.0667 46 43172.4667 21670.8667 47 49266.4667 43172.4667 48 62338.6667 49266.4667 49 94725.6667 62338.6667 50 95604.6667 94725.6667 51 52726.8667 95604.6667 52 62416.6667 52726.8667 53 56174.0667 62416.6667 54 30281.4667 56174.0667 55 5894.0667 30281.4667 56 -992.9333 5894.0667 57 -10006.1333 -992.9333 58 -65135.5333 -10006.1333 59 -64471.5333 -65135.5333 60 NA -64471.5333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -18372.7778 -43435.7778 [2,] -82549.7778 -18372.7778 [3,] -54357.5778 -82549.7778 [4,] -63405.7778 -54357.5778 [5,] -85532.3778 -63405.7778 [6,] -55130.9778 -85532.3778 [7,] -10748.3778 -55130.9778 [8,] -50631.3778 -10748.3778 [9,] -36548.5778 -50631.3778 [10,] -29696.9778 -36548.5778 [11,] -9119.9778 -29696.9778 [12,] 24435.2222 -9119.9778 [13,] 2086.2222 24435.2222 [14,] -7400.7778 2086.2222 [15,] -17742.5778 -7400.7778 [16,] -11740.7778 -17742.5778 [17,] 1639.6222 -11740.7778 [18,] 10718.0222 1639.6222 [19,] 6292.6222 10718.0222 [20,] 8819.6222 6292.6222 [21,] -10683.5778 8819.6222 [22,] 6723.0222 -10683.5778 [23,] -7460.9778 6723.0222 [24,] 50606.2222 -7460.9778 [25,] 32916.2222 50606.2222 [26,] 42885.2222 32916.2222 [27,] 82863.4222 42885.2222 [28,] 70807.2222 82863.4222 [29,] 52062.6222 70807.2222 [30,] 34844.0222 52062.6222 [31,] 15413.6222 34844.0222 [32,] 39155.6222 15413.6222 [33,] 35567.4222 39155.6222 [34,] 44937.0222 35567.4222 [35,] 31786.0222 44937.0222 [36,] -93944.3333 31786.0222 [37,] -111355.3333 -93944.3333 [38,] -48539.3333 -111355.3333 [39,] -63490.1333 -48539.3333 [40,] -58077.3333 -63490.1333 [41,] -24343.9333 -58077.3333 [42,] -20712.5333 -24343.9333 [43,] -16851.9333 -20712.5333 [44,] 3649.0667 -16851.9333 [45,] 21670.8667 3649.0667 [46,] 43172.4667 21670.8667 [47,] 49266.4667 43172.4667 [48,] 62338.6667 49266.4667 [49,] 94725.6667 62338.6667 [50,] 95604.6667 94725.6667 [51,] 52726.8667 95604.6667 [52,] 62416.6667 52726.8667 [53,] 56174.0667 62416.6667 [54,] 30281.4667 56174.0667 [55,] 5894.0667 30281.4667 [56,] -992.9333 5894.0667 [57,] -10006.1333 -992.9333 [58,] -65135.5333 -10006.1333 [59,] -64471.5333 -65135.5333 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -18372.7778 -43435.7778 2 -82549.7778 -18372.7778 3 -54357.5778 -82549.7778 4 -63405.7778 -54357.5778 5 -85532.3778 -63405.7778 6 -55130.9778 -85532.3778 7 -10748.3778 -55130.9778 8 -50631.3778 -10748.3778 9 -36548.5778 -50631.3778 10 -29696.9778 -36548.5778 11 -9119.9778 -29696.9778 12 24435.2222 -9119.9778 13 2086.2222 24435.2222 14 -7400.7778 2086.2222 15 -17742.5778 -7400.7778 16 -11740.7778 -17742.5778 17 1639.6222 -11740.7778 18 10718.0222 1639.6222 19 6292.6222 10718.0222 20 8819.6222 6292.6222 21 -10683.5778 8819.6222 22 6723.0222 -10683.5778 23 -7460.9778 6723.0222 24 50606.2222 -7460.9778 25 32916.2222 50606.2222 26 42885.2222 32916.2222 27 82863.4222 42885.2222 28 70807.2222 82863.4222 29 52062.6222 70807.2222 30 34844.0222 52062.6222 31 15413.6222 34844.0222 32 39155.6222 15413.6222 33 35567.4222 39155.6222 34 44937.0222 35567.4222 35 31786.0222 44937.0222 36 -93944.3333 31786.0222 37 -111355.3333 -93944.3333 38 -48539.3333 -111355.3333 39 -63490.1333 -48539.3333 40 -58077.3333 -63490.1333 41 -24343.9333 -58077.3333 42 -20712.5333 -24343.9333 43 -16851.9333 -20712.5333 44 3649.0667 -16851.9333 45 21670.8667 3649.0667 46 43172.4667 21670.8667 47 49266.4667 43172.4667 48 62338.6667 49266.4667 49 94725.6667 62338.6667 50 95604.6667 94725.6667 51 52726.8667 95604.6667 52 62416.6667 52726.8667 53 56174.0667 62416.6667 54 30281.4667 56174.0667 55 5894.0667 30281.4667 56 -992.9333 5894.0667 57 -10006.1333 -992.9333 58 -65135.5333 -10006.1333 59 -64471.5333 -65135.5333 > 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/7qdf01261310534.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/81wc81261310534.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/9as7q1261310534.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/10ehso1261310534.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/11zc5f1261310534.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/1220551261310534.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/1366xf1261310534.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/14fdgq1261310534.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/15oq5e1261310534.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/16nqj31261310534.tab") + } > > try(system("convert tmp/1nvfe1261310534.ps tmp/1nvfe1261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/2lkdj1261310534.ps tmp/2lkdj1261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/3xzb71261310534.ps tmp/3xzb71261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/4rayw1261310534.ps tmp/4rayw1261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/5pvto1261310534.ps tmp/5pvto1261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/65njr1261310534.ps tmp/65njr1261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/7qdf01261310534.ps tmp/7qdf01261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/81wc81261310534.ps tmp/81wc81261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/9as7q1261310534.ps tmp/9as7q1261310534.png",intern=TRUE)) character(0) > try(system("convert tmp/10ehso1261310534.ps tmp/10ehso1261310534.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.382 1.540 3.952