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(3.2,1,1.9,1,0,1,0.6,1,0.2,1,0.9,1,2.4,1,4.7,1,9.4,1,12.5,1,15.8,1,18.2,1,16.8,0,17.3,0,19.3,0,17.9,0,20.2,0,18.7,0,20.1,0,18.2,0,18.4,0,18.2,0,18.9,0,19.9,0,21.3,0,20,0,19.5,0,19.6,0,20.9,0,21,0,19.9,0,19.6,0,20.9,0,21.7,0,22.9,0,21.5,0,21.3,0,23.5,0,21.6,0,24.5,0,22.2,0,23.5,0,20.9,0,20.7,0,18.1,0,17.1,0,14.8,0,13.8,0,15.2,0,16,0,17.6,0,15,0,15,0,16.3,0,19.4,0,21.3,0,20.5,0,21.1,0,21.6,0,22.6,0),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 3.2 1 1 0 0 0 0 0 0 0 0 0 0 2 1.9 1 0 1 0 0 0 0 0 0 0 0 0 3 0.0 1 0 0 1 0 0 0 0 0 0 0 0 4 0.6 1 0 0 0 1 0 0 0 0 0 0 0 5 0.2 1 0 0 0 0 1 0 0 0 0 0 0 6 0.9 1 0 0 0 0 0 1 0 0 0 0 0 7 2.4 1 0 0 0 0 0 0 1 0 0 0 0 8 4.7 1 0 0 0 0 0 0 0 1 0 0 0 9 9.4 1 0 0 0 0 0 0 0 0 1 0 0 10 12.5 1 0 0 0 0 0 0 0 0 0 1 0 11 15.8 1 0 0 0 0 0 0 0 0 0 0 1 12 18.2 1 0 0 0 0 0 0 0 0 0 0 0 13 16.8 0 1 0 0 0 0 0 0 0 0 0 0 14 17.3 0 0 1 0 0 0 0 0 0 0 0 0 15 19.3 0 0 0 1 0 0 0 0 0 0 0 0 16 17.9 0 0 0 0 1 0 0 0 0 0 0 0 17 20.2 0 0 0 0 0 1 0 0 0 0 0 0 18 18.7 0 0 0 0 0 0 1 0 0 0 0 0 19 20.1 0 0 0 0 0 0 0 1 0 0 0 0 20 18.2 0 0 0 0 0 0 0 0 1 0 0 0 21 18.4 0 0 0 0 0 0 0 0 0 1 0 0 22 18.2 0 0 0 0 0 0 0 0 0 0 1 0 23 18.9 0 0 0 0 0 0 0 0 0 0 0 1 24 19.9 0 0 0 0 0 0 0 0 0 0 0 0 25 21.3 0 1 0 0 0 0 0 0 0 0 0 0 26 20.0 0 0 1 0 0 0 0 0 0 0 0 0 27 19.5 0 0 0 1 0 0 0 0 0 0 0 0 28 19.6 0 0 0 0 1 0 0 0 0 0 0 0 29 20.9 0 0 0 0 0 1 0 0 0 0 0 0 30 21.0 0 0 0 0 0 0 1 0 0 0 0 0 31 19.9 0 0 0 0 0 0 0 1 0 0 0 0 32 19.6 0 0 0 0 0 0 0 0 1 0 0 0 33 20.9 0 0 0 0 0 0 0 0 0 1 0 0 34 21.7 0 0 0 0 0 0 0 0 0 0 1 0 35 22.9 0 0 0 0 0 0 0 0 0 0 0 1 36 21.5 0 0 0 0 0 0 0 0 0 0 0 0 37 21.3 0 1 0 0 0 0 0 0 0 0 0 0 38 23.5 0 0 1 0 0 0 0 0 0 0 0 0 39 21.6 0 0 0 1 0 0 0 0 0 0 0 0 40 24.5 0 0 0 0 1 0 0 0 0 0 0 0 41 22.2 0 0 0 0 0 1 0 0 0 0 0 0 42 23.5 0 0 0 0 0 0 1 0 0 0 0 0 43 20.9 0 0 0 0 0 0 0 1 0 0 0 0 44 20.7 0 0 0 0 0 0 0 0 1 0 0 0 45 18.1 0 0 0 0 0 0 0 0 0 1 0 0 46 17.1 0 0 0 0 0 0 0 0 0 0 1 0 47 14.8 0 0 0 0 0 0 0 0 0 0 0 1 48 13.8 0 0 0 0 0 0 0 0 0 0 0 0 49 15.2 0 1 0 0 0 0 0 0 0 0 0 0 50 16.0 0 0 1 0 0 0 0 0 0 0 0 0 51 17.6 0 0 0 1 0 0 0 0 0 0 0 0 52 15.0 0 0 0 0 1 0 0 0 0 0 0 0 53 15.0 0 0 0 0 0 1 0 0 0 0 0 0 54 16.3 0 0 0 0 0 0 1 0 0 0 0 0 55 19.4 0 0 0 0 0 0 0 1 0 0 0 0 56 21.3 0 0 0 0 0 0 0 0 1 0 0 0 57 20.5 0 0 0 0 0 0 0 0 0 1 0 0 58 21.1 0 0 0 0 0 0 0 0 0 0 1 0 59 21.6 0 0 0 0 0 0 0 0 0 0 0 1 60 22.6 0 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 21.94 -13.69 -3.64 -3.46 -3.60 -3.68 M5 M6 M7 M8 M9 M10 -3.50 -3.12 -2.66 -2.30 -1.74 -1.08 M11 -0.40 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.13792 -2.48792 0.09208 1.63208 9.95167 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 21.938 1.693 12.955 < 2e-16 *** X -13.690 1.210 -11.317 5.08e-15 *** M1 -3.640 2.370 -1.536 0.131 M2 -3.460 2.370 -1.460 0.151 M3 -3.600 2.370 -1.519 0.136 M4 -3.680 2.370 -1.553 0.127 M5 -3.500 2.370 -1.477 0.146 M6 -3.120 2.370 -1.316 0.194 M7 -2.660 2.370 -1.122 0.267 M8 -2.300 2.370 -0.970 0.337 M9 -1.740 2.370 -0.734 0.467 M10 -1.080 2.370 -0.456 0.651 M11 -0.400 2.370 -0.169 0.867 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.748 on 47 degrees of freedom Multiple R-squared: 0.7418, Adjusted R-squared: 0.6759 F-statistic: 11.25 on 12 and 47 DF, p-value: 3.967e-10 > 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.20120183 0.40240366 0.7987982 [2,] 0.18277735 0.36555470 0.8172227 [3,] 0.09365197 0.18730393 0.9063480 [4,] 0.04324974 0.08649947 0.9567503 [5,] 0.05083288 0.10166576 0.9491671 [6,] 0.21531572 0.43063145 0.7846843 [7,] 0.52983862 0.94032276 0.4701614 [8,] 0.77482994 0.45034011 0.2251701 [9,] 0.88307612 0.23384775 0.1169239 [10,] 0.86703127 0.26593746 0.1329687 [11,] 0.82567615 0.34864770 0.1743238 [12,] 0.76979898 0.46040205 0.2302010 [13,] 0.71013144 0.57973713 0.2898686 [14,] 0.65741007 0.68517986 0.3425899 [15,] 0.59824142 0.80351716 0.4017586 [16,] 0.50494342 0.99011316 0.4950566 [17,] 0.41242519 0.82485039 0.5875748 [18,] 0.32336144 0.64672288 0.6766386 [19,] 0.25079101 0.50158202 0.7492090 [20,] 0.21362406 0.42724813 0.7863759 [21,] 0.18438677 0.36877353 0.8156132 [22,] 0.17005029 0.34010058 0.8299497 [23,] 0.21212994 0.42425987 0.7878701 [24,] 0.17583701 0.35167402 0.8241630 [25,] 0.30779385 0.61558771 0.6922061 [26,] 0.34589638 0.69179276 0.6541036 [27,] 0.41628953 0.83257907 0.5837105 [28,] 0.28912030 0.57824061 0.7108797 [29,] 0.16943206 0.33886412 0.8305679 > postscript(file="/var/www/html/rcomp/tmp/1lrec1258739076.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/2mcck1258739076.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/3pzqg1258739076.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/46yeq1258739076.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/5lez51258739076.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 -1.40833333 -2.88833333 -4.64833333 -3.96833333 -4.54833333 -4.22833333 7 8 9 10 11 12 -3.18833333 -1.24833333 2.89166667 5.33166667 7.95166667 9.95166667 13 14 15 16 17 18 -1.49791667 -1.17791667 0.96208333 -0.35791667 1.76208333 -0.11791667 19 20 21 22 23 24 0.82208333 -1.43791667 -1.79791667 -2.65791667 -2.63791667 -2.03791667 25 26 27 28 29 30 3.00208333 1.52208333 1.16208333 1.34208333 2.46208333 2.18208333 31 32 33 34 35 36 0.62208333 -0.03791667 0.70208333 0.84208333 1.36208333 -0.43791667 37 38 39 40 41 42 3.00208333 5.02208333 3.26208333 6.24208333 3.76208333 4.68208333 43 44 45 46 47 48 1.62208333 1.06208333 -2.09791667 -3.75791667 -6.73791667 -8.13791667 49 50 51 52 53 54 -3.09791667 -2.47791667 -0.73791667 -3.25791667 -3.43791667 -2.51791667 55 56 57 58 59 60 0.12208333 1.66208333 0.30208333 0.24208333 0.06208333 0.66208333 > postscript(file="/var/www/html/rcomp/tmp/6ucrn1258739076.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 -1.40833333 NA 1 -2.88833333 -1.40833333 2 -4.64833333 -2.88833333 3 -3.96833333 -4.64833333 4 -4.54833333 -3.96833333 5 -4.22833333 -4.54833333 6 -3.18833333 -4.22833333 7 -1.24833333 -3.18833333 8 2.89166667 -1.24833333 9 5.33166667 2.89166667 10 7.95166667 5.33166667 11 9.95166667 7.95166667 12 -1.49791667 9.95166667 13 -1.17791667 -1.49791667 14 0.96208333 -1.17791667 15 -0.35791667 0.96208333 16 1.76208333 -0.35791667 17 -0.11791667 1.76208333 18 0.82208333 -0.11791667 19 -1.43791667 0.82208333 20 -1.79791667 -1.43791667 21 -2.65791667 -1.79791667 22 -2.63791667 -2.65791667 23 -2.03791667 -2.63791667 24 3.00208333 -2.03791667 25 1.52208333 3.00208333 26 1.16208333 1.52208333 27 1.34208333 1.16208333 28 2.46208333 1.34208333 29 2.18208333 2.46208333 30 0.62208333 2.18208333 31 -0.03791667 0.62208333 32 0.70208333 -0.03791667 33 0.84208333 0.70208333 34 1.36208333 0.84208333 35 -0.43791667 1.36208333 36 3.00208333 -0.43791667 37 5.02208333 3.00208333 38 3.26208333 5.02208333 39 6.24208333 3.26208333 40 3.76208333 6.24208333 41 4.68208333 3.76208333 42 1.62208333 4.68208333 43 1.06208333 1.62208333 44 -2.09791667 1.06208333 45 -3.75791667 -2.09791667 46 -6.73791667 -3.75791667 47 -8.13791667 -6.73791667 48 -3.09791667 -8.13791667 49 -2.47791667 -3.09791667 50 -0.73791667 -2.47791667 51 -3.25791667 -0.73791667 52 -3.43791667 -3.25791667 53 -2.51791667 -3.43791667 54 0.12208333 -2.51791667 55 1.66208333 0.12208333 56 0.30208333 1.66208333 57 0.24208333 0.30208333 58 0.06208333 0.24208333 59 0.66208333 0.06208333 60 NA 0.66208333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.88833333 -1.40833333 [2,] -4.64833333 -2.88833333 [3,] -3.96833333 -4.64833333 [4,] -4.54833333 -3.96833333 [5,] -4.22833333 -4.54833333 [6,] -3.18833333 -4.22833333 [7,] -1.24833333 -3.18833333 [8,] 2.89166667 -1.24833333 [9,] 5.33166667 2.89166667 [10,] 7.95166667 5.33166667 [11,] 9.95166667 7.95166667 [12,] -1.49791667 9.95166667 [13,] -1.17791667 -1.49791667 [14,] 0.96208333 -1.17791667 [15,] -0.35791667 0.96208333 [16,] 1.76208333 -0.35791667 [17,] -0.11791667 1.76208333 [18,] 0.82208333 -0.11791667 [19,] -1.43791667 0.82208333 [20,] -1.79791667 -1.43791667 [21,] -2.65791667 -1.79791667 [22,] -2.63791667 -2.65791667 [23,] -2.03791667 -2.63791667 [24,] 3.00208333 -2.03791667 [25,] 1.52208333 3.00208333 [26,] 1.16208333 1.52208333 [27,] 1.34208333 1.16208333 [28,] 2.46208333 1.34208333 [29,] 2.18208333 2.46208333 [30,] 0.62208333 2.18208333 [31,] -0.03791667 0.62208333 [32,] 0.70208333 -0.03791667 [33,] 0.84208333 0.70208333 [34,] 1.36208333 0.84208333 [35,] -0.43791667 1.36208333 [36,] 3.00208333 -0.43791667 [37,] 5.02208333 3.00208333 [38,] 3.26208333 5.02208333 [39,] 6.24208333 3.26208333 [40,] 3.76208333 6.24208333 [41,] 4.68208333 3.76208333 [42,] 1.62208333 4.68208333 [43,] 1.06208333 1.62208333 [44,] -2.09791667 1.06208333 [45,] -3.75791667 -2.09791667 [46,] -6.73791667 -3.75791667 [47,] -8.13791667 -6.73791667 [48,] -3.09791667 -8.13791667 [49,] -2.47791667 -3.09791667 [50,] -0.73791667 -2.47791667 [51,] -3.25791667 -0.73791667 [52,] -3.43791667 -3.25791667 [53,] -2.51791667 -3.43791667 [54,] 0.12208333 -2.51791667 [55,] 1.66208333 0.12208333 [56,] 0.30208333 1.66208333 [57,] 0.24208333 0.30208333 [58,] 0.06208333 0.24208333 [59,] 0.66208333 0.06208333 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.88833333 -1.40833333 2 -4.64833333 -2.88833333 3 -3.96833333 -4.64833333 4 -4.54833333 -3.96833333 5 -4.22833333 -4.54833333 6 -3.18833333 -4.22833333 7 -1.24833333 -3.18833333 8 2.89166667 -1.24833333 9 5.33166667 2.89166667 10 7.95166667 5.33166667 11 9.95166667 7.95166667 12 -1.49791667 9.95166667 13 -1.17791667 -1.49791667 14 0.96208333 -1.17791667 15 -0.35791667 0.96208333 16 1.76208333 -0.35791667 17 -0.11791667 1.76208333 18 0.82208333 -0.11791667 19 -1.43791667 0.82208333 20 -1.79791667 -1.43791667 21 -2.65791667 -1.79791667 22 -2.63791667 -2.65791667 23 -2.03791667 -2.63791667 24 3.00208333 -2.03791667 25 1.52208333 3.00208333 26 1.16208333 1.52208333 27 1.34208333 1.16208333 28 2.46208333 1.34208333 29 2.18208333 2.46208333 30 0.62208333 2.18208333 31 -0.03791667 0.62208333 32 0.70208333 -0.03791667 33 0.84208333 0.70208333 34 1.36208333 0.84208333 35 -0.43791667 1.36208333 36 3.00208333 -0.43791667 37 5.02208333 3.00208333 38 3.26208333 5.02208333 39 6.24208333 3.26208333 40 3.76208333 6.24208333 41 4.68208333 3.76208333 42 1.62208333 4.68208333 43 1.06208333 1.62208333 44 -2.09791667 1.06208333 45 -3.75791667 -2.09791667 46 -6.73791667 -3.75791667 47 -8.13791667 -6.73791667 48 -3.09791667 -8.13791667 49 -2.47791667 -3.09791667 50 -0.73791667 -2.47791667 51 -3.25791667 -0.73791667 52 -3.43791667 -3.25791667 53 -2.51791667 -3.43791667 54 0.12208333 -2.51791667 55 1.66208333 0.12208333 56 0.30208333 1.66208333 57 0.24208333 0.30208333 58 0.06208333 0.24208333 59 0.66208333 0.06208333 > 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/7oix61258739076.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/8tpxz1258739076.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/9um9q1258739076.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/109z811258739076.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/112tgn1258739076.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/12v2fj1258739076.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/13633s1258739077.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/14wybb1258739077.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/156qa01258739077.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/16n4q61258739077.tab") + } > system("convert tmp/1lrec1258739076.ps tmp/1lrec1258739076.png") > system("convert tmp/2mcck1258739076.ps tmp/2mcck1258739076.png") > system("convert tmp/3pzqg1258739076.ps tmp/3pzqg1258739076.png") > system("convert tmp/46yeq1258739076.ps tmp/46yeq1258739076.png") > system("convert tmp/5lez51258739076.ps tmp/5lez51258739076.png") > system("convert tmp/6ucrn1258739076.ps tmp/6ucrn1258739076.png") > system("convert tmp/7oix61258739076.ps tmp/7oix61258739076.png") > system("convert tmp/8tpxz1258739076.ps tmp/8tpxz1258739076.png") > system("convert tmp/9um9q1258739076.ps tmp/9um9q1258739076.png") > system("convert tmp/109z811258739076.ps tmp/109z811258739076.png") > > > proc.time() user system elapsed 2.430 1.562 5.720