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(3353,1,3186,1,3902,1,4164,1,3499,1,4145,1,3796,1,3711,1,3949,1,3740,1,3243,1,4407,1,4814,1,3908,1,5250,1,3937,1,4004,1,5560,1,3922,1,3759,1,4138,1,4634,1,3996,1,4308,1,4143,0,4429,0,5219,0,4929,0,5755,0,5592,0,4163,0,4962,0,5208,0,4755,0,4491,0,5732,0,5731,0,5040,0,6102,0,4904,0,5369,0,5578,0,4619,0,4731,0,5011,0,5299,0,4146,0,4625,0,4736,0,4219,0,5116,0,4205,0,4121,0,5103,1,4300,1,4578,1,3809,1,5526,1,4247,1,3830,1,4394,1),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 3353 1 1 0 0 0 0 0 0 0 0 0 0 2 3186 1 0 1 0 0 0 0 0 0 0 0 0 3 3902 1 0 0 1 0 0 0 0 0 0 0 0 4 4164 1 0 0 0 1 0 0 0 0 0 0 0 5 3499 1 0 0 0 0 1 0 0 0 0 0 0 6 4145 1 0 0 0 0 0 1 0 0 0 0 0 7 3796 1 0 0 0 0 0 0 1 0 0 0 0 8 3711 1 0 0 0 0 0 0 0 1 0 0 0 9 3949 1 0 0 0 0 0 0 0 0 1 0 0 10 3740 1 0 0 0 0 0 0 0 0 0 1 0 11 3243 1 0 0 0 0 0 0 0 0 0 0 1 12 4407 1 0 0 0 0 0 0 0 0 0 0 0 13 4814 1 1 0 0 0 0 0 0 0 0 0 0 14 3908 1 0 1 0 0 0 0 0 0 0 0 0 15 5250 1 0 0 1 0 0 0 0 0 0 0 0 16 3937 1 0 0 0 1 0 0 0 0 0 0 0 17 4004 1 0 0 0 0 1 0 0 0 0 0 0 18 5560 1 0 0 0 0 0 1 0 0 0 0 0 19 3922 1 0 0 0 0 0 0 1 0 0 0 0 20 3759 1 0 0 0 0 0 0 0 1 0 0 0 21 4138 1 0 0 0 0 0 0 0 0 1 0 0 22 4634 1 0 0 0 0 0 0 0 0 0 1 0 23 3996 1 0 0 0 0 0 0 0 0 0 0 1 24 4308 1 0 0 0 0 0 0 0 0 0 0 0 25 4143 0 1 0 0 0 0 0 0 0 0 0 0 26 4429 0 0 1 0 0 0 0 0 0 0 0 0 27 5219 0 0 0 1 0 0 0 0 0 0 0 0 28 4929 0 0 0 0 1 0 0 0 0 0 0 0 29 5755 0 0 0 0 0 1 0 0 0 0 0 0 30 5592 0 0 0 0 0 0 1 0 0 0 0 0 31 4163 0 0 0 0 0 0 0 1 0 0 0 0 32 4962 0 0 0 0 0 0 0 0 1 0 0 0 33 5208 0 0 0 0 0 0 0 0 0 1 0 0 34 4755 0 0 0 0 0 0 0 0 0 0 1 0 35 4491 0 0 0 0 0 0 0 0 0 0 0 1 36 5732 0 0 0 0 0 0 0 0 0 0 0 0 37 5731 0 1 0 0 0 0 0 0 0 0 0 0 38 5040 0 0 1 0 0 0 0 0 0 0 0 0 39 6102 0 0 0 1 0 0 0 0 0 0 0 0 40 4904 0 0 0 0 1 0 0 0 0 0 0 0 41 5369 0 0 0 0 0 1 0 0 0 0 0 0 42 5578 0 0 0 0 0 0 1 0 0 0 0 0 43 4619 0 0 0 0 0 0 0 1 0 0 0 0 44 4731 0 0 0 0 0 0 0 0 1 0 0 0 45 5011 0 0 0 0 0 0 0 0 0 1 0 0 46 5299 0 0 0 0 0 0 0 0 0 0 1 0 47 4146 0 0 0 0 0 0 0 0 0 0 0 1 48 4625 0 0 0 0 0 0 0 0 0 0 0 0 49 4736 0 1 0 0 0 0 0 0 0 0 0 0 50 4219 0 0 1 0 0 0 0 0 0 0 0 0 51 5116 0 0 0 1 0 0 0 0 0 0 0 0 52 4205 0 0 0 0 1 0 0 0 0 0 0 0 53 4121 0 0 0 0 0 1 0 0 0 0 0 0 54 5103 1 0 0 0 0 0 1 0 0 0 0 0 55 4300 1 0 0 0 0 0 0 1 0 0 0 0 56 4578 1 0 0 0 0 0 0 0 1 0 0 0 57 3809 1 0 0 0 0 0 0 0 0 1 0 0 58 5526 1 0 0 0 0 0 0 0 0 0 1 0 59 4247 1 0 0 0 0 0 0 0 0 0 0 1 60 3830 1 0 0 0 0 0 0 0 0 0 0 0 61 4394 1 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) X M1 M2 M3 M4 5051.6 -785.3 -130.4 -581.1 380.3 -309.7 M5 M6 M7 M8 M9 M10 -187.9 615.2 -420.4 -232.2 -157.4 210.4 M11 -555.8 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -782.83 -323.06 -12.20 258.17 1049.34 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5051.6 243.7 20.730 < 2e-16 *** X -785.3 134.1 -5.854 4.18e-07 *** M1 -130.4 311.7 -0.418 0.6775 M2 -581.1 326.4 -1.780 0.0814 . M3 380.3 326.4 1.165 0.2497 M4 -309.7 326.4 -0.949 0.3475 M5 -187.9 326.4 -0.576 0.5676 M6 615.2 325.3 1.891 0.0646 . M7 -420.4 325.3 -1.292 0.2024 M8 -232.2 325.3 -0.714 0.4788 M9 -157.4 325.3 -0.484 0.6307 M10 210.4 325.3 0.647 0.5208 M11 -555.8 325.3 -1.709 0.0940 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 514.3 on 48 degrees of freedom Multiple R-squared: 0.5621, Adjusted R-squared: 0.4526 F-statistic: 5.134 on 12 and 48 DF, p-value: 1.940e-05 > 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.9618506 0.07629882 0.03814941 [2,] 0.9367134 0.12657316 0.06328658 [3,] 0.9659661 0.06806776 0.03403388 [4,] 0.9353249 0.12935019 0.06467510 [5,] 0.9034842 0.19303162 0.09651581 [6,] 0.8493137 0.30137264 0.15068632 [7,] 0.8361669 0.32766617 0.16383308 [8,] 0.8019253 0.39614938 0.19807469 [9,] 0.7226752 0.55464963 0.27732481 [10,] 0.7078590 0.58428199 0.29214099 [11,] 0.6589546 0.68209071 0.34104536 [12,] 0.5788330 0.84233391 0.42116696 [13,] 0.5043418 0.99131646 0.49565823 [14,] 0.6721990 0.65560196 0.32780098 [15,] 0.5815861 0.83682782 0.41841391 [16,] 0.5435670 0.91286602 0.45643301 [17,] 0.4623885 0.92477690 0.53761155 [18,] 0.4069015 0.81380299 0.59309851 [19,] 0.4157195 0.83143910 0.58428045 [20,] 0.3216021 0.64320417 0.67839791 [21,] 0.4608907 0.92178133 0.53910934 [22,] 0.6085408 0.78291838 0.39145919 [23,] 0.6247527 0.75049467 0.37524733 [24,] 0.7022295 0.59554096 0.29777048 [25,] 0.6841488 0.63170234 0.31585117 [26,] 0.8885641 0.22287185 0.11143592 [27,] 0.8118498 0.37630048 0.18815024 [28,] 0.6964433 0.60711342 0.30355671 [29,] 0.5630473 0.87390542 0.43695271 [30,] 0.7095677 0.58086458 0.29043229 > postscript(file="/var/www/html/rcomp/tmp/13b981258620426.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/2tyhc1258620426.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/3fjzy1258620426.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/492zx1258620426.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/5p4ia1258620426.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 -782.829932 -499.195918 -744.595918 207.404082 -579.395918 -736.463946 7 8 9 10 11 12 -49.863946 -323.063946 -159.863946 -736.663946 -467.463946 140.736054 13 14 15 16 17 18 678.170068 222.804082 603.404082 -19.595918 -74.395918 678.536054 19 20 21 22 23 24 76.136054 -275.063946 29.136054 157.336054 285.536054 41.736054 25 26 27 28 29 30 -778.170068 -41.536054 -212.936054 187.063946 891.263946 -74.804082 31 32 33 34 35 36 -468.204082 142.595918 313.795918 -507.004082 -4.804082 680.395918 37 38 39 40 41 42 809.829932 569.463946 670.063946 162.063946 505.263946 -88.804082 43 44 45 46 47 48 -12.204082 -88.404082 116.795918 36.995918 -349.804082 -426.604082 49 50 51 52 53 54 -185.170068 -251.536054 -315.936054 -536.936054 -742.736054 221.536054 55 56 57 58 59 60 454.136054 543.936054 -299.863946 1049.336054 536.536054 -436.263946 61 258.170068 > postscript(file="/var/www/html/rcomp/tmp/6meqy1258620426.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 -782.829932 NA 1 -499.195918 -782.829932 2 -744.595918 -499.195918 3 207.404082 -744.595918 4 -579.395918 207.404082 5 -736.463946 -579.395918 6 -49.863946 -736.463946 7 -323.063946 -49.863946 8 -159.863946 -323.063946 9 -736.663946 -159.863946 10 -467.463946 -736.663946 11 140.736054 -467.463946 12 678.170068 140.736054 13 222.804082 678.170068 14 603.404082 222.804082 15 -19.595918 603.404082 16 -74.395918 -19.595918 17 678.536054 -74.395918 18 76.136054 678.536054 19 -275.063946 76.136054 20 29.136054 -275.063946 21 157.336054 29.136054 22 285.536054 157.336054 23 41.736054 285.536054 24 -778.170068 41.736054 25 -41.536054 -778.170068 26 -212.936054 -41.536054 27 187.063946 -212.936054 28 891.263946 187.063946 29 -74.804082 891.263946 30 -468.204082 -74.804082 31 142.595918 -468.204082 32 313.795918 142.595918 33 -507.004082 313.795918 34 -4.804082 -507.004082 35 680.395918 -4.804082 36 809.829932 680.395918 37 569.463946 809.829932 38 670.063946 569.463946 39 162.063946 670.063946 40 505.263946 162.063946 41 -88.804082 505.263946 42 -12.204082 -88.804082 43 -88.404082 -12.204082 44 116.795918 -88.404082 45 36.995918 116.795918 46 -349.804082 36.995918 47 -426.604082 -349.804082 48 -185.170068 -426.604082 49 -251.536054 -185.170068 50 -315.936054 -251.536054 51 -536.936054 -315.936054 52 -742.736054 -536.936054 53 221.536054 -742.736054 54 454.136054 221.536054 55 543.936054 454.136054 56 -299.863946 543.936054 57 1049.336054 -299.863946 58 536.536054 1049.336054 59 -436.263946 536.536054 60 258.170068 -436.263946 61 NA 258.170068 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -499.195918 -782.829932 [2,] -744.595918 -499.195918 [3,] 207.404082 -744.595918 [4,] -579.395918 207.404082 [5,] -736.463946 -579.395918 [6,] -49.863946 -736.463946 [7,] -323.063946 -49.863946 [8,] -159.863946 -323.063946 [9,] -736.663946 -159.863946 [10,] -467.463946 -736.663946 [11,] 140.736054 -467.463946 [12,] 678.170068 140.736054 [13,] 222.804082 678.170068 [14,] 603.404082 222.804082 [15,] -19.595918 603.404082 [16,] -74.395918 -19.595918 [17,] 678.536054 -74.395918 [18,] 76.136054 678.536054 [19,] -275.063946 76.136054 [20,] 29.136054 -275.063946 [21,] 157.336054 29.136054 [22,] 285.536054 157.336054 [23,] 41.736054 285.536054 [24,] -778.170068 41.736054 [25,] -41.536054 -778.170068 [26,] -212.936054 -41.536054 [27,] 187.063946 -212.936054 [28,] 891.263946 187.063946 [29,] -74.804082 891.263946 [30,] -468.204082 -74.804082 [31,] 142.595918 -468.204082 [32,] 313.795918 142.595918 [33,] -507.004082 313.795918 [34,] -4.804082 -507.004082 [35,] 680.395918 -4.804082 [36,] 809.829932 680.395918 [37,] 569.463946 809.829932 [38,] 670.063946 569.463946 [39,] 162.063946 670.063946 [40,] 505.263946 162.063946 [41,] -88.804082 505.263946 [42,] -12.204082 -88.804082 [43,] -88.404082 -12.204082 [44,] 116.795918 -88.404082 [45,] 36.995918 116.795918 [46,] -349.804082 36.995918 [47,] -426.604082 -349.804082 [48,] -185.170068 -426.604082 [49,] -251.536054 -185.170068 [50,] -315.936054 -251.536054 [51,] -536.936054 -315.936054 [52,] -742.736054 -536.936054 [53,] 221.536054 -742.736054 [54,] 454.136054 221.536054 [55,] 543.936054 454.136054 [56,] -299.863946 543.936054 [57,] 1049.336054 -299.863946 [58,] 536.536054 1049.336054 [59,] -436.263946 536.536054 [60,] 258.170068 -436.263946 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -499.195918 -782.829932 2 -744.595918 -499.195918 3 207.404082 -744.595918 4 -579.395918 207.404082 5 -736.463946 -579.395918 6 -49.863946 -736.463946 7 -323.063946 -49.863946 8 -159.863946 -323.063946 9 -736.663946 -159.863946 10 -467.463946 -736.663946 11 140.736054 -467.463946 12 678.170068 140.736054 13 222.804082 678.170068 14 603.404082 222.804082 15 -19.595918 603.404082 16 -74.395918 -19.595918 17 678.536054 -74.395918 18 76.136054 678.536054 19 -275.063946 76.136054 20 29.136054 -275.063946 21 157.336054 29.136054 22 285.536054 157.336054 23 41.736054 285.536054 24 -778.170068 41.736054 25 -41.536054 -778.170068 26 -212.936054 -41.536054 27 187.063946 -212.936054 28 891.263946 187.063946 29 -74.804082 891.263946 30 -468.204082 -74.804082 31 142.595918 -468.204082 32 313.795918 142.595918 33 -507.004082 313.795918 34 -4.804082 -507.004082 35 680.395918 -4.804082 36 809.829932 680.395918 37 569.463946 809.829932 38 670.063946 569.463946 39 162.063946 670.063946 40 505.263946 162.063946 41 -88.804082 505.263946 42 -12.204082 -88.804082 43 -88.404082 -12.204082 44 116.795918 -88.404082 45 36.995918 116.795918 46 -349.804082 36.995918 47 -426.604082 -349.804082 48 -185.170068 -426.604082 49 -251.536054 -185.170068 50 -315.936054 -251.536054 51 -536.936054 -315.936054 52 -742.736054 -536.936054 53 221.536054 -742.736054 54 454.136054 221.536054 55 543.936054 454.136054 56 -299.863946 543.936054 57 1049.336054 -299.863946 58 536.536054 1049.336054 59 -436.263946 536.536054 60 258.170068 -436.263946 > 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/77hjn1258620426.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/89fi11258620426.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/95frs1258620426.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/10xq8a1258620426.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/11g9e41258620426.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/12f14a1258620426.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/13al0c1258620426.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/14vp961258620426.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/1597xu1258620426.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/16hekk1258620426.tab") + } > > system("convert tmp/13b981258620426.ps tmp/13b981258620426.png") > system("convert tmp/2tyhc1258620426.ps tmp/2tyhc1258620426.png") > system("convert tmp/3fjzy1258620426.ps tmp/3fjzy1258620426.png") > system("convert tmp/492zx1258620426.ps tmp/492zx1258620426.png") > system("convert tmp/5p4ia1258620426.ps tmp/5p4ia1258620426.png") > system("convert tmp/6meqy1258620426.ps tmp/6meqy1258620426.png") > system("convert tmp/77hjn1258620426.ps tmp/77hjn1258620426.png") > system("convert tmp/89fi11258620426.ps tmp/89fi11258620426.png") > system("convert tmp/95frs1258620426.ps tmp/95frs1258620426.png") > system("convert tmp/10xq8a1258620426.ps tmp/10xq8a1258620426.png") > > > proc.time() user system elapsed 2.418 1.548 3.234