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(2.11,0,2.09,0,2.05,0,2.08,0,2.06,0,2.06,0,2.08,0,2.07,0,2.06,0,2.07,0,2.06,0,2.09,0,2.07,0,2.09,0,2.28,0,2.33,0,2.35,0,2.52,0,2.63,0,2.58,0,2.70,0,2.81,0,2.97,0,3.04,0,3.28,0,3.33,0,3.50,0,3.56,0,3.57,0,3.69,0,3.82,0,3.79,0,3.96,0,4.06,0,4.05,0,4.03,0,3.94,0,4.02,0,3.88,0,4.02,0,4.03,0,4.09,0,3.99,0,4.01,0,4.01,0,4.19,0,4.30,0,4.27,0,3.82,0,3.15,1,2.49,1,1.81,1,1.26,1,1.06,1,0.84,1,0.78,1,0.70,1,0.36,1,0.35,1,0.36,1),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 2.11 0 1 0 0 0 0 0 0 0 0 0 0 2 2.09 0 0 1 0 0 0 0 0 0 0 0 0 3 2.05 0 0 0 1 0 0 0 0 0 0 0 0 4 2.08 0 0 0 0 1 0 0 0 0 0 0 0 5 2.06 0 0 0 0 0 1 0 0 0 0 0 0 6 2.06 0 0 0 0 0 0 1 0 0 0 0 0 7 2.08 0 0 0 0 0 0 0 1 0 0 0 0 8 2.07 0 0 0 0 0 0 0 0 1 0 0 0 9 2.06 0 0 0 0 0 0 0 0 0 1 0 0 10 2.07 0 0 0 0 0 0 0 0 0 0 1 0 11 2.06 0 0 0 0 0 0 0 0 0 0 0 1 12 2.09 0 0 0 0 0 0 0 0 0 0 0 0 13 2.07 0 1 0 0 0 0 0 0 0 0 0 0 14 2.09 0 0 1 0 0 0 0 0 0 0 0 0 15 2.28 0 0 0 1 0 0 0 0 0 0 0 0 16 2.33 0 0 0 0 1 0 0 0 0 0 0 0 17 2.35 0 0 0 0 0 1 0 0 0 0 0 0 18 2.52 0 0 0 0 0 0 1 0 0 0 0 0 19 2.63 0 0 0 0 0 0 0 1 0 0 0 0 20 2.58 0 0 0 0 0 0 0 0 1 0 0 0 21 2.70 0 0 0 0 0 0 0 0 0 1 0 0 22 2.81 0 0 0 0 0 0 0 0 0 0 1 0 23 2.97 0 0 0 0 0 0 0 0 0 0 0 1 24 3.04 0 0 0 0 0 0 0 0 0 0 0 0 25 3.28 0 1 0 0 0 0 0 0 0 0 0 0 26 3.33 0 0 1 0 0 0 0 0 0 0 0 0 27 3.50 0 0 0 1 0 0 0 0 0 0 0 0 28 3.56 0 0 0 0 1 0 0 0 0 0 0 0 29 3.57 0 0 0 0 0 1 0 0 0 0 0 0 30 3.69 0 0 0 0 0 0 1 0 0 0 0 0 31 3.82 0 0 0 0 0 0 0 1 0 0 0 0 32 3.79 0 0 0 0 0 0 0 0 1 0 0 0 33 3.96 0 0 0 0 0 0 0 0 0 1 0 0 34 4.06 0 0 0 0 0 0 0 0 0 0 1 0 35 4.05 0 0 0 0 0 0 0 0 0 0 0 1 36 4.03 0 0 0 0 0 0 0 0 0 0 0 0 37 3.94 0 1 0 0 0 0 0 0 0 0 0 0 38 4.02 0 0 1 0 0 0 0 0 0 0 0 0 39 3.88 0 0 0 1 0 0 0 0 0 0 0 0 40 4.02 0 0 0 0 1 0 0 0 0 0 0 0 41 4.03 0 0 0 0 0 1 0 0 0 0 0 0 42 4.09 0 0 0 0 0 0 1 0 0 0 0 0 43 3.99 0 0 0 0 0 0 0 1 0 0 0 0 44 4.01 0 0 0 0 0 0 0 0 1 0 0 0 45 4.01 0 0 0 0 0 0 0 0 0 1 0 0 46 4.19 0 0 0 0 0 0 0 0 0 0 1 0 47 4.30 0 0 0 0 0 0 0 0 0 0 0 1 48 4.27 0 0 0 0 0 0 0 0 0 0 0 0 49 3.82 0 1 0 0 0 0 0 0 0 0 0 0 50 3.15 1 0 1 0 0 0 0 0 0 0 0 0 51 2.49 1 0 0 1 0 0 0 0 0 0 0 0 52 1.81 1 0 0 0 1 0 0 0 0 0 0 0 53 1.26 1 0 0 0 0 1 0 0 0 0 0 0 54 1.06 1 0 0 0 0 0 1 0 0 0 0 0 55 0.84 1 0 0 0 0 0 0 1 0 0 0 0 56 0.78 1 0 0 0 0 0 0 0 1 0 0 0 57 0.70 1 0 0 0 0 0 0 0 0 1 0 0 58 0.36 1 0 0 0 0 0 0 0 0 0 1 0 59 0.35 1 0 0 0 0 0 0 0 0 0 0 1 60 0.36 1 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 3.14255 -1.92273 -0.09855 0.17800 0.08200 0.00200 M5 M6 M7 M8 M9 M10 -0.10400 -0.07400 -0.08600 -0.11200 -0.07200 -0.06000 M11 -0.01200 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.23055 -0.87836 -0.09418 0.87845 1.75218 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.14255 0.43284 7.260 3.3e-09 *** X -1.92273 0.32262 -5.960 3.1e-07 *** M1 -0.09854 0.60872 -0.162 0.872 M2 0.17800 0.60529 0.294 0.770 M3 0.08200 0.60529 0.135 0.893 M4 0.00200 0.60529 0.003 0.997 M5 -0.10400 0.60529 -0.172 0.864 M6 -0.07400 0.60529 -0.122 0.903 M7 -0.08600 0.60529 -0.142 0.888 M8 -0.11200 0.60529 -0.185 0.854 M9 -0.07200 0.60529 -0.119 0.906 M10 -0.06000 0.60529 -0.099 0.921 M11 -0.01200 0.60529 -0.020 0.984 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.9571 on 47 degrees of freedom Multiple R-squared: 0.4366, Adjusted R-squared: 0.2927 F-statistic: 3.035 on 12 and 47 DF, p-value: 0.003170 > 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.010141438 0.020282876 0.989858562 [2,] 0.005454162 0.010908325 0.994545838 [3,] 0.006980236 0.013960472 0.993019764 [4,] 0.009727805 0.019455611 0.990272195 [5,] 0.010227243 0.020454487 0.989772757 [6,] 0.015033188 0.030066377 0.984966812 [7,] 0.024443295 0.048886589 0.975556705 [8,] 0.047228018 0.094456036 0.952771982 [9,] 0.076201113 0.152402227 0.923798887 [10,] 0.175830787 0.351661574 0.824169213 [11,] 0.437178901 0.874357802 0.562821099 [12,] 0.647540470 0.704919060 0.352459530 [13,] 0.763559657 0.472880685 0.236440343 [14,] 0.817497288 0.365005424 0.182502712 [15,] 0.844067176 0.311865648 0.155932824 [16,] 0.855922624 0.288154751 0.144077376 [17,] 0.857125353 0.285749294 0.142874647 [18,] 0.858322049 0.283355903 0.141677951 [19,] 0.857551836 0.284896328 0.142448164 [20,] 0.841976507 0.316046986 0.158023493 [21,] 0.814514075 0.370971850 0.185485925 [22,] 0.777403429 0.445193142 0.222596571 [23,] 0.935094832 0.129810336 0.064905168 [24,] 0.990132955 0.019734090 0.009867045 [25,] 0.997055717 0.005888565 0.002944283 [26,] 0.997251623 0.005496755 0.002748377 [27,] 0.995612172 0.008775657 0.004387828 [28,] 0.991752445 0.016495109 0.008247555 [29,] 0.985920531 0.028158938 0.014079469 > postscript(file="/var/www/html/rcomp/tmp/1ddqc1259315821.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/27tzf1259315821.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/3r9gc1259315821.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/4kq141259315821.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/55qwe1259315821.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 -0.934000000 -1.230545455 -1.174545455 -1.064545455 -0.978545455 -1.008545455 7 8 9 10 11 12 -0.976545455 -0.960545455 -1.010545455 -1.012545455 -1.070545455 -1.052545455 13 14 15 16 17 18 -0.974000000 -1.230545455 -0.944545455 -0.814545455 -0.688545455 -0.548545455 19 20 21 22 23 24 -0.426545455 -0.450545455 -0.370545455 -0.272545455 -0.160545455 -0.102545455 25 26 27 28 29 30 0.236000000 0.009454545 0.275454545 0.415454545 0.531454545 0.621454545 31 32 33 34 35 36 0.763454545 0.759454545 0.889454545 0.977454545 0.919454545 0.887454545 37 38 39 40 41 42 0.896000000 0.699454545 0.655454545 0.875454545 0.991454545 1.021454545 43 44 45 46 47 48 0.933454545 0.979454545 0.939454545 1.107454545 1.169454545 1.127454545 49 50 51 52 53 54 0.776000000 1.752181818 1.188181818 0.588181818 0.144181818 -0.085818182 55 56 57 58 59 60 -0.293818182 -0.327818182 -0.447818182 -0.799818182 -0.857818182 -0.859818182 > postscript(file="/var/www/html/rcomp/tmp/6qmhs1259315821.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 -0.934000000 NA 1 -1.230545455 -0.934000000 2 -1.174545455 -1.230545455 3 -1.064545455 -1.174545455 4 -0.978545455 -1.064545455 5 -1.008545455 -0.978545455 6 -0.976545455 -1.008545455 7 -0.960545455 -0.976545455 8 -1.010545455 -0.960545455 9 -1.012545455 -1.010545455 10 -1.070545455 -1.012545455 11 -1.052545455 -1.070545455 12 -0.974000000 -1.052545455 13 -1.230545455 -0.974000000 14 -0.944545455 -1.230545455 15 -0.814545455 -0.944545455 16 -0.688545455 -0.814545455 17 -0.548545455 -0.688545455 18 -0.426545455 -0.548545455 19 -0.450545455 -0.426545455 20 -0.370545455 -0.450545455 21 -0.272545455 -0.370545455 22 -0.160545455 -0.272545455 23 -0.102545455 -0.160545455 24 0.236000000 -0.102545455 25 0.009454545 0.236000000 26 0.275454545 0.009454545 27 0.415454545 0.275454545 28 0.531454545 0.415454545 29 0.621454545 0.531454545 30 0.763454545 0.621454545 31 0.759454545 0.763454545 32 0.889454545 0.759454545 33 0.977454545 0.889454545 34 0.919454545 0.977454545 35 0.887454545 0.919454545 36 0.896000000 0.887454545 37 0.699454545 0.896000000 38 0.655454545 0.699454545 39 0.875454545 0.655454545 40 0.991454545 0.875454545 41 1.021454545 0.991454545 42 0.933454545 1.021454545 43 0.979454545 0.933454545 44 0.939454545 0.979454545 45 1.107454545 0.939454545 46 1.169454545 1.107454545 47 1.127454545 1.169454545 48 0.776000000 1.127454545 49 1.752181818 0.776000000 50 1.188181818 1.752181818 51 0.588181818 1.188181818 52 0.144181818 0.588181818 53 -0.085818182 0.144181818 54 -0.293818182 -0.085818182 55 -0.327818182 -0.293818182 56 -0.447818182 -0.327818182 57 -0.799818182 -0.447818182 58 -0.857818182 -0.799818182 59 -0.859818182 -0.857818182 60 NA -0.859818182 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.230545455 -0.934000000 [2,] -1.174545455 -1.230545455 [3,] -1.064545455 -1.174545455 [4,] -0.978545455 -1.064545455 [5,] -1.008545455 -0.978545455 [6,] -0.976545455 -1.008545455 [7,] -0.960545455 -0.976545455 [8,] -1.010545455 -0.960545455 [9,] -1.012545455 -1.010545455 [10,] -1.070545455 -1.012545455 [11,] -1.052545455 -1.070545455 [12,] -0.974000000 -1.052545455 [13,] -1.230545455 -0.974000000 [14,] -0.944545455 -1.230545455 [15,] -0.814545455 -0.944545455 [16,] -0.688545455 -0.814545455 [17,] -0.548545455 -0.688545455 [18,] -0.426545455 -0.548545455 [19,] -0.450545455 -0.426545455 [20,] -0.370545455 -0.450545455 [21,] -0.272545455 -0.370545455 [22,] -0.160545455 -0.272545455 [23,] -0.102545455 -0.160545455 [24,] 0.236000000 -0.102545455 [25,] 0.009454545 0.236000000 [26,] 0.275454545 0.009454545 [27,] 0.415454545 0.275454545 [28,] 0.531454545 0.415454545 [29,] 0.621454545 0.531454545 [30,] 0.763454545 0.621454545 [31,] 0.759454545 0.763454545 [32,] 0.889454545 0.759454545 [33,] 0.977454545 0.889454545 [34,] 0.919454545 0.977454545 [35,] 0.887454545 0.919454545 [36,] 0.896000000 0.887454545 [37,] 0.699454545 0.896000000 [38,] 0.655454545 0.699454545 [39,] 0.875454545 0.655454545 [40,] 0.991454545 0.875454545 [41,] 1.021454545 0.991454545 [42,] 0.933454545 1.021454545 [43,] 0.979454545 0.933454545 [44,] 0.939454545 0.979454545 [45,] 1.107454545 0.939454545 [46,] 1.169454545 1.107454545 [47,] 1.127454545 1.169454545 [48,] 0.776000000 1.127454545 [49,] 1.752181818 0.776000000 [50,] 1.188181818 1.752181818 [51,] 0.588181818 1.188181818 [52,] 0.144181818 0.588181818 [53,] -0.085818182 0.144181818 [54,] -0.293818182 -0.085818182 [55,] -0.327818182 -0.293818182 [56,] -0.447818182 -0.327818182 [57,] -0.799818182 -0.447818182 [58,] -0.857818182 -0.799818182 [59,] -0.859818182 -0.857818182 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.230545455 -0.934000000 2 -1.174545455 -1.230545455 3 -1.064545455 -1.174545455 4 -0.978545455 -1.064545455 5 -1.008545455 -0.978545455 6 -0.976545455 -1.008545455 7 -0.960545455 -0.976545455 8 -1.010545455 -0.960545455 9 -1.012545455 -1.010545455 10 -1.070545455 -1.012545455 11 -1.052545455 -1.070545455 12 -0.974000000 -1.052545455 13 -1.230545455 -0.974000000 14 -0.944545455 -1.230545455 15 -0.814545455 -0.944545455 16 -0.688545455 -0.814545455 17 -0.548545455 -0.688545455 18 -0.426545455 -0.548545455 19 -0.450545455 -0.426545455 20 -0.370545455 -0.450545455 21 -0.272545455 -0.370545455 22 -0.160545455 -0.272545455 23 -0.102545455 -0.160545455 24 0.236000000 -0.102545455 25 0.009454545 0.236000000 26 0.275454545 0.009454545 27 0.415454545 0.275454545 28 0.531454545 0.415454545 29 0.621454545 0.531454545 30 0.763454545 0.621454545 31 0.759454545 0.763454545 32 0.889454545 0.759454545 33 0.977454545 0.889454545 34 0.919454545 0.977454545 35 0.887454545 0.919454545 36 0.896000000 0.887454545 37 0.699454545 0.896000000 38 0.655454545 0.699454545 39 0.875454545 0.655454545 40 0.991454545 0.875454545 41 1.021454545 0.991454545 42 0.933454545 1.021454545 43 0.979454545 0.933454545 44 0.939454545 0.979454545 45 1.107454545 0.939454545 46 1.169454545 1.107454545 47 1.127454545 1.169454545 48 0.776000000 1.127454545 49 1.752181818 0.776000000 50 1.188181818 1.752181818 51 0.588181818 1.188181818 52 0.144181818 0.588181818 53 -0.085818182 0.144181818 54 -0.293818182 -0.085818182 55 -0.327818182 -0.293818182 56 -0.447818182 -0.327818182 57 -0.799818182 -0.447818182 58 -0.857818182 -0.799818182 59 -0.859818182 -0.857818182 > 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/74z5d1259315821.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/85vbc1259315821.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/9g3eb1259315821.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/10n6zd1259315821.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/11x8wn1259315821.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/12z0r21259315821.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/1377wx1259315821.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/14w8jc1259315821.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/15v3g21259315821.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/16md4v1259315821.tab") + } > > system("convert tmp/1ddqc1259315821.ps tmp/1ddqc1259315821.png") > system("convert tmp/27tzf1259315821.ps tmp/27tzf1259315821.png") > system("convert tmp/3r9gc1259315821.ps tmp/3r9gc1259315821.png") > system("convert tmp/4kq141259315821.ps tmp/4kq141259315821.png") > system("convert tmp/55qwe1259315821.ps tmp/55qwe1259315821.png") > system("convert tmp/6qmhs1259315821.ps tmp/6qmhs1259315821.png") > system("convert tmp/74z5d1259315821.ps tmp/74z5d1259315821.png") > system("convert tmp/85vbc1259315821.ps tmp/85vbc1259315821.png") > system("convert tmp/9g3eb1259315821.ps tmp/9g3eb1259315821.png") > system("convert tmp/10n6zd1259315821.ps tmp/10n6zd1259315821.png") > > > proc.time() user system elapsed 2.400 1.556 2.834