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.5,99.2,8.6,116.5,8.5,98.4,8.2,90.6,8.1,130.5,7.9,107.4,8.6,106,8.7,196.5,8.7,107.8,8.5,90.5,8.4,123.8,8.5,114.7,8.7,115.3,8.7,197,8.6,88.4,8.5,93.8,8.3,111.3,8,105.9,8.2,123.6,8.1,171,8.1,97,8,99.2,7.9,126.6,7.9,103.4,8,121.3,8,129.6,7.9,110.8,8,98.9,7.7,122.8,7.2,120.9,7.5,133.1,7.3,203.1,7,110.2,7,119.5,7,135.1,7.2,113.9,7.3,137.4,7.1,157.1,6.8,126.4,6.4,112.2,6.1,128.8,6.5,136.8,7.7,156.5,7.9,215.2,7.5,146.7,6.9,130.8,6.6,133.1,6.9,153.4,7.7,159.9,8,174.6,8,145,7.7,112.9,7.3,137.8,7.4,150.6,8.1,162.1,8.3,226.4),dim=c(2,56),dimnames=list(c('X','Yt-2'),1:56)) > y <- array(NA,dim=c(2,56),dimnames=list(c('X','Yt-2'),1:56)) > 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 = 'Include Monthly Dummies' > par1 = '2' > #'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 Yt-2 X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 99.2 8.5 1 0 0 0 0 0 0 0 0 0 0 1 2 116.5 8.6 0 1 0 0 0 0 0 0 0 0 0 2 3 98.4 8.5 0 0 1 0 0 0 0 0 0 0 0 3 4 90.6 8.2 0 0 0 1 0 0 0 0 0 0 0 4 5 130.5 8.1 0 0 0 0 1 0 0 0 0 0 0 5 6 107.4 7.9 0 0 0 0 0 1 0 0 0 0 0 6 7 106.0 8.6 0 0 0 0 0 0 1 0 0 0 0 7 8 196.5 8.7 0 0 0 0 0 0 0 1 0 0 0 8 9 107.8 8.7 0 0 0 0 0 0 0 0 1 0 0 9 10 90.5 8.5 0 0 0 0 0 0 0 0 0 1 0 10 11 123.8 8.4 0 0 0 0 0 0 0 0 0 0 1 11 12 114.7 8.5 0 0 0 0 0 0 0 0 0 0 0 12 13 115.3 8.7 1 0 0 0 0 0 0 0 0 0 0 13 14 197.0 8.7 0 1 0 0 0 0 0 0 0 0 0 14 15 88.4 8.6 0 0 1 0 0 0 0 0 0 0 0 15 16 93.8 8.5 0 0 0 1 0 0 0 0 0 0 0 16 17 111.3 8.3 0 0 0 0 1 0 0 0 0 0 0 17 18 105.9 8.0 0 0 0 0 0 1 0 0 0 0 0 18 19 123.6 8.2 0 0 0 0 0 0 1 0 0 0 0 19 20 171.0 8.1 0 0 0 0 0 0 0 1 0 0 0 20 21 97.0 8.1 0 0 0 0 0 0 0 0 1 0 0 21 22 99.2 8.0 0 0 0 0 0 0 0 0 0 1 0 22 23 126.6 7.9 0 0 0 0 0 0 0 0 0 0 1 23 24 103.4 7.9 0 0 0 0 0 0 0 0 0 0 0 24 25 121.3 8.0 1 0 0 0 0 0 0 0 0 0 0 25 26 129.6 8.0 0 1 0 0 0 0 0 0 0 0 0 26 27 110.8 7.9 0 0 1 0 0 0 0 0 0 0 0 27 28 98.9 8.0 0 0 0 1 0 0 0 0 0 0 0 28 29 122.8 7.7 0 0 0 0 1 0 0 0 0 0 0 29 30 120.9 7.2 0 0 0 0 0 1 0 0 0 0 0 30 31 133.1 7.5 0 0 0 0 0 0 1 0 0 0 0 31 32 203.1 7.3 0 0 0 0 0 0 0 1 0 0 0 32 33 110.2 7.0 0 0 0 0 0 0 0 0 1 0 0 33 34 119.5 7.0 0 0 0 0 0 0 0 0 0 1 0 34 35 135.1 7.0 0 0 0 0 0 0 0 0 0 0 1 35 36 113.9 7.2 0 0 0 0 0 0 0 0 0 0 0 36 37 137.4 7.3 1 0 0 0 0 0 0 0 0 0 0 37 38 157.1 7.1 0 1 0 0 0 0 0 0 0 0 0 38 39 126.4 6.8 0 0 1 0 0 0 0 0 0 0 0 39 40 112.2 6.4 0 0 0 1 0 0 0 0 0 0 0 40 41 128.8 6.1 0 0 0 0 1 0 0 0 0 0 0 41 42 136.8 6.5 0 0 0 0 0 1 0 0 0 0 0 42 43 156.5 7.7 0 0 0 0 0 0 1 0 0 0 0 43 44 215.2 7.9 0 0 0 0 0 0 0 1 0 0 0 44 45 146.7 7.5 0 0 0 0 0 0 0 0 1 0 0 45 46 130.8 6.9 0 0 0 0 0 0 0 0 0 1 0 46 47 133.1 6.6 0 0 0 0 0 0 0 0 0 0 1 47 48 153.4 6.9 0 0 0 0 0 0 0 0 0 0 0 48 49 159.9 7.7 1 0 0 0 0 0 0 0 0 0 0 49 50 174.6 8.0 0 1 0 0 0 0 0 0 0 0 0 50 51 145.0 8.0 0 0 1 0 0 0 0 0 0 0 0 51 52 112.9 7.7 0 0 0 1 0 0 0 0 0 0 0 52 53 137.8 7.3 0 0 0 0 1 0 0 0 0 0 0 53 54 150.6 7.4 0 0 0 0 0 1 0 0 0 0 0 54 55 162.1 8.1 0 0 0 0 0 0 1 0 0 0 0 55 56 226.4 8.3 0 0 0 0 0 0 0 1 0 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 54.448 4.891 8.175 35.332 -6.228 -18.356 M5 M6 M7 M8 M9 M10 6.488 4.070 11.991 76.989 -3.942 -9.254 M11 t 10.021 0.987 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -24.9687 -6.8783 -0.7588 6.0030 50.8511 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 54.4479 35.3695 1.539 0.13121 X 4.8909 4.1044 1.192 0.24009 M1 8.1750 9.2101 0.888 0.37980 M2 35.3324 9.2422 3.823 0.00043 *** M3 -6.2276 9.1855 -0.678 0.50150 M4 -18.3564 9.1280 -2.011 0.05077 . M5 6.4883 9.1408 0.710 0.48174 M6 4.0705 9.1656 0.444 0.65925 M7 11.9911 9.2822 1.292 0.20347 M8 76.9885 9.3388 8.244 2.56e-10 *** M9 -3.9423 9.6310 -0.409 0.68437 M10 -9.2538 9.6201 -0.962 0.34159 M11 10.0206 9.6401 1.039 0.30453 t 0.9870 0.1567 6.299 1.48e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 13.59 on 42 degrees of freedom Multiple R-squared: 0.8626, Adjusted R-squared: 0.82 F-statistic: 20.28 on 13 and 42 DF, p-value: 5.195e-14 > 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.9999814 3.710197e-05 1.855098e-05 [2,] 0.9999681 6.373112e-05 3.186556e-05 [3,] 0.9999333 1.334294e-04 6.671470e-05 [4,] 0.9999592 8.162762e-05 4.081381e-05 [5,] 0.9998986 2.028649e-04 1.014325e-04 [6,] 0.9997462 5.075725e-04 2.537863e-04 [7,] 0.9996621 6.757437e-04 3.378718e-04 [8,] 0.9992532 1.493650e-03 7.468248e-04 [9,] 0.9984923 3.015498e-03 1.507749e-03 [10,] 0.9990482 1.903575e-03 9.517876e-04 [11,] 0.9983894 3.221274e-03 1.610637e-03 [12,] 0.9964390 7.122017e-03 3.561008e-03 [13,] 0.9951763 9.647418e-03 4.823709e-03 [14,] 0.9907785 1.844309e-02 9.221543e-03 [15,] 0.9836151 3.276973e-02 1.638486e-02 [16,] 0.9721945 5.561093e-02 2.780547e-02 [17,] 0.9804365 3.912691e-02 1.956346e-02 [18,] 0.9647889 7.042229e-02 3.521114e-02 [19,] 0.9921793 1.564150e-02 7.820750e-03 [20,] 0.9936352 1.272956e-02 6.364781e-03 [21,] 0.9908052 1.838954e-02 9.194770e-03 [22,] 0.9795663 4.086738e-02 2.043369e-02 [23,] 0.9771707 4.565852e-02 2.282926e-02 > postscript(file="/var/www/html/rcomp/tmp/1v32f1258810444.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/2dou41258810444.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/3559v1258810444.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/4difz1258810444.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/5xsnv1258810444.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 = 56 Frequency = 1 1 2 3 4 5 6 -5.9828672 -17.3163237 5.6458575 10.4549516 25.0124010 4.3214951 7 8 9 10 11 12 -9.4097801 14.6167634 5.8606509 -6.1366226 7.3911039 6.8356509 13 14 15 16 17 18 -2.7045382 50.8510995 -16.6867194 0.3441866 -7.0092699 -9.5110817 19 20 21 22 23 24 -1.6968866 -19.7921549 -13.8482673 -6.8346349 0.7930915 -13.3732673 25 26 27 28 29 30 -5.1243624 -24.9687247 -2.7065436 -3.9538258 -4.4181882 -2.4418118 31 32 33 34 35 36 -0.6167108 4.3771150 -7.1117152 6.5128231 1.8514555 -11.2930915 37 38 39 40 41 42 2.5558134 -4.9103608 6.4300086 5.3281968 -2.4361656 5.0383640 43 44 45 46 47 48 9.9616183 1.6990678 15.0993316 6.4584344 -10.0356509 17.8307079 49 50 51 52 53 54 11.2559543 -3.6556903 7.3173968 -12.1735091 -11.1487774 2.5930345 55 56 1.7617592 -0.9007913 > postscript(file="/var/www/html/rcomp/tmp/6ukbo1258810444.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -5.9828672 NA 1 -17.3163237 -5.9828672 2 5.6458575 -17.3163237 3 10.4549516 5.6458575 4 25.0124010 10.4549516 5 4.3214951 25.0124010 6 -9.4097801 4.3214951 7 14.6167634 -9.4097801 8 5.8606509 14.6167634 9 -6.1366226 5.8606509 10 7.3911039 -6.1366226 11 6.8356509 7.3911039 12 -2.7045382 6.8356509 13 50.8510995 -2.7045382 14 -16.6867194 50.8510995 15 0.3441866 -16.6867194 16 -7.0092699 0.3441866 17 -9.5110817 -7.0092699 18 -1.6968866 -9.5110817 19 -19.7921549 -1.6968866 20 -13.8482673 -19.7921549 21 -6.8346349 -13.8482673 22 0.7930915 -6.8346349 23 -13.3732673 0.7930915 24 -5.1243624 -13.3732673 25 -24.9687247 -5.1243624 26 -2.7065436 -24.9687247 27 -3.9538258 -2.7065436 28 -4.4181882 -3.9538258 29 -2.4418118 -4.4181882 30 -0.6167108 -2.4418118 31 4.3771150 -0.6167108 32 -7.1117152 4.3771150 33 6.5128231 -7.1117152 34 1.8514555 6.5128231 35 -11.2930915 1.8514555 36 2.5558134 -11.2930915 37 -4.9103608 2.5558134 38 6.4300086 -4.9103608 39 5.3281968 6.4300086 40 -2.4361656 5.3281968 41 5.0383640 -2.4361656 42 9.9616183 5.0383640 43 1.6990678 9.9616183 44 15.0993316 1.6990678 45 6.4584344 15.0993316 46 -10.0356509 6.4584344 47 17.8307079 -10.0356509 48 11.2559543 17.8307079 49 -3.6556903 11.2559543 50 7.3173968 -3.6556903 51 -12.1735091 7.3173968 52 -11.1487774 -12.1735091 53 2.5930345 -11.1487774 54 1.7617592 2.5930345 55 -0.9007913 1.7617592 56 NA -0.9007913 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -17.3163237 -5.9828672 [2,] 5.6458575 -17.3163237 [3,] 10.4549516 5.6458575 [4,] 25.0124010 10.4549516 [5,] 4.3214951 25.0124010 [6,] -9.4097801 4.3214951 [7,] 14.6167634 -9.4097801 [8,] 5.8606509 14.6167634 [9,] -6.1366226 5.8606509 [10,] 7.3911039 -6.1366226 [11,] 6.8356509 7.3911039 [12,] -2.7045382 6.8356509 [13,] 50.8510995 -2.7045382 [14,] -16.6867194 50.8510995 [15,] 0.3441866 -16.6867194 [16,] -7.0092699 0.3441866 [17,] -9.5110817 -7.0092699 [18,] -1.6968866 -9.5110817 [19,] -19.7921549 -1.6968866 [20,] -13.8482673 -19.7921549 [21,] -6.8346349 -13.8482673 [22,] 0.7930915 -6.8346349 [23,] -13.3732673 0.7930915 [24,] -5.1243624 -13.3732673 [25,] -24.9687247 -5.1243624 [26,] -2.7065436 -24.9687247 [27,] -3.9538258 -2.7065436 [28,] -4.4181882 -3.9538258 [29,] -2.4418118 -4.4181882 [30,] -0.6167108 -2.4418118 [31,] 4.3771150 -0.6167108 [32,] -7.1117152 4.3771150 [33,] 6.5128231 -7.1117152 [34,] 1.8514555 6.5128231 [35,] -11.2930915 1.8514555 [36,] 2.5558134 -11.2930915 [37,] -4.9103608 2.5558134 [38,] 6.4300086 -4.9103608 [39,] 5.3281968 6.4300086 [40,] -2.4361656 5.3281968 [41,] 5.0383640 -2.4361656 [42,] 9.9616183 5.0383640 [43,] 1.6990678 9.9616183 [44,] 15.0993316 1.6990678 [45,] 6.4584344 15.0993316 [46,] -10.0356509 6.4584344 [47,] 17.8307079 -10.0356509 [48,] 11.2559543 17.8307079 [49,] -3.6556903 11.2559543 [50,] 7.3173968 -3.6556903 [51,] -12.1735091 7.3173968 [52,] -11.1487774 -12.1735091 [53,] 2.5930345 -11.1487774 [54,] 1.7617592 2.5930345 [55,] -0.9007913 1.7617592 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -17.3163237 -5.9828672 2 5.6458575 -17.3163237 3 10.4549516 5.6458575 4 25.0124010 10.4549516 5 4.3214951 25.0124010 6 -9.4097801 4.3214951 7 14.6167634 -9.4097801 8 5.8606509 14.6167634 9 -6.1366226 5.8606509 10 7.3911039 -6.1366226 11 6.8356509 7.3911039 12 -2.7045382 6.8356509 13 50.8510995 -2.7045382 14 -16.6867194 50.8510995 15 0.3441866 -16.6867194 16 -7.0092699 0.3441866 17 -9.5110817 -7.0092699 18 -1.6968866 -9.5110817 19 -19.7921549 -1.6968866 20 -13.8482673 -19.7921549 21 -6.8346349 -13.8482673 22 0.7930915 -6.8346349 23 -13.3732673 0.7930915 24 -5.1243624 -13.3732673 25 -24.9687247 -5.1243624 26 -2.7065436 -24.9687247 27 -3.9538258 -2.7065436 28 -4.4181882 -3.9538258 29 -2.4418118 -4.4181882 30 -0.6167108 -2.4418118 31 4.3771150 -0.6167108 32 -7.1117152 4.3771150 33 6.5128231 -7.1117152 34 1.8514555 6.5128231 35 -11.2930915 1.8514555 36 2.5558134 -11.2930915 37 -4.9103608 2.5558134 38 6.4300086 -4.9103608 39 5.3281968 6.4300086 40 -2.4361656 5.3281968 41 5.0383640 -2.4361656 42 9.9616183 5.0383640 43 1.6990678 9.9616183 44 15.0993316 1.6990678 45 6.4584344 15.0993316 46 -10.0356509 6.4584344 47 17.8307079 -10.0356509 48 11.2559543 17.8307079 49 -3.6556903 11.2559543 50 7.3173968 -3.6556903 51 -12.1735091 7.3173968 52 -11.1487774 -12.1735091 53 2.5930345 -11.1487774 54 1.7617592 2.5930345 55 -0.9007913 1.7617592 > 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/7wwn61258810444.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/8koii1258810444.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/92t001258810444.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/10ndal1258810444.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/11rknb1258810444.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/12n8u81258810444.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/13iqk81258810444.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/14rlsq1258810444.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/15d9si1258810444.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/16ddqx1258810444.tab") + } > > system("convert tmp/1v32f1258810444.ps tmp/1v32f1258810444.png") > system("convert tmp/2dou41258810444.ps tmp/2dou41258810444.png") > system("convert tmp/3559v1258810444.ps tmp/3559v1258810444.png") > system("convert tmp/4difz1258810444.ps tmp/4difz1258810444.png") > system("convert tmp/5xsnv1258810444.ps tmp/5xsnv1258810444.png") > system("convert tmp/6ukbo1258810444.ps tmp/6ukbo1258810444.png") > system("convert tmp/7wwn61258810444.ps tmp/7wwn61258810444.png") > system("convert tmp/8koii1258810444.ps tmp/8koii1258810444.png") > system("convert tmp/92t001258810444.ps tmp/92t001258810444.png") > system("convert tmp/10ndal1258810444.ps tmp/10ndal1258810444.png") > > > proc.time() user system elapsed 2.340 1.544 3.463