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(22,0,22,0,20,0,21,0,20,0,21,0,21,0,21,0,19,0,21,0,21,0,22,0,19,0,24,0,22,0,22,0,22,0,24,0,22,0,23,0,24,0,21,0,20,0,22,0,23,0,23,0,22,0,20,0,21,1,21,1,20,1,20,1,17,1,18,1,19,1,19,1,20,1,21,1,20,1,21,1,19,1,22,1,20,1,18,1,16,1,17,1,18,1,19,1,18,1,20,1,21,1,18,1,19,1,19,1,19,1,21,1,19,1,19,1,17,1,16,1,16,1,17,1,16,1,15,1,16,1,16,1,16,1,18,1,19,1,16,1,16,1,16,1),dim=c(2,72),dimnames=list(c('Y','X'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Y','X'),1:72)) > 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 22 0 2 22 0 3 20 0 4 21 0 5 20 0 6 21 0 7 21 0 8 21 0 9 19 0 10 21 0 11 21 0 12 22 0 13 19 0 14 24 0 15 22 0 16 22 0 17 22 0 18 24 0 19 22 0 20 23 0 21 24 0 22 21 0 23 20 0 24 22 0 25 23 0 26 23 0 27 22 0 28 20 0 29 21 1 30 21 1 31 20 1 32 20 1 33 17 1 34 18 1 35 19 1 36 19 1 37 20 1 38 21 1 39 20 1 40 21 1 41 19 1 42 22 1 43 20 1 44 18 1 45 16 1 46 17 1 47 18 1 48 19 1 49 18 1 50 20 1 51 21 1 52 18 1 53 19 1 54 19 1 55 19 1 56 21 1 57 19 1 58 19 1 59 17 1 60 16 1 61 16 1 62 17 1 63 16 1 64 15 1 65 16 1 66 16 1 67 16 1 68 18 1 69 19 1 70 16 1 71 16 1 72 16 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 21.571 -3.185 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.3864 -1.3864 0.4286 1.4286 3.6136 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 21.5714 0.3205 67.31 < 2e-16 *** X -3.1851 0.4099 -7.77 4.85e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.696 on 70 degrees of freedom Multiple R-squared: 0.4631, Adjusted R-squared: 0.4554 F-statistic: 60.37 on 1 and 70 DF, p-value: 4.852e-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.27747679 0.55495359 0.7225232 [2,] 0.14220136 0.28440273 0.8577986 [3,] 0.06655959 0.13311918 0.9334404 [4,] 0.02879251 0.05758502 0.9712075 [5,] 0.07557868 0.15115737 0.9244213 [6,] 0.04025668 0.08051337 0.9597433 [7,] 0.02041927 0.04083855 0.9795807 [8,] 0.01719982 0.03439963 0.9828002 [9,] 0.03666149 0.07332299 0.9633385 [10,] 0.16989024 0.33978047 0.8301098 [11,] 0.13310159 0.26620318 0.8668984 [12,] 0.10130702 0.20261403 0.8986930 [13,] 0.07494251 0.14988502 0.9250575 [14,] 0.15095679 0.30191358 0.8490432 [15,] 0.11196517 0.22393034 0.8880348 [16,] 0.10800929 0.21601858 0.8919907 [17,] 0.16405677 0.32811353 0.8359432 [18,] 0.12443956 0.24887912 0.8755604 [19,] 0.12204650 0.24409299 0.8779535 [20,] 0.08952890 0.17905779 0.9104711 [21,] 0.08193043 0.16386086 0.9180696 [22,] 0.07662179 0.15324359 0.9233782 [23,] 0.05783259 0.11566518 0.9421674 [24,] 0.05227084 0.10454168 0.9477292 [25,] 0.04640426 0.09280853 0.9535957 [26,] 0.04248779 0.08497558 0.9575122 [27,] 0.03547373 0.07094747 0.9645263 [28,] 0.02868857 0.05737714 0.9713114 [29,] 0.05810757 0.11621514 0.9418924 [30,] 0.05190852 0.10381705 0.9480915 [31,] 0.03761295 0.07522591 0.9623870 [32,] 0.02664472 0.05328943 0.9733553 [33,] 0.02197260 0.04394520 0.9780274 [34,] 0.02927662 0.05855323 0.9707234 [35,] 0.02508519 0.05017038 0.9749148 [36,] 0.03551947 0.07103895 0.9644805 [37,] 0.02738952 0.05477904 0.9726105 [38,] 0.09186170 0.18372339 0.9081383 [39,] 0.09591812 0.19183625 0.9040819 [40,] 0.08819714 0.17639428 0.9118029 [41,] 0.16435516 0.32871031 0.8356448 [42,] 0.16985649 0.33971298 0.8301435 [43,] 0.14049067 0.28098133 0.8595093 [44,] 0.11778502 0.23557005 0.8822150 [45,] 0.09376885 0.18753771 0.9062311 [46,] 0.10676877 0.21353755 0.8932312 [47,] 0.22352096 0.44704191 0.7764790 [48,] 0.18836715 0.37673429 0.8116329 [49,] 0.17946010 0.35892020 0.8205399 [50,] 0.17678377 0.35356754 0.8232162 [51,] 0.18210589 0.36421179 0.8178941 [52,] 0.57867855 0.84264291 0.4213215 [53,] 0.69659311 0.60681378 0.3034069 [54,] 0.85358196 0.29283607 0.1464180 [55,] 0.82666087 0.34667827 0.1733391 [56,] 0.80532255 0.38935490 0.1946775 [57,] 0.77234794 0.45530411 0.2276521 [58,] 0.71166188 0.57667623 0.2883381 [59,] 0.64923708 0.70152584 0.3507629 [60,] 0.70289212 0.59421576 0.2971079 [61,] 0.62203754 0.75592492 0.3779625 [62,] 0.52689993 0.94620013 0.4731001 [63,] 0.42174646 0.84349293 0.5782535 > postscript(file="/var/www/html/rcomp/tmp/190ya1258724928.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/2qplq1258724928.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/3xyjt1258724928.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/40dop1258724928.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/53lsz1258724928.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 = 72 Frequency = 1 1 2 3 4 5 6 7 0.4285714 0.4285714 -1.5714286 -0.5714286 -1.5714286 -0.5714286 -0.5714286 8 9 10 11 12 13 14 -0.5714286 -2.5714286 -0.5714286 -0.5714286 0.4285714 -2.5714286 2.4285714 15 16 17 18 19 20 21 0.4285714 0.4285714 0.4285714 2.4285714 0.4285714 1.4285714 2.4285714 22 23 24 25 26 27 28 -0.5714286 -1.5714286 0.4285714 1.4285714 1.4285714 0.4285714 -1.5714286 29 30 31 32 33 34 35 2.6136364 2.6136364 1.6136364 1.6136364 -1.3863636 -0.3863636 0.6136364 36 37 38 39 40 41 42 0.6136364 1.6136364 2.6136364 1.6136364 2.6136364 0.6136364 3.6136364 43 44 45 46 47 48 49 1.6136364 -0.3863636 -2.3863636 -1.3863636 -0.3863636 0.6136364 -0.3863636 50 51 52 53 54 55 56 1.6136364 2.6136364 -0.3863636 0.6136364 0.6136364 0.6136364 2.6136364 57 58 59 60 61 62 63 0.6136364 0.6136364 -1.3863636 -2.3863636 -2.3863636 -1.3863636 -2.3863636 64 65 66 67 68 69 70 -3.3863636 -2.3863636 -2.3863636 -2.3863636 -0.3863636 0.6136364 -2.3863636 71 72 -2.3863636 -2.3863636 > postscript(file="/var/www/html/rcomp/tmp/6skx01258724928.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 0.4285714 NA 1 0.4285714 0.4285714 2 -1.5714286 0.4285714 3 -0.5714286 -1.5714286 4 -1.5714286 -0.5714286 5 -0.5714286 -1.5714286 6 -0.5714286 -0.5714286 7 -0.5714286 -0.5714286 8 -2.5714286 -0.5714286 9 -0.5714286 -2.5714286 10 -0.5714286 -0.5714286 11 0.4285714 -0.5714286 12 -2.5714286 0.4285714 13 2.4285714 -2.5714286 14 0.4285714 2.4285714 15 0.4285714 0.4285714 16 0.4285714 0.4285714 17 2.4285714 0.4285714 18 0.4285714 2.4285714 19 1.4285714 0.4285714 20 2.4285714 1.4285714 21 -0.5714286 2.4285714 22 -1.5714286 -0.5714286 23 0.4285714 -1.5714286 24 1.4285714 0.4285714 25 1.4285714 1.4285714 26 0.4285714 1.4285714 27 -1.5714286 0.4285714 28 2.6136364 -1.5714286 29 2.6136364 2.6136364 30 1.6136364 2.6136364 31 1.6136364 1.6136364 32 -1.3863636 1.6136364 33 -0.3863636 -1.3863636 34 0.6136364 -0.3863636 35 0.6136364 0.6136364 36 1.6136364 0.6136364 37 2.6136364 1.6136364 38 1.6136364 2.6136364 39 2.6136364 1.6136364 40 0.6136364 2.6136364 41 3.6136364 0.6136364 42 1.6136364 3.6136364 43 -0.3863636 1.6136364 44 -2.3863636 -0.3863636 45 -1.3863636 -2.3863636 46 -0.3863636 -1.3863636 47 0.6136364 -0.3863636 48 -0.3863636 0.6136364 49 1.6136364 -0.3863636 50 2.6136364 1.6136364 51 -0.3863636 2.6136364 52 0.6136364 -0.3863636 53 0.6136364 0.6136364 54 0.6136364 0.6136364 55 2.6136364 0.6136364 56 0.6136364 2.6136364 57 0.6136364 0.6136364 58 -1.3863636 0.6136364 59 -2.3863636 -1.3863636 60 -2.3863636 -2.3863636 61 -1.3863636 -2.3863636 62 -2.3863636 -1.3863636 63 -3.3863636 -2.3863636 64 -2.3863636 -3.3863636 65 -2.3863636 -2.3863636 66 -2.3863636 -2.3863636 67 -0.3863636 -2.3863636 68 0.6136364 -0.3863636 69 -2.3863636 0.6136364 70 -2.3863636 -2.3863636 71 -2.3863636 -2.3863636 72 NA -2.3863636 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.4285714 0.4285714 [2,] -1.5714286 0.4285714 [3,] -0.5714286 -1.5714286 [4,] -1.5714286 -0.5714286 [5,] -0.5714286 -1.5714286 [6,] -0.5714286 -0.5714286 [7,] -0.5714286 -0.5714286 [8,] -2.5714286 -0.5714286 [9,] -0.5714286 -2.5714286 [10,] -0.5714286 -0.5714286 [11,] 0.4285714 -0.5714286 [12,] -2.5714286 0.4285714 [13,] 2.4285714 -2.5714286 [14,] 0.4285714 2.4285714 [15,] 0.4285714 0.4285714 [16,] 0.4285714 0.4285714 [17,] 2.4285714 0.4285714 [18,] 0.4285714 2.4285714 [19,] 1.4285714 0.4285714 [20,] 2.4285714 1.4285714 [21,] -0.5714286 2.4285714 [22,] -1.5714286 -0.5714286 [23,] 0.4285714 -1.5714286 [24,] 1.4285714 0.4285714 [25,] 1.4285714 1.4285714 [26,] 0.4285714 1.4285714 [27,] -1.5714286 0.4285714 [28,] 2.6136364 -1.5714286 [29,] 2.6136364 2.6136364 [30,] 1.6136364 2.6136364 [31,] 1.6136364 1.6136364 [32,] -1.3863636 1.6136364 [33,] -0.3863636 -1.3863636 [34,] 0.6136364 -0.3863636 [35,] 0.6136364 0.6136364 [36,] 1.6136364 0.6136364 [37,] 2.6136364 1.6136364 [38,] 1.6136364 2.6136364 [39,] 2.6136364 1.6136364 [40,] 0.6136364 2.6136364 [41,] 3.6136364 0.6136364 [42,] 1.6136364 3.6136364 [43,] -0.3863636 1.6136364 [44,] -2.3863636 -0.3863636 [45,] -1.3863636 -2.3863636 [46,] -0.3863636 -1.3863636 [47,] 0.6136364 -0.3863636 [48,] -0.3863636 0.6136364 [49,] 1.6136364 -0.3863636 [50,] 2.6136364 1.6136364 [51,] -0.3863636 2.6136364 [52,] 0.6136364 -0.3863636 [53,] 0.6136364 0.6136364 [54,] 0.6136364 0.6136364 [55,] 2.6136364 0.6136364 [56,] 0.6136364 2.6136364 [57,] 0.6136364 0.6136364 [58,] -1.3863636 0.6136364 [59,] -2.3863636 -1.3863636 [60,] -2.3863636 -2.3863636 [61,] -1.3863636 -2.3863636 [62,] -2.3863636 -1.3863636 [63,] -3.3863636 -2.3863636 [64,] -2.3863636 -3.3863636 [65,] -2.3863636 -2.3863636 [66,] -2.3863636 -2.3863636 [67,] -0.3863636 -2.3863636 [68,] 0.6136364 -0.3863636 [69,] -2.3863636 0.6136364 [70,] -2.3863636 -2.3863636 [71,] -2.3863636 -2.3863636 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.4285714 0.4285714 2 -1.5714286 0.4285714 3 -0.5714286 -1.5714286 4 -1.5714286 -0.5714286 5 -0.5714286 -1.5714286 6 -0.5714286 -0.5714286 7 -0.5714286 -0.5714286 8 -2.5714286 -0.5714286 9 -0.5714286 -2.5714286 10 -0.5714286 -0.5714286 11 0.4285714 -0.5714286 12 -2.5714286 0.4285714 13 2.4285714 -2.5714286 14 0.4285714 2.4285714 15 0.4285714 0.4285714 16 0.4285714 0.4285714 17 2.4285714 0.4285714 18 0.4285714 2.4285714 19 1.4285714 0.4285714 20 2.4285714 1.4285714 21 -0.5714286 2.4285714 22 -1.5714286 -0.5714286 23 0.4285714 -1.5714286 24 1.4285714 0.4285714 25 1.4285714 1.4285714 26 0.4285714 1.4285714 27 -1.5714286 0.4285714 28 2.6136364 -1.5714286 29 2.6136364 2.6136364 30 1.6136364 2.6136364 31 1.6136364 1.6136364 32 -1.3863636 1.6136364 33 -0.3863636 -1.3863636 34 0.6136364 -0.3863636 35 0.6136364 0.6136364 36 1.6136364 0.6136364 37 2.6136364 1.6136364 38 1.6136364 2.6136364 39 2.6136364 1.6136364 40 0.6136364 2.6136364 41 3.6136364 0.6136364 42 1.6136364 3.6136364 43 -0.3863636 1.6136364 44 -2.3863636 -0.3863636 45 -1.3863636 -2.3863636 46 -0.3863636 -1.3863636 47 0.6136364 -0.3863636 48 -0.3863636 0.6136364 49 1.6136364 -0.3863636 50 2.6136364 1.6136364 51 -0.3863636 2.6136364 52 0.6136364 -0.3863636 53 0.6136364 0.6136364 54 0.6136364 0.6136364 55 2.6136364 0.6136364 56 0.6136364 2.6136364 57 0.6136364 0.6136364 58 -1.3863636 0.6136364 59 -2.3863636 -1.3863636 60 -2.3863636 -2.3863636 61 -1.3863636 -2.3863636 62 -2.3863636 -1.3863636 63 -3.3863636 -2.3863636 64 -2.3863636 -3.3863636 65 -2.3863636 -2.3863636 66 -2.3863636 -2.3863636 67 -0.3863636 -2.3863636 68 0.6136364 -0.3863636 69 -2.3863636 0.6136364 70 -2.3863636 -2.3863636 71 -2.3863636 -2.3863636 > 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/7n0h01258724928.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/8mrho1258724928.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/9zmlt1258724928.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/10sanr1258724928.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/118zir1258724928.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/12ozej1258724928.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/13ft821258724928.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/14si9t1258724929.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/157qbv1258724929.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/16san61258724929.tab") + } > > system("convert tmp/190ya1258724928.ps tmp/190ya1258724928.png") > system("convert tmp/2qplq1258724928.ps tmp/2qplq1258724928.png") > system("convert tmp/3xyjt1258724928.ps tmp/3xyjt1258724928.png") > system("convert tmp/40dop1258724928.ps tmp/40dop1258724928.png") > system("convert tmp/53lsz1258724928.ps tmp/53lsz1258724928.png") > system("convert tmp/6skx01258724928.ps tmp/6skx01258724928.png") > system("convert tmp/7n0h01258724928.ps tmp/7n0h01258724928.png") > system("convert tmp/8mrho1258724928.ps tmp/8mrho1258724928.png") > system("convert tmp/9zmlt1258724928.ps tmp/9zmlt1258724928.png") > system("convert tmp/10sanr1258724928.ps tmp/10sanr1258724928.png") > > > proc.time() user system elapsed 2.682 1.603 5.230