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.70 + ,110.30 + ,8.10 + ,8.00 + ,7.50 + ,103.90 + ,7.70 + ,8.10 + ,7.60 + ,101.60 + ,7.50 + ,7.70 + ,7.80 + ,94.60 + ,7.60 + ,7.50 + ,7.80 + ,95.90 + ,7.80 + ,7.60 + ,7.80 + ,104.70 + ,7.80 + ,7.80 + ,7.50 + ,102.80 + ,7.80 + ,7.80 + ,7.50 + ,98.10 + ,7.50 + ,7.80 + ,7.10 + ,113.90 + ,7.50 + ,7.50 + ,7.50 + ,80.90 + ,7.10 + ,7.50 + ,7.50 + ,95.70 + ,7.50 + ,7.10 + ,7.60 + ,113.20 + ,7.50 + ,7.50 + ,7.70 + ,105.90 + ,7.60 + ,7.50 + ,7.70 + ,108.80 + ,7.70 + ,7.60 + ,7.90 + ,102.30 + ,7.70 + ,7.70 + ,8.10 + ,99.00 + ,7.90 + ,7.70 + ,8.20 + ,100.70 + ,8.10 + ,7.90 + ,8.20 + ,115.50 + ,8.20 + ,8.10 + ,8.20 + ,100.70 + ,8.20 + ,8.20 + ,7.90 + ,109.90 + ,8.20 + ,8.20 + ,7.30 + ,114.60 + ,7.90 + ,8.20 + ,6.90 + ,85.40 + ,7.30 + ,7.90 + ,6.60 + ,100.50 + ,6.90 + ,7.30 + ,6.70 + ,114.80 + ,6.60 + ,6.90 + ,6.90 + ,116.50 + ,6.70 + ,6.60 + ,7.00 + ,112.90 + ,6.90 + ,6.70 + ,7.10 + ,102.00 + ,7.00 + ,6.90 + ,7.20 + ,106.00 + ,7.10 + ,7.00 + ,7.10 + ,105.30 + ,7.20 + ,7.10 + ,6.90 + ,118.80 + ,7.10 + ,7.20 + ,7.00 + ,106.10 + ,6.90 + ,7.10 + ,6.80 + ,109.30 + ,7.00 + ,6.90 + ,6.40 + ,117.20 + ,6.80 + ,7.00 + ,6.70 + ,92.50 + ,6.40 + ,6.80 + ,6.60 + ,104.20 + ,6.70 + ,6.40 + ,6.40 + ,112.50 + ,6.60 + ,6.70 + ,6.30 + ,122.40 + ,6.40 + ,6.60 + ,6.20 + ,113.30 + ,6.30 + ,6.40 + ,6.50 + ,100.00 + ,6.20 + ,6.30 + ,6.80 + ,110.70 + ,6.50 + ,6.20 + ,6.80 + ,112.80 + ,6.80 + ,6.50 + ,6.40 + ,109.80 + ,6.80 + ,6.80 + ,6.10 + ,117.30 + ,6.40 + ,6.80 + ,5.80 + ,109.10 + ,6.10 + ,6.40 + ,6.10 + ,115.90 + ,5.80 + ,6.10 + ,7.20 + ,96.00 + ,6.10 + ,5.80 + ,7.30 + ,99.80 + ,7.20 + ,6.10 + ,6.90 + ,116.80 + ,7.30 + ,7.20 + ,6.10 + ,115.70 + ,6.90 + ,7.30 + ,5.80 + ,99.40 + ,6.10 + ,6.90 + ,6.20 + ,94.30 + ,5.80 + ,6.10 + ,7.10 + ,91.00 + ,6.20 + ,5.80 + ,7.70 + ,93.20 + ,7.10 + ,6.20 + ,7.90 + ,103.10 + ,7.70 + ,7.10 + ,7.70 + ,94.10 + ,7.90 + ,7.70 + ,7.40 + ,91.80 + ,7.70 + ,7.90 + ,7.50 + ,102.70 + ,7.40 + ,7.70 + ,8.00 + ,82.60 + ,7.50 + ,7.40) + ,dim=c(4 + ,58) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2') + ,1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = '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 Y1 Y2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 7.7 110.3 8.1 8.0 1 0 0 0 0 0 0 0 0 0 0 1 2 7.5 103.9 7.7 8.1 0 1 0 0 0 0 0 0 0 0 0 2 3 7.6 101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 51 52 7.1 91.0 6.2 5.8 0 0 0 1 0 0 0 0 0 0 0 52 53 7.7 93.2 7.1 6.2 0 0 0 0 1 0 0 0 0 0 0 53 54 7.9 103.1 7.7 7.1 0 0 0 0 0 1 0 0 0 0 0 54 55 7.7 94.1 7.9 7.7 0 0 0 0 0 0 1 0 0 0 0 55 56 7.4 91.8 7.7 7.9 0 0 0 0 0 0 0 1 0 0 0 56 57 7.5 102.7 7.4 7.7 0 0 0 0 0 0 0 0 1 0 0 57 58 8.0 82.6 7.5 7.4 0 0 0 0 0 0 0 0 0 1 0 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 M1 M2 4.07581 -0.01658 1.37884 -0.67583 -0.09634 -0.06391 M3 M4 M5 M6 M7 M8 0.03745 0.01518 -0.15804 -0.02278 -0.06885 -0.15415 M9 M10 M11 t 0.01249 0.10369 -0.48169 -0.00501 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.479544 -0.130501 0.003955 0.144064 0.400840 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.075808 1.004399 4.058 0.000211 *** X -0.016584 0.005499 -3.016 0.004338 ** Y1 1.378839 0.112875 12.216 2.06e-15 *** Y2 -0.675825 0.120155 -5.625 1.37e-06 *** M1 -0.096343 0.145639 -0.662 0.511891 M2 -0.063909 0.151328 -0.422 0.674943 M3 0.037451 0.169160 0.221 0.825857 M4 0.015182 0.170499 0.089 0.929469 M5 -0.158041 0.165870 -0.953 0.346141 M6 -0.022776 0.149099 -0.153 0.879323 M7 -0.068847 0.153843 -0.448 0.656804 M8 -0.154153 0.154904 -0.995 0.325361 M9 0.012487 0.147277 0.085 0.932834 M10 0.103689 0.207027 0.501 0.619094 M11 -0.481693 0.181600 -2.652 0.011227 * t -0.005010 0.002393 -2.093 0.042392 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2167 on 42 degrees of freedom Multiple R-squared: 0.9176, Adjusted R-squared: 0.8881 F-statistic: 31.17 on 15 and 42 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.04247555 0.08495109 0.9575245 [2,] 0.02193403 0.04386805 0.9780660 [3,] 0.04556730 0.09113460 0.9544327 [4,] 0.57724484 0.84551032 0.4227552 [5,] 0.53368381 0.93263237 0.4663162 [6,] 0.49550011 0.99100022 0.5044999 [7,] 0.43050938 0.86101876 0.5694906 [8,] 0.39887206 0.79774411 0.6011279 [9,] 0.48375595 0.96751189 0.5162441 [10,] 0.37611026 0.75222052 0.6238897 [11,] 0.29315326 0.58630652 0.7068467 [12,] 0.29621067 0.59242133 0.7037893 [13,] 0.35504363 0.71008725 0.6449564 [14,] 0.32117892 0.64235784 0.6788211 [15,] 0.40542015 0.81084029 0.5945799 [16,] 0.39486931 0.78973862 0.6051307 [17,] 0.38474608 0.76949215 0.6152539 [18,] 0.37546809 0.75093618 0.6245319 [19,] 0.73789900 0.52420200 0.2621010 [20,] 0.61562251 0.76875498 0.3843775 [21,] 0.54678216 0.90643568 0.4532178 > postscript(file="/var/www/html/rcomp/tmp/12d3n1258724109.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/2efc01258724109.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/3wmed1258724109.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/44q2x1258724109.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/5xkxj1258724109.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 58 Frequency = 1 1 2 3 4 5 6 -0.207266054 0.078292157 0.049236151 -0.112619928 -0.121013216 0.029831885 7 8 9 10 11 12 -0.250596111 0.175427691 -0.326928290 -0.008846590 0.005117936 0.188978675 13 14 15 16 17 18 0.131386487 0.081753529 0.145191004 0.041975759 0.207798490 0.320261807 19 20 21 22 23 24 0.193486835 0.136372185 -0.133663395 -0.479543560 0.207302068 0.211086316 25 26 27 28 29 30 0.199999648 0.004688860 -0.175143215 -0.051831137 -0.055507907 0.043581848 31 32 33 34 35 36 0.192235294 -0.137430435 -0.224699567 -0.004138382 -0.003699389 -0.202107201 37 38 39 40 41 42 0.171609085 -0.104007941 -0.050620721 -0.027130823 -0.024975959 -0.402235783 43 44 45 46 47 48 0.024758392 -0.177590879 0.284451643 0.351844765 -0.208720615 -0.197957790 49 50 51 52 53 54 -0.295729165 -0.060726605 0.031336780 0.149606129 -0.006301408 0.008560244 55 56 57 58 -0.159884409 0.003221439 0.400839609 0.140683766 > postscript(file="/var/www/html/rcomp/tmp/69keq1258724109.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.207266054 NA 1 0.078292157 -0.207266054 2 0.049236151 0.078292157 3 -0.112619928 0.049236151 4 -0.121013216 -0.112619928 5 0.029831885 -0.121013216 6 -0.250596111 0.029831885 7 0.175427691 -0.250596111 8 -0.326928290 0.175427691 9 -0.008846590 -0.326928290 10 0.005117936 -0.008846590 11 0.188978675 0.005117936 12 0.131386487 0.188978675 13 0.081753529 0.131386487 14 0.145191004 0.081753529 15 0.041975759 0.145191004 16 0.207798490 0.041975759 17 0.320261807 0.207798490 18 0.193486835 0.320261807 19 0.136372185 0.193486835 20 -0.133663395 0.136372185 21 -0.479543560 -0.133663395 22 0.207302068 -0.479543560 23 0.211086316 0.207302068 24 0.199999648 0.211086316 25 0.004688860 0.199999648 26 -0.175143215 0.004688860 27 -0.051831137 -0.175143215 28 -0.055507907 -0.051831137 29 0.043581848 -0.055507907 30 0.192235294 0.043581848 31 -0.137430435 0.192235294 32 -0.224699567 -0.137430435 33 -0.004138382 -0.224699567 34 -0.003699389 -0.004138382 35 -0.202107201 -0.003699389 36 0.171609085 -0.202107201 37 -0.104007941 0.171609085 38 -0.050620721 -0.104007941 39 -0.027130823 -0.050620721 40 -0.024975959 -0.027130823 41 -0.402235783 -0.024975959 42 0.024758392 -0.402235783 43 -0.177590879 0.024758392 44 0.284451643 -0.177590879 45 0.351844765 0.284451643 46 -0.208720615 0.351844765 47 -0.197957790 -0.208720615 48 -0.295729165 -0.197957790 49 -0.060726605 -0.295729165 50 0.031336780 -0.060726605 51 0.149606129 0.031336780 52 -0.006301408 0.149606129 53 0.008560244 -0.006301408 54 -0.159884409 0.008560244 55 0.003221439 -0.159884409 56 0.400839609 0.003221439 57 0.140683766 0.400839609 58 NA 0.140683766 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.078292157 -0.207266054 [2,] 0.049236151 0.078292157 [3,] -0.112619928 0.049236151 [4,] -0.121013216 -0.112619928 [5,] 0.029831885 -0.121013216 [6,] -0.250596111 0.029831885 [7,] 0.175427691 -0.250596111 [8,] -0.326928290 0.175427691 [9,] -0.008846590 -0.326928290 [10,] 0.005117936 -0.008846590 [11,] 0.188978675 0.005117936 [12,] 0.131386487 0.188978675 [13,] 0.081753529 0.131386487 [14,] 0.145191004 0.081753529 [15,] 0.041975759 0.145191004 [16,] 0.207798490 0.041975759 [17,] 0.320261807 0.207798490 [18,] 0.193486835 0.320261807 [19,] 0.136372185 0.193486835 [20,] -0.133663395 0.136372185 [21,] -0.479543560 -0.133663395 [22,] 0.207302068 -0.479543560 [23,] 0.211086316 0.207302068 [24,] 0.199999648 0.211086316 [25,] 0.004688860 0.199999648 [26,] -0.175143215 0.004688860 [27,] -0.051831137 -0.175143215 [28,] -0.055507907 -0.051831137 [29,] 0.043581848 -0.055507907 [30,] 0.192235294 0.043581848 [31,] -0.137430435 0.192235294 [32,] -0.224699567 -0.137430435 [33,] -0.004138382 -0.224699567 [34,] -0.003699389 -0.004138382 [35,] -0.202107201 -0.003699389 [36,] 0.171609085 -0.202107201 [37,] -0.104007941 0.171609085 [38,] -0.050620721 -0.104007941 [39,] -0.027130823 -0.050620721 [40,] -0.024975959 -0.027130823 [41,] -0.402235783 -0.024975959 [42,] 0.024758392 -0.402235783 [43,] -0.177590879 0.024758392 [44,] 0.284451643 -0.177590879 [45,] 0.351844765 0.284451643 [46,] -0.208720615 0.351844765 [47,] -0.197957790 -0.208720615 [48,] -0.295729165 -0.197957790 [49,] -0.060726605 -0.295729165 [50,] 0.031336780 -0.060726605 [51,] 0.149606129 0.031336780 [52,] -0.006301408 0.149606129 [53,] 0.008560244 -0.006301408 [54,] -0.159884409 0.008560244 [55,] 0.003221439 -0.159884409 [56,] 0.400839609 0.003221439 [57,] 0.140683766 0.400839609 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.078292157 -0.207266054 2 0.049236151 0.078292157 3 -0.112619928 0.049236151 4 -0.121013216 -0.112619928 5 0.029831885 -0.121013216 6 -0.250596111 0.029831885 7 0.175427691 -0.250596111 8 -0.326928290 0.175427691 9 -0.008846590 -0.326928290 10 0.005117936 -0.008846590 11 0.188978675 0.005117936 12 0.131386487 0.188978675 13 0.081753529 0.131386487 14 0.145191004 0.081753529 15 0.041975759 0.145191004 16 0.207798490 0.041975759 17 0.320261807 0.207798490 18 0.193486835 0.320261807 19 0.136372185 0.193486835 20 -0.133663395 0.136372185 21 -0.479543560 -0.133663395 22 0.207302068 -0.479543560 23 0.211086316 0.207302068 24 0.199999648 0.211086316 25 0.004688860 0.199999648 26 -0.175143215 0.004688860 27 -0.051831137 -0.175143215 28 -0.055507907 -0.051831137 29 0.043581848 -0.055507907 30 0.192235294 0.043581848 31 -0.137430435 0.192235294 32 -0.224699567 -0.137430435 33 -0.004138382 -0.224699567 34 -0.003699389 -0.004138382 35 -0.202107201 -0.003699389 36 0.171609085 -0.202107201 37 -0.104007941 0.171609085 38 -0.050620721 -0.104007941 39 -0.027130823 -0.050620721 40 -0.024975959 -0.027130823 41 -0.402235783 -0.024975959 42 0.024758392 -0.402235783 43 -0.177590879 0.024758392 44 0.284451643 -0.177590879 45 0.351844765 0.284451643 46 -0.208720615 0.351844765 47 -0.197957790 -0.208720615 48 -0.295729165 -0.197957790 49 -0.060726605 -0.295729165 50 0.031336780 -0.060726605 51 0.149606129 0.031336780 52 -0.006301408 0.149606129 53 0.008560244 -0.006301408 54 -0.159884409 0.008560244 55 0.003221439 -0.159884409 56 0.400839609 0.003221439 57 0.140683766 0.400839609 > 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/7c8se1258724109.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/8fmch1258724109.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/9yzoa1258724109.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/10qexg1258724109.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/11t7sn1258724109.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/12s17j1258724109.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/13kdvx1258724109.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/14714e1258724109.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/15vjeg1258724109.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/16wudz1258724109.tab") + } > > system("convert tmp/12d3n1258724109.ps tmp/12d3n1258724109.png") > system("convert tmp/2efc01258724109.ps tmp/2efc01258724109.png") > system("convert tmp/3wmed1258724109.ps tmp/3wmed1258724109.png") > system("convert tmp/44q2x1258724109.ps tmp/44q2x1258724109.png") > system("convert tmp/5xkxj1258724109.ps tmp/5xkxj1258724109.png") > system("convert tmp/69keq1258724109.ps tmp/69keq1258724109.png") > system("convert tmp/7c8se1258724109.ps tmp/7c8se1258724109.png") > system("convert tmp/8fmch1258724109.ps tmp/8fmch1258724109.png") > system("convert tmp/9yzoa1258724109.ps tmp/9yzoa1258724109.png") > system("convert tmp/10qexg1258724109.ps tmp/10qexg1258724109.png") > > > proc.time() user system elapsed 2.361 1.593 2.808