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(20366,0,22782,0,19169,0,13807,0,29743,0,25591,0,29096,0,26482,0,22405,0,27044,0,17970,0,18730,0,19684,0,19785,0,18479,0,10698,0,31956,0,29506,0,34506,0,27165,0,26736,0,23691,0,18157,0,17328,0,18205,0,20995,0,17382,0,9367,0,31124,0,26551,0,30651,0,25859,0,25100,0,25778,0,20418,0,18688,0,20424,0,24776,0,19814,0,12738,0,31566,0,30111,0,30019,0,31934,1,25826,1,26835,1,20205,1,17789,1,20520,1,22518,1,15572,1,11509,1,25447,1,24090,1,27786,1,26195,1,20516,1,22759,1,19028,1,16971,1,20036,1),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),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 = '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 20366 0 1 0 0 0 0 0 0 0 0 0 0 2 22782 0 0 1 0 0 0 0 0 0 0 0 0 3 19169 0 0 0 1 0 0 0 0 0 0 0 0 4 13807 0 0 0 0 1 0 0 0 0 0 0 0 5 29743 0 0 0 0 0 1 0 0 0 0 0 0 6 25591 0 0 0 0 0 0 1 0 0 0 0 0 7 29096 0 0 0 0 0 0 0 1 0 0 0 0 8 26482 0 0 0 0 0 0 0 0 1 0 0 0 9 22405 0 0 0 0 0 0 0 0 0 1 0 0 10 27044 0 0 0 0 0 0 0 0 0 0 1 0 11 17970 0 0 0 0 0 0 0 0 0 0 0 1 12 18730 0 0 0 0 0 0 0 0 0 0 0 0 13 19684 0 1 0 0 0 0 0 0 0 0 0 0 14 19785 0 0 1 0 0 0 0 0 0 0 0 0 15 18479 0 0 0 1 0 0 0 0 0 0 0 0 16 10698 0 0 0 0 1 0 0 0 0 0 0 0 17 31956 0 0 0 0 0 1 0 0 0 0 0 0 18 29506 0 0 0 0 0 0 1 0 0 0 0 0 19 34506 0 0 0 0 0 0 0 1 0 0 0 0 20 27165 0 0 0 0 0 0 0 0 1 0 0 0 21 26736 0 0 0 0 0 0 0 0 0 1 0 0 22 23691 0 0 0 0 0 0 0 0 0 0 1 0 23 18157 0 0 0 0 0 0 0 0 0 0 0 1 24 17328 0 0 0 0 0 0 0 0 0 0 0 0 25 18205 0 1 0 0 0 0 0 0 0 0 0 0 26 20995 0 0 1 0 0 0 0 0 0 0 0 0 27 17382 0 0 0 1 0 0 0 0 0 0 0 0 28 9367 0 0 0 0 1 0 0 0 0 0 0 0 29 31124 0 0 0 0 0 1 0 0 0 0 0 0 30 26551 0 0 0 0 0 0 1 0 0 0 0 0 31 30651 0 0 0 0 0 0 0 1 0 0 0 0 32 25859 0 0 0 0 0 0 0 0 1 0 0 0 33 25100 0 0 0 0 0 0 0 0 0 1 0 0 34 25778 0 0 0 0 0 0 0 0 0 0 1 0 35 20418 0 0 0 0 0 0 0 0 0 0 0 1 36 18688 0 0 0 0 0 0 0 0 0 0 0 0 37 20424 0 1 0 0 0 0 0 0 0 0 0 0 38 24776 0 0 1 0 0 0 0 0 0 0 0 0 39 19814 0 0 0 1 0 0 0 0 0 0 0 0 40 12738 0 0 0 0 1 0 0 0 0 0 0 0 41 31566 0 0 0 0 0 1 0 0 0 0 0 0 42 30111 0 0 0 0 0 0 1 0 0 0 0 0 43 30019 0 0 0 0 0 0 0 1 0 0 0 0 44 31934 1 0 0 0 0 0 0 0 1 0 0 0 45 25826 1 0 0 0 0 0 0 0 0 1 0 0 46 26835 1 0 0 0 0 0 0 0 0 0 1 0 47 20205 1 0 0 0 0 0 0 0 0 0 0 1 48 17789 1 0 0 0 0 0 0 0 0 0 0 0 49 20520 1 1 0 0 0 0 0 0 0 0 0 0 50 22518 1 0 1 0 0 0 0 0 0 0 0 0 51 15572 1 0 0 1 0 0 0 0 0 0 0 0 52 11509 1 0 0 0 1 0 0 0 0 0 0 0 53 25447 1 0 0 0 0 1 0 0 0 0 0 0 54 24090 1 0 0 0 0 0 1 0 0 0 0 0 55 27786 1 0 0 0 0 0 0 1 0 0 0 0 56 26195 1 0 0 0 0 0 0 0 1 0 0 0 57 20516 1 0 0 0 0 0 0 0 0 1 0 0 58 22759 1 0 0 0 0 0 0 0 0 0 1 0 59 19028 1 0 0 0 0 0 0 0 0 0 0 1 60 16971 1 0 0 0 0 0 0 0 0 0 0 0 61 20036 1 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) X M1 M2 M3 M4 18279.642 -946.104 1908.226 4080.779 -7.221 -6466.621 M5 M6 M7 M8 M9 M10 11876.779 9079.379 12321.179 9625.800 6215.400 7320.200 M11 1254.400 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3763.3 -1423.4 178.2 1103.7 4974.7 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 18279.642 906.256 20.171 < 2e-16 *** X -946.104 563.483 -1.679 0.09965 . M1 1908.226 1189.113 1.605 0.11511 M2 4080.779 1246.473 3.274 0.00197 ** M3 -7.221 1246.473 -0.006 0.99540 M4 -6466.621 1246.473 -5.188 4.24e-06 *** M5 11876.779 1246.473 9.528 1.20e-12 *** M6 9079.379 1246.473 7.284 2.70e-09 *** M7 12321.179 1246.473 9.885 3.70e-13 *** M8 9625.800 1241.368 7.754 5.19e-10 *** M9 6215.400 1241.368 5.007 7.87e-06 *** M10 7320.200 1241.368 5.897 3.60e-07 *** M11 1254.400 1241.368 1.010 0.31732 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1963 on 48 degrees of freedom Multiple R-squared: 0.9058, Adjusted R-squared: 0.8822 F-statistic: 38.45 on 12 and 48 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.44464673 0.8892935 0.5553533 [2,] 0.37373413 0.7474683 0.6262659 [3,] 0.47376582 0.9475316 0.5262342 [4,] 0.72944545 0.5411091 0.2705545 [5,] 0.62962314 0.7407537 0.3703769 [6,] 0.69260473 0.6147905 0.3073953 [7,] 0.68811130 0.6237774 0.3118887 [8,] 0.61538788 0.7692242 0.3846121 [9,] 0.53397316 0.9320537 0.4660268 [10,] 0.51273658 0.9745268 0.4872634 [11,] 0.47323394 0.9464679 0.5267661 [12,] 0.40095322 0.8019064 0.5990468 [13,] 0.45731230 0.9146246 0.5426877 [14,] 0.38037631 0.7607526 0.6196237 [15,] 0.31068455 0.6213691 0.6893155 [16,] 0.24279724 0.4855945 0.7572028 [17,] 0.34442439 0.6888488 0.6555756 [18,] 0.26212423 0.5242485 0.7378758 [19,] 0.20196213 0.4039243 0.7980379 [20,] 0.18680291 0.3736058 0.8131971 [21,] 0.14150778 0.2830156 0.8584922 [22,] 0.14640207 0.2928041 0.8535979 [23,] 0.15915313 0.3183063 0.8408469 [24,] 0.11071634 0.2214327 0.8892837 [25,] 0.10279771 0.2055954 0.8972023 [26,] 0.06846976 0.1369395 0.9315302 [27,] 0.06831084 0.1366217 0.9316892 [28,] 0.03816110 0.0763222 0.9618389 [29,] 0.10867570 0.2173514 0.8913243 [30,] 0.38034111 0.7606822 0.6196589 > postscript(file="/var/www/html/rcomp/tmp/1ae1o1258729336.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/21k451258729336.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/364jw1258729336.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/4jbgv1258729336.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/5thol1258729336.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 178.13187 421.57912 896.57912 1993.97912 -413.42088 -1768.02088 7 8 9 10 11 12 -1504.82088 -1423.44176 -2090.04176 1444.15824 -1564.04176 450.35824 13 14 15 16 17 18 -503.86813 -2575.42088 206.57912 -1115.02088 1799.57912 2146.97912 19 20 21 22 23 24 3905.17912 -740.44176 2240.95824 -1908.84176 -1377.04176 -951.64176 25 26 27 28 29 30 -1982.86813 -1365.42088 -890.42088 -2446.02088 967.57912 -808.02088 31 32 33 34 35 36 50.17912 -2046.44176 604.95824 178.15824 883.95824 408.35824 37 38 39 40 41 42 236.13187 2415.57912 1541.57912 924.97912 1409.57912 2751.97912 43 44 45 46 47 48 -581.82088 4974.66264 2277.06264 2181.26264 1617.06264 455.46264 49 50 51 52 53 54 1278.23626 1103.68352 -1754.31648 642.08352 -3763.31648 -2322.91648 55 56 57 58 59 60 -1868.71648 -764.33736 -3032.93736 -1894.73736 440.06264 -362.53736 61 794.23626 > postscript(file="/var/www/html/rcomp/tmp/62u4t1258729336.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 178.13187 NA 1 421.57912 178.13187 2 896.57912 421.57912 3 1993.97912 896.57912 4 -413.42088 1993.97912 5 -1768.02088 -413.42088 6 -1504.82088 -1768.02088 7 -1423.44176 -1504.82088 8 -2090.04176 -1423.44176 9 1444.15824 -2090.04176 10 -1564.04176 1444.15824 11 450.35824 -1564.04176 12 -503.86813 450.35824 13 -2575.42088 -503.86813 14 206.57912 -2575.42088 15 -1115.02088 206.57912 16 1799.57912 -1115.02088 17 2146.97912 1799.57912 18 3905.17912 2146.97912 19 -740.44176 3905.17912 20 2240.95824 -740.44176 21 -1908.84176 2240.95824 22 -1377.04176 -1908.84176 23 -951.64176 -1377.04176 24 -1982.86813 -951.64176 25 -1365.42088 -1982.86813 26 -890.42088 -1365.42088 27 -2446.02088 -890.42088 28 967.57912 -2446.02088 29 -808.02088 967.57912 30 50.17912 -808.02088 31 -2046.44176 50.17912 32 604.95824 -2046.44176 33 178.15824 604.95824 34 883.95824 178.15824 35 408.35824 883.95824 36 236.13187 408.35824 37 2415.57912 236.13187 38 1541.57912 2415.57912 39 924.97912 1541.57912 40 1409.57912 924.97912 41 2751.97912 1409.57912 42 -581.82088 2751.97912 43 4974.66264 -581.82088 44 2277.06264 4974.66264 45 2181.26264 2277.06264 46 1617.06264 2181.26264 47 455.46264 1617.06264 48 1278.23626 455.46264 49 1103.68352 1278.23626 50 -1754.31648 1103.68352 51 642.08352 -1754.31648 52 -3763.31648 642.08352 53 -2322.91648 -3763.31648 54 -1868.71648 -2322.91648 55 -764.33736 -1868.71648 56 -3032.93736 -764.33736 57 -1894.73736 -3032.93736 58 440.06264 -1894.73736 59 -362.53736 440.06264 60 794.23626 -362.53736 61 NA 794.23626 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 421.57912 178.13187 [2,] 896.57912 421.57912 [3,] 1993.97912 896.57912 [4,] -413.42088 1993.97912 [5,] -1768.02088 -413.42088 [6,] -1504.82088 -1768.02088 [7,] -1423.44176 -1504.82088 [8,] -2090.04176 -1423.44176 [9,] 1444.15824 -2090.04176 [10,] -1564.04176 1444.15824 [11,] 450.35824 -1564.04176 [12,] -503.86813 450.35824 [13,] -2575.42088 -503.86813 [14,] 206.57912 -2575.42088 [15,] -1115.02088 206.57912 [16,] 1799.57912 -1115.02088 [17,] 2146.97912 1799.57912 [18,] 3905.17912 2146.97912 [19,] -740.44176 3905.17912 [20,] 2240.95824 -740.44176 [21,] -1908.84176 2240.95824 [22,] -1377.04176 -1908.84176 [23,] -951.64176 -1377.04176 [24,] -1982.86813 -951.64176 [25,] -1365.42088 -1982.86813 [26,] -890.42088 -1365.42088 [27,] -2446.02088 -890.42088 [28,] 967.57912 -2446.02088 [29,] -808.02088 967.57912 [30,] 50.17912 -808.02088 [31,] -2046.44176 50.17912 [32,] 604.95824 -2046.44176 [33,] 178.15824 604.95824 [34,] 883.95824 178.15824 [35,] 408.35824 883.95824 [36,] 236.13187 408.35824 [37,] 2415.57912 236.13187 [38,] 1541.57912 2415.57912 [39,] 924.97912 1541.57912 [40,] 1409.57912 924.97912 [41,] 2751.97912 1409.57912 [42,] -581.82088 2751.97912 [43,] 4974.66264 -581.82088 [44,] 2277.06264 4974.66264 [45,] 2181.26264 2277.06264 [46,] 1617.06264 2181.26264 [47,] 455.46264 1617.06264 [48,] 1278.23626 455.46264 [49,] 1103.68352 1278.23626 [50,] -1754.31648 1103.68352 [51,] 642.08352 -1754.31648 [52,] -3763.31648 642.08352 [53,] -2322.91648 -3763.31648 [54,] -1868.71648 -2322.91648 [55,] -764.33736 -1868.71648 [56,] -3032.93736 -764.33736 [57,] -1894.73736 -3032.93736 [58,] 440.06264 -1894.73736 [59,] -362.53736 440.06264 [60,] 794.23626 -362.53736 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 421.57912 178.13187 2 896.57912 421.57912 3 1993.97912 896.57912 4 -413.42088 1993.97912 5 -1768.02088 -413.42088 6 -1504.82088 -1768.02088 7 -1423.44176 -1504.82088 8 -2090.04176 -1423.44176 9 1444.15824 -2090.04176 10 -1564.04176 1444.15824 11 450.35824 -1564.04176 12 -503.86813 450.35824 13 -2575.42088 -503.86813 14 206.57912 -2575.42088 15 -1115.02088 206.57912 16 1799.57912 -1115.02088 17 2146.97912 1799.57912 18 3905.17912 2146.97912 19 -740.44176 3905.17912 20 2240.95824 -740.44176 21 -1908.84176 2240.95824 22 -1377.04176 -1908.84176 23 -951.64176 -1377.04176 24 -1982.86813 -951.64176 25 -1365.42088 -1982.86813 26 -890.42088 -1365.42088 27 -2446.02088 -890.42088 28 967.57912 -2446.02088 29 -808.02088 967.57912 30 50.17912 -808.02088 31 -2046.44176 50.17912 32 604.95824 -2046.44176 33 178.15824 604.95824 34 883.95824 178.15824 35 408.35824 883.95824 36 236.13187 408.35824 37 2415.57912 236.13187 38 1541.57912 2415.57912 39 924.97912 1541.57912 40 1409.57912 924.97912 41 2751.97912 1409.57912 42 -581.82088 2751.97912 43 4974.66264 -581.82088 44 2277.06264 4974.66264 45 2181.26264 2277.06264 46 1617.06264 2181.26264 47 455.46264 1617.06264 48 1278.23626 455.46264 49 1103.68352 1278.23626 50 -1754.31648 1103.68352 51 642.08352 -1754.31648 52 -3763.31648 642.08352 53 -2322.91648 -3763.31648 54 -1868.71648 -2322.91648 55 -764.33736 -1868.71648 56 -3032.93736 -764.33736 57 -1894.73736 -3032.93736 58 440.06264 -1894.73736 59 -362.53736 440.06264 60 794.23626 -362.53736 > 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/74edg1258729336.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/8gl141258729336.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/9y0qc1258729336.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/10fldp1258729336.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/11ougt1258729336.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/12aoys1258729336.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/13hnb31258729336.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/14fwp11258729336.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/15q9cf1258729336.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/16fp3n1258729336.tab") + } > > system("convert tmp/1ae1o1258729336.ps tmp/1ae1o1258729336.png") > system("convert tmp/21k451258729336.ps tmp/21k451258729336.png") > system("convert tmp/364jw1258729336.ps tmp/364jw1258729336.png") > system("convert tmp/4jbgv1258729336.ps tmp/4jbgv1258729336.png") > system("convert tmp/5thol1258729336.ps tmp/5thol1258729336.png") > system("convert tmp/62u4t1258729336.ps tmp/62u4t1258729336.png") > system("convert tmp/74edg1258729336.ps tmp/74edg1258729336.png") > system("convert tmp/8gl141258729336.ps tmp/8gl141258729336.png") > system("convert tmp/9y0qc1258729336.ps tmp/9y0qc1258729336.png") > system("convert tmp/10fldp1258729336.ps tmp/10fldp1258729336.png") > > > proc.time() user system elapsed 2.494 1.607 4.549