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 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 280 1258 1 0 0 0 0 0 0 0 0 0 0 2 557 1199 0 1 0 0 0 0 0 0 0 0 0 3 831 1158 0 0 1 0 0 0 0 0 0 0 0 4 1081 1427 0 0 0 1 0 0 0 0 0 0 0 5 1318 934 0 0 0 0 1 0 0 0 0 0 0 6 1578 709 0 0 0 0 0 1 0 0 0 0 0 7 1859 1186 0 0 0 0 0 0 1 0 0 0 0 8 2141 986 0 0 0 0 0 0 0 1 0 0 0 9 2428 1033 0 0 0 0 0 0 0 0 1 0 0 10 2715 1257 0 0 0 0 0 0 0 0 0 1 0 11 3004 1105 0 0 0 0 0 0 0 0 0 0 1 12 3309 1179 0 0 0 0 0 0 0 0 0 0 0 13 269 1092 1 0 0 0 0 0 0 0 0 0 0 14 537 1092 0 1 0 0 0 0 0 0 0 0 0 15 813 1087 0 0 1 0 0 0 0 0 0 0 0 16 1068 2028 0 0 0 1 0 0 0 0 0 0 0 17 1411 2039 0 0 0 0 1 0 0 0 0 0 0 18 1675 2010 0 0 0 0 0 1 0 0 0 0 0 19 1958 754 0 0 0 0 0 0 1 0 0 0 0 20 2242 760 0 0 0 0 0 0 0 1 0 0 0 21 2524 715 0 0 0 0 0 0 0 0 1 0 0 22 2836 855 0 0 0 0 0 0 0 0 0 1 0 23 3143 971 0 0 0 0 0 0 0 0 0 0 1 24 3522 815 0 0 0 0 0 0 0 0 0 0 0 25 285 915 1 0 0 0 0 0 0 0 0 0 0 26 574 843 0 1 0 0 0 0 0 0 0 0 0 27 865 761 0 0 1 0 0 0 0 0 0 0 0 28 1147 1858 0 0 0 1 0 0 0 0 0 0 0 29 1516 2968 0 0 0 0 1 0 0 0 0 0 0 30 1789 4061 0 0 0 0 0 1 0 0 0 0 0 31 2087 3661 0 0 0 0 0 0 1 0 0 0 0 32 2372 3269 0 0 0 0 0 0 0 1 0 0 0 33 2669 2857 0 0 0 0 0 0 0 0 1 0 0 34 2966 2568 0 0 0 0 0 0 0 0 0 1 0 35 3270 2274 0 0 0 0 0 0 0 0 0 0 1 36 3652 1987 0 0 0 0 0 0 0 0 0 0 0 37 329 683 1 0 0 0 0 0 0 0 0 0 0 38 658 381 0 1 0 0 0 0 0 0 0 0 0 39 988 71 0 0 1 0 0 0 0 0 0 0 0 40 1303 1772 0 0 0 1 0 0 0 0 0 0 0 41 1603 3485 0 0 0 0 1 0 0 0 0 0 0 42 1929 5181 0 0 0 0 0 1 0 0 0 0 0 43 2235 4479 0 0 0 0 0 0 1 0 0 0 0 44 2544 3782 0 0 0 0 0 0 0 1 0 0 0 45 2872 3067 0 0 0 0 0 0 0 0 1 0 0 46 3198 2489 0 0 0 0 0 0 0 0 0 1 0 47 3544 1903 0 0 0 0 0 0 0 0 0 0 1 48 3903 1330 0 0 0 0 0 0 0 0 0 0 0 49 332 736 1 0 0 0 0 0 0 0 0 0 0 50 665 483 0 1 0 0 0 0 0 0 0 0 0 51 1001 242 0 0 1 0 0 0 0 0 0 0 0 52 1329 1334 0 0 0 1 0 0 0 0 0 0 0 53 1639 2423 0 0 0 0 1 0 0 0 0 0 0 54 1975 3523 0 0 0 0 0 1 0 0 0 0 0 55 2304 2986 0 0 0 0 0 0 1 0 0 0 0 56 2640 2462 0 0 0 0 0 0 0 1 0 0 0 57 2992 1908 0 0 0 0 0 0 0 0 1 0 0 58 3330 1575 0 0 0 0 0 0 0 0 0 1 0 59 3690 1237 0 0 0 0 0 0 0 0 0 0 1 60 4063 904 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 3.580e+03 8.796e-02 -3.364e+03 -3.053e+03 -2.739e+03 -2.543e+03 M5 M6 M7 M8 M9 M10 -2.292e+03 -2.064e+03 -1.722e+03 -1.391e+03 -1.052e+03 -7.253e+02 M11 -3.820e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -375.17 -103.45 -38.58 99.88 403.02 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.580e+03 8.402e+01 42.612 < 2e-16 *** X 8.796e-02 2.600e-02 3.383 0.00145 ** M1 -3.364e+03 1.100e+02 -30.588 < 2e-16 *** M2 -3.053e+03 1.103e+02 -27.678 < 2e-16 *** M3 -2.739e+03 1.107e+02 -24.742 < 2e-16 *** M4 -2.543e+03 1.103e+02 -23.059 < 2e-16 *** M5 -2.292e+03 1.135e+02 -20.184 < 2e-16 *** M6 -2.064e+03 1.198e+02 -17.224 < 2e-16 *** M7 -1.722e+03 1.153e+02 -14.929 < 2e-16 *** M8 -1.391e+03 1.128e+02 -12.332 2.44e-16 *** M9 -1.052e+03 1.111e+02 -9.471 1.79e-12 *** M10 -7.253e+02 1.105e+02 -6.565 3.73e-08 *** M11 -3.820e+02 1.099e+02 -3.477 0.00110 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 173.4 on 47 degrees of freedom Multiple R-squared: 0.9793, Adjusted R-squared: 0.974 F-statistic: 185.1 on 12 and 47 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,] 6.912375e-04 0.0013824749 0.99930876 [2,] 5.341593e-04 0.0010683186 0.99946584 [3,] 6.297238e-05 0.0001259448 0.99993703 [4,] 8.356457e-04 0.0016712915 0.99916435 [5,] 1.026460e-03 0.0020529203 0.99897354 [6,] 1.239359e-03 0.0024787185 0.99876064 [7,] 2.905860e-03 0.0058117201 0.99709414 [8,] 1.059382e-02 0.0211876382 0.98940618 [9,] 1.027347e-01 0.2054693611 0.89726532 [10,] 6.159691e-02 0.1231938213 0.93840309 [11,] 3.598292e-02 0.0719658310 0.96401708 [12,] 2.113808e-02 0.0422761665 0.97886192 [13,] 1.672816e-02 0.0334563182 0.98327184 [14,] 1.925565e-02 0.0385113014 0.98074435 [15,] 1.861405e-02 0.0372281033 0.98138595 [16,] 1.796074e-02 0.0359214739 0.98203926 [17,] 2.005891e-02 0.0401178222 0.97994109 [18,] 3.133404e-02 0.0626680773 0.96866596 [19,] 7.443447e-02 0.1488689453 0.92556553 [20,] 3.425731e-01 0.6851462206 0.65742689 [21,] 9.542463e-01 0.0915074251 0.04575371 [22,] 9.289003e-01 0.1421994611 0.07109973 [23,] 9.165093e-01 0.1669813364 0.08349067 [24,] 9.225672e-01 0.1548656723 0.07743284 [25,] 9.057703e-01 0.1884594061 0.09422970 [26,] 8.538474e-01 0.2923052599 0.14615263 [27,] 8.429566e-01 0.3140867806 0.15704339 [28,] 8.315640e-01 0.3368720959 0.16843605 [29,] 8.069602e-01 0.3860796338 0.19303982 > postscript(file="/var/www/html/rcomp/tmp/132x71258722686.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/2t9he1258722686.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/3m6x31258722686.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/4ste51258722686.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/566yq1258722686.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 -47.252428 -76.330821 -112.069333 -82.012131 -53.108482 -1.171523 7 8 9 10 11 12 -104.064929 -135.461510 -191.332212 -250.741769 -291.632117 -375.170625 13 14 15 16 17 18 -43.651235 -86.919209 -123.824245 -147.875484 -57.303166 -18.606169 19 20 21 22 23 24 32.933355 -14.582778 -67.361253 -94.382254 -140.845612 -130.153552 25 26 27 28 29 30 -12.082494 -28.017420 -43.149614 -53.922456 -34.017068 -85.010058 31 32 33 34 35 36 -93.763430 -105.271885 -110.769410 -115.056005 -128.456176 -103.241489 37 38 39 40 41 42 52.323992 96.619633 140.542089 109.642017 7.508134 -43.524128 43 44 45 46 47 48 -17.713884 21.605153 73.759202 123.892755 178.176609 205.547568 49 50 51 52 53 54 50.662165 94.647816 138.501102 174.168055 136.920582 148.311878 55 56 57 58 59 60 182.608888 233.711020 295.703672 336.287273 382.757296 403.018098 > postscript(file="/var/www/html/rcomp/tmp/6durf1258722686.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 -47.252428 NA 1 -76.330821 -47.252428 2 -112.069333 -76.330821 3 -82.012131 -112.069333 4 -53.108482 -82.012131 5 -1.171523 -53.108482 6 -104.064929 -1.171523 7 -135.461510 -104.064929 8 -191.332212 -135.461510 9 -250.741769 -191.332212 10 -291.632117 -250.741769 11 -375.170625 -291.632117 12 -43.651235 -375.170625 13 -86.919209 -43.651235 14 -123.824245 -86.919209 15 -147.875484 -123.824245 16 -57.303166 -147.875484 17 -18.606169 -57.303166 18 32.933355 -18.606169 19 -14.582778 32.933355 20 -67.361253 -14.582778 21 -94.382254 -67.361253 22 -140.845612 -94.382254 23 -130.153552 -140.845612 24 -12.082494 -130.153552 25 -28.017420 -12.082494 26 -43.149614 -28.017420 27 -53.922456 -43.149614 28 -34.017068 -53.922456 29 -85.010058 -34.017068 30 -93.763430 -85.010058 31 -105.271885 -93.763430 32 -110.769410 -105.271885 33 -115.056005 -110.769410 34 -128.456176 -115.056005 35 -103.241489 -128.456176 36 52.323992 -103.241489 37 96.619633 52.323992 38 140.542089 96.619633 39 109.642017 140.542089 40 7.508134 109.642017 41 -43.524128 7.508134 42 -17.713884 -43.524128 43 21.605153 -17.713884 44 73.759202 21.605153 45 123.892755 73.759202 46 178.176609 123.892755 47 205.547568 178.176609 48 50.662165 205.547568 49 94.647816 50.662165 50 138.501102 94.647816 51 174.168055 138.501102 52 136.920582 174.168055 53 148.311878 136.920582 54 182.608888 148.311878 55 233.711020 182.608888 56 295.703672 233.711020 57 336.287273 295.703672 58 382.757296 336.287273 59 403.018098 382.757296 60 NA 403.018098 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -76.330821 -47.252428 [2,] -112.069333 -76.330821 [3,] -82.012131 -112.069333 [4,] -53.108482 -82.012131 [5,] -1.171523 -53.108482 [6,] -104.064929 -1.171523 [7,] -135.461510 -104.064929 [8,] -191.332212 -135.461510 [9,] -250.741769 -191.332212 [10,] -291.632117 -250.741769 [11,] -375.170625 -291.632117 [12,] -43.651235 -375.170625 [13,] -86.919209 -43.651235 [14,] -123.824245 -86.919209 [15,] -147.875484 -123.824245 [16,] -57.303166 -147.875484 [17,] -18.606169 -57.303166 [18,] 32.933355 -18.606169 [19,] -14.582778 32.933355 [20,] -67.361253 -14.582778 [21,] -94.382254 -67.361253 [22,] -140.845612 -94.382254 [23,] -130.153552 -140.845612 [24,] -12.082494 -130.153552 [25,] -28.017420 -12.082494 [26,] -43.149614 -28.017420 [27,] -53.922456 -43.149614 [28,] -34.017068 -53.922456 [29,] -85.010058 -34.017068 [30,] -93.763430 -85.010058 [31,] -105.271885 -93.763430 [32,] -110.769410 -105.271885 [33,] -115.056005 -110.769410 [34,] -128.456176 -115.056005 [35,] -103.241489 -128.456176 [36,] 52.323992 -103.241489 [37,] 96.619633 52.323992 [38,] 140.542089 96.619633 [39,] 109.642017 140.542089 [40,] 7.508134 109.642017 [41,] -43.524128 7.508134 [42,] -17.713884 -43.524128 [43,] 21.605153 -17.713884 [44,] 73.759202 21.605153 [45,] 123.892755 73.759202 [46,] 178.176609 123.892755 [47,] 205.547568 178.176609 [48,] 50.662165 205.547568 [49,] 94.647816 50.662165 [50,] 138.501102 94.647816 [51,] 174.168055 138.501102 [52,] 136.920582 174.168055 [53,] 148.311878 136.920582 [54,] 182.608888 148.311878 [55,] 233.711020 182.608888 [56,] 295.703672 233.711020 [57,] 336.287273 295.703672 [58,] 382.757296 336.287273 [59,] 403.018098 382.757296 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -76.330821 -47.252428 2 -112.069333 -76.330821 3 -82.012131 -112.069333 4 -53.108482 -82.012131 5 -1.171523 -53.108482 6 -104.064929 -1.171523 7 -135.461510 -104.064929 8 -191.332212 -135.461510 9 -250.741769 -191.332212 10 -291.632117 -250.741769 11 -375.170625 -291.632117 12 -43.651235 -375.170625 13 -86.919209 -43.651235 14 -123.824245 -86.919209 15 -147.875484 -123.824245 16 -57.303166 -147.875484 17 -18.606169 -57.303166 18 32.933355 -18.606169 19 -14.582778 32.933355 20 -67.361253 -14.582778 21 -94.382254 -67.361253 22 -140.845612 -94.382254 23 -130.153552 -140.845612 24 -12.082494 -130.153552 25 -28.017420 -12.082494 26 -43.149614 -28.017420 27 -53.922456 -43.149614 28 -34.017068 -53.922456 29 -85.010058 -34.017068 30 -93.763430 -85.010058 31 -105.271885 -93.763430 32 -110.769410 -105.271885 33 -115.056005 -110.769410 34 -128.456176 -115.056005 35 -103.241489 -128.456176 36 52.323992 -103.241489 37 96.619633 52.323992 38 140.542089 96.619633 39 109.642017 140.542089 40 7.508134 109.642017 41 -43.524128 7.508134 42 -17.713884 -43.524128 43 21.605153 -17.713884 44 73.759202 21.605153 45 123.892755 73.759202 46 178.176609 123.892755 47 205.547568 178.176609 48 50.662165 205.547568 49 94.647816 50.662165 50 138.501102 94.647816 51 174.168055 138.501102 52 136.920582 174.168055 53 148.311878 136.920582 54 182.608888 148.311878 55 233.711020 182.608888 56 295.703672 233.711020 57 336.287273 295.703672 58 382.757296 336.287273 59 403.018098 382.757296 > 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/78b1e1258722686.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/8j0hq1258722686.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/9i7zb1258722686.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/10k1r11258722686.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/1167yk1258722686.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/12ima61258722686.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/134kfv1258722686.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/1442q11258722686.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/15ql6u1258722686.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/16motu1258722686.tab") + } > > system("convert tmp/132x71258722686.ps tmp/132x71258722686.png") > system("convert tmp/2t9he1258722686.ps tmp/2t9he1258722686.png") > system("convert tmp/3m6x31258722686.ps tmp/3m6x31258722686.png") > system("convert tmp/4ste51258722686.ps tmp/4ste51258722686.png") > system("convert tmp/566yq1258722686.ps tmp/566yq1258722686.png") > system("convert tmp/6durf1258722686.ps tmp/6durf1258722686.png") > system("convert tmp/78b1e1258722686.ps tmp/78b1e1258722686.png") > system("convert tmp/8j0hq1258722686.ps tmp/8j0hq1258722686.png") > system("convert tmp/9i7zb1258722686.ps tmp/9i7zb1258722686.png") > system("convert tmp/10k1r11258722686.ps tmp/10k1r11258722686.png") > > > proc.time() user system elapsed 2.346 1.550 2.787