R version 2.8.0 (2008-10-20) 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(106.7,0,110.2,0,125.9,0,100.1,0,106.4,0,114.8,0,81.3,0,87,0,104.2,0,108,0,105,0,94.5,0,92,0,95.9,0,108.8,0,103.4,0,102.1,0,110.1,0,83.2,0,82.7,0,106.8,0,113.7,0,102.5,0,96.6,0,92.1,0,95.6,0,102.3,0,98.6,0,98.2,0,104.5,0,84,0,73.8,0,103.9,0,106,0,97.2,0,102.6,0,89,0,93.8,0,116.7,1,106.8,1,98.5,1,118.7,1,90,1,91.9,1,113.3,1,113.1,1,104.1,1,108.7,1,96.7,1,101,1,116.9,1,105.8,1,99,1,129.4,1,83,1,88.9,1,115.9,1,104.2,1,113.4,1,112.2,1,100.8,1,107.3,1,126.6,1,102.9,1,117.9,1,128.8,1,87.5,1,93.8,1,122.7,1,126.2,1,124.6,1,116.7,1,115.2,1,111.1,1,129.9,1,113.3,1,118.5,1,133.5,1,102.1,1,102.4,1),dim=c(2,80),dimnames=list(c('y','x'),1:80)) > y <- array(NA,dim=c(2,80),dimnames=list(c('y','x'),1:80)) > 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 = 'Do not include Seasonal 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 1 106.7 0 2 110.2 0 3 125.9 0 4 100.1 0 5 106.4 0 6 114.8 0 7 81.3 0 8 87.0 0 9 104.2 0 10 108.0 0 11 105.0 0 12 94.5 0 13 92.0 0 14 95.9 0 15 108.8 0 16 103.4 0 17 102.1 0 18 110.1 0 19 83.2 0 20 82.7 0 21 106.8 0 22 113.7 0 23 102.5 0 24 96.6 0 25 92.1 0 26 95.6 0 27 102.3 0 28 98.6 0 29 98.2 0 30 104.5 0 31 84.0 0 32 73.8 0 33 103.9 0 34 106.0 0 35 97.2 0 36 102.6 0 37 89.0 0 38 93.8 0 39 116.7 1 40 106.8 1 41 98.5 1 42 118.7 1 43 90.0 1 44 91.9 1 45 113.3 1 46 113.1 1 47 104.1 1 48 108.7 1 49 96.7 1 50 101.0 1 51 116.9 1 52 105.8 1 53 99.0 1 54 129.4 1 55 83.0 1 56 88.9 1 57 115.9 1 58 104.2 1 59 113.4 1 60 112.2 1 61 100.8 1 62 107.3 1 63 126.6 1 64 102.9 1 65 117.9 1 66 128.8 1 67 87.5 1 68 93.8 1 69 122.7 1 70 126.2 1 71 124.6 1 72 116.7 1 73 115.2 1 74 111.1 1 75 129.9 1 76 113.3 1 77 118.5 1 78 133.5 1 79 102.1 1 80 102.4 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x 99.57 10.20 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -26.762 -7.491 2.486 7.135 26.334 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 99.566 1.901 52.387 < 2e-16 *** x 10.196 2.623 3.887 0.000212 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.72 on 78 degrees of freedom Multiple R-squared: 0.1623, Adjusted R-squared: 0.1515 F-statistic: 15.11 on 1 and 78 DF, p-value: 0.0002117 > 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.57299127 0.85401746 0.42700873 [2,] 0.44122328 0.88244656 0.55877672 [3,] 0.86759339 0.26481322 0.13240661 [4,] 0.90613335 0.18773330 0.09386665 [5,] 0.85190610 0.29618779 0.14809390 [6,] 0.79360688 0.41278625 0.20639312 [7,] 0.71743462 0.56513075 0.28256538 [8,] 0.67647877 0.64704246 0.32352123 [9,] 0.65413691 0.69172617 0.34586309 [10,] 0.58900926 0.82198149 0.41099074 [11,] 0.53374178 0.93251644 0.46625822 [12,] 0.45103462 0.90206925 0.54896538 [13,] 0.37093846 0.74187691 0.62906154 [14,] 0.33685839 0.67371677 0.66314161 [15,] 0.45524577 0.91049154 0.54475423 [16,] 0.55701401 0.88597198 0.44298599 [17,] 0.50421763 0.99156474 0.49578237 [18,] 0.52544688 0.94910623 0.47455312 [19,] 0.45728118 0.91456236 0.54271882 [20,] 0.39600276 0.79200553 0.60399724 [21,] 0.36200281 0.72400562 0.63799719 [22,] 0.30774807 0.61549615 0.69225193 [23,] 0.25327294 0.50654589 0.74672706 [24,] 0.20291542 0.40583084 0.79708458 [25,] 0.15972938 0.31945875 0.84027062 [26,] 0.13136256 0.26272512 0.86863744 [27,] 0.16198018 0.32396035 0.83801982 [28,] 0.35809778 0.71619555 0.64190222 [29,] 0.30674875 0.61349751 0.69325125 [30,] 0.27195209 0.54390418 0.72804791 [31,] 0.22167052 0.44334104 0.77832948 [32,] 0.18670914 0.37341828 0.81329086 [33,] 0.16789169 0.33578338 0.83210831 [34,] 0.13504471 0.27008941 0.86495529 [35,] 0.10651638 0.21303277 0.89348362 [36,] 0.08524448 0.17048897 0.91475552 [37,] 0.08205006 0.16410011 0.91794994 [38,] 0.07348379 0.14696758 0.92651621 [39,] 0.11561960 0.23123921 0.88438040 [40,] 0.14240667 0.28481334 0.85759333 [41,] 0.11862059 0.23724119 0.88137941 [42,] 0.09522771 0.19045542 0.90477229 [43,] 0.07381219 0.14762438 0.92618781 [44,] 0.05406864 0.10813728 0.94593136 [45,] 0.05409353 0.10818706 0.94590647 [46,] 0.04466962 0.08933923 0.95533038 [47,] 0.03814518 0.07629036 0.96185482 [48,] 0.02736128 0.05472256 0.97263872 [49,] 0.02472642 0.04945283 0.97527358 [50,] 0.04937339 0.09874678 0.95062661 [51,] 0.16563148 0.33126296 0.83436852 [52,] 0.29056282 0.58112565 0.70943718 [53,] 0.24954857 0.49909714 0.75045143 [54,] 0.21858505 0.43717009 0.78141495 [55,] 0.17507010 0.35014019 0.82492990 [56,] 0.13550809 0.27101619 0.86449191 [57,] 0.13295262 0.26590524 0.86704738 [58,] 0.10579589 0.21159179 0.89420411 [59,] 0.12344192 0.24688383 0.87655808 [60,] 0.11225673 0.22451346 0.88774327 [61,] 0.08553381 0.17106762 0.91446619 [62,] 0.11030691 0.22061382 0.88969309 [63,] 0.33140950 0.66281901 0.66859050 [64,] 0.58364994 0.83270012 0.41635006 [65,] 0.52217419 0.95565162 0.47782581 [66,] 0.50441547 0.99116907 0.49558453 [67,] 0.46417748 0.92835497 0.53582252 [68,] 0.35323707 0.70647414 0.64676293 [69,] 0.24586725 0.49173450 0.75413275 [70,] 0.16256920 0.32513839 0.83743080 [71,] 0.18323464 0.36646927 0.81676536 > postscript(file="/var/www/html/freestat/rcomp/tmp/1ignl1227566948.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/freestat/rcomp/tmp/2kr9n1227566948.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/freestat/rcomp/tmp/3is7f1227566948.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/freestat/rcomp/tmp/4hbfv1227566948.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/freestat/rcomp/tmp/5y3se1227566948.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 = 80 Frequency = 1 1 2 3 4 5 6 7.1342105 10.6342105 26.3342105 0.5342105 6.8342105 15.2342105 7 8 9 10 11 12 -18.2657895 -12.5657895 4.6342105 8.4342105 5.4342105 -5.0657895 13 14 15 16 17 18 -7.5657895 -3.6657895 9.2342105 3.8342105 2.5342105 10.5342105 19 20 21 22 23 24 -16.3657895 -16.8657895 7.2342105 14.1342105 2.9342105 -2.9657895 25 26 27 28 29 30 -7.4657895 -3.9657895 2.7342105 -0.9657895 -1.3657895 4.9342105 31 32 33 34 35 36 -15.5657895 -25.7657895 4.3342105 6.4342105 -2.3657895 3.0342105 37 38 39 40 41 42 -10.5657895 -5.7657895 6.9380952 -2.9619048 -11.2619048 8.9380952 43 44 45 46 47 48 -19.7619048 -17.8619048 3.5380952 3.3380952 -5.6619048 -1.0619048 49 50 51 52 53 54 -13.0619048 -8.7619048 7.1380952 -3.9619048 -10.7619048 19.6380952 55 56 57 58 59 60 -26.7619048 -20.8619048 6.1380952 -5.5619048 3.6380952 2.4380952 61 62 63 64 65 66 -8.9619048 -2.4619048 16.8380952 -6.8619048 8.1380952 19.0380952 67 68 69 70 71 72 -22.2619048 -15.9619048 12.9380952 16.4380952 14.8380952 6.9380952 73 74 75 76 77 78 5.4380952 1.3380952 20.1380952 3.5380952 8.7380952 23.7380952 79 80 -7.6619048 -7.3619048 > postscript(file="/var/www/html/freestat/rcomp/tmp/6xlpk1227566948.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 = 80 Frequency = 1 lag(myerror, k = 1) myerror 0 7.1342105 NA 1 10.6342105 7.1342105 2 26.3342105 10.6342105 3 0.5342105 26.3342105 4 6.8342105 0.5342105 5 15.2342105 6.8342105 6 -18.2657895 15.2342105 7 -12.5657895 -18.2657895 8 4.6342105 -12.5657895 9 8.4342105 4.6342105 10 5.4342105 8.4342105 11 -5.0657895 5.4342105 12 -7.5657895 -5.0657895 13 -3.6657895 -7.5657895 14 9.2342105 -3.6657895 15 3.8342105 9.2342105 16 2.5342105 3.8342105 17 10.5342105 2.5342105 18 -16.3657895 10.5342105 19 -16.8657895 -16.3657895 20 7.2342105 -16.8657895 21 14.1342105 7.2342105 22 2.9342105 14.1342105 23 -2.9657895 2.9342105 24 -7.4657895 -2.9657895 25 -3.9657895 -7.4657895 26 2.7342105 -3.9657895 27 -0.9657895 2.7342105 28 -1.3657895 -0.9657895 29 4.9342105 -1.3657895 30 -15.5657895 4.9342105 31 -25.7657895 -15.5657895 32 4.3342105 -25.7657895 33 6.4342105 4.3342105 34 -2.3657895 6.4342105 35 3.0342105 -2.3657895 36 -10.5657895 3.0342105 37 -5.7657895 -10.5657895 38 6.9380952 -5.7657895 39 -2.9619048 6.9380952 40 -11.2619048 -2.9619048 41 8.9380952 -11.2619048 42 -19.7619048 8.9380952 43 -17.8619048 -19.7619048 44 3.5380952 -17.8619048 45 3.3380952 3.5380952 46 -5.6619048 3.3380952 47 -1.0619048 -5.6619048 48 -13.0619048 -1.0619048 49 -8.7619048 -13.0619048 50 7.1380952 -8.7619048 51 -3.9619048 7.1380952 52 -10.7619048 -3.9619048 53 19.6380952 -10.7619048 54 -26.7619048 19.6380952 55 -20.8619048 -26.7619048 56 6.1380952 -20.8619048 57 -5.5619048 6.1380952 58 3.6380952 -5.5619048 59 2.4380952 3.6380952 60 -8.9619048 2.4380952 61 -2.4619048 -8.9619048 62 16.8380952 -2.4619048 63 -6.8619048 16.8380952 64 8.1380952 -6.8619048 65 19.0380952 8.1380952 66 -22.2619048 19.0380952 67 -15.9619048 -22.2619048 68 12.9380952 -15.9619048 69 16.4380952 12.9380952 70 14.8380952 16.4380952 71 6.9380952 14.8380952 72 5.4380952 6.9380952 73 1.3380952 5.4380952 74 20.1380952 1.3380952 75 3.5380952 20.1380952 76 8.7380952 3.5380952 77 23.7380952 8.7380952 78 -7.6619048 23.7380952 79 -7.3619048 -7.6619048 80 NA -7.3619048 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 10.6342105 7.1342105 [2,] 26.3342105 10.6342105 [3,] 0.5342105 26.3342105 [4,] 6.8342105 0.5342105 [5,] 15.2342105 6.8342105 [6,] -18.2657895 15.2342105 [7,] -12.5657895 -18.2657895 [8,] 4.6342105 -12.5657895 [9,] 8.4342105 4.6342105 [10,] 5.4342105 8.4342105 [11,] -5.0657895 5.4342105 [12,] -7.5657895 -5.0657895 [13,] -3.6657895 -7.5657895 [14,] 9.2342105 -3.6657895 [15,] 3.8342105 9.2342105 [16,] 2.5342105 3.8342105 [17,] 10.5342105 2.5342105 [18,] -16.3657895 10.5342105 [19,] -16.8657895 -16.3657895 [20,] 7.2342105 -16.8657895 [21,] 14.1342105 7.2342105 [22,] 2.9342105 14.1342105 [23,] -2.9657895 2.9342105 [24,] -7.4657895 -2.9657895 [25,] -3.9657895 -7.4657895 [26,] 2.7342105 -3.9657895 [27,] -0.9657895 2.7342105 [28,] -1.3657895 -0.9657895 [29,] 4.9342105 -1.3657895 [30,] -15.5657895 4.9342105 [31,] -25.7657895 -15.5657895 [32,] 4.3342105 -25.7657895 [33,] 6.4342105 4.3342105 [34,] -2.3657895 6.4342105 [35,] 3.0342105 -2.3657895 [36,] -10.5657895 3.0342105 [37,] -5.7657895 -10.5657895 [38,] 6.9380952 -5.7657895 [39,] -2.9619048 6.9380952 [40,] -11.2619048 -2.9619048 [41,] 8.9380952 -11.2619048 [42,] -19.7619048 8.9380952 [43,] -17.8619048 -19.7619048 [44,] 3.5380952 -17.8619048 [45,] 3.3380952 3.5380952 [46,] -5.6619048 3.3380952 [47,] -1.0619048 -5.6619048 [48,] -13.0619048 -1.0619048 [49,] -8.7619048 -13.0619048 [50,] 7.1380952 -8.7619048 [51,] -3.9619048 7.1380952 [52,] -10.7619048 -3.9619048 [53,] 19.6380952 -10.7619048 [54,] -26.7619048 19.6380952 [55,] -20.8619048 -26.7619048 [56,] 6.1380952 -20.8619048 [57,] -5.5619048 6.1380952 [58,] 3.6380952 -5.5619048 [59,] 2.4380952 3.6380952 [60,] -8.9619048 2.4380952 [61,] -2.4619048 -8.9619048 [62,] 16.8380952 -2.4619048 [63,] -6.8619048 16.8380952 [64,] 8.1380952 -6.8619048 [65,] 19.0380952 8.1380952 [66,] -22.2619048 19.0380952 [67,] -15.9619048 -22.2619048 [68,] 12.9380952 -15.9619048 [69,] 16.4380952 12.9380952 [70,] 14.8380952 16.4380952 [71,] 6.9380952 14.8380952 [72,] 5.4380952 6.9380952 [73,] 1.3380952 5.4380952 [74,] 20.1380952 1.3380952 [75,] 3.5380952 20.1380952 [76,] 8.7380952 3.5380952 [77,] 23.7380952 8.7380952 [78,] -7.6619048 23.7380952 [79,] -7.3619048 -7.6619048 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 10.6342105 7.1342105 2 26.3342105 10.6342105 3 0.5342105 26.3342105 4 6.8342105 0.5342105 5 15.2342105 6.8342105 6 -18.2657895 15.2342105 7 -12.5657895 -18.2657895 8 4.6342105 -12.5657895 9 8.4342105 4.6342105 10 5.4342105 8.4342105 11 -5.0657895 5.4342105 12 -7.5657895 -5.0657895 13 -3.6657895 -7.5657895 14 9.2342105 -3.6657895 15 3.8342105 9.2342105 16 2.5342105 3.8342105 17 10.5342105 2.5342105 18 -16.3657895 10.5342105 19 -16.8657895 -16.3657895 20 7.2342105 -16.8657895 21 14.1342105 7.2342105 22 2.9342105 14.1342105 23 -2.9657895 2.9342105 24 -7.4657895 -2.9657895 25 -3.9657895 -7.4657895 26 2.7342105 -3.9657895 27 -0.9657895 2.7342105 28 -1.3657895 -0.9657895 29 4.9342105 -1.3657895 30 -15.5657895 4.9342105 31 -25.7657895 -15.5657895 32 4.3342105 -25.7657895 33 6.4342105 4.3342105 34 -2.3657895 6.4342105 35 3.0342105 -2.3657895 36 -10.5657895 3.0342105 37 -5.7657895 -10.5657895 38 6.9380952 -5.7657895 39 -2.9619048 6.9380952 40 -11.2619048 -2.9619048 41 8.9380952 -11.2619048 42 -19.7619048 8.9380952 43 -17.8619048 -19.7619048 44 3.5380952 -17.8619048 45 3.3380952 3.5380952 46 -5.6619048 3.3380952 47 -1.0619048 -5.6619048 48 -13.0619048 -1.0619048 49 -8.7619048 -13.0619048 50 7.1380952 -8.7619048 51 -3.9619048 7.1380952 52 -10.7619048 -3.9619048 53 19.6380952 -10.7619048 54 -26.7619048 19.6380952 55 -20.8619048 -26.7619048 56 6.1380952 -20.8619048 57 -5.5619048 6.1380952 58 3.6380952 -5.5619048 59 2.4380952 3.6380952 60 -8.9619048 2.4380952 61 -2.4619048 -8.9619048 62 16.8380952 -2.4619048 63 -6.8619048 16.8380952 64 8.1380952 -6.8619048 65 19.0380952 8.1380952 66 -22.2619048 19.0380952 67 -15.9619048 -22.2619048 68 12.9380952 -15.9619048 69 16.4380952 12.9380952 70 14.8380952 16.4380952 71 6.9380952 14.8380952 72 5.4380952 6.9380952 73 1.3380952 5.4380952 74 20.1380952 1.3380952 75 3.5380952 20.1380952 76 8.7380952 3.5380952 77 23.7380952 8.7380952 78 -7.6619048 23.7380952 79 -7.3619048 -7.6619048 > 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/freestat/rcomp/tmp/7kkug1227566948.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/freestat/rcomp/tmp/89s7s1227566948.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/freestat/rcomp/tmp/92i4b1227566948.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/freestat/rcomp/tmp/10cvfo1227566948.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/111l8s1227566948.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/freestat/rcomp/tmp/12mjpi1227566948.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/freestat/rcomp/tmp/13uanq1227566948.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/freestat/rcomp/tmp/14znt61227566948.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/freestat/rcomp/tmp/152zfo1227566948.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/freestat/rcomp/tmp/16r3fh1227566948.tab") + } > > system("convert tmp/1ignl1227566948.ps tmp/1ignl1227566948.png") > system("convert tmp/2kr9n1227566948.ps tmp/2kr9n1227566948.png") > system("convert tmp/3is7f1227566948.ps tmp/3is7f1227566948.png") > system("convert tmp/4hbfv1227566948.ps tmp/4hbfv1227566948.png") > system("convert tmp/5y3se1227566948.ps tmp/5y3se1227566948.png") > system("convert tmp/6xlpk1227566948.ps tmp/6xlpk1227566948.png") > system("convert tmp/7kkug1227566948.ps tmp/7kkug1227566948.png") > system("convert tmp/89s7s1227566948.ps tmp/89s7s1227566948.png") > system("convert tmp/92i4b1227566948.ps tmp/92i4b1227566948.png") > system("convert tmp/10cvfo1227566948.ps tmp/10cvfo1227566948.png") > > > proc.time() user system elapsed 3.916 2.512 4.215