R version 2.7.0 (2008-04-22) Copyright (C) 2008 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(564260,0,491117,0,621769,0,642302,0,611278,0,846462,0,607912,0,547550,0,715309,0,695634,0,779700,0,1303196,0,540356,0,532917,0,680054,0,663715,0,711397,0,801442,0,589042,0,611648,0,852471,0,703403,0,701913,0,1277262,0,552924,0,624650,0,785161,0,683755,0,637168,0,766338,1,590239,1,724734,1,797947,1,734796,1,741821,1,1352663,1,586784,0,619788,0,817280,0,670827,0,741638,0,791051,0,614362,0,684702,0,815746,0,740751,0,787766,0,1403677,0,704144,0,609141,0,770951,0,664689,0,719533,0,799724,0,683953,0,723532,0,705441,0,711204,0,792322,0,1360777,0),dim=c(2,60),dimnames=list(c('x','y'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('x','y'),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 x y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 564260 0 1 0 0 0 0 0 0 0 0 0 0 1 2 491117 0 0 1 0 0 0 0 0 0 0 0 0 2 3 621769 0 0 0 1 0 0 0 0 0 0 0 0 3 4 642302 0 0 0 0 1 0 0 0 0 0 0 0 4 5 611278 0 0 0 0 0 1 0 0 0 0 0 0 5 6 846462 0 0 0 0 0 0 1 0 0 0 0 0 6 7 607912 0 0 0 0 0 0 0 1 0 0 0 0 7 8 547550 0 0 0 0 0 0 0 0 1 0 0 0 8 9 715309 0 0 0 0 0 0 0 0 0 1 0 0 9 10 695634 0 0 0 0 0 0 0 0 0 0 1 0 10 11 779700 0 0 0 0 0 0 0 0 0 0 0 1 11 12 1303196 0 0 0 0 0 0 0 0 0 0 0 0 12 13 540356 0 1 0 0 0 0 0 0 0 0 0 0 13 14 532917 0 0 1 0 0 0 0 0 0 0 0 0 14 15 680054 0 0 0 1 0 0 0 0 0 0 0 0 15 16 663715 0 0 0 0 1 0 0 0 0 0 0 0 16 17 711397 0 0 0 0 0 1 0 0 0 0 0 0 17 18 801442 0 0 0 0 0 0 1 0 0 0 0 0 18 19 589042 0 0 0 0 0 0 0 1 0 0 0 0 19 20 611648 0 0 0 0 0 0 0 0 1 0 0 0 20 21 852471 0 0 0 0 0 0 0 0 0 1 0 0 21 22 703403 0 0 0 0 0 0 0 0 0 0 1 0 22 23 701913 0 0 0 0 0 0 0 0 0 0 0 1 23 24 1277262 0 0 0 0 0 0 0 0 0 0 0 0 24 25 552924 0 1 0 0 0 0 0 0 0 0 0 0 25 26 624650 0 0 1 0 0 0 0 0 0 0 0 0 26 27 785161 0 0 0 1 0 0 0 0 0 0 0 0 27 28 683755 0 0 0 0 1 0 0 0 0 0 0 0 28 29 637168 0 0 0 0 0 1 0 0 0 0 0 0 29 30 766338 1 0 0 0 0 0 1 0 0 0 0 0 30 31 590239 1 0 0 0 0 0 0 1 0 0 0 0 31 32 724734 1 0 0 0 0 0 0 0 1 0 0 0 32 33 797947 1 0 0 0 0 0 0 0 0 1 0 0 33 34 734796 1 0 0 0 0 0 0 0 0 0 1 0 34 35 741821 1 0 0 0 0 0 0 0 0 0 0 1 35 36 1352663 1 0 0 0 0 0 0 0 0 0 0 0 36 37 586784 0 1 0 0 0 0 0 0 0 0 0 0 37 38 619788 0 0 1 0 0 0 0 0 0 0 0 0 38 39 817280 0 0 0 1 0 0 0 0 0 0 0 0 39 40 670827 0 0 0 0 1 0 0 0 0 0 0 0 40 41 741638 0 0 0 0 0 1 0 0 0 0 0 0 41 42 791051 0 0 0 0 0 0 1 0 0 0 0 0 42 43 614362 0 0 0 0 0 0 0 1 0 0 0 0 43 44 684702 0 0 0 0 0 0 0 0 1 0 0 0 44 45 815746 0 0 0 0 0 0 0 0 0 1 0 0 45 46 740751 0 0 0 0 0 0 0 0 0 0 1 0 46 47 787766 0 0 0 0 0 0 0 0 0 0 0 1 47 48 1403677 0 0 0 0 0 0 0 0 0 0 0 0 48 49 704144 0 1 0 0 0 0 0 0 0 0 0 0 49 50 609141 0 0 1 0 0 0 0 0 0 0 0 0 50 51 770951 0 0 0 1 0 0 0 0 0 0 0 0 51 52 664689 0 0 0 0 1 0 0 0 0 0 0 0 52 53 719533 0 0 0 0 0 1 0 0 0 0 0 0 53 54 799724 0 0 0 0 0 0 1 0 0 0 0 0 54 55 683953 0 0 0 0 0 0 0 1 0 0 0 0 55 56 723532 0 0 0 0 0 0 0 0 1 0 0 0 56 57 705441 0 0 0 0 0 0 0 0 0 1 0 0 57 58 711204 0 0 0 0 0 0 0 0 0 0 1 0 58 59 792322 0 0 0 0 0 0 0 0 0 0 0 1 59 60 1360777 0 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) y M1 M2 M3 M4 1282020 6650 -731330 -747061 -589101 -660646 M5 M6 M7 M8 M9 M10 -643061 -529151 -714613 -674841 -557452 -619237 M11 t -577250 1560 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -108055.1 -31007.6 459.5 22114.6 95139.8 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1282020.1 24394.2 52.554 < 2e-16 *** y 6650.0 19407.0 0.343 0.733 M1 -731329.9 29554.8 -24.745 < 2e-16 *** M2 -747061.0 29511.4 -25.314 < 2e-16 *** M3 -589100.8 29472.1 -19.988 < 2e-16 *** M4 -660646.3 29436.9 -22.443 < 2e-16 *** M5 -643061.2 29405.7 -21.869 < 2e-16 *** M6 -529150.8 29121.2 -18.171 < 2e-16 *** M7 -714612.7 29098.2 -24.559 < 2e-16 *** M8 -674841.3 29079.3 -23.207 < 2e-16 *** M9 -557451.8 29064.6 -19.180 < 2e-16 *** M10 -619237.1 29054.1 -21.313 < 2e-16 *** M11 -577250.5 29047.8 -19.872 < 2e-16 *** t 1560.1 349.4 4.466 5.15e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 45930 on 46 degrees of freedom Multiple R-squared: 0.959, Adjusted R-squared: 0.9474 F-statistic: 82.78 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.4752661 0.9505321 0.5247339 [2,] 0.5644264 0.8711472 0.4355736 [3,] 0.4686576 0.9373151 0.5313424 [4,] 0.4251410 0.8502820 0.5748590 [5,] 0.7368470 0.5263060 0.2631530 [6,] 0.6533756 0.6932487 0.3466244 [7,] 0.7626198 0.4747604 0.2373802 [8,] 0.7533761 0.4932478 0.2466239 [9,] 0.7604678 0.4790643 0.2395322 [10,] 0.7900876 0.4198248 0.2099124 [11,] 0.8150849 0.3698301 0.1849151 [12,] 0.7557904 0.4884193 0.2442096 [13,] 0.8398926 0.3202147 0.1601074 [14,] 0.7736097 0.4527807 0.2263903 [15,] 0.7539495 0.4921009 0.2460505 [16,] 0.8624585 0.2750831 0.1375415 [17,] 0.8389594 0.3220812 0.1610406 [18,] 0.7933298 0.4133404 0.2066702 [19,] 0.7146530 0.5706939 0.2853470 [20,] 0.6258196 0.7483609 0.3741804 [21,] 0.8261025 0.3477950 0.1738975 [22,] 0.7386737 0.5226525 0.2613263 [23,] 0.6875836 0.6248327 0.3124164 [24,] 0.5827127 0.8345747 0.4172873 [25,] 0.4528704 0.9057407 0.5471296 [26,] 0.3507420 0.7014840 0.6492580 [27,] 0.4218246 0.8436492 0.5781754 > postscript(file="/var/www/html/rcomp/tmp/1l2p11228158146.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/2zgfn1228158146.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/30o571228158146.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/4buw51228158146.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/5z28j1228158146.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 12009.667 -46962.333 -75830.733 14687.667 -35481.533 84231.867 7 8 9 10 11 12 29583.667 -72109.933 -23300.533 17249.667 57768.867 2454.267 13 14 15 16 17 18 -30615.967 -23883.967 -36267.367 17379.033 45915.833 20490.233 19 20 21 22 23 24 -8007.967 -26733.567 95139.833 6297.033 -38739.767 -42201.367 25 26 27 28 29 30 -36769.600 49127.400 50118.000 18697.400 -47034.800 -39985.400 31 32 33 34 35 36 -32182.600 60980.800 15244.200 12318.400 -24203.400 7828.000 37 38 39 40 41 42 -21631.233 25543.767 63515.367 -12952.233 38713.567 -27344.033 43 44 45 46 47 48 -20131.233 8877.167 20971.567 6201.767 9669.967 46770.367 49 50 51 52 53 54 77007.133 -3824.867 -1535.267 -37811.867 -2113.067 -37392.667 55 56 57 58 59 60 30738.133 28985.533 -108055.067 -42066.867 -4495.667 -14851.267 > postscript(file="/var/www/html/rcomp/tmp/6r6ci1228158146.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 12009.667 NA 1 -46962.333 12009.667 2 -75830.733 -46962.333 3 14687.667 -75830.733 4 -35481.533 14687.667 5 84231.867 -35481.533 6 29583.667 84231.867 7 -72109.933 29583.667 8 -23300.533 -72109.933 9 17249.667 -23300.533 10 57768.867 17249.667 11 2454.267 57768.867 12 -30615.967 2454.267 13 -23883.967 -30615.967 14 -36267.367 -23883.967 15 17379.033 -36267.367 16 45915.833 17379.033 17 20490.233 45915.833 18 -8007.967 20490.233 19 -26733.567 -8007.967 20 95139.833 -26733.567 21 6297.033 95139.833 22 -38739.767 6297.033 23 -42201.367 -38739.767 24 -36769.600 -42201.367 25 49127.400 -36769.600 26 50118.000 49127.400 27 18697.400 50118.000 28 -47034.800 18697.400 29 -39985.400 -47034.800 30 -32182.600 -39985.400 31 60980.800 -32182.600 32 15244.200 60980.800 33 12318.400 15244.200 34 -24203.400 12318.400 35 7828.000 -24203.400 36 -21631.233 7828.000 37 25543.767 -21631.233 38 63515.367 25543.767 39 -12952.233 63515.367 40 38713.567 -12952.233 41 -27344.033 38713.567 42 -20131.233 -27344.033 43 8877.167 -20131.233 44 20971.567 8877.167 45 6201.767 20971.567 46 9669.967 6201.767 47 46770.367 9669.967 48 77007.133 46770.367 49 -3824.867 77007.133 50 -1535.267 -3824.867 51 -37811.867 -1535.267 52 -2113.067 -37811.867 53 -37392.667 -2113.067 54 30738.133 -37392.667 55 28985.533 30738.133 56 -108055.067 28985.533 57 -42066.867 -108055.067 58 -4495.667 -42066.867 59 -14851.267 -4495.667 60 NA -14851.267 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -46962.333 12009.667 [2,] -75830.733 -46962.333 [3,] 14687.667 -75830.733 [4,] -35481.533 14687.667 [5,] 84231.867 -35481.533 [6,] 29583.667 84231.867 [7,] -72109.933 29583.667 [8,] -23300.533 -72109.933 [9,] 17249.667 -23300.533 [10,] 57768.867 17249.667 [11,] 2454.267 57768.867 [12,] -30615.967 2454.267 [13,] -23883.967 -30615.967 [14,] -36267.367 -23883.967 [15,] 17379.033 -36267.367 [16,] 45915.833 17379.033 [17,] 20490.233 45915.833 [18,] -8007.967 20490.233 [19,] -26733.567 -8007.967 [20,] 95139.833 -26733.567 [21,] 6297.033 95139.833 [22,] -38739.767 6297.033 [23,] -42201.367 -38739.767 [24,] -36769.600 -42201.367 [25,] 49127.400 -36769.600 [26,] 50118.000 49127.400 [27,] 18697.400 50118.000 [28,] -47034.800 18697.400 [29,] -39985.400 -47034.800 [30,] -32182.600 -39985.400 [31,] 60980.800 -32182.600 [32,] 15244.200 60980.800 [33,] 12318.400 15244.200 [34,] -24203.400 12318.400 [35,] 7828.000 -24203.400 [36,] -21631.233 7828.000 [37,] 25543.767 -21631.233 [38,] 63515.367 25543.767 [39,] -12952.233 63515.367 [40,] 38713.567 -12952.233 [41,] -27344.033 38713.567 [42,] -20131.233 -27344.033 [43,] 8877.167 -20131.233 [44,] 20971.567 8877.167 [45,] 6201.767 20971.567 [46,] 9669.967 6201.767 [47,] 46770.367 9669.967 [48,] 77007.133 46770.367 [49,] -3824.867 77007.133 [50,] -1535.267 -3824.867 [51,] -37811.867 -1535.267 [52,] -2113.067 -37811.867 [53,] -37392.667 -2113.067 [54,] 30738.133 -37392.667 [55,] 28985.533 30738.133 [56,] -108055.067 28985.533 [57,] -42066.867 -108055.067 [58,] -4495.667 -42066.867 [59,] -14851.267 -4495.667 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -46962.333 12009.667 2 -75830.733 -46962.333 3 14687.667 -75830.733 4 -35481.533 14687.667 5 84231.867 -35481.533 6 29583.667 84231.867 7 -72109.933 29583.667 8 -23300.533 -72109.933 9 17249.667 -23300.533 10 57768.867 17249.667 11 2454.267 57768.867 12 -30615.967 2454.267 13 -23883.967 -30615.967 14 -36267.367 -23883.967 15 17379.033 -36267.367 16 45915.833 17379.033 17 20490.233 45915.833 18 -8007.967 20490.233 19 -26733.567 -8007.967 20 95139.833 -26733.567 21 6297.033 95139.833 22 -38739.767 6297.033 23 -42201.367 -38739.767 24 -36769.600 -42201.367 25 49127.400 -36769.600 26 50118.000 49127.400 27 18697.400 50118.000 28 -47034.800 18697.400 29 -39985.400 -47034.800 30 -32182.600 -39985.400 31 60980.800 -32182.600 32 15244.200 60980.800 33 12318.400 15244.200 34 -24203.400 12318.400 35 7828.000 -24203.400 36 -21631.233 7828.000 37 25543.767 -21631.233 38 63515.367 25543.767 39 -12952.233 63515.367 40 38713.567 -12952.233 41 -27344.033 38713.567 42 -20131.233 -27344.033 43 8877.167 -20131.233 44 20971.567 8877.167 45 6201.767 20971.567 46 9669.967 6201.767 47 46770.367 9669.967 48 77007.133 46770.367 49 -3824.867 77007.133 50 -1535.267 -3824.867 51 -37811.867 -1535.267 52 -2113.067 -37811.867 53 -37392.667 -2113.067 54 30738.133 -37392.667 55 28985.533 30738.133 56 -108055.067 28985.533 57 -42066.867 -108055.067 58 -4495.667 -42066.867 59 -14851.267 -4495.667 > 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/79nsf1228158146.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/845lp1228158146.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/9gd3p1228158146.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/10rhgp1228158146.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/119up71228158146.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/12ydil1228158146.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/13m4ac1228158146.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/14efzr1228158146.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/158gcz1228158146.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/16po2i1228158146.tab") + } > > system("convert tmp/1l2p11228158146.ps tmp/1l2p11228158146.png") > system("convert tmp/2zgfn1228158146.ps tmp/2zgfn1228158146.png") > system("convert tmp/30o571228158146.ps tmp/30o571228158146.png") > system("convert tmp/4buw51228158146.ps tmp/4buw51228158146.png") > system("convert tmp/5z28j1228158146.ps tmp/5z28j1228158146.png") > system("convert tmp/6r6ci1228158146.ps tmp/6r6ci1228158146.png") > system("convert tmp/79nsf1228158146.ps tmp/79nsf1228158146.png") > system("convert tmp/845lp1228158146.ps tmp/845lp1228158146.png") > system("convert tmp/9gd3p1228158146.ps tmp/9gd3p1228158146.png") > system("convert tmp/10rhgp1228158146.ps tmp/10rhgp1228158146.png") > > > proc.time() user system elapsed 4.955 2.748 5.333