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(825,444,696,627,677,387,825,696,656,327,677,825,785,448,656,677,412,225,785,656,352,182,412,785,839,460,352,412,729,411,839,352,696,342,729,839,641,361,696,729,695,377,641,696,638,331,695,641,762,428,638,695,635,340,762,638,721,352,635,762,854,461,721,635,418,221,854,721,367,198,418,854,824,422,367,418,687,329,824,367,601,320,687,824,676,375,601,687,740,364,676,601,691,351,740,676,683,380,691,740,594,319,683,691,729,322,594,683,731,386,729,594,386,221,731,729,331,187,386,731,707,344,331,386,715,342,707,331,657,365,715,707,653,313,657,715,642,356,653,657,643,337,642,653,718,389,643,642,654,326,718,643,632,343,654,718,731,357,632,654,392,220,731,632,344,228,392,731,792,391,344,392,852,425,792,344,649,332,852,792,629,298,649,852,685,360,629,649,617,326,685,629,715,325,617,685,715,393,715,617,629,301,715,715,916,426,629,715,531,265,916,629,357,210,531,916,917,429,357,531,828,440,917,357,708,357,828,917,858,431,708,828),dim=c(4,58),dimnames=list(c('Y','X','Y-1','Y-2'),1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y-1','Y-2'),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 Y-1 Y-2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 825 444 696 627 1 0 0 0 0 0 0 0 0 0 0 1 2 677 387 825 696 0 1 0 0 0 0 0 0 0 0 0 2 3 656 327 677 825 0 0 1 0 0 0 0 0 0 0 0 3 4 785 448 656 677 0 0 0 1 0 0 0 0 0 0 0 4 5 412 225 785 656 0 0 0 0 1 0 0 0 0 0 0 5 6 352 182 412 785 0 0 0 0 0 1 0 0 0 0 0 6 7 839 460 352 412 0 0 0 0 0 0 1 0 0 0 0 7 8 729 411 839 352 0 0 0 0 0 0 0 1 0 0 0 8 9 696 342 729 839 0 0 0 0 0 0 0 0 1 0 0 9 10 641 361 696 729 0 0 0 0 0 0 0 0 0 1 0 10 11 695 377 641 696 0 0 0 0 0 0 0 0 0 0 1 11 12 638 331 695 641 0 0 0 0 0 0 0 0 0 0 0 12 13 762 428 638 695 1 0 0 0 0 0 0 0 0 0 0 13 14 635 340 762 638 0 1 0 0 0 0 0 0 0 0 0 14 15 721 352 635 762 0 0 1 0 0 0 0 0 0 0 0 15 16 854 461 721 635 0 0 0 1 0 0 0 0 0 0 0 16 17 418 221 854 721 0 0 0 0 1 0 0 0 0 0 0 17 18 367 198 418 854 0 0 0 0 0 1 0 0 0 0 0 18 19 824 422 367 418 0 0 0 0 0 0 1 0 0 0 0 19 20 687 329 824 367 0 0 0 0 0 0 0 1 0 0 0 20 21 601 320 687 824 0 0 0 0 0 0 0 0 1 0 0 21 22 676 375 601 687 0 0 0 0 0 0 0 0 0 1 0 22 23 740 364 676 601 0 0 0 0 0 0 0 0 0 0 1 23 24 691 351 740 676 0 0 0 0 0 0 0 0 0 0 0 24 25 683 380 691 740 1 0 0 0 0 0 0 0 0 0 0 25 26 594 319 683 691 0 1 0 0 0 0 0 0 0 0 0 26 27 729 322 594 683 0 0 1 0 0 0 0 0 0 0 0 27 28 731 386 729 594 0 0 0 1 0 0 0 0 0 0 0 28 29 386 221 731 729 0 0 0 0 1 0 0 0 0 0 0 29 30 331 187 386 731 0 0 0 0 0 1 0 0 0 0 0 30 31 707 344 331 386 0 0 0 0 0 0 1 0 0 0 0 31 32 715 342 707 331 0 0 0 0 0 0 0 1 0 0 0 32 33 657 365 715 707 0 0 0 0 0 0 0 0 1 0 0 33 34 653 313 657 715 0 0 0 0 0 0 0 0 0 1 0 34 35 642 356 653 657 0 0 0 0 0 0 0 0 0 0 1 35 36 643 337 642 653 0 0 0 0 0 0 0 0 0 0 0 36 37 718 389 643 642 1 0 0 0 0 0 0 0 0 0 0 37 38 654 326 718 643 0 1 0 0 0 0 0 0 0 0 0 38 39 632 343 654 718 0 0 1 0 0 0 0 0 0 0 0 39 40 731 357 632 654 0 0 0 1 0 0 0 0 0 0 0 40 41 392 220 731 632 0 0 0 0 1 0 0 0 0 0 0 41 42 344 228 392 731 0 0 0 0 0 1 0 0 0 0 0 42 43 792 391 344 392 0 0 0 0 0 0 1 0 0 0 0 43 44 852 425 792 344 0 0 0 0 0 0 0 1 0 0 0 44 45 649 332 852 792 0 0 0 0 0 0 0 0 1 0 0 45 46 629 298 649 852 0 0 0 0 0 0 0 0 0 1 0 46 47 685 360 629 649 0 0 0 0 0 0 0 0 0 0 1 47 48 617 326 685 629 0 0 0 0 0 0 0 0 0 0 0 48 49 715 325 617 685 1 0 0 0 0 0 0 0 0 0 0 49 50 715 393 715 617 0 1 0 0 0 0 0 0 0 0 0 50 51 629 301 715 715 0 0 1 0 0 0 0 0 0 0 0 51 52 916 426 629 715 0 0 0 1 0 0 0 0 0 0 0 52 53 531 265 916 629 0 0 0 0 1 0 0 0 0 0 0 53 54 357 210 531 916 0 0 0 0 0 1 0 0 0 0 0 54 55 917 429 357 531 0 0 0 0 0 0 1 0 0 0 0 55 56 828 440 917 357 0 0 0 0 0 0 0 1 0 0 0 56 57 708 357 828 917 0 0 0 0 0 0 0 0 1 0 0 57 58 858 431 708 828 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 `Y-1` `Y-2` M1 M2 104.97838 1.33317 -0.04041 0.14977 15.96837 -10.36451 M3 M4 M5 M6 M7 M8 23.23242 50.52479 -76.49523 -150.36644 89.96765 92.38042 M9 M10 M11 t -18.74603 -2.90955 4.94440 0.81937 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -66.552 -22.325 -5.256 22.732 71.094 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 104.97838 95.58221 1.098 0.27833 X 1.33317 0.16879 7.898 7.77e-10 *** `Y-1` -0.04041 0.11267 -0.359 0.72168 `Y-2` 0.14977 0.10530 1.422 0.16230 M1 15.96837 27.84569 0.573 0.56939 M2 -10.36451 25.65998 -0.404 0.68832 M3 23.23242 27.41612 0.847 0.40158 M4 50.52479 28.80601 1.754 0.08673 . M5 -76.49523 35.51231 -2.154 0.03702 * M6 -150.36644 44.61114 -3.371 0.00162 ** M7 89.96765 52.11724 1.726 0.09165 . M8 92.38042 44.59275 2.072 0.04448 * M9 -18.74603 30.51787 -0.614 0.54235 M10 -2.90955 28.60456 -0.102 0.91947 M11 4.94440 27.51554 0.180 0.85826 t 0.81937 0.30099 2.722 0.00940 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 37.38 on 42 degrees of freedom Multiple R-squared: 0.9525, Adjusted R-squared: 0.9355 F-statistic: 56.11 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.008675816 0.01735163 0.9913242 [2,] 0.022240194 0.04448039 0.9777598 [3,] 0.150627306 0.30125461 0.8493727 [4,] 0.121000387 0.24200077 0.8789996 [5,] 0.100446555 0.20089311 0.8995534 [6,] 0.079820952 0.15964190 0.9201790 [7,] 0.082934159 0.16586832 0.9170658 [8,] 0.051755897 0.10351179 0.9482441 [9,] 0.140035209 0.28007042 0.8599648 [10,] 0.187995760 0.37599152 0.8120042 [11,] 0.133533359 0.26706672 0.8664666 [12,] 0.296489936 0.59297987 0.7035101 [13,] 0.212496245 0.42499249 0.7875038 [14,] 0.214404427 0.42880885 0.7855956 [15,] 0.246005973 0.49201195 0.7539940 [16,] 0.283063115 0.56612623 0.7169369 [17,] 0.247846952 0.49569390 0.7521530 [18,] 0.192281524 0.38456305 0.8077185 [19,] 0.169909482 0.33981896 0.8300905 [20,] 0.230885896 0.46177179 0.7691141 [21,] 0.357062269 0.71412454 0.6429377 > postscript(file="/var/www/html/rcomp/tmp/1lly71259094423.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/2368d1259094423.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/335281259094423.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/4wsu71259094423.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/5kqvy1259094423.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 7 45.524392 -6.093442 -6.820448 -45.927631 12.926625 48.912509 -22.420723 8 9 10 11 12 13 14 -41.663559 50.248596 -31.595966 -4.879837 13.990187 -18.505469 10.874001 15 16 17 18 19 20 21 22.756442 4.825532 7.479696 22.657576 3.114555 12.970884 -24.704743 22 23 24 25 26 27 28 -22.640988 63.261331 27.070666 -47.944174 -23.091993 71.094204 -21.555642 29 30 31 32 33 34 35 -40.520950 8.618784 -16.392943 14.471461 -19.875071 25.251963 -43.222378 36 37 38 39 40 41 42 -12.612586 -22.037069 26.346602 -66.552388 -5.632024 -28.492453 -42.631071 43 44 45 46 47 48 49 -4.257577 32.473714 -0.907984 -9.424971 -15.159115 -28.448267 42.962320 50 51 52 53 54 55 56 -8.035167 -20.477811 68.289765 48.607082 -37.557798 39.956688 -18.252499 57 58 -4.760798 38.409963 > postscript(file="/var/www/html/rcomp/tmp/6v34j1259094423.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 45.524392 NA 1 -6.093442 45.524392 2 -6.820448 -6.093442 3 -45.927631 -6.820448 4 12.926625 -45.927631 5 48.912509 12.926625 6 -22.420723 48.912509 7 -41.663559 -22.420723 8 50.248596 -41.663559 9 -31.595966 50.248596 10 -4.879837 -31.595966 11 13.990187 -4.879837 12 -18.505469 13.990187 13 10.874001 -18.505469 14 22.756442 10.874001 15 4.825532 22.756442 16 7.479696 4.825532 17 22.657576 7.479696 18 3.114555 22.657576 19 12.970884 3.114555 20 -24.704743 12.970884 21 -22.640988 -24.704743 22 63.261331 -22.640988 23 27.070666 63.261331 24 -47.944174 27.070666 25 -23.091993 -47.944174 26 71.094204 -23.091993 27 -21.555642 71.094204 28 -40.520950 -21.555642 29 8.618784 -40.520950 30 -16.392943 8.618784 31 14.471461 -16.392943 32 -19.875071 14.471461 33 25.251963 -19.875071 34 -43.222378 25.251963 35 -12.612586 -43.222378 36 -22.037069 -12.612586 37 26.346602 -22.037069 38 -66.552388 26.346602 39 -5.632024 -66.552388 40 -28.492453 -5.632024 41 -42.631071 -28.492453 42 -4.257577 -42.631071 43 32.473714 -4.257577 44 -0.907984 32.473714 45 -9.424971 -0.907984 46 -15.159115 -9.424971 47 -28.448267 -15.159115 48 42.962320 -28.448267 49 -8.035167 42.962320 50 -20.477811 -8.035167 51 68.289765 -20.477811 52 48.607082 68.289765 53 -37.557798 48.607082 54 39.956688 -37.557798 55 -18.252499 39.956688 56 -4.760798 -18.252499 57 38.409963 -4.760798 58 NA 38.409963 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -6.093442 45.524392 [2,] -6.820448 -6.093442 [3,] -45.927631 -6.820448 [4,] 12.926625 -45.927631 [5,] 48.912509 12.926625 [6,] -22.420723 48.912509 [7,] -41.663559 -22.420723 [8,] 50.248596 -41.663559 [9,] -31.595966 50.248596 [10,] -4.879837 -31.595966 [11,] 13.990187 -4.879837 [12,] -18.505469 13.990187 [13,] 10.874001 -18.505469 [14,] 22.756442 10.874001 [15,] 4.825532 22.756442 [16,] 7.479696 4.825532 [17,] 22.657576 7.479696 [18,] 3.114555 22.657576 [19,] 12.970884 3.114555 [20,] -24.704743 12.970884 [21,] -22.640988 -24.704743 [22,] 63.261331 -22.640988 [23,] 27.070666 63.261331 [24,] -47.944174 27.070666 [25,] -23.091993 -47.944174 [26,] 71.094204 -23.091993 [27,] -21.555642 71.094204 [28,] -40.520950 -21.555642 [29,] 8.618784 -40.520950 [30,] -16.392943 8.618784 [31,] 14.471461 -16.392943 [32,] -19.875071 14.471461 [33,] 25.251963 -19.875071 [34,] -43.222378 25.251963 [35,] -12.612586 -43.222378 [36,] -22.037069 -12.612586 [37,] 26.346602 -22.037069 [38,] -66.552388 26.346602 [39,] -5.632024 -66.552388 [40,] -28.492453 -5.632024 [41,] -42.631071 -28.492453 [42,] -4.257577 -42.631071 [43,] 32.473714 -4.257577 [44,] -0.907984 32.473714 [45,] -9.424971 -0.907984 [46,] -15.159115 -9.424971 [47,] -28.448267 -15.159115 [48,] 42.962320 -28.448267 [49,] -8.035167 42.962320 [50,] -20.477811 -8.035167 [51,] 68.289765 -20.477811 [52,] 48.607082 68.289765 [53,] -37.557798 48.607082 [54,] 39.956688 -37.557798 [55,] -18.252499 39.956688 [56,] -4.760798 -18.252499 [57,] 38.409963 -4.760798 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -6.093442 45.524392 2 -6.820448 -6.093442 3 -45.927631 -6.820448 4 12.926625 -45.927631 5 48.912509 12.926625 6 -22.420723 48.912509 7 -41.663559 -22.420723 8 50.248596 -41.663559 9 -31.595966 50.248596 10 -4.879837 -31.595966 11 13.990187 -4.879837 12 -18.505469 13.990187 13 10.874001 -18.505469 14 22.756442 10.874001 15 4.825532 22.756442 16 7.479696 4.825532 17 22.657576 7.479696 18 3.114555 22.657576 19 12.970884 3.114555 20 -24.704743 12.970884 21 -22.640988 -24.704743 22 63.261331 -22.640988 23 27.070666 63.261331 24 -47.944174 27.070666 25 -23.091993 -47.944174 26 71.094204 -23.091993 27 -21.555642 71.094204 28 -40.520950 -21.555642 29 8.618784 -40.520950 30 -16.392943 8.618784 31 14.471461 -16.392943 32 -19.875071 14.471461 33 25.251963 -19.875071 34 -43.222378 25.251963 35 -12.612586 -43.222378 36 -22.037069 -12.612586 37 26.346602 -22.037069 38 -66.552388 26.346602 39 -5.632024 -66.552388 40 -28.492453 -5.632024 41 -42.631071 -28.492453 42 -4.257577 -42.631071 43 32.473714 -4.257577 44 -0.907984 32.473714 45 -9.424971 -0.907984 46 -15.159115 -9.424971 47 -28.448267 -15.159115 48 42.962320 -28.448267 49 -8.035167 42.962320 50 -20.477811 -8.035167 51 68.289765 -20.477811 52 48.607082 68.289765 53 -37.557798 48.607082 54 39.956688 -37.557798 55 -18.252499 39.956688 56 -4.760798 -18.252499 57 38.409963 -4.760798 > 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/7rnde1259094423.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/85wma1259094423.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/9j1ub1259094423.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/10avos1259094423.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/11ifqd1259094423.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/121lrf1259094423.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/13elmf1259094423.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/14lnuv1259094423.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/15qhqj1259094423.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/16v6eg1259094424.tab") + } > > system("convert tmp/1lly71259094423.ps tmp/1lly71259094423.png") > system("convert tmp/2368d1259094423.ps tmp/2368d1259094423.png") > system("convert tmp/335281259094423.ps tmp/335281259094423.png") > system("convert tmp/4wsu71259094423.ps tmp/4wsu71259094423.png") > system("convert tmp/5kqvy1259094423.ps tmp/5kqvy1259094423.png") > system("convert tmp/6v34j1259094423.ps tmp/6v34j1259094423.png") > system("convert tmp/7rnde1259094423.ps tmp/7rnde1259094423.png") > system("convert tmp/85wma1259094423.ps tmp/85wma1259094423.png") > system("convert tmp/9j1ub1259094423.ps tmp/9j1ub1259094423.png") > system("convert tmp/10avos1259094423.ps tmp/10avos1259094423.png") > > > proc.time() user system elapsed 2.391 1.597 3.064