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(7.55,42.97,7.55,42.98,7.59,43.01,7.59,43.09,7.59,43.14,7.57,43.39,7.57,43.46,7.59,43.54,7.6,43.62,7.64,44.01,7.64,44.5,7.76,44.73,7.76,44.89,7.76,45.09,7.77,45.17,7.83,45.24,7.94,45.42,7.94,45.67,7.94,45.68,8.09,46.56,8.18,46.72,8.26,47.01,8.28,47.26,8.28,47.49,8.28,47.51,8.29,47.52,8.3,47.66,8.3,47.71,8.31,47.87,8.33,48,8.33,48,8.34,48.05,8.48,48.25,8.59,48.72,8.67,48.94,8.67,49.16,8.67,49.18,8.71,49.25,8.72,49.34,8.72,49.49,8.72,49.57,8.74,49.63,8.74,49.67,8.74,49.7,8.74,49.8,8.79,50.09,8.85,50.49,8.86,50.73,8.87,51.12,8.92,51.15,8.96,51.41,8.97,51.61,8.99,52.06,8.98,52.17,8.98,52.18,9.01,52.19,9.01,52.74,9.03,53.05,9.05,53.38,9.05,53.78),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 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X 1 7.55 42.97 2 7.55 42.98 3 7.59 43.01 4 7.59 43.09 5 7.59 43.14 6 7.57 43.39 7 7.57 43.46 8 7.59 43.54 9 7.60 43.62 10 7.64 44.01 11 7.64 44.50 12 7.76 44.73 13 7.76 44.89 14 7.76 45.09 15 7.77 45.17 16 7.83 45.24 17 7.94 45.42 18 7.94 45.67 19 7.94 45.68 20 8.09 46.56 21 8.18 46.72 22 8.26 47.01 23 8.28 47.26 24 8.28 47.49 25 8.28 47.51 26 8.29 47.52 27 8.30 47.66 28 8.30 47.71 29 8.31 47.87 30 8.33 48.00 31 8.33 48.00 32 8.34 48.05 33 8.48 48.25 34 8.59 48.72 35 8.67 48.94 36 8.67 49.16 37 8.67 49.18 38 8.71 49.25 39 8.72 49.34 40 8.72 49.49 41 8.72 49.57 42 8.74 49.63 43 8.74 49.67 44 8.74 49.70 45 8.74 49.80 46 8.79 50.09 47 8.85 50.49 48 8.86 50.73 49 8.87 51.12 50 8.92 51.15 51 8.96 51.41 52 8.97 51.61 53 8.99 52.06 54 8.98 52.17 55 8.98 52.18 56 9.01 52.19 57 9.01 52.74 58 9.03 53.05 59 9.05 53.38 60 9.05 53.78 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 0.4621 0.1646 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.262340 -0.040446 0.001123 0.065745 0.154151 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.462073 0.178599 2.587 0.0122 * X 0.164564 0.003719 44.254 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.08843 on 58 degrees of freedom Multiple R-squared: 0.9712, Adjusted R-squared: 0.9707 F-statistic: 1958 on 1 and 58 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,] 7.088882e-03 1.417776e-02 9.929111e-01 [2,] 5.382416e-03 1.076483e-02 9.946176e-01 [3,] 1.176589e-03 2.353179e-03 9.988234e-01 [4,] 2.425289e-04 4.850579e-04 9.997575e-01 [5,] 5.265156e-05 1.053031e-04 9.999473e-01 [6,] 2.307036e-05 4.614071e-05 9.999769e-01 [7,] 5.669553e-06 1.133911e-05 9.999943e-01 [8,] 2.145122e-04 4.290244e-04 9.997855e-01 [9,] 1.389755e-04 2.779510e-04 9.998610e-01 [10,] 6.131066e-05 1.226213e-04 9.999387e-01 [11,] 3.175934e-05 6.351868e-05 9.999682e-01 [12,] 6.481191e-05 1.296238e-04 9.999352e-01 [13,] 2.744966e-03 5.489932e-03 9.972550e-01 [14,] 4.438253e-03 8.876505e-03 9.955617e-01 [15,] 5.590415e-03 1.118083e-02 9.944096e-01 [16,] 9.370187e-03 1.874037e-02 9.906298e-01 [17,] 2.638608e-02 5.277215e-02 9.736139e-01 [18,] 5.513768e-02 1.102754e-01 9.448623e-01 [19,] 5.715501e-02 1.143100e-01 9.428450e-01 [20,] 4.673076e-02 9.346152e-02 9.532692e-01 [21,] 3.907274e-02 7.814548e-02 9.609273e-01 [22,] 3.359258e-02 6.718517e-02 9.664074e-01 [23,] 3.143040e-02 6.286080e-02 9.685696e-01 [24,] 3.502047e-02 7.004094e-02 9.649795e-01 [25,] 5.437108e-02 1.087422e-01 9.456289e-01 [26,] 1.107109e-01 2.214217e-01 8.892891e-01 [27,] 3.296471e-01 6.592941e-01 6.703529e-01 [28,] 9.269022e-01 1.461956e-01 7.309778e-02 [29,] 9.961225e-01 7.754992e-03 3.877496e-03 [30,] 9.993817e-01 1.236622e-03 6.183108e-04 [31,] 9.996953e-01 6.094173e-04 3.047086e-04 [32,] 9.997422e-01 5.156956e-04 2.578478e-04 [33,] 9.997876e-01 4.248153e-04 2.124076e-04 [34,] 9.997140e-01 5.720154e-04 2.860077e-04 [35,] 9.995414e-01 9.171485e-04 4.585743e-04 [36,] 9.992368e-01 1.526364e-03 7.631819e-04 [37,] 9.989316e-01 2.136722e-03 1.068361e-03 [38,] 9.981610e-01 3.678092e-03 1.839046e-03 [39,] 9.972533e-01 5.493448e-03 2.746724e-03 [40,] 9.968555e-01 6.288922e-03 3.144461e-03 [41,] 9.987487e-01 2.502572e-03 1.251286e-03 [42,] 9.991975e-01 1.605079e-03 8.025394e-04 [43,] 9.985427e-01 2.914682e-03 1.457341e-03 [44,] 9.986279e-01 2.744269e-03 1.372135e-03 [45,] 9.999864e-01 2.718210e-05 1.359105e-05 [46,] 9.999937e-01 1.253140e-05 6.265698e-06 [47,] 9.999627e-01 7.467368e-05 3.733684e-05 [48,] 9.998000e-01 4.000655e-04 2.000327e-04 [49,] 9.991440e-01 1.711919e-03 8.559595e-04 [50,] 9.974836e-01 5.032705e-03 2.516353e-03 [51,] 9.965136e-01 6.972743e-03 3.486371e-03 > postscript(file="/var/www/html/rcomp/tmp/1nzy91258557981.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/2tpfk1258557981.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/37z8r1258557981.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/46pso1258557981.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/5y2ow1258557981.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 0.0165996549 0.0149540120 0.0500170832 0.0368519397 0.0286237251 6 7 8 9 10 -0.0325173482 -0.0440368487 -0.0372019922 -0.0403671356 -0.0645472100 11 12 13 14 15 -0.1451837137 -0.0630335011 -0.0893637880 -0.1222766466 -0.1254417901 16 17 18 19 20 -0.0769612906 0.0034171366 -0.0377239367 -0.0393695796 -0.0341861576 21 22 23 24 25 0.0294835555 0.0617599104 0.0406188372 0.0027690497 -0.0005222361 26 27 28 29 30 0.0078321209 -0.0052068801 -0.0134350948 -0.0297653817 -0.0311587398 31 32 33 34 35 -0.0311587398 -0.0293869545 0.0777001869 0.1103549691 0.1541508246 36 37 38 39 40 0.1179466801 0.1146553942 0.1431358937 0.1383251073 0.1136404633 41 42 43 44 45 0.1004753199 0.1106014623 0.1040188906 0.0990819618 0.0826255325 46 47 48 49 50 0.0849018874 0.0790761702 0.0495807398 -0.0045993346 0.0404637367 51 52 53 54 55 0.0376770204 0.0147641618 -0.0392897701 -0.0673918424 -0.0690374853 56 57 58 59 60 -0.0406831283 -0.1311934895 -0.1622084204 -0.1965146372 -0.2623403544 > postscript(file="/var/www/html/rcomp/tmp/64r2l1258557981.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.0165996549 NA 1 0.0149540120 0.0165996549 2 0.0500170832 0.0149540120 3 0.0368519397 0.0500170832 4 0.0286237251 0.0368519397 5 -0.0325173482 0.0286237251 6 -0.0440368487 -0.0325173482 7 -0.0372019922 -0.0440368487 8 -0.0403671356 -0.0372019922 9 -0.0645472100 -0.0403671356 10 -0.1451837137 -0.0645472100 11 -0.0630335011 -0.1451837137 12 -0.0893637880 -0.0630335011 13 -0.1222766466 -0.0893637880 14 -0.1254417901 -0.1222766466 15 -0.0769612906 -0.1254417901 16 0.0034171366 -0.0769612906 17 -0.0377239367 0.0034171366 18 -0.0393695796 -0.0377239367 19 -0.0341861576 -0.0393695796 20 0.0294835555 -0.0341861576 21 0.0617599104 0.0294835555 22 0.0406188372 0.0617599104 23 0.0027690497 0.0406188372 24 -0.0005222361 0.0027690497 25 0.0078321209 -0.0005222361 26 -0.0052068801 0.0078321209 27 -0.0134350948 -0.0052068801 28 -0.0297653817 -0.0134350948 29 -0.0311587398 -0.0297653817 30 -0.0311587398 -0.0311587398 31 -0.0293869545 -0.0311587398 32 0.0777001869 -0.0293869545 33 0.1103549691 0.0777001869 34 0.1541508246 0.1103549691 35 0.1179466801 0.1541508246 36 0.1146553942 0.1179466801 37 0.1431358937 0.1146553942 38 0.1383251073 0.1431358937 39 0.1136404633 0.1383251073 40 0.1004753199 0.1136404633 41 0.1106014623 0.1004753199 42 0.1040188906 0.1106014623 43 0.0990819618 0.1040188906 44 0.0826255325 0.0990819618 45 0.0849018874 0.0826255325 46 0.0790761702 0.0849018874 47 0.0495807398 0.0790761702 48 -0.0045993346 0.0495807398 49 0.0404637367 -0.0045993346 50 0.0376770204 0.0404637367 51 0.0147641618 0.0376770204 52 -0.0392897701 0.0147641618 53 -0.0673918424 -0.0392897701 54 -0.0690374853 -0.0673918424 55 -0.0406831283 -0.0690374853 56 -0.1311934895 -0.0406831283 57 -0.1622084204 -0.1311934895 58 -0.1965146372 -0.1622084204 59 -0.2623403544 -0.1965146372 60 NA -0.2623403544 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0149540120 0.0165996549 [2,] 0.0500170832 0.0149540120 [3,] 0.0368519397 0.0500170832 [4,] 0.0286237251 0.0368519397 [5,] -0.0325173482 0.0286237251 [6,] -0.0440368487 -0.0325173482 [7,] -0.0372019922 -0.0440368487 [8,] -0.0403671356 -0.0372019922 [9,] -0.0645472100 -0.0403671356 [10,] -0.1451837137 -0.0645472100 [11,] -0.0630335011 -0.1451837137 [12,] -0.0893637880 -0.0630335011 [13,] -0.1222766466 -0.0893637880 [14,] -0.1254417901 -0.1222766466 [15,] -0.0769612906 -0.1254417901 [16,] 0.0034171366 -0.0769612906 [17,] -0.0377239367 0.0034171366 [18,] -0.0393695796 -0.0377239367 [19,] -0.0341861576 -0.0393695796 [20,] 0.0294835555 -0.0341861576 [21,] 0.0617599104 0.0294835555 [22,] 0.0406188372 0.0617599104 [23,] 0.0027690497 0.0406188372 [24,] -0.0005222361 0.0027690497 [25,] 0.0078321209 -0.0005222361 [26,] -0.0052068801 0.0078321209 [27,] -0.0134350948 -0.0052068801 [28,] -0.0297653817 -0.0134350948 [29,] -0.0311587398 -0.0297653817 [30,] -0.0311587398 -0.0311587398 [31,] -0.0293869545 -0.0311587398 [32,] 0.0777001869 -0.0293869545 [33,] 0.1103549691 0.0777001869 [34,] 0.1541508246 0.1103549691 [35,] 0.1179466801 0.1541508246 [36,] 0.1146553942 0.1179466801 [37,] 0.1431358937 0.1146553942 [38,] 0.1383251073 0.1431358937 [39,] 0.1136404633 0.1383251073 [40,] 0.1004753199 0.1136404633 [41,] 0.1106014623 0.1004753199 [42,] 0.1040188906 0.1106014623 [43,] 0.0990819618 0.1040188906 [44,] 0.0826255325 0.0990819618 [45,] 0.0849018874 0.0826255325 [46,] 0.0790761702 0.0849018874 [47,] 0.0495807398 0.0790761702 [48,] -0.0045993346 0.0495807398 [49,] 0.0404637367 -0.0045993346 [50,] 0.0376770204 0.0404637367 [51,] 0.0147641618 0.0376770204 [52,] -0.0392897701 0.0147641618 [53,] -0.0673918424 -0.0392897701 [54,] -0.0690374853 -0.0673918424 [55,] -0.0406831283 -0.0690374853 [56,] -0.1311934895 -0.0406831283 [57,] -0.1622084204 -0.1311934895 [58,] -0.1965146372 -0.1622084204 [59,] -0.2623403544 -0.1965146372 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0149540120 0.0165996549 2 0.0500170832 0.0149540120 3 0.0368519397 0.0500170832 4 0.0286237251 0.0368519397 5 -0.0325173482 0.0286237251 6 -0.0440368487 -0.0325173482 7 -0.0372019922 -0.0440368487 8 -0.0403671356 -0.0372019922 9 -0.0645472100 -0.0403671356 10 -0.1451837137 -0.0645472100 11 -0.0630335011 -0.1451837137 12 -0.0893637880 -0.0630335011 13 -0.1222766466 -0.0893637880 14 -0.1254417901 -0.1222766466 15 -0.0769612906 -0.1254417901 16 0.0034171366 -0.0769612906 17 -0.0377239367 0.0034171366 18 -0.0393695796 -0.0377239367 19 -0.0341861576 -0.0393695796 20 0.0294835555 -0.0341861576 21 0.0617599104 0.0294835555 22 0.0406188372 0.0617599104 23 0.0027690497 0.0406188372 24 -0.0005222361 0.0027690497 25 0.0078321209 -0.0005222361 26 -0.0052068801 0.0078321209 27 -0.0134350948 -0.0052068801 28 -0.0297653817 -0.0134350948 29 -0.0311587398 -0.0297653817 30 -0.0311587398 -0.0311587398 31 -0.0293869545 -0.0311587398 32 0.0777001869 -0.0293869545 33 0.1103549691 0.0777001869 34 0.1541508246 0.1103549691 35 0.1179466801 0.1541508246 36 0.1146553942 0.1179466801 37 0.1431358937 0.1146553942 38 0.1383251073 0.1431358937 39 0.1136404633 0.1383251073 40 0.1004753199 0.1136404633 41 0.1106014623 0.1004753199 42 0.1040188906 0.1106014623 43 0.0990819618 0.1040188906 44 0.0826255325 0.0990819618 45 0.0849018874 0.0826255325 46 0.0790761702 0.0849018874 47 0.0495807398 0.0790761702 48 -0.0045993346 0.0495807398 49 0.0404637367 -0.0045993346 50 0.0376770204 0.0404637367 51 0.0147641618 0.0376770204 52 -0.0392897701 0.0147641618 53 -0.0673918424 -0.0392897701 54 -0.0690374853 -0.0673918424 55 -0.0406831283 -0.0690374853 56 -0.1311934895 -0.0406831283 57 -0.1622084204 -0.1311934895 58 -0.1965146372 -0.1622084204 59 -0.2623403544 -0.1965146372 > 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/79kov1258557981.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/88gi81258557981.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/9ewni1258557981.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/10q5231258557981.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/11t7gg1258557981.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/124i6z1258557981.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/13gply1258557981.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/14yhjl1258557981.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/15k7ru1258557981.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/16f5ry1258557981.tab") + } > > system("convert tmp/1nzy91258557981.ps tmp/1nzy91258557981.png") > system("convert tmp/2tpfk1258557981.ps tmp/2tpfk1258557981.png") > system("convert tmp/37z8r1258557981.ps tmp/37z8r1258557981.png") > system("convert tmp/46pso1258557981.ps tmp/46pso1258557981.png") > system("convert tmp/5y2ow1258557981.ps tmp/5y2ow1258557981.png") > system("convert tmp/64r2l1258557981.ps tmp/64r2l1258557981.png") > system("convert tmp/79kov1258557981.ps tmp/79kov1258557981.png") > system("convert tmp/88gi81258557981.ps tmp/88gi81258557981.png") > system("convert tmp/9ewni1258557981.ps tmp/9ewni1258557981.png") > system("convert tmp/10q5231258557981.ps tmp/10q5231258557981.png") > > > proc.time() user system elapsed 2.527 1.633 5.041