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(2529,314,2196,318,3202,320,2718,323,2728,325,2354,327,2697,330,2651,331,2067,332,2641,334,2539,334,2294,334,2712,339,2314,345,3092,346,2677,352,2813,355,2668,358,2939,361,2617,363,2231,364,2481,365,2421,366,2408,370,2560,371,2100,371,3315,372,2801,373,2403,373,3024,374,2507,375,2980,375,2211,376,2471,376,2594,377,2452,377,2232,378,2373,379,3127,380,2802,384,2641,389,2787,390,2619,391,2806,392,2193,393,2323,394,2529,394,2412,395,2262,396,2154,397,3230,398,2295,399,2715,400,2733,400,2317,401,2730,401,1913,406,2390,407,2484,423,1960,427),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 2529 314 1 0 0 0 0 0 0 0 0 0 0 2 2196 318 0 1 0 0 0 0 0 0 0 0 0 3 3202 320 0 0 1 0 0 0 0 0 0 0 0 4 2718 323 0 0 0 1 0 0 0 0 0 0 0 5 2728 325 0 0 0 0 1 0 0 0 0 0 0 6 2354 327 0 0 0 0 0 1 0 0 0 0 0 7 2697 330 0 0 0 0 0 0 1 0 0 0 0 8 2651 331 0 0 0 0 0 0 0 1 0 0 0 9 2067 332 0 0 0 0 0 0 0 0 1 0 0 10 2641 334 0 0 0 0 0 0 0 0 0 1 0 11 2539 334 0 0 0 0 0 0 0 0 0 0 1 12 2294 334 0 0 0 0 0 0 0 0 0 0 0 13 2712 339 1 0 0 0 0 0 0 0 0 0 0 14 2314 345 0 1 0 0 0 0 0 0 0 0 0 15 3092 346 0 0 1 0 0 0 0 0 0 0 0 16 2677 352 0 0 0 1 0 0 0 0 0 0 0 17 2813 355 0 0 0 0 1 0 0 0 0 0 0 18 2668 358 0 0 0 0 0 1 0 0 0 0 0 19 2939 361 0 0 0 0 0 0 1 0 0 0 0 20 2617 363 0 0 0 0 0 0 0 1 0 0 0 21 2231 364 0 0 0 0 0 0 0 0 1 0 0 22 2481 365 0 0 0 0 0 0 0 0 0 1 0 23 2421 366 0 0 0 0 0 0 0 0 0 0 1 24 2408 370 0 0 0 0 0 0 0 0 0 0 0 25 2560 371 1 0 0 0 0 0 0 0 0 0 0 26 2100 371 0 1 0 0 0 0 0 0 0 0 0 27 3315 372 0 0 1 0 0 0 0 0 0 0 0 28 2801 373 0 0 0 1 0 0 0 0 0 0 0 29 2403 373 0 0 0 0 1 0 0 0 0 0 0 30 3024 374 0 0 0 0 0 1 0 0 0 0 0 31 2507 375 0 0 0 0 0 0 1 0 0 0 0 32 2980 375 0 0 0 0 0 0 0 1 0 0 0 33 2211 376 0 0 0 0 0 0 0 0 1 0 0 34 2471 376 0 0 0 0 0 0 0 0 0 1 0 35 2594 377 0 0 0 0 0 0 0 0 0 0 1 36 2452 377 0 0 0 0 0 0 0 0 0 0 0 37 2232 378 1 0 0 0 0 0 0 0 0 0 0 38 2373 379 0 1 0 0 0 0 0 0 0 0 0 39 3127 380 0 0 1 0 0 0 0 0 0 0 0 40 2802 384 0 0 0 1 0 0 0 0 0 0 0 41 2641 389 0 0 0 0 1 0 0 0 0 0 0 42 2787 390 0 0 0 0 0 1 0 0 0 0 0 43 2619 391 0 0 0 0 0 0 1 0 0 0 0 44 2806 392 0 0 0 0 0 0 0 1 0 0 0 45 2193 393 0 0 0 0 0 0 0 0 1 0 0 46 2323 394 0 0 0 0 0 0 0 0 0 1 0 47 2529 394 0 0 0 0 0 0 0 0 0 0 1 48 2412 395 0 0 0 0 0 0 0 0 0 0 0 49 2262 396 1 0 0 0 0 0 0 0 0 0 0 50 2154 397 0 1 0 0 0 0 0 0 0 0 0 51 3230 398 0 0 1 0 0 0 0 0 0 0 0 52 2295 399 0 0 0 1 0 0 0 0 0 0 0 53 2715 400 0 0 0 0 1 0 0 0 0 0 0 54 2733 400 0 0 0 0 0 1 0 0 0 0 0 55 2317 401 0 0 0 0 0 0 1 0 0 0 0 56 2730 401 0 0 0 0 0 0 0 1 0 0 0 57 1913 406 0 0 0 0 0 0 0 0 1 0 0 58 2390 407 0 0 0 0 0 0 0 0 0 1 0 59 2484 423 0 0 0 0 0 0 0 0 0 0 1 60 1960 427 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 2798.646 -1.296 126.574 -101.915 865.441 334.730 M5 M6 M7 M8 M9 M10 338.983 393.998 298.932 440.969 -190.498 148.999 M11 205.866 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -414.69 -105.54 10.86 95.07 316.25 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2798.6458 310.5535 9.012 8.24e-12 *** X -1.2965 0.7924 -1.636 0.108484 M1 126.5736 106.0949 1.193 0.238849 M2 -101.9148 105.8133 -0.963 0.340399 M3 865.4410 105.6851 8.189 1.33e-10 *** M4 334.7305 105.4013 3.176 0.002639 ** M5 338.9828 105.2269 3.221 0.002318 ** M6 393.9979 105.1307 3.748 0.000488 *** M7 298.9315 105.0243 2.846 0.006536 ** M8 440.9687 104.9831 4.200 0.000118 *** M9 -190.4976 104.9045 -1.816 0.075765 . M10 148.9989 104.8692 1.421 0.161974 M11 205.8663 104.7916 1.965 0.055396 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 165.7 on 47 degrees of freedom Multiple R-squared: 0.7751, Adjusted R-squared: 0.7177 F-statistic: 13.5 on 12 and 47 DF, p-value: 1.899e-11 > 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.2250678 0.4501356 0.7749322 [2,] 0.1105709 0.2211418 0.8894291 [3,] 0.1998674 0.3997348 0.8001326 [4,] 0.1834408 0.3668816 0.8165592 [5,] 0.2076089 0.4152178 0.7923911 [6,] 0.1328268 0.2656535 0.8671732 [7,] 0.1919810 0.3839619 0.8080190 [8,] 0.2432108 0.4864217 0.7567892 [9,] 0.1687958 0.3375916 0.8312042 [10,] 0.1736606 0.3473213 0.8263394 [11,] 0.2474398 0.4948796 0.7525602 [12,] 0.2089800 0.4179601 0.7910200 [13,] 0.1654790 0.3309579 0.8345210 [14,] 0.6565441 0.6869118 0.3434559 [15,] 0.8667212 0.2665576 0.1332788 [16,] 0.8922443 0.2155114 0.1077557 [17,] 0.8928206 0.2143588 0.1071794 [18,] 0.8380313 0.3239374 0.1619687 [19,] 0.7806035 0.4387930 0.2193965 [20,] 0.7399531 0.5200938 0.2600469 [21,] 0.6498453 0.7003094 0.3501547 [22,] 0.7185812 0.5628375 0.2814188 [23,] 0.6345977 0.7308047 0.3654023 [24,] 0.6551048 0.6897905 0.3448952 [25,] 0.7992245 0.4015510 0.2007755 [26,] 0.7597637 0.4804726 0.2402363 [27,] 0.6395829 0.7208341 0.3604171 [28,] 0.6315303 0.7369395 0.3684697 [29,] 0.4551566 0.9103133 0.5448434 > postscript(file="/var/www/html/rcomp/tmp/10ma21258718922.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/26c6c1258718922.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/3am6y1258718922.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/4jwe11258718922.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/58hcm1258718922.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 10.87984847 -88.44576025 -47.20856461 3.39143539 11.73213648 6 7 8 9 10 -414.68996678 27.26582668 -159.47487441 -110.71207005 126.38442450 11 12 13 14 15 -32.48295589 -71.61664608 226.29221225 64.55959263 -123.49970628 16 17 18 19 20 -0.01022262 135.62697302 -60.49863570 309.45715776 -151.98704878 21 22 23 24 25 94.77575558 6.57575558 -108.99513025 89.05715776 115.78003788 26 27 28 29 30 -115.73154904 133.20915205 151.21616295 -251.03612507 316.24527711 31 32 33 34 35 -104.39191853 226.57088583 90.33369019 10.83719564 78.26630981 36 37 38 39 40 142.13261962 -203.14450026 167.64040737 -44.41889154 166.47760301 41 42 43 44 45 7.70778775 99.98918993 28.35199429 74.61129320 94.37409756 46 47 48 49 50 -113.82590244 35.30671718 125.46952154 -149.80759834 -28.02269071 51 52 53 54 55 81.91801038 -321.07497873 95.96922781 58.95413544 -260.68306020 56 57 58 59 60 10.27974416 -168.77147328 -29.97147328 27.90505916 -285.04265283 > postscript(file="/var/www/html/rcomp/tmp/6ehwl1258718922.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 10.87984847 NA 1 -88.44576025 10.87984847 2 -47.20856461 -88.44576025 3 3.39143539 -47.20856461 4 11.73213648 3.39143539 5 -414.68996678 11.73213648 6 27.26582668 -414.68996678 7 -159.47487441 27.26582668 8 -110.71207005 -159.47487441 9 126.38442450 -110.71207005 10 -32.48295589 126.38442450 11 -71.61664608 -32.48295589 12 226.29221225 -71.61664608 13 64.55959263 226.29221225 14 -123.49970628 64.55959263 15 -0.01022262 -123.49970628 16 135.62697302 -0.01022262 17 -60.49863570 135.62697302 18 309.45715776 -60.49863570 19 -151.98704878 309.45715776 20 94.77575558 -151.98704878 21 6.57575558 94.77575558 22 -108.99513025 6.57575558 23 89.05715776 -108.99513025 24 115.78003788 89.05715776 25 -115.73154904 115.78003788 26 133.20915205 -115.73154904 27 151.21616295 133.20915205 28 -251.03612507 151.21616295 29 316.24527711 -251.03612507 30 -104.39191853 316.24527711 31 226.57088583 -104.39191853 32 90.33369019 226.57088583 33 10.83719564 90.33369019 34 78.26630981 10.83719564 35 142.13261962 78.26630981 36 -203.14450026 142.13261962 37 167.64040737 -203.14450026 38 -44.41889154 167.64040737 39 166.47760301 -44.41889154 40 7.70778775 166.47760301 41 99.98918993 7.70778775 42 28.35199429 99.98918993 43 74.61129320 28.35199429 44 94.37409756 74.61129320 45 -113.82590244 94.37409756 46 35.30671718 -113.82590244 47 125.46952154 35.30671718 48 -149.80759834 125.46952154 49 -28.02269071 -149.80759834 50 81.91801038 -28.02269071 51 -321.07497873 81.91801038 52 95.96922781 -321.07497873 53 58.95413544 95.96922781 54 -260.68306020 58.95413544 55 10.27974416 -260.68306020 56 -168.77147328 10.27974416 57 -29.97147328 -168.77147328 58 27.90505916 -29.97147328 59 -285.04265283 27.90505916 60 NA -285.04265283 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -88.44576025 10.87984847 [2,] -47.20856461 -88.44576025 [3,] 3.39143539 -47.20856461 [4,] 11.73213648 3.39143539 [5,] -414.68996678 11.73213648 [6,] 27.26582668 -414.68996678 [7,] -159.47487441 27.26582668 [8,] -110.71207005 -159.47487441 [9,] 126.38442450 -110.71207005 [10,] -32.48295589 126.38442450 [11,] -71.61664608 -32.48295589 [12,] 226.29221225 -71.61664608 [13,] 64.55959263 226.29221225 [14,] -123.49970628 64.55959263 [15,] -0.01022262 -123.49970628 [16,] 135.62697302 -0.01022262 [17,] -60.49863570 135.62697302 [18,] 309.45715776 -60.49863570 [19,] -151.98704878 309.45715776 [20,] 94.77575558 -151.98704878 [21,] 6.57575558 94.77575558 [22,] -108.99513025 6.57575558 [23,] 89.05715776 -108.99513025 [24,] 115.78003788 89.05715776 [25,] -115.73154904 115.78003788 [26,] 133.20915205 -115.73154904 [27,] 151.21616295 133.20915205 [28,] -251.03612507 151.21616295 [29,] 316.24527711 -251.03612507 [30,] -104.39191853 316.24527711 [31,] 226.57088583 -104.39191853 [32,] 90.33369019 226.57088583 [33,] 10.83719564 90.33369019 [34,] 78.26630981 10.83719564 [35,] 142.13261962 78.26630981 [36,] -203.14450026 142.13261962 [37,] 167.64040737 -203.14450026 [38,] -44.41889154 167.64040737 [39,] 166.47760301 -44.41889154 [40,] 7.70778775 166.47760301 [41,] 99.98918993 7.70778775 [42,] 28.35199429 99.98918993 [43,] 74.61129320 28.35199429 [44,] 94.37409756 74.61129320 [45,] -113.82590244 94.37409756 [46,] 35.30671718 -113.82590244 [47,] 125.46952154 35.30671718 [48,] -149.80759834 125.46952154 [49,] -28.02269071 -149.80759834 [50,] 81.91801038 -28.02269071 [51,] -321.07497873 81.91801038 [52,] 95.96922781 -321.07497873 [53,] 58.95413544 95.96922781 [54,] -260.68306020 58.95413544 [55,] 10.27974416 -260.68306020 [56,] -168.77147328 10.27974416 [57,] -29.97147328 -168.77147328 [58,] 27.90505916 -29.97147328 [59,] -285.04265283 27.90505916 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -88.44576025 10.87984847 2 -47.20856461 -88.44576025 3 3.39143539 -47.20856461 4 11.73213648 3.39143539 5 -414.68996678 11.73213648 6 27.26582668 -414.68996678 7 -159.47487441 27.26582668 8 -110.71207005 -159.47487441 9 126.38442450 -110.71207005 10 -32.48295589 126.38442450 11 -71.61664608 -32.48295589 12 226.29221225 -71.61664608 13 64.55959263 226.29221225 14 -123.49970628 64.55959263 15 -0.01022262 -123.49970628 16 135.62697302 -0.01022262 17 -60.49863570 135.62697302 18 309.45715776 -60.49863570 19 -151.98704878 309.45715776 20 94.77575558 -151.98704878 21 6.57575558 94.77575558 22 -108.99513025 6.57575558 23 89.05715776 -108.99513025 24 115.78003788 89.05715776 25 -115.73154904 115.78003788 26 133.20915205 -115.73154904 27 151.21616295 133.20915205 28 -251.03612507 151.21616295 29 316.24527711 -251.03612507 30 -104.39191853 316.24527711 31 226.57088583 -104.39191853 32 90.33369019 226.57088583 33 10.83719564 90.33369019 34 78.26630981 10.83719564 35 142.13261962 78.26630981 36 -203.14450026 142.13261962 37 167.64040737 -203.14450026 38 -44.41889154 167.64040737 39 166.47760301 -44.41889154 40 7.70778775 166.47760301 41 99.98918993 7.70778775 42 28.35199429 99.98918993 43 74.61129320 28.35199429 44 94.37409756 74.61129320 45 -113.82590244 94.37409756 46 35.30671718 -113.82590244 47 125.46952154 35.30671718 48 -149.80759834 125.46952154 49 -28.02269071 -149.80759834 50 81.91801038 -28.02269071 51 -321.07497873 81.91801038 52 95.96922781 -321.07497873 53 58.95413544 95.96922781 54 -260.68306020 58.95413544 55 10.27974416 -260.68306020 56 -168.77147328 10.27974416 57 -29.97147328 -168.77147328 58 27.90505916 -29.97147328 59 -285.04265283 27.90505916 > 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/7m14g1258718922.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/8vs2d1258718922.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/9o18l1258718922.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/10n4wz1258718922.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/11zhch1258718922.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/1268p61258718922.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/136ht71258718922.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/14llwu1258718922.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/1574l81258718922.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/16e9t31258718922.tab") + } > system("convert tmp/10ma21258718922.ps tmp/10ma21258718922.png") > system("convert tmp/26c6c1258718922.ps tmp/26c6c1258718922.png") > system("convert tmp/3am6y1258718922.ps tmp/3am6y1258718922.png") > system("convert tmp/4jwe11258718922.ps tmp/4jwe11258718922.png") > system("convert tmp/58hcm1258718922.ps tmp/58hcm1258718922.png") > system("convert tmp/6ehwl1258718922.ps tmp/6ehwl1258718922.png") > system("convert tmp/7m14g1258718922.ps tmp/7m14g1258718922.png") > system("convert tmp/8vs2d1258718922.ps tmp/8vs2d1258718922.png") > system("convert tmp/9o18l1258718922.ps tmp/9o18l1258718922.png") > system("convert tmp/10n4wz1258718922.ps tmp/10n4wz1258718922.png") > > > proc.time() user system elapsed 2.470 1.590 8.028