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(8.2,9.9,8.0,9.8,7.5,9.3,6.8,8.3,6.5,8.0,6.6,8.5,7.6,10.4,8.0,11.1,8.1,10.9,7.7,10.0,7.5,9.2,7.6,9.2,7.8,9.5,7.8,9.6,7.8,9.5,7.5,9.1,7.5,8.9,7.1,9.0,7.5,10.1,7.5,10.3,7.6,10.2,7.7,9.6,7.7,9.2,7.9,9.3,8.1,9.4,8.2,9.4,8.2,9.2,8.2,9.0,7.9,9.0,7.3,9.0,6.9,9.8,6.6,10.0,6.7,9.8,6.9,9.3,7.0,9.0,7.1,9.0,7.2,9.1,7.1,9.1,6.9,9.1,7.0,9.2,6.8,8.8,6.4,8.3,6.7,8.4,6.6,8.1,6.4,7.7,6.3,7.9,6.2,7.9,6.5,8.0,6.8,7.9,6.8,7.6,6.4,7.1,6.1,6.8,5.8,6.5,6.1,6.9,7.2,8.2,7.3,8.7,6.9,8.3,6.1,7.9,5.8,7.5,6.2,7.8,7.1,8.3,7.7,8.4,7.9,8.2,7.7,7.7,7.4,7.2,7.5,7.3,8.0,8.1,8.1,8.5),dim=c(2,68),dimnames=list(c('Y','X'),1:68)) > y <- array(NA,dim=c(2,68),dimnames=list(c('Y','X'),1:68)) > 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 = 'Do not include Seasonal 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 1 8.2 9.9 2 8.0 9.8 3 7.5 9.3 4 6.8 8.3 5 6.5 8.0 6 6.6 8.5 7 7.6 10.4 8 8.0 11.1 9 8.1 10.9 10 7.7 10.0 11 7.5 9.2 12 7.6 9.2 13 7.8 9.5 14 7.8 9.6 15 7.8 9.5 16 7.5 9.1 17 7.5 8.9 18 7.1 9.0 19 7.5 10.1 20 7.5 10.3 21 7.6 10.2 22 7.7 9.6 23 7.7 9.2 24 7.9 9.3 25 8.1 9.4 26 8.2 9.4 27 8.2 9.2 28 8.2 9.0 29 7.9 9.0 30 7.3 9.0 31 6.9 9.8 32 6.6 10.0 33 6.7 9.8 34 6.9 9.3 35 7.0 9.0 36 7.1 9.0 37 7.2 9.1 38 7.1 9.1 39 6.9 9.1 40 7.0 9.2 41 6.8 8.8 42 6.4 8.3 43 6.7 8.4 44 6.6 8.1 45 6.4 7.7 46 6.3 7.9 47 6.2 7.9 48 6.5 8.0 49 6.8 7.9 50 6.8 7.6 51 6.4 7.1 52 6.1 6.8 53 5.8 6.5 54 6.1 6.9 55 7.2 8.2 56 7.3 8.7 57 6.9 8.3 58 6.1 7.9 59 5.8 7.5 60 6.2 7.8 61 7.1 8.3 62 7.7 8.4 63 7.9 8.2 64 7.7 7.7 65 7.4 7.2 66 7.5 7.3 67 8.0 8.1 68 8.1 8.5 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 3.5533 0.4152 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.1049 -0.3557 -0.1000 0.3027 1.0839 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.55332 0.57192 6.213 3.95e-08 *** X 0.41516 0.06471 6.416 1.75e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.5227 on 66 degrees of freedom Multiple R-squared: 0.3841, Adjusted R-squared: 0.3748 F-statistic: 41.16 on 1 and 66 DF, p-value: 1.747e-08 > 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.0053143608 0.0106287217 0.9946856392 [2,] 0.0146716526 0.0293433052 0.9853283474 [3,] 0.1640886973 0.3281773946 0.8359113027 [4,] 0.1552217031 0.3104434061 0.8447782969 [5,] 0.0894998359 0.1789996717 0.9105001641 [6,] 0.0475229845 0.0950459690 0.9524770155 [7,] 0.0286243900 0.0572487800 0.9713756100 [8,] 0.0198904270 0.0397808540 0.9801095730 [9,] 0.0146426031 0.0292852063 0.9853573969 [10,] 0.0091731329 0.0183462657 0.9908268671 [11,] 0.0061767195 0.0123534389 0.9938232805 [12,] 0.0032966470 0.0065932940 0.9967033530 [13,] 0.0020319756 0.0040639512 0.9979680244 [14,] 0.0011587032 0.0023174064 0.9988412968 [15,] 0.0009092398 0.0018184796 0.9990907602 [16,] 0.0008700998 0.0017401996 0.9991299002 [17,] 0.0005011396 0.0010022792 0.9994988604 [18,] 0.0002513491 0.0005026982 0.9997486509 [19,] 0.0001842540 0.0003685079 0.9998157460 [20,] 0.0002290926 0.0004581852 0.9997709074 [21,] 0.0005170978 0.0010341956 0.9994829022 [22,] 0.0015134219 0.0030268439 0.9984865781 [23,] 0.0049203559 0.0098407117 0.9950796441 [24,] 0.0165911447 0.0331822894 0.9834088553 [25,] 0.0205022801 0.0410045602 0.9794977199 [26,] 0.0142655457 0.0285310913 0.9857344543 [27,] 0.0277999507 0.0555999013 0.9722000493 [28,] 0.1012472982 0.2024945965 0.8987527018 [29,] 0.1748496310 0.3496992620 0.8251503690 [30,] 0.1757394335 0.3514788671 0.8242605665 [31,] 0.1493558807 0.2987117615 0.8506441193 [32,] 0.1181385012 0.2362770024 0.8818614988 [33,] 0.0890478277 0.1780956553 0.9109521723 [34,] 0.0690501388 0.1381002775 0.9309498612 [35,] 0.0640186372 0.1280372743 0.9359813628 [36,] 0.0573791656 0.1147583311 0.9426208344 [37,] 0.0554387026 0.1108774052 0.9445612974 [38,] 0.0692011175 0.1384022350 0.9307988825 [39,] 0.0623381591 0.1246763182 0.9376618409 [40,] 0.0523975617 0.1047951235 0.9476024383 [41,] 0.0418636844 0.0837273688 0.9581363156 [42,] 0.0440950831 0.0881901663 0.9559049169 [43,] 0.0565956824 0.1131913649 0.9434043176 [44,] 0.0535691387 0.1071382775 0.9464308613 [45,] 0.0385757169 0.0771514338 0.9614242831 [46,] 0.0262839145 0.0525678291 0.9737160855 [47,] 0.0165281801 0.0330563601 0.9834718199 [48,] 0.0101321158 0.0202642316 0.9898678842 [49,] 0.0067035563 0.0134071126 0.9932964437 [50,] 0.0047619942 0.0095239883 0.9952380058 [51,] 0.0028871658 0.0057743316 0.9971128342 [52,] 0.0017171588 0.0034343176 0.9982828412 [53,] 0.0012775504 0.0025551008 0.9987224496 [54,] 0.0062464411 0.0124928821 0.9937535589 [55,] 0.0848971832 0.1697943664 0.9151028168 [56,] 0.7324164660 0.5351670680 0.2675835340 [57,] 0.9871668446 0.0256663108 0.0128331554 [58,] 0.9993259845 0.0013480310 0.0006740155 [59,] 0.9976513945 0.0046972110 0.0023486055 > postscript(file="/var/www/html/rcomp/tmp/1s6581258569525.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/2nbfb1258569525.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/3wd1i1258569525.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/4m3jt1258569525.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/5yaq51258569525.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 = 68 Frequency = 1 1 2 3 4 5 6 0.536609986 0.378125824 0.085705013 -0.199136608 -0.374589094 -0.482168284 7 8 9 10 11 12 -0.270969203 -0.161580068 0.021451607 -0.004905852 0.127220851 0.227220851 13 14 15 16 17 18 0.302673338 0.261157500 0.302673338 0.168736689 0.251768365 -0.189747473 19 20 21 22 23 24 -0.246421690 -0.329453365 -0.187937527 0.161157500 0.327220851 0.485705013 25 26 27 28 29 30 0.644189175 0.744189175 0.827220851 0.910252527 0.610252527 0.010252527 31 32 33 34 35 36 -0.721874176 -1.104905852 -0.921874176 -0.514294987 -0.289747473 -0.189747473 37 38 39 40 41 42 -0.131263311 -0.231263311 -0.431263311 -0.372779149 -0.406715797 -0.599136608 43 44 45 46 47 48 -0.340652446 -0.316104932 -0.350041581 -0.533073256 -0.633073256 -0.374589094 49 50 51 52 53 54 -0.033073256 0.091474257 -0.100946554 -0.276399040 -0.451851526 -0.317914878 55 56 57 58 59 60 0.242379230 0.134800041 -0.099136608 -0.733073256 -0.867009905 -0.591557419 61 62 63 64 65 66 0.100863392 0.659347554 0.942379230 0.949958419 0.857537609 0.916021771 67 68 1.083895068 1.017831716 > postscript(file="/var/www/html/rcomp/tmp/676sr1258569525.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 = 68 Frequency = 1 lag(myerror, k = 1) myerror 0 0.536609986 NA 1 0.378125824 0.536609986 2 0.085705013 0.378125824 3 -0.199136608 0.085705013 4 -0.374589094 -0.199136608 5 -0.482168284 -0.374589094 6 -0.270969203 -0.482168284 7 -0.161580068 -0.270969203 8 0.021451607 -0.161580068 9 -0.004905852 0.021451607 10 0.127220851 -0.004905852 11 0.227220851 0.127220851 12 0.302673338 0.227220851 13 0.261157500 0.302673338 14 0.302673338 0.261157500 15 0.168736689 0.302673338 16 0.251768365 0.168736689 17 -0.189747473 0.251768365 18 -0.246421690 -0.189747473 19 -0.329453365 -0.246421690 20 -0.187937527 -0.329453365 21 0.161157500 -0.187937527 22 0.327220851 0.161157500 23 0.485705013 0.327220851 24 0.644189175 0.485705013 25 0.744189175 0.644189175 26 0.827220851 0.744189175 27 0.910252527 0.827220851 28 0.610252527 0.910252527 29 0.010252527 0.610252527 30 -0.721874176 0.010252527 31 -1.104905852 -0.721874176 32 -0.921874176 -1.104905852 33 -0.514294987 -0.921874176 34 -0.289747473 -0.514294987 35 -0.189747473 -0.289747473 36 -0.131263311 -0.189747473 37 -0.231263311 -0.131263311 38 -0.431263311 -0.231263311 39 -0.372779149 -0.431263311 40 -0.406715797 -0.372779149 41 -0.599136608 -0.406715797 42 -0.340652446 -0.599136608 43 -0.316104932 -0.340652446 44 -0.350041581 -0.316104932 45 -0.533073256 -0.350041581 46 -0.633073256 -0.533073256 47 -0.374589094 -0.633073256 48 -0.033073256 -0.374589094 49 0.091474257 -0.033073256 50 -0.100946554 0.091474257 51 -0.276399040 -0.100946554 52 -0.451851526 -0.276399040 53 -0.317914878 -0.451851526 54 0.242379230 -0.317914878 55 0.134800041 0.242379230 56 -0.099136608 0.134800041 57 -0.733073256 -0.099136608 58 -0.867009905 -0.733073256 59 -0.591557419 -0.867009905 60 0.100863392 -0.591557419 61 0.659347554 0.100863392 62 0.942379230 0.659347554 63 0.949958419 0.942379230 64 0.857537609 0.949958419 65 0.916021771 0.857537609 66 1.083895068 0.916021771 67 1.017831716 1.083895068 68 NA 1.017831716 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.378125824 0.536609986 [2,] 0.085705013 0.378125824 [3,] -0.199136608 0.085705013 [4,] -0.374589094 -0.199136608 [5,] -0.482168284 -0.374589094 [6,] -0.270969203 -0.482168284 [7,] -0.161580068 -0.270969203 [8,] 0.021451607 -0.161580068 [9,] -0.004905852 0.021451607 [10,] 0.127220851 -0.004905852 [11,] 0.227220851 0.127220851 [12,] 0.302673338 0.227220851 [13,] 0.261157500 0.302673338 [14,] 0.302673338 0.261157500 [15,] 0.168736689 0.302673338 [16,] 0.251768365 0.168736689 [17,] -0.189747473 0.251768365 [18,] -0.246421690 -0.189747473 [19,] -0.329453365 -0.246421690 [20,] -0.187937527 -0.329453365 [21,] 0.161157500 -0.187937527 [22,] 0.327220851 0.161157500 [23,] 0.485705013 0.327220851 [24,] 0.644189175 0.485705013 [25,] 0.744189175 0.644189175 [26,] 0.827220851 0.744189175 [27,] 0.910252527 0.827220851 [28,] 0.610252527 0.910252527 [29,] 0.010252527 0.610252527 [30,] -0.721874176 0.010252527 [31,] -1.104905852 -0.721874176 [32,] -0.921874176 -1.104905852 [33,] -0.514294987 -0.921874176 [34,] -0.289747473 -0.514294987 [35,] -0.189747473 -0.289747473 [36,] -0.131263311 -0.189747473 [37,] -0.231263311 -0.131263311 [38,] -0.431263311 -0.231263311 [39,] -0.372779149 -0.431263311 [40,] -0.406715797 -0.372779149 [41,] -0.599136608 -0.406715797 [42,] -0.340652446 -0.599136608 [43,] -0.316104932 -0.340652446 [44,] -0.350041581 -0.316104932 [45,] -0.533073256 -0.350041581 [46,] -0.633073256 -0.533073256 [47,] -0.374589094 -0.633073256 [48,] -0.033073256 -0.374589094 [49,] 0.091474257 -0.033073256 [50,] -0.100946554 0.091474257 [51,] -0.276399040 -0.100946554 [52,] -0.451851526 -0.276399040 [53,] -0.317914878 -0.451851526 [54,] 0.242379230 -0.317914878 [55,] 0.134800041 0.242379230 [56,] -0.099136608 0.134800041 [57,] -0.733073256 -0.099136608 [58,] -0.867009905 -0.733073256 [59,] -0.591557419 -0.867009905 [60,] 0.100863392 -0.591557419 [61,] 0.659347554 0.100863392 [62,] 0.942379230 0.659347554 [63,] 0.949958419 0.942379230 [64,] 0.857537609 0.949958419 [65,] 0.916021771 0.857537609 [66,] 1.083895068 0.916021771 [67,] 1.017831716 1.083895068 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.378125824 0.536609986 2 0.085705013 0.378125824 3 -0.199136608 0.085705013 4 -0.374589094 -0.199136608 5 -0.482168284 -0.374589094 6 -0.270969203 -0.482168284 7 -0.161580068 -0.270969203 8 0.021451607 -0.161580068 9 -0.004905852 0.021451607 10 0.127220851 -0.004905852 11 0.227220851 0.127220851 12 0.302673338 0.227220851 13 0.261157500 0.302673338 14 0.302673338 0.261157500 15 0.168736689 0.302673338 16 0.251768365 0.168736689 17 -0.189747473 0.251768365 18 -0.246421690 -0.189747473 19 -0.329453365 -0.246421690 20 -0.187937527 -0.329453365 21 0.161157500 -0.187937527 22 0.327220851 0.161157500 23 0.485705013 0.327220851 24 0.644189175 0.485705013 25 0.744189175 0.644189175 26 0.827220851 0.744189175 27 0.910252527 0.827220851 28 0.610252527 0.910252527 29 0.010252527 0.610252527 30 -0.721874176 0.010252527 31 -1.104905852 -0.721874176 32 -0.921874176 -1.104905852 33 -0.514294987 -0.921874176 34 -0.289747473 -0.514294987 35 -0.189747473 -0.289747473 36 -0.131263311 -0.189747473 37 -0.231263311 -0.131263311 38 -0.431263311 -0.231263311 39 -0.372779149 -0.431263311 40 -0.406715797 -0.372779149 41 -0.599136608 -0.406715797 42 -0.340652446 -0.599136608 43 -0.316104932 -0.340652446 44 -0.350041581 -0.316104932 45 -0.533073256 -0.350041581 46 -0.633073256 -0.533073256 47 -0.374589094 -0.633073256 48 -0.033073256 -0.374589094 49 0.091474257 -0.033073256 50 -0.100946554 0.091474257 51 -0.276399040 -0.100946554 52 -0.451851526 -0.276399040 53 -0.317914878 -0.451851526 54 0.242379230 -0.317914878 55 0.134800041 0.242379230 56 -0.099136608 0.134800041 57 -0.733073256 -0.099136608 58 -0.867009905 -0.733073256 59 -0.591557419 -0.867009905 60 0.100863392 -0.591557419 61 0.659347554 0.100863392 62 0.942379230 0.659347554 63 0.949958419 0.942379230 64 0.857537609 0.949958419 65 0.916021771 0.857537609 66 1.083895068 0.916021771 67 1.017831716 1.083895068 > 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/77l3f1258569525.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/8455l1258569525.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/9sb441258569525.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/10idq41258569525.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/11bsr71258569525.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/12ict71258569525.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/13afju1258569525.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/14sldw1258569525.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/1501d11258569525.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/16c5bp1258569525.tab") + } > > system("convert tmp/1s6581258569525.ps tmp/1s6581258569525.png") > system("convert tmp/2nbfb1258569525.ps tmp/2nbfb1258569525.png") > system("convert tmp/3wd1i1258569525.ps tmp/3wd1i1258569525.png") > system("convert tmp/4m3jt1258569525.ps tmp/4m3jt1258569525.png") > system("convert tmp/5yaq51258569525.ps tmp/5yaq51258569525.png") > system("convert tmp/676sr1258569525.ps tmp/676sr1258569525.png") > system("convert tmp/77l3f1258569525.ps tmp/77l3f1258569525.png") > system("convert tmp/8455l1258569525.ps tmp/8455l1258569525.png") > system("convert tmp/9sb441258569525.ps tmp/9sb441258569525.png") > system("convert tmp/10idq41258569525.ps tmp/10idq41258569525.png") > > > proc.time() user system elapsed 2.476 1.552 2.932