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(93.0,0,99.2,0,112.2,0,112.1,0,103.3,0,108.2,0,90.4,0,72.8,0,111.0,0,117.9,0,111.3,0,110.5,0,94.8,0,100.4,0,132.1,0,114.6,0,101.9,0,130.2,0,84.0,0,86.4,0,122.3,0,120.9,0,110.2,0,112.6,0,102.0,0,105.0,0,130.5,0,115.5,0,103.7,0,130.9,0,89.1,0,93.8,0,123.8,0,111.9,0,118.3,0,116.9,0,103.6,1,116.6,1,141.3,1,107.0,1,125.2,1,136.4,1,91.6,1,95.3,1,132.3,1,130.6,1,131.9,1,118.6,1,114.3,1,111.3,1,126.5,1,112.1,1,119.3,1,142.4,1,101.1,1,97.4,1,129.1,1,136.9,1,129.8,1,123.9,1),dim=c(2,60),dimnames=list(c('INV','INVA'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('INV','INVA'),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 INV INVA M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 93.0 0 1 0 0 0 0 0 0 0 0 0 0 2 99.2 0 0 1 0 0 0 0 0 0 0 0 0 3 112.2 0 0 0 1 0 0 0 0 0 0 0 0 4 112.1 0 0 0 0 1 0 0 0 0 0 0 0 5 103.3 0 0 0 0 0 1 0 0 0 0 0 0 6 108.2 0 0 0 0 0 0 1 0 0 0 0 0 7 90.4 0 0 0 0 0 0 0 1 0 0 0 0 8 72.8 0 0 0 0 0 0 0 0 1 0 0 0 9 111.0 0 0 0 0 0 0 0 0 0 1 0 0 10 117.9 0 0 0 0 0 0 0 0 0 0 1 0 11 111.3 0 0 0 0 0 0 0 0 0 0 0 1 12 110.5 0 0 0 0 0 0 0 0 0 0 0 0 13 94.8 0 1 0 0 0 0 0 0 0 0 0 0 14 100.4 0 0 1 0 0 0 0 0 0 0 0 0 15 132.1 0 0 0 1 0 0 0 0 0 0 0 0 16 114.6 0 0 0 0 1 0 0 0 0 0 0 0 17 101.9 0 0 0 0 0 1 0 0 0 0 0 0 18 130.2 0 0 0 0 0 0 1 0 0 0 0 0 19 84.0 0 0 0 0 0 0 0 1 0 0 0 0 20 86.4 0 0 0 0 0 0 0 0 1 0 0 0 21 122.3 0 0 0 0 0 0 0 0 0 1 0 0 22 120.9 0 0 0 0 0 0 0 0 0 0 1 0 23 110.2 0 0 0 0 0 0 0 0 0 0 0 1 24 112.6 0 0 0 0 0 0 0 0 0 0 0 0 25 102.0 0 1 0 0 0 0 0 0 0 0 0 0 26 105.0 0 0 1 0 0 0 0 0 0 0 0 0 27 130.5 0 0 0 1 0 0 0 0 0 0 0 0 28 115.5 0 0 0 0 1 0 0 0 0 0 0 0 29 103.7 0 0 0 0 0 1 0 0 0 0 0 0 30 130.9 0 0 0 0 0 0 1 0 0 0 0 0 31 89.1 0 0 0 0 0 0 0 1 0 0 0 0 32 93.8 0 0 0 0 0 0 0 0 1 0 0 0 33 123.8 0 0 0 0 0 0 0 0 0 1 0 0 34 111.9 0 0 0 0 0 0 0 0 0 0 1 0 35 118.3 0 0 0 0 0 0 0 0 0 0 0 1 36 116.9 0 0 0 0 0 0 0 0 0 0 0 0 37 103.6 1 1 0 0 0 0 0 0 0 0 0 0 38 116.6 1 0 1 0 0 0 0 0 0 0 0 0 39 141.3 1 0 0 1 0 0 0 0 0 0 0 0 40 107.0 1 0 0 0 1 0 0 0 0 0 0 0 41 125.2 1 0 0 0 0 1 0 0 0 0 0 0 42 136.4 1 0 0 0 0 0 1 0 0 0 0 0 43 91.6 1 0 0 0 0 0 0 1 0 0 0 0 44 95.3 1 0 0 0 0 0 0 0 1 0 0 0 45 132.3 1 0 0 0 0 0 0 0 0 1 0 0 46 130.6 1 0 0 0 0 0 0 0 0 0 1 0 47 131.9 1 0 0 0 0 0 0 0 0 0 0 1 48 118.6 1 0 0 0 0 0 0 0 0 0 0 0 49 114.3 1 1 0 0 0 0 0 0 0 0 0 0 50 111.3 1 0 1 0 0 0 0 0 0 0 0 0 51 126.5 1 0 0 1 0 0 0 0 0 0 0 0 52 112.1 1 0 0 0 1 0 0 0 0 0 0 0 53 119.3 1 0 0 0 0 1 0 0 0 0 0 0 54 142.4 1 0 0 0 0 0 1 0 0 0 0 0 55 101.1 1 0 0 0 0 0 0 1 0 0 0 0 56 97.4 1 0 0 0 0 0 0 0 1 0 0 0 57 129.1 1 0 0 0 0 0 0 0 0 1 0 0 58 136.9 1 0 0 0 0 0 0 0 0 0 1 0 59 129.8 1 0 0 0 0 0 0 0 0 0 0 1 60 123.9 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) INVA M1 M2 M3 M4 111.86 11.61 -14.96 -10.00 12.02 -4.24 M5 M6 M7 M8 M9 M10 -5.82 13.12 -25.26 -27.36 7.20 7.14 M11 3.80 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -16.775 -3.025 1.019 4.661 9.305 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 111.855 2.952 37.892 < 2e-16 *** INVA 11.613 1.693 6.859 1.34e-08 *** M1 -14.960 4.063 -3.682 0.000597 *** M2 -10.000 4.063 -2.461 0.017582 * M3 12.020 4.063 2.958 0.004832 ** M4 -4.240 4.063 -1.043 0.302064 M5 -5.820 4.063 -1.432 0.158669 M6 13.120 4.063 3.229 0.002269 ** M7 -25.260 4.063 -6.217 1.26e-07 *** M8 -27.360 4.063 -6.733 2.08e-08 *** M9 7.200 4.063 1.772 0.082886 . M10 7.140 4.063 1.757 0.085400 . M11 3.800 4.063 0.935 0.354469 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.425 on 47 degrees of freedom Multiple R-squared: 0.8619, Adjusted R-squared: 0.8266 F-statistic: 24.43 on 12 and 47 DF, p-value: 3.339e-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.9156784 0.16864327 0.08432163 [2,] 0.8586807 0.28263850 0.14131925 [3,] 0.9787056 0.04258884 0.02129442 [4,] 0.9659893 0.06802147 0.03401073 [5,] 0.9704536 0.05909288 0.02954644 [6,] 0.9651838 0.06963247 0.03481623 [7,] 0.9400787 0.11984261 0.05992131 [8,] 0.9360055 0.12798901 0.06399450 [9,] 0.8988734 0.20225316 0.10112658 [10,] 0.8759220 0.24815607 0.12407803 [11,] 0.8303883 0.33922333 0.16961166 [12,] 0.8108235 0.37835303 0.18917652 [13,] 0.8770123 0.24597532 0.12298766 [14,] 0.8682635 0.26347297 0.13173649 [15,] 0.8648231 0.27035389 0.13517695 [16,] 0.8080065 0.38398700 0.19199350 [17,] 0.8621532 0.27569361 0.13784680 [18,] 0.8368120 0.32637595 0.16318798 [19,] 0.8818837 0.23623262 0.11811631 [20,] 0.8655980 0.26880391 0.13440196 [21,] 0.8061471 0.38770589 0.19385295 [22,] 0.8228838 0.35423234 0.17711617 [23,] 0.7775290 0.44494207 0.22247103 [24,] 0.9154183 0.16916334 0.08458167 [25,] 0.9220993 0.15580149 0.07790074 [26,] 0.9126397 0.17472053 0.08736026 [27,] 0.8812534 0.23749325 0.11874663 [28,] 0.9287614 0.14247724 0.07123862 [29,] 0.8398318 0.32033640 0.16016820 > postscript(file="/var/www/html/rcomp/tmp/1zixj1229619353.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/2ztyx1229619353.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/38w6v1229619353.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/4y5my1229619353.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/56k6m1229619353.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 7 8 -3.8950 -2.6550 -11.6750 4.4850 -2.7350 -16.7750 3.8050 -11.6950 9 10 11 12 13 14 15 16 -8.0550 -1.0950 -4.3550 -1.3550 -2.0950 -1.4550 8.2250 6.9850 17 18 19 20 21 22 23 24 -4.1350 5.2250 -2.5950 1.9050 3.2450 1.9050 -5.4550 0.7450 25 26 27 28 29 30 31 32 5.1050 3.1450 6.6250 7.8850 -2.3350 5.9250 2.5050 9.3050 33 34 35 36 37 38 39 40 4.7450 -7.0950 2.6450 5.0450 -4.9075 3.1325 5.8125 -12.2275 41 42 43 44 45 46 47 48 7.5525 -0.1875 -6.6075 -0.8075 1.6325 -0.0075 4.6325 -4.8675 49 50 51 52 53 54 55 56 5.7925 -2.1675 -8.9875 -7.1275 1.6525 5.8125 2.8925 1.2925 57 58 59 60 -1.5675 6.2925 2.5325 0.4325 > postscript(file="/var/www/html/rcomp/tmp/6quk11229619353.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 -3.8950 NA 1 -2.6550 -3.8950 2 -11.6750 -2.6550 3 4.4850 -11.6750 4 -2.7350 4.4850 5 -16.7750 -2.7350 6 3.8050 -16.7750 7 -11.6950 3.8050 8 -8.0550 -11.6950 9 -1.0950 -8.0550 10 -4.3550 -1.0950 11 -1.3550 -4.3550 12 -2.0950 -1.3550 13 -1.4550 -2.0950 14 8.2250 -1.4550 15 6.9850 8.2250 16 -4.1350 6.9850 17 5.2250 -4.1350 18 -2.5950 5.2250 19 1.9050 -2.5950 20 3.2450 1.9050 21 1.9050 3.2450 22 -5.4550 1.9050 23 0.7450 -5.4550 24 5.1050 0.7450 25 3.1450 5.1050 26 6.6250 3.1450 27 7.8850 6.6250 28 -2.3350 7.8850 29 5.9250 -2.3350 30 2.5050 5.9250 31 9.3050 2.5050 32 4.7450 9.3050 33 -7.0950 4.7450 34 2.6450 -7.0950 35 5.0450 2.6450 36 -4.9075 5.0450 37 3.1325 -4.9075 38 5.8125 3.1325 39 -12.2275 5.8125 40 7.5525 -12.2275 41 -0.1875 7.5525 42 -6.6075 -0.1875 43 -0.8075 -6.6075 44 1.6325 -0.8075 45 -0.0075 1.6325 46 4.6325 -0.0075 47 -4.8675 4.6325 48 5.7925 -4.8675 49 -2.1675 5.7925 50 -8.9875 -2.1675 51 -7.1275 -8.9875 52 1.6525 -7.1275 53 5.8125 1.6525 54 2.8925 5.8125 55 1.2925 2.8925 56 -1.5675 1.2925 57 6.2925 -1.5675 58 2.5325 6.2925 59 0.4325 2.5325 60 NA 0.4325 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.6550 -3.8950 [2,] -11.6750 -2.6550 [3,] 4.4850 -11.6750 [4,] -2.7350 4.4850 [5,] -16.7750 -2.7350 [6,] 3.8050 -16.7750 [7,] -11.6950 3.8050 [8,] -8.0550 -11.6950 [9,] -1.0950 -8.0550 [10,] -4.3550 -1.0950 [11,] -1.3550 -4.3550 [12,] -2.0950 -1.3550 [13,] -1.4550 -2.0950 [14,] 8.2250 -1.4550 [15,] 6.9850 8.2250 [16,] -4.1350 6.9850 [17,] 5.2250 -4.1350 [18,] -2.5950 5.2250 [19,] 1.9050 -2.5950 [20,] 3.2450 1.9050 [21,] 1.9050 3.2450 [22,] -5.4550 1.9050 [23,] 0.7450 -5.4550 [24,] 5.1050 0.7450 [25,] 3.1450 5.1050 [26,] 6.6250 3.1450 [27,] 7.8850 6.6250 [28,] -2.3350 7.8850 [29,] 5.9250 -2.3350 [30,] 2.5050 5.9250 [31,] 9.3050 2.5050 [32,] 4.7450 9.3050 [33,] -7.0950 4.7450 [34,] 2.6450 -7.0950 [35,] 5.0450 2.6450 [36,] -4.9075 5.0450 [37,] 3.1325 -4.9075 [38,] 5.8125 3.1325 [39,] -12.2275 5.8125 [40,] 7.5525 -12.2275 [41,] -0.1875 7.5525 [42,] -6.6075 -0.1875 [43,] -0.8075 -6.6075 [44,] 1.6325 -0.8075 [45,] -0.0075 1.6325 [46,] 4.6325 -0.0075 [47,] -4.8675 4.6325 [48,] 5.7925 -4.8675 [49,] -2.1675 5.7925 [50,] -8.9875 -2.1675 [51,] -7.1275 -8.9875 [52,] 1.6525 -7.1275 [53,] 5.8125 1.6525 [54,] 2.8925 5.8125 [55,] 1.2925 2.8925 [56,] -1.5675 1.2925 [57,] 6.2925 -1.5675 [58,] 2.5325 6.2925 [59,] 0.4325 2.5325 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.6550 -3.8950 2 -11.6750 -2.6550 3 4.4850 -11.6750 4 -2.7350 4.4850 5 -16.7750 -2.7350 6 3.8050 -16.7750 7 -11.6950 3.8050 8 -8.0550 -11.6950 9 -1.0950 -8.0550 10 -4.3550 -1.0950 11 -1.3550 -4.3550 12 -2.0950 -1.3550 13 -1.4550 -2.0950 14 8.2250 -1.4550 15 6.9850 8.2250 16 -4.1350 6.9850 17 5.2250 -4.1350 18 -2.5950 5.2250 19 1.9050 -2.5950 20 3.2450 1.9050 21 1.9050 3.2450 22 -5.4550 1.9050 23 0.7450 -5.4550 24 5.1050 0.7450 25 3.1450 5.1050 26 6.6250 3.1450 27 7.8850 6.6250 28 -2.3350 7.8850 29 5.9250 -2.3350 30 2.5050 5.9250 31 9.3050 2.5050 32 4.7450 9.3050 33 -7.0950 4.7450 34 2.6450 -7.0950 35 5.0450 2.6450 36 -4.9075 5.0450 37 3.1325 -4.9075 38 5.8125 3.1325 39 -12.2275 5.8125 40 7.5525 -12.2275 41 -0.1875 7.5525 42 -6.6075 -0.1875 43 -0.8075 -6.6075 44 1.6325 -0.8075 45 -0.0075 1.6325 46 4.6325 -0.0075 47 -4.8675 4.6325 48 5.7925 -4.8675 49 -2.1675 5.7925 50 -8.9875 -2.1675 51 -7.1275 -8.9875 52 1.6525 -7.1275 53 5.8125 1.6525 54 2.8925 5.8125 55 1.2925 2.8925 56 -1.5675 1.2925 57 6.2925 -1.5675 58 2.5325 6.2925 59 0.4325 2.5325 > 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/7esu11229619353.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/8f3h01229619353.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/9cvar1229619353.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/10pzhc1229619353.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/112cin1229619354.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/12redv1229619354.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/13jege1229619354.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/14jkzj1229619354.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/15ssum1229619354.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/160byx1229619354.tab") + } > > system("convert tmp/1zixj1229619353.ps tmp/1zixj1229619353.png") > system("convert tmp/2ztyx1229619353.ps tmp/2ztyx1229619353.png") > system("convert tmp/38w6v1229619353.ps tmp/38w6v1229619353.png") > system("convert tmp/4y5my1229619353.ps tmp/4y5my1229619353.png") > system("convert tmp/56k6m1229619353.ps tmp/56k6m1229619353.png") > system("convert tmp/6quk11229619353.ps tmp/6quk11229619353.png") > system("convert tmp/7esu11229619353.ps tmp/7esu11229619353.png") > system("convert tmp/8f3h01229619353.ps tmp/8f3h01229619353.png") > system("convert tmp/9cvar1229619353.ps tmp/9cvar1229619353.png") > system("convert tmp/10pzhc1229619353.ps tmp/10pzhc1229619353.png") > > > proc.time() user system elapsed 2.700 1.747 4.152