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(24,24,22,23,25,24,24,24,29,27,26,28,26,25,21,19,23,19,22,19,21,20,16,16,19,22,16,21,25,25,27,29,23,28,22,25,23,26,20,24,24,28,23,28,20,28,21,28,22,32,17,31,21,22,19,29,23,31,22,29,15,32,23,32,21,31,18,29,18,28,18,28,18,29,10,22,13,26,10,24,9,27,9,27,6,23,11,21,9,19,10,17,9,19,16,21,10,13,7,8,7,5,14,10,11,6,10,6,6,8,8,11,13,12,12,13,15,19,16,19,16,18),dim=c(2,61),dimnames=list(c('s','consv'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('s','consv'),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 s consv M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 24 24 1 0 0 0 0 0 0 0 0 0 0 2 22 23 0 1 0 0 0 0 0 0 0 0 0 3 25 24 0 0 1 0 0 0 0 0 0 0 0 4 24 24 0 0 0 1 0 0 0 0 0 0 0 5 29 27 0 0 0 0 1 0 0 0 0 0 0 6 26 28 0 0 0 0 0 1 0 0 0 0 0 7 26 25 0 0 0 0 0 0 1 0 0 0 0 8 21 19 0 0 0 0 0 0 0 1 0 0 0 9 23 19 0 0 0 0 0 0 0 0 1 0 0 10 22 19 0 0 0 0 0 0 0 0 0 1 0 11 21 20 0 0 0 0 0 0 0 0 0 0 1 12 16 16 0 0 0 0 0 0 0 0 0 0 0 13 19 22 1 0 0 0 0 0 0 0 0 0 0 14 16 21 0 1 0 0 0 0 0 0 0 0 0 15 25 25 0 0 1 0 0 0 0 0 0 0 0 16 27 29 0 0 0 1 0 0 0 0 0 0 0 17 23 28 0 0 0 0 1 0 0 0 0 0 0 18 22 25 0 0 0 0 0 1 0 0 0 0 0 19 23 26 0 0 0 0 0 0 1 0 0 0 0 20 20 24 0 0 0 0 0 0 0 1 0 0 0 21 24 28 0 0 0 0 0 0 0 0 1 0 0 22 23 28 0 0 0 0 0 0 0 0 0 1 0 23 20 28 0 0 0 0 0 0 0 0 0 0 1 24 21 28 0 0 0 0 0 0 0 0 0 0 0 25 22 32 1 0 0 0 0 0 0 0 0 0 0 26 17 31 0 1 0 0 0 0 0 0 0 0 0 27 21 22 0 0 1 0 0 0 0 0 0 0 0 28 19 29 0 0 0 1 0 0 0 0 0 0 0 29 23 31 0 0 0 0 1 0 0 0 0 0 0 30 22 29 0 0 0 0 0 1 0 0 0 0 0 31 15 32 0 0 0 0 0 0 1 0 0 0 0 32 23 32 0 0 0 0 0 0 0 1 0 0 0 33 21 31 0 0 0 0 0 0 0 0 1 0 0 34 18 29 0 0 0 0 0 0 0 0 0 1 0 35 18 28 0 0 0 0 0 0 0 0 0 0 1 36 18 28 0 0 0 0 0 0 0 0 0 0 0 37 18 29 1 0 0 0 0 0 0 0 0 0 0 38 10 22 0 1 0 0 0 0 0 0 0 0 0 39 13 26 0 0 1 0 0 0 0 0 0 0 0 40 10 24 0 0 0 1 0 0 0 0 0 0 0 41 9 27 0 0 0 0 1 0 0 0 0 0 0 42 9 27 0 0 0 0 0 1 0 0 0 0 0 43 6 23 0 0 0 0 0 0 1 0 0 0 0 44 11 21 0 0 0 0 0 0 0 1 0 0 0 45 9 19 0 0 0 0 0 0 0 0 1 0 0 46 10 17 0 0 0 0 0 0 0 0 0 1 0 47 9 19 0 0 0 0 0 0 0 0 0 0 1 48 16 21 0 0 0 0 0 0 0 0 0 0 0 49 10 13 1 0 0 0 0 0 0 0 0 0 0 50 7 8 0 1 0 0 0 0 0 0 0 0 0 51 7 5 0 0 1 0 0 0 0 0 0 0 0 52 14 10 0 0 0 1 0 0 0 0 0 0 0 53 11 6 0 0 0 0 1 0 0 0 0 0 0 54 10 6 0 0 0 0 0 1 0 0 0 0 0 55 6 8 0 0 0 0 0 0 1 0 0 0 0 56 8 11 0 0 0 0 0 0 0 1 0 0 0 57 13 12 0 0 0 0 0 0 0 0 1 0 0 58 12 13 0 0 0 0 0 0 0 0 0 1 0 59 15 19 0 0 0 0 0 0 0 0 0 0 1 60 16 19 0 0 0 0 0 0 0 0 0 0 0 61 16 18 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) consv M1 M2 M3 M4 5.6212 0.5258 0.4512 -2.2638 1.8517 0.9793 M5 M6 M7 M8 M9 M10 0.8638 0.0845 -2.4103 -0.2742 0.9155 0.2310 M11 -1.0103 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.6827 -2.9083 0.4625 2.7398 9.6432 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.62125 3.21246 1.750 0.0865 . consv 0.52584 0.09648 5.450 1.71e-06 *** M1 0.45116 3.21873 0.140 0.8891 M2 -2.26383 3.36402 -0.673 0.5042 M3 1.85167 3.36684 0.550 0.5849 M4 0.97933 3.36219 0.291 0.7721 M5 0.86383 3.36402 0.257 0.7984 M6 0.08450 3.36181 0.025 0.9801 M7 -2.41033 3.36153 -0.717 0.4768 M8 -0.27416 3.36269 -0.082 0.9354 M9 0.91550 3.36181 0.272 0.7865 M10 0.23100 3.36330 0.069 0.9455 M11 -1.01033 3.36153 -0.301 0.7650 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.315 on 48 degrees of freedom Multiple R-squared: 0.4111, Adjusted R-squared: 0.2639 F-statistic: 2.792 on 12 and 48 DF, p-value: 0.005744 > 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.13338062 0.26676125 0.86661938 [2,] 0.25028360 0.50056721 0.74971640 [3,] 0.15360220 0.30720440 0.84639780 [4,] 0.16931735 0.33863469 0.83068265 [5,] 0.15569129 0.31138257 0.84430871 [6,] 0.12052065 0.24104129 0.87947935 [7,] 0.08622627 0.17245255 0.91377373 [8,] 0.06042144 0.12084289 0.93957856 [9,] 0.04049027 0.08098054 0.95950973 [10,] 0.02428526 0.04857052 0.97571474 [11,] 0.02045494 0.04090989 0.97954506 [12,] 0.02935003 0.05870007 0.97064997 [13,] 0.06038738 0.12077477 0.93961262 [14,] 0.07767054 0.15534108 0.92232946 [15,] 0.10568503 0.21137006 0.89431497 [16,] 0.28382347 0.56764694 0.71617653 [17,] 0.46320903 0.92641805 0.53679097 [18,] 0.58228056 0.83543887 0.41771944 [19,] 0.65163599 0.69672802 0.34836401 [20,] 0.69386420 0.61227159 0.30613580 [21,] 0.60839856 0.78320287 0.39160144 [22,] 0.63744387 0.72511225 0.36255613 [23,] 0.70850275 0.58299451 0.29149725 [24,] 0.88550330 0.22899341 0.11449670 [25,] 0.93468945 0.13062111 0.06531055 [26,] 0.94973188 0.10053625 0.05026812 [27,] 0.93906759 0.12186482 0.06093241 [28,] 0.91434326 0.17131349 0.08565674 [29,] 0.85712625 0.28574750 0.14287375 [30,] 0.83109709 0.33780582 0.16890291 > postscript(file="/var/www/html/rcomp/tmp/199w21258565284.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/2r4bg1258565284.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/3n9m91258565284.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/4u6ba1258565284.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/5nh5l1258565284.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 5.3074963 6.5483259 4.9069866 4.7793303 8.3173214 5.5708147 7 8 9 10 11 12 9.6431584 5.6620090 6.4723438 6.1568416 5.8723438 1.9653572 13 14 15 16 17 18 1.3591704 1.6000000 4.3811495 5.1501450 1.7914843 3.1483259 19 20 21 22 23 24 6.1173214 2.0328236 2.7398102 2.4243079 0.6656472 0.6553124 25 26 27 28 29 30 -0.8992003 -2.6583707 1.9586607 -2.8498550 0.2139731 1.0449776 31 32 33 34 35 36 -5.0377010 0.8261271 -1.8377010 -3.1015291 -1.3343528 -2.3446876 37 38 39 40 41 42 -3.3216891 -4.9258371 -8.1446876 -9.2206697 -11.6826786 -10.9033483 43 44 45 46 47 48 -9.3051674 -5.3896652 -7.5276562 -4.7914843 -5.6018191 -0.6638281 49 50 51 52 53 54 -2.9082960 -0.5641181 -3.1021091 2.1410493 1.3598998 1.1392302 55 56 57 58 59 60 -1.4176114 -3.1312945 0.1532033 -0.6881360 0.3981809 0.3878460 61 0.4625187 > postscript(file="/var/www/html/rcomp/tmp/6pi4h1258565284.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 5.3074963 NA 1 6.5483259 5.3074963 2 4.9069866 6.5483259 3 4.7793303 4.9069866 4 8.3173214 4.7793303 5 5.5708147 8.3173214 6 9.6431584 5.5708147 7 5.6620090 9.6431584 8 6.4723438 5.6620090 9 6.1568416 6.4723438 10 5.8723438 6.1568416 11 1.9653572 5.8723438 12 1.3591704 1.9653572 13 1.6000000 1.3591704 14 4.3811495 1.6000000 15 5.1501450 4.3811495 16 1.7914843 5.1501450 17 3.1483259 1.7914843 18 6.1173214 3.1483259 19 2.0328236 6.1173214 20 2.7398102 2.0328236 21 2.4243079 2.7398102 22 0.6656472 2.4243079 23 0.6553124 0.6656472 24 -0.8992003 0.6553124 25 -2.6583707 -0.8992003 26 1.9586607 -2.6583707 27 -2.8498550 1.9586607 28 0.2139731 -2.8498550 29 1.0449776 0.2139731 30 -5.0377010 1.0449776 31 0.8261271 -5.0377010 32 -1.8377010 0.8261271 33 -3.1015291 -1.8377010 34 -1.3343528 -3.1015291 35 -2.3446876 -1.3343528 36 -3.3216891 -2.3446876 37 -4.9258371 -3.3216891 38 -8.1446876 -4.9258371 39 -9.2206697 -8.1446876 40 -11.6826786 -9.2206697 41 -10.9033483 -11.6826786 42 -9.3051674 -10.9033483 43 -5.3896652 -9.3051674 44 -7.5276562 -5.3896652 45 -4.7914843 -7.5276562 46 -5.6018191 -4.7914843 47 -0.6638281 -5.6018191 48 -2.9082960 -0.6638281 49 -0.5641181 -2.9082960 50 -3.1021091 -0.5641181 51 2.1410493 -3.1021091 52 1.3598998 2.1410493 53 1.1392302 1.3598998 54 -1.4176114 1.1392302 55 -3.1312945 -1.4176114 56 0.1532033 -3.1312945 57 -0.6881360 0.1532033 58 0.3981809 -0.6881360 59 0.3878460 0.3981809 60 0.4625187 0.3878460 61 NA 0.4625187 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.5483259 5.3074963 [2,] 4.9069866 6.5483259 [3,] 4.7793303 4.9069866 [4,] 8.3173214 4.7793303 [5,] 5.5708147 8.3173214 [6,] 9.6431584 5.5708147 [7,] 5.6620090 9.6431584 [8,] 6.4723438 5.6620090 [9,] 6.1568416 6.4723438 [10,] 5.8723438 6.1568416 [11,] 1.9653572 5.8723438 [12,] 1.3591704 1.9653572 [13,] 1.6000000 1.3591704 [14,] 4.3811495 1.6000000 [15,] 5.1501450 4.3811495 [16,] 1.7914843 5.1501450 [17,] 3.1483259 1.7914843 [18,] 6.1173214 3.1483259 [19,] 2.0328236 6.1173214 [20,] 2.7398102 2.0328236 [21,] 2.4243079 2.7398102 [22,] 0.6656472 2.4243079 [23,] 0.6553124 0.6656472 [24,] -0.8992003 0.6553124 [25,] -2.6583707 -0.8992003 [26,] 1.9586607 -2.6583707 [27,] -2.8498550 1.9586607 [28,] 0.2139731 -2.8498550 [29,] 1.0449776 0.2139731 [30,] -5.0377010 1.0449776 [31,] 0.8261271 -5.0377010 [32,] -1.8377010 0.8261271 [33,] -3.1015291 -1.8377010 [34,] -1.3343528 -3.1015291 [35,] -2.3446876 -1.3343528 [36,] -3.3216891 -2.3446876 [37,] -4.9258371 -3.3216891 [38,] -8.1446876 -4.9258371 [39,] -9.2206697 -8.1446876 [40,] -11.6826786 -9.2206697 [41,] -10.9033483 -11.6826786 [42,] -9.3051674 -10.9033483 [43,] -5.3896652 -9.3051674 [44,] -7.5276562 -5.3896652 [45,] -4.7914843 -7.5276562 [46,] -5.6018191 -4.7914843 [47,] -0.6638281 -5.6018191 [48,] -2.9082960 -0.6638281 [49,] -0.5641181 -2.9082960 [50,] -3.1021091 -0.5641181 [51,] 2.1410493 -3.1021091 [52,] 1.3598998 2.1410493 [53,] 1.1392302 1.3598998 [54,] -1.4176114 1.1392302 [55,] -3.1312945 -1.4176114 [56,] 0.1532033 -3.1312945 [57,] -0.6881360 0.1532033 [58,] 0.3981809 -0.6881360 [59,] 0.3878460 0.3981809 [60,] 0.4625187 0.3878460 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.5483259 5.3074963 2 4.9069866 6.5483259 3 4.7793303 4.9069866 4 8.3173214 4.7793303 5 5.5708147 8.3173214 6 9.6431584 5.5708147 7 5.6620090 9.6431584 8 6.4723438 5.6620090 9 6.1568416 6.4723438 10 5.8723438 6.1568416 11 1.9653572 5.8723438 12 1.3591704 1.9653572 13 1.6000000 1.3591704 14 4.3811495 1.6000000 15 5.1501450 4.3811495 16 1.7914843 5.1501450 17 3.1483259 1.7914843 18 6.1173214 3.1483259 19 2.0328236 6.1173214 20 2.7398102 2.0328236 21 2.4243079 2.7398102 22 0.6656472 2.4243079 23 0.6553124 0.6656472 24 -0.8992003 0.6553124 25 -2.6583707 -0.8992003 26 1.9586607 -2.6583707 27 -2.8498550 1.9586607 28 0.2139731 -2.8498550 29 1.0449776 0.2139731 30 -5.0377010 1.0449776 31 0.8261271 -5.0377010 32 -1.8377010 0.8261271 33 -3.1015291 -1.8377010 34 -1.3343528 -3.1015291 35 -2.3446876 -1.3343528 36 -3.3216891 -2.3446876 37 -4.9258371 -3.3216891 38 -8.1446876 -4.9258371 39 -9.2206697 -8.1446876 40 -11.6826786 -9.2206697 41 -10.9033483 -11.6826786 42 -9.3051674 -10.9033483 43 -5.3896652 -9.3051674 44 -7.5276562 -5.3896652 45 -4.7914843 -7.5276562 46 -5.6018191 -4.7914843 47 -0.6638281 -5.6018191 48 -2.9082960 -0.6638281 49 -0.5641181 -2.9082960 50 -3.1021091 -0.5641181 51 2.1410493 -3.1021091 52 1.3598998 2.1410493 53 1.1392302 1.3598998 54 -1.4176114 1.1392302 55 -3.1312945 -1.4176114 56 0.1532033 -3.1312945 57 -0.6881360 0.1532033 58 0.3981809 -0.6881360 59 0.3878460 0.3981809 60 0.4625187 0.3878460 > 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/7q86m1258565284.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/8dyea1258565284.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/9ydvm1258565284.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/10awzf1258565284.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/113ic81258565284.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/12b0iy1258565284.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/13y6041258565284.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/14ad351258565284.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/15pk6b1258565284.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/16478o1258565284.tab") + } > > system("convert tmp/199w21258565284.ps tmp/199w21258565284.png") > system("convert tmp/2r4bg1258565284.ps tmp/2r4bg1258565284.png") > system("convert tmp/3n9m91258565284.ps tmp/3n9m91258565284.png") > system("convert tmp/4u6ba1258565284.ps tmp/4u6ba1258565284.png") > system("convert tmp/5nh5l1258565284.ps tmp/5nh5l1258565284.png") > system("convert tmp/6pi4h1258565284.ps tmp/6pi4h1258565284.png") > system("convert tmp/7q86m1258565284.ps tmp/7q86m1258565284.png") > system("convert tmp/8dyea1258565284.ps tmp/8dyea1258565284.png") > system("convert tmp/9ydvm1258565284.ps tmp/9ydvm1258565284.png") > system("convert tmp/10awzf1258565284.ps tmp/10awzf1258565284.png") > > > proc.time() user system elapsed 2.363 1.525 2.773