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(280,1258,557,1199,831,1158,1081,1427,1318,934,1578,709,1859,1186,2141,986,2428,1033,2715,1257,3004,1105,3309,1179,269,1092,537,1092,813,1087,1068,2028,1411,2039,1675,2010,1958,754,2242,760,2524,715,2836,855,3143,971,3522,815,285,915,574,843,865,761,1147,1858,1516,2968,1789,4061,2087,3661,2372,3269,2669,2857,2966,2568,3270,2274,3652,1987,329,683,658,381,988,71,1303,1772,1603,3485,1929,5181,2235,4479,2544,3782,2872,3067,3198,2489,3544,1903,3903,1330,332,736,665,483,1001,242,1329,1334,1639,2423,1975,3523,2304,2986,2640,2462,2992,1908,3330,1575,3690,1237,4063,904),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 = '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 t 1 280 1258 1 0 0 0 0 0 0 0 0 0 0 1 2 557 1199 0 1 0 0 0 0 0 0 0 0 0 2 3 831 1158 0 0 1 0 0 0 0 0 0 0 0 3 4 1081 1427 0 0 0 1 0 0 0 0 0 0 0 4 5 1318 934 0 0 0 0 1 0 0 0 0 0 0 5 6 1578 709 0 0 0 0 0 1 0 0 0 0 0 6 7 1859 1186 0 0 0 0 0 0 1 0 0 0 0 7 8 2141 986 0 0 0 0 0 0 0 1 0 0 0 8 9 2428 1033 0 0 0 0 0 0 0 0 1 0 0 9 10 2715 1257 0 0 0 0 0 0 0 0 0 1 0 10 11 3004 1105 0 0 0 0 0 0 0 0 0 0 1 11 12 3309 1179 0 0 0 0 0 0 0 0 0 0 0 12 13 269 1092 1 0 0 0 0 0 0 0 0 0 0 13 14 537 1092 0 1 0 0 0 0 0 0 0 0 0 14 15 813 1087 0 0 1 0 0 0 0 0 0 0 0 15 16 1068 2028 0 0 0 1 0 0 0 0 0 0 0 16 17 1411 2039 0 0 0 0 1 0 0 0 0 0 0 17 18 1675 2010 0 0 0 0 0 1 0 0 0 0 0 18 19 1958 754 0 0 0 0 0 0 1 0 0 0 0 19 20 2242 760 0 0 0 0 0 0 0 1 0 0 0 20 21 2524 715 0 0 0 0 0 0 0 0 1 0 0 21 22 2836 855 0 0 0 0 0 0 0 0 0 1 0 22 23 3143 971 0 0 0 0 0 0 0 0 0 0 1 23 24 3522 815 0 0 0 0 0 0 0 0 0 0 0 24 25 285 915 1 0 0 0 0 0 0 0 0 0 0 25 26 574 843 0 1 0 0 0 0 0 0 0 0 0 26 27 865 761 0 0 1 0 0 0 0 0 0 0 0 27 28 1147 1858 0 0 0 1 0 0 0 0 0 0 0 28 29 1516 2968 0 0 0 0 1 0 0 0 0 0 0 29 30 1789 4061 0 0 0 0 0 1 0 0 0 0 0 30 31 2087 3661 0 0 0 0 0 0 1 0 0 0 0 31 32 2372 3269 0 0 0 0 0 0 0 1 0 0 0 32 33 2669 2857 0 0 0 0 0 0 0 0 1 0 0 33 34 2966 2568 0 0 0 0 0 0 0 0 0 1 0 34 35 3270 2274 0 0 0 0 0 0 0 0 0 0 1 35 36 3652 1987 0 0 0 0 0 0 0 0 0 0 0 36 37 329 683 1 0 0 0 0 0 0 0 0 0 0 37 38 658 381 0 1 0 0 0 0 0 0 0 0 0 38 39 988 71 0 0 1 0 0 0 0 0 0 0 0 39 40 1303 1772 0 0 0 1 0 0 0 0 0 0 0 40 41 1603 3485 0 0 0 0 1 0 0 0 0 0 0 41 42 1929 5181 0 0 0 0 0 1 0 0 0 0 0 42 43 2235 4479 0 0 0 0 0 0 1 0 0 0 0 43 44 2544 3782 0 0 0 0 0 0 0 1 0 0 0 44 45 2872 3067 0 0 0 0 0 0 0 0 1 0 0 45 46 3198 2489 0 0 0 0 0 0 0 0 0 1 0 46 47 3544 1903 0 0 0 0 0 0 0 0 0 0 1 47 48 3903 1330 0 0 0 0 0 0 0 0 0 0 0 48 49 332 736 1 0 0 0 0 0 0 0 0 0 0 49 50 665 483 0 1 0 0 0 0 0 0 0 0 0 50 51 1001 242 0 0 1 0 0 0 0 0 0 0 0 51 52 1329 1334 0 0 0 1 0 0 0 0 0 0 0 52 53 1639 2423 0 0 0 0 1 0 0 0 0 0 0 53 54 1975 3523 0 0 0 0 0 1 0 0 0 0 0 54 55 2304 2986 0 0 0 0 0 0 1 0 0 0 0 55 56 2640 2462 0 0 0 0 0 0 0 1 0 0 0 56 57 2992 1908 0 0 0 0 0 0 0 0 1 0 0 57 58 3330 1575 0 0 0 0 0 0 0 0 0 1 0 58 59 3690 1237 0 0 0 0 0 0 0 0 0 0 1 59 60 4063 904 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 3.354e+03 2.632e-02 -3.290e+03 -2.996e+03 -2.699e+03 -2.449e+03 M5 M6 M7 M8 M9 M10 -2.163e+03 -1.899e+03 -1.595e+03 -1.295e+03 -9.853e+02 -6.773e+02 M11 t -3.579e+02 8.410e+00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -177.27 -48.72 -12.53 44.04 180.28 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.354e+03 4.711e+01 71.201 < 2e-16 *** X 2.632e-02 1.430e-02 1.841 0.072 . M1 -3.290e+03 5.648e+01 -58.250 < 2e-16 *** M2 -2.996e+03 5.650e+01 -53.023 < 2e-16 *** M3 -2.699e+03 5.661e+01 -47.682 < 2e-16 *** M4 -2.449e+03 5.687e+01 -43.054 < 2e-16 *** M5 -2.163e+03 5.899e+01 -36.671 < 2e-16 *** M6 -1.899e+03 6.277e+01 -30.250 < 2e-16 *** M7 -1.595e+03 5.986e+01 -26.649 < 2e-16 *** M8 -1.295e+03 5.815e+01 -22.269 < 2e-16 *** M9 -9.853e+02 5.698e+01 -17.292 < 2e-16 *** M10 -6.773e+02 5.653e+01 -11.981 9.60e-16 *** M11 -3.579e+02 5.612e+01 -6.377 7.85e-08 *** t 8.410e+00 7.253e-01 11.595 3.00e-15 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 88.51 on 46 degrees of freedom Multiple R-squared: 0.9947, Adjusted R-squared: 0.9932 F-statistic: 666.3 on 13 and 46 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.04324202 0.0864840312 0.9567579844 [2,] 0.01242042 0.0248408405 0.9875795797 [3,] 0.14104967 0.2820993363 0.8589503318 [4,] 0.14472199 0.2894439721 0.8552780140 [5,] 0.11245830 0.2249166086 0.8875416957 [6,] 0.10027652 0.2005530373 0.8997234813 [7,] 0.10533071 0.2106614243 0.8946692879 [8,] 0.22855698 0.4571139640 0.7714430180 [9,] 0.30752487 0.6150497484 0.6924751258 [10,] 0.29919352 0.5983870495 0.7008064752 [11,] 0.24244480 0.4848896068 0.7575551966 [12,] 0.16993106 0.3398621190 0.8300689405 [13,] 0.16239900 0.3247980005 0.8376009998 [14,] 0.11562003 0.2312400614 0.8843799693 [15,] 0.07808728 0.1561745657 0.9219127171 [16,] 0.04879899 0.0975979731 0.9512010135 [17,] 0.03528019 0.0705603879 0.9647198061 [18,] 0.03719753 0.0743950568 0.9628024716 [19,] 0.12827297 0.2565459390 0.8717270305 [20,] 0.78125699 0.4374860108 0.2187430054 [21,] 0.75041548 0.4991690367 0.2495845183 [22,] 0.71651554 0.5669689263 0.2834844632 [23,] 0.81308704 0.3738259133 0.1869129567 [24,] 0.97601091 0.0479781768 0.0239890884 [25,] 0.99963231 0.0007353878 0.0003676939 [26,] 0.99921039 0.0015792177 0.0007896089 [27,] 0.99913098 0.0017380389 0.0008690195 > postscript(file="/var/www/html/rcomp/tmp/17m0l1258723100.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/2sbpd1258723100.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/3lot41258723100.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/4ce4n1258723100.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/59f0g1258723100.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 174.392122 150.133653 120.238220 104.006894 60.241868 53.501492 7 8 9 10 11 12 9.815489 -11.633064 -43.909560 -79.207170 -114.007895 -177.268206 13 14 15 16 17 18 66.838206 32.026672 3.183606 -25.736866 23.231249 15.331538 19 20 21 22 23 24 19.263527 -5.607593 -40.462360 -48.548827 -72.404152 -55.610142 25 26 27 28 29 30 -13.426156 -25.342424 -37.158609 -43.185490 2.853501 -25.580766 31 32 33 34 35 36 -29.181380 -42.575892 -52.770069 -64.563911 -80.626752 -57.384412 37 38 39 40 41 42 -64.242745 -30.104693 3.080797 14.154743 -24.679115 -15.986232 43 44 45 46 47 48 -3.637259 14.996784 43.778517 68.592060 102.215574 109.986331 49 50 51 52 53 54 -163.561428 -126.713209 -89.344015 -49.239281 -61.647504 -27.266033 55 56 57 58 59 60 3.739623 44.819764 93.363472 123.727848 164.823225 180.276429 > postscript(file="/var/www/html/rcomp/tmp/6pfuf1258723100.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 174.392122 NA 1 150.133653 174.392122 2 120.238220 150.133653 3 104.006894 120.238220 4 60.241868 104.006894 5 53.501492 60.241868 6 9.815489 53.501492 7 -11.633064 9.815489 8 -43.909560 -11.633064 9 -79.207170 -43.909560 10 -114.007895 -79.207170 11 -177.268206 -114.007895 12 66.838206 -177.268206 13 32.026672 66.838206 14 3.183606 32.026672 15 -25.736866 3.183606 16 23.231249 -25.736866 17 15.331538 23.231249 18 19.263527 15.331538 19 -5.607593 19.263527 20 -40.462360 -5.607593 21 -48.548827 -40.462360 22 -72.404152 -48.548827 23 -55.610142 -72.404152 24 -13.426156 -55.610142 25 -25.342424 -13.426156 26 -37.158609 -25.342424 27 -43.185490 -37.158609 28 2.853501 -43.185490 29 -25.580766 2.853501 30 -29.181380 -25.580766 31 -42.575892 -29.181380 32 -52.770069 -42.575892 33 -64.563911 -52.770069 34 -80.626752 -64.563911 35 -57.384412 -80.626752 36 -64.242745 -57.384412 37 -30.104693 -64.242745 38 3.080797 -30.104693 39 14.154743 3.080797 40 -24.679115 14.154743 41 -15.986232 -24.679115 42 -3.637259 -15.986232 43 14.996784 -3.637259 44 43.778517 14.996784 45 68.592060 43.778517 46 102.215574 68.592060 47 109.986331 102.215574 48 -163.561428 109.986331 49 -126.713209 -163.561428 50 -89.344015 -126.713209 51 -49.239281 -89.344015 52 -61.647504 -49.239281 53 -27.266033 -61.647504 54 3.739623 -27.266033 55 44.819764 3.739623 56 93.363472 44.819764 57 123.727848 93.363472 58 164.823225 123.727848 59 180.276429 164.823225 60 NA 180.276429 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 150.133653 174.392122 [2,] 120.238220 150.133653 [3,] 104.006894 120.238220 [4,] 60.241868 104.006894 [5,] 53.501492 60.241868 [6,] 9.815489 53.501492 [7,] -11.633064 9.815489 [8,] -43.909560 -11.633064 [9,] -79.207170 -43.909560 [10,] -114.007895 -79.207170 [11,] -177.268206 -114.007895 [12,] 66.838206 -177.268206 [13,] 32.026672 66.838206 [14,] 3.183606 32.026672 [15,] -25.736866 3.183606 [16,] 23.231249 -25.736866 [17,] 15.331538 23.231249 [18,] 19.263527 15.331538 [19,] -5.607593 19.263527 [20,] -40.462360 -5.607593 [21,] -48.548827 -40.462360 [22,] -72.404152 -48.548827 [23,] -55.610142 -72.404152 [24,] -13.426156 -55.610142 [25,] -25.342424 -13.426156 [26,] -37.158609 -25.342424 [27,] -43.185490 -37.158609 [28,] 2.853501 -43.185490 [29,] -25.580766 2.853501 [30,] -29.181380 -25.580766 [31,] -42.575892 -29.181380 [32,] -52.770069 -42.575892 [33,] -64.563911 -52.770069 [34,] -80.626752 -64.563911 [35,] -57.384412 -80.626752 [36,] -64.242745 -57.384412 [37,] -30.104693 -64.242745 [38,] 3.080797 -30.104693 [39,] 14.154743 3.080797 [40,] -24.679115 14.154743 [41,] -15.986232 -24.679115 [42,] -3.637259 -15.986232 [43,] 14.996784 -3.637259 [44,] 43.778517 14.996784 [45,] 68.592060 43.778517 [46,] 102.215574 68.592060 [47,] 109.986331 102.215574 [48,] -163.561428 109.986331 [49,] -126.713209 -163.561428 [50,] -89.344015 -126.713209 [51,] -49.239281 -89.344015 [52,] -61.647504 -49.239281 [53,] -27.266033 -61.647504 [54,] 3.739623 -27.266033 [55,] 44.819764 3.739623 [56,] 93.363472 44.819764 [57,] 123.727848 93.363472 [58,] 164.823225 123.727848 [59,] 180.276429 164.823225 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 150.133653 174.392122 2 120.238220 150.133653 3 104.006894 120.238220 4 60.241868 104.006894 5 53.501492 60.241868 6 9.815489 53.501492 7 -11.633064 9.815489 8 -43.909560 -11.633064 9 -79.207170 -43.909560 10 -114.007895 -79.207170 11 -177.268206 -114.007895 12 66.838206 -177.268206 13 32.026672 66.838206 14 3.183606 32.026672 15 -25.736866 3.183606 16 23.231249 -25.736866 17 15.331538 23.231249 18 19.263527 15.331538 19 -5.607593 19.263527 20 -40.462360 -5.607593 21 -48.548827 -40.462360 22 -72.404152 -48.548827 23 -55.610142 -72.404152 24 -13.426156 -55.610142 25 -25.342424 -13.426156 26 -37.158609 -25.342424 27 -43.185490 -37.158609 28 2.853501 -43.185490 29 -25.580766 2.853501 30 -29.181380 -25.580766 31 -42.575892 -29.181380 32 -52.770069 -42.575892 33 -64.563911 -52.770069 34 -80.626752 -64.563911 35 -57.384412 -80.626752 36 -64.242745 -57.384412 37 -30.104693 -64.242745 38 3.080797 -30.104693 39 14.154743 3.080797 40 -24.679115 14.154743 41 -15.986232 -24.679115 42 -3.637259 -15.986232 43 14.996784 -3.637259 44 43.778517 14.996784 45 68.592060 43.778517 46 102.215574 68.592060 47 109.986331 102.215574 48 -163.561428 109.986331 49 -126.713209 -163.561428 50 -89.344015 -126.713209 51 -49.239281 -89.344015 52 -61.647504 -49.239281 53 -27.266033 -61.647504 54 3.739623 -27.266033 55 44.819764 3.739623 56 93.363472 44.819764 57 123.727848 93.363472 58 164.823225 123.727848 59 180.276429 164.823225 > 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/7366w1258723100.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/8wzka1258723100.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/9drhs1258723100.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/100nwy1258723100.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/11afaa1258723100.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/1298hc1258723100.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/13efh31258723100.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/141zx51258723100.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/150xio1258723100.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/16nkxt1258723100.tab") + } > > system("convert tmp/17m0l1258723100.ps tmp/17m0l1258723100.png") > system("convert tmp/2sbpd1258723100.ps tmp/2sbpd1258723100.png") > system("convert tmp/3lot41258723100.ps tmp/3lot41258723100.png") > system("convert tmp/4ce4n1258723100.ps tmp/4ce4n1258723100.png") > system("convert tmp/59f0g1258723100.ps tmp/59f0g1258723100.png") > system("convert tmp/6pfuf1258723100.ps tmp/6pfuf1258723100.png") > system("convert tmp/7366w1258723100.ps tmp/7366w1258723100.png") > system("convert tmp/8wzka1258723100.ps tmp/8wzka1258723100.png") > system("convert tmp/9drhs1258723100.ps tmp/9drhs1258723100.png") > system("convert tmp/100nwy1258723100.ps tmp/100nwy1258723100.png") > > > proc.time() user system elapsed 2.452 1.592 5.266