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(1.6,8.3,1.8,1.6,1.5,7.5,1.6,1.8,1.5,7.2,1.5,1.6,1.3,7.4,1.5,1.5,1.4,8.8,1.3,1.5,1.4,9.3,1.4,1.3,1.3,9.3,1.4,1.4,1.3,8.7,1.3,1.4,1.2,8.2,1.3,1.3,1.1,8.3,1.2,1.3,1.4,8.5,1.1,1.2,1.2,8.6,1.4,1.1,1.5,8.5,1.2,1.4,1.1,8.2,1.5,1.2,1.3,8.1,1.1,1.5,1.5,7.9,1.3,1.1,1.1,8.6,1.5,1.3,1.4,8.7,1.1,1.5,1.3,8.7,1.4,1.1,1.5,8.5,1.3,1.4,1.6,8.4,1.5,1.3,1.7,8.5,1.6,1.5,1.1,8.7,1.7,1.6,1.6,8.7,1.1,1.7,1.3,8.6,1.6,1.1,1.7,8.5,1.3,1.6,1.6,8.3,1.7,1.3,1.7,8,1.6,1.7,1.9,8.2,1.7,1.6,1.8,8.1,1.9,1.7,1.9,8.1,1.8,1.9,1.6,8,1.9,1.8,1.5,7.9,1.6,1.9,1.6,7.9,1.5,1.6,1.6,8,1.6,1.5,1.7,8,1.6,1.6,2,7.9,1.7,1.6,2,8,2,1.7,1.9,7.7,2,2,1.7,7.2,1.9,2,1.8,7.5,1.7,1.9,1.9,7.3,1.8,1.7,1.7,7,1.9,1.8,2,7,1.7,1.9,2.1,7,2,1.7,2.4,7.2,2.1,2,2.5,7.3,2.4,2.1,2.5,7.1,2.5,2.4,2.6,6.8,2.5,2.5,2.2,6.4,2.6,2.5,2.5,6.1,2.2,2.6,2.8,6.5,2.5,2.2,2.8,7.7,2.8,2.5,2.9,7.9,2.8,2.8,3,7.5,2.9,2.8,3.1,6.9,3,2.9,2.9,6.6,3.1,3,2.7,6.9,2.9,3.1),dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '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 Y1 Y2 t 1 1.6 8.3 1.8 1.6 1 2 1.5 7.5 1.6 1.8 2 3 1.5 7.2 1.5 1.6 3 4 1.3 7.4 1.5 1.5 4 5 1.4 8.8 1.3 1.5 5 6 1.4 9.3 1.4 1.3 6 7 1.3 9.3 1.4 1.4 7 8 1.3 8.7 1.3 1.4 8 9 1.2 8.2 1.3 1.3 9 10 1.1 8.3 1.2 1.3 10 11 1.4 8.5 1.1 1.2 11 12 1.2 8.6 1.4 1.1 12 13 1.5 8.5 1.2 1.4 13 14 1.1 8.2 1.5 1.2 14 15 1.3 8.1 1.1 1.5 15 16 1.5 7.9 1.3 1.1 16 17 1.1 8.6 1.5 1.3 17 18 1.4 8.7 1.1 1.5 18 19 1.3 8.7 1.4 1.1 19 20 1.5 8.5 1.3 1.4 20 21 1.6 8.4 1.5 1.3 21 22 1.7 8.5 1.6 1.5 22 23 1.1 8.7 1.7 1.6 23 24 1.6 8.7 1.1 1.7 24 25 1.3 8.6 1.6 1.1 25 26 1.7 8.5 1.3 1.6 26 27 1.6 8.3 1.7 1.3 27 28 1.7 8.0 1.6 1.7 28 29 1.9 8.2 1.7 1.6 29 30 1.8 8.1 1.9 1.7 30 31 1.9 8.1 1.8 1.9 31 32 1.6 8.0 1.9 1.8 32 33 1.5 7.9 1.6 1.9 33 34 1.6 7.9 1.5 1.6 34 35 1.6 8.0 1.6 1.5 35 36 1.7 8.0 1.6 1.6 36 37 2.0 7.9 1.7 1.6 37 38 2.0 8.0 2.0 1.7 38 39 1.9 7.7 2.0 2.0 39 40 1.7 7.2 1.9 2.0 40 41 1.8 7.5 1.7 1.9 41 42 1.9 7.3 1.8 1.7 42 43 1.7 7.0 1.9 1.8 43 44 2.0 7.0 1.7 1.9 44 45 2.1 7.0 2.0 1.7 45 46 2.4 7.2 2.1 2.0 46 47 2.5 7.3 2.4 2.1 47 48 2.5 7.1 2.5 2.4 48 49 2.6 6.8 2.5 2.5 49 50 2.2 6.4 2.6 2.5 50 51 2.5 6.1 2.2 2.6 51 52 2.8 6.5 2.5 2.2 52 53 2.8 7.7 2.8 2.5 53 54 2.9 7.9 2.8 2.8 54 55 3.0 7.5 2.9 2.8 55 56 3.1 6.9 3.0 2.9 56 57 2.9 6.6 3.1 3.0 57 58 2.7 6.9 2.9 3.1 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 t 0.125898 0.009441 0.393131 0.359986 0.009004 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.55942 -0.08223 0.02162 0.12109 0.36974 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.125898 0.506992 0.248 0.80484 X 0.009441 0.052382 0.180 0.85766 Y1 0.393131 0.123489 3.184 0.00244 ** Y2 0.359986 0.125166 2.876 0.00579 ** t 0.009004 0.002880 3.126 0.00287 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.1885 on 53 degrees of freedom Multiple R-squared: 0.8888, Adjusted R-squared: 0.8804 F-statistic: 105.9 on 4 and 53 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.062795595 0.12559119 0.9372044 [2,] 0.019207898 0.03841580 0.9807921 [3,] 0.006082358 0.01216472 0.9939176 [4,] 0.085815600 0.17163120 0.9141844 [5,] 0.045471930 0.09094386 0.9545281 [6,] 0.093256281 0.18651256 0.9067437 [7,] 0.077892629 0.15578526 0.9221074 [8,] 0.045875993 0.09175199 0.9541240 [9,] 0.181575604 0.36315121 0.8184244 [10,] 0.175923853 0.35184771 0.8240761 [11,] 0.138740739 0.27748148 0.8612593 [12,] 0.105288662 0.21057732 0.8947113 [13,] 0.106601910 0.21320382 0.8933981 [14,] 0.145802693 0.29160539 0.8541973 [15,] 0.154422880 0.30884576 0.8455771 [16,] 0.521539275 0.95692145 0.4784607 [17,] 0.506116837 0.98776633 0.4938832 [18,] 0.473733347 0.94746669 0.5262667 [19,] 0.553275664 0.89344867 0.4467243 [20,] 0.514065969 0.97186806 0.4859340 [21,] 0.477315538 0.95463108 0.5226845 [22,] 0.608318461 0.78336308 0.3916815 [23,] 0.553347267 0.89330547 0.4466527 [24,] 0.659809335 0.68038133 0.3401907 [25,] 0.635837445 0.72832511 0.3641626 [26,] 0.652592122 0.69481576 0.3474079 [27,] 0.582355545 0.83528891 0.4176445 [28,] 0.504918790 0.99016242 0.4950812 [29,] 0.420676021 0.84135204 0.5793240 [30,] 0.526553619 0.94689276 0.4734464 [31,] 0.493642967 0.98728593 0.5063570 [32,] 0.431446044 0.86289209 0.5685540 [33,] 0.391939226 0.78387845 0.6080608 [34,] 0.307878400 0.61575680 0.6921216 [35,] 0.239855131 0.47971026 0.7601449 [36,] 0.425076285 0.85015257 0.5749237 [37,] 0.358011705 0.71602341 0.6419883 [38,] 0.450867411 0.90173482 0.5491326 [39,] 0.414719685 0.82943937 0.5852803 [40,] 0.346651850 0.69330370 0.6533482 [41,] 0.240585722 0.48117144 0.7594143 [42,] 0.225725090 0.45145018 0.7742749 [43,] 0.606282762 0.78743448 0.3937172 > postscript(file="/var/www/html/rcomp/tmp/1mw3j1258567276.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/2ce7z1258567276.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/3cljx1258567276.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/45upn1258567276.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/57g7v1258567276.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 = 58 Frequency = 1 1 2 3 4 5 6 0.103126555 0.008304413 0.113443165 -0.061450167 0.094955138 0.113915071 7 8 9 10 11 12 -0.031087294 0.004886504 -0.063398273 -0.134033029 0.230386731 -0.061501799 13 14 15 16 17 18 0.201068908 -0.251044708 -0.009847817 0.248404771 -0.317830929 0.057476399 19 20 21 22 23 24 -0.025472264 0.098729430 0.148042152 0.126784019 -0.559419597 0.131456591 25 26 27 28 29 30 -0.157176985 0.172709622 0.016337430 0.005484607 0.191278183 -0.031406288 31 32 33 34 35 36 0.026905844 -0.284468343 -0.310587352 -0.072282242 -0.085544587 -0.030546952 37 38 39 40 41 42 0.222080265 0.058194544 -0.155972775 -0.320943055 -0.118154283 0.007414206 43 44 45 46 47 48 -0.274069013 0.059554806 0.104608951 0.246408144 0.182522422 0.028097932 49 50 51 52 53 54 0.085927805 -0.358612740 0.056469502 0.369744522 0.123476737 0.104589021 55 56 57 58 0.160048477 0.181397495 -0.100085725 -0.269294143 > postscript(file="/var/www/html/rcomp/tmp/6dwj71258567276.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 0.103126555 NA 1 0.008304413 0.103126555 2 0.113443165 0.008304413 3 -0.061450167 0.113443165 4 0.094955138 -0.061450167 5 0.113915071 0.094955138 6 -0.031087294 0.113915071 7 0.004886504 -0.031087294 8 -0.063398273 0.004886504 9 -0.134033029 -0.063398273 10 0.230386731 -0.134033029 11 -0.061501799 0.230386731 12 0.201068908 -0.061501799 13 -0.251044708 0.201068908 14 -0.009847817 -0.251044708 15 0.248404771 -0.009847817 16 -0.317830929 0.248404771 17 0.057476399 -0.317830929 18 -0.025472264 0.057476399 19 0.098729430 -0.025472264 20 0.148042152 0.098729430 21 0.126784019 0.148042152 22 -0.559419597 0.126784019 23 0.131456591 -0.559419597 24 -0.157176985 0.131456591 25 0.172709622 -0.157176985 26 0.016337430 0.172709622 27 0.005484607 0.016337430 28 0.191278183 0.005484607 29 -0.031406288 0.191278183 30 0.026905844 -0.031406288 31 -0.284468343 0.026905844 32 -0.310587352 -0.284468343 33 -0.072282242 -0.310587352 34 -0.085544587 -0.072282242 35 -0.030546952 -0.085544587 36 0.222080265 -0.030546952 37 0.058194544 0.222080265 38 -0.155972775 0.058194544 39 -0.320943055 -0.155972775 40 -0.118154283 -0.320943055 41 0.007414206 -0.118154283 42 -0.274069013 0.007414206 43 0.059554806 -0.274069013 44 0.104608951 0.059554806 45 0.246408144 0.104608951 46 0.182522422 0.246408144 47 0.028097932 0.182522422 48 0.085927805 0.028097932 49 -0.358612740 0.085927805 50 0.056469502 -0.358612740 51 0.369744522 0.056469502 52 0.123476737 0.369744522 53 0.104589021 0.123476737 54 0.160048477 0.104589021 55 0.181397495 0.160048477 56 -0.100085725 0.181397495 57 -0.269294143 -0.100085725 58 NA -0.269294143 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.008304413 0.103126555 [2,] 0.113443165 0.008304413 [3,] -0.061450167 0.113443165 [4,] 0.094955138 -0.061450167 [5,] 0.113915071 0.094955138 [6,] -0.031087294 0.113915071 [7,] 0.004886504 -0.031087294 [8,] -0.063398273 0.004886504 [9,] -0.134033029 -0.063398273 [10,] 0.230386731 -0.134033029 [11,] -0.061501799 0.230386731 [12,] 0.201068908 -0.061501799 [13,] -0.251044708 0.201068908 [14,] -0.009847817 -0.251044708 [15,] 0.248404771 -0.009847817 [16,] -0.317830929 0.248404771 [17,] 0.057476399 -0.317830929 [18,] -0.025472264 0.057476399 [19,] 0.098729430 -0.025472264 [20,] 0.148042152 0.098729430 [21,] 0.126784019 0.148042152 [22,] -0.559419597 0.126784019 [23,] 0.131456591 -0.559419597 [24,] -0.157176985 0.131456591 [25,] 0.172709622 -0.157176985 [26,] 0.016337430 0.172709622 [27,] 0.005484607 0.016337430 [28,] 0.191278183 0.005484607 [29,] -0.031406288 0.191278183 [30,] 0.026905844 -0.031406288 [31,] -0.284468343 0.026905844 [32,] -0.310587352 -0.284468343 [33,] -0.072282242 -0.310587352 [34,] -0.085544587 -0.072282242 [35,] -0.030546952 -0.085544587 [36,] 0.222080265 -0.030546952 [37,] 0.058194544 0.222080265 [38,] -0.155972775 0.058194544 [39,] -0.320943055 -0.155972775 [40,] -0.118154283 -0.320943055 [41,] 0.007414206 -0.118154283 [42,] -0.274069013 0.007414206 [43,] 0.059554806 -0.274069013 [44,] 0.104608951 0.059554806 [45,] 0.246408144 0.104608951 [46,] 0.182522422 0.246408144 [47,] 0.028097932 0.182522422 [48,] 0.085927805 0.028097932 [49,] -0.358612740 0.085927805 [50,] 0.056469502 -0.358612740 [51,] 0.369744522 0.056469502 [52,] 0.123476737 0.369744522 [53,] 0.104589021 0.123476737 [54,] 0.160048477 0.104589021 [55,] 0.181397495 0.160048477 [56,] -0.100085725 0.181397495 [57,] -0.269294143 -0.100085725 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.008304413 0.103126555 2 0.113443165 0.008304413 3 -0.061450167 0.113443165 4 0.094955138 -0.061450167 5 0.113915071 0.094955138 6 -0.031087294 0.113915071 7 0.004886504 -0.031087294 8 -0.063398273 0.004886504 9 -0.134033029 -0.063398273 10 0.230386731 -0.134033029 11 -0.061501799 0.230386731 12 0.201068908 -0.061501799 13 -0.251044708 0.201068908 14 -0.009847817 -0.251044708 15 0.248404771 -0.009847817 16 -0.317830929 0.248404771 17 0.057476399 -0.317830929 18 -0.025472264 0.057476399 19 0.098729430 -0.025472264 20 0.148042152 0.098729430 21 0.126784019 0.148042152 22 -0.559419597 0.126784019 23 0.131456591 -0.559419597 24 -0.157176985 0.131456591 25 0.172709622 -0.157176985 26 0.016337430 0.172709622 27 0.005484607 0.016337430 28 0.191278183 0.005484607 29 -0.031406288 0.191278183 30 0.026905844 -0.031406288 31 -0.284468343 0.026905844 32 -0.310587352 -0.284468343 33 -0.072282242 -0.310587352 34 -0.085544587 -0.072282242 35 -0.030546952 -0.085544587 36 0.222080265 -0.030546952 37 0.058194544 0.222080265 38 -0.155972775 0.058194544 39 -0.320943055 -0.155972775 40 -0.118154283 -0.320943055 41 0.007414206 -0.118154283 42 -0.274069013 0.007414206 43 0.059554806 -0.274069013 44 0.104608951 0.059554806 45 0.246408144 0.104608951 46 0.182522422 0.246408144 47 0.028097932 0.182522422 48 0.085927805 0.028097932 49 -0.358612740 0.085927805 50 0.056469502 -0.358612740 51 0.369744522 0.056469502 52 0.123476737 0.369744522 53 0.104589021 0.123476737 54 0.160048477 0.104589021 55 0.181397495 0.160048477 56 -0.100085725 0.181397495 57 -0.269294143 -0.100085725 > 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/7auk01258567277.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/83jl41258567277.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/9xjfh1258567277.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/102bhe1258567277.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/11jyh11258567277.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/12rt001258567277.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/13ae161258567277.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/1488i61258567277.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/1520iv1258567277.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/16v3yr1258567277.tab") + } > > system("convert tmp/1mw3j1258567276.ps tmp/1mw3j1258567276.png") > system("convert tmp/2ce7z1258567276.ps tmp/2ce7z1258567276.png") > system("convert tmp/3cljx1258567276.ps tmp/3cljx1258567276.png") > system("convert tmp/45upn1258567276.ps tmp/45upn1258567276.png") > system("convert tmp/57g7v1258567276.ps tmp/57g7v1258567276.png") > system("convert tmp/6dwj71258567276.ps tmp/6dwj71258567276.png") > system("convert tmp/7auk01258567277.ps tmp/7auk01258567277.png") > system("convert tmp/83jl41258567277.ps tmp/83jl41258567277.png") > system("convert tmp/9xjfh1258567277.ps tmp/9xjfh1258567277.png") > system("convert tmp/102bhe1258567277.ps tmp/102bhe1258567277.png") > > > proc.time() user system elapsed 2.477 1.609 5.894