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(114 + ,106.3 + ,93.5 + ,113.8 + ,107.2 + ,93.1 + ,113.6 + ,107.8 + ,91 + ,113.7 + ,109.2 + ,91.1 + ,114.2 + ,109.7 + ,91.9 + ,114.8 + ,108.7 + ,92.4 + ,115.2 + ,109.3 + ,92.8 + ,115.3 + ,110.4 + ,92.5 + ,114.9 + ,111.1 + ,91.3 + ,115.1 + ,110.1 + ,91.2 + ,116 + ,109.5 + ,92.8 + ,116 + ,109 + ,92.9 + ,116 + ,108.5 + ,93 + ,115.9 + ,108.8 + ,92.4 + ,115.6 + ,109.8 + ,90.7 + ,116.6 + ,110.7 + ,91.3 + ,116.9 + ,110.6 + ,91.7 + ,117.9 + ,111.2 + ,92.2 + ,117.9 + ,112 + ,92.3 + ,117.7 + ,111.1 + ,92.1 + ,117.4 + ,111.6 + ,90.5 + ,117.3 + ,110.2 + ,90.1 + ,119 + ,111.5 + ,91.7 + ,119.1 + ,110.6 + ,92.1 + ,119 + ,110.6 + ,92.4 + ,118.5 + ,110.3 + ,92.4 + ,117 + ,111.7 + ,90 + ,117.5 + ,113.8 + ,90.5 + ,118.2 + ,113.9 + ,91.8 + ,118.2 + ,114.3 + ,91.7 + ,118.3 + ,113.8 + ,91.6 + ,118.2 + ,114.3 + ,91.4 + ,117.9 + ,116.4 + ,89.8 + ,117.8 + ,115.6 + ,89.7 + ,118.6 + ,115.2 + ,90.9 + ,118.9 + ,113.6 + ,91 + ,120.8 + ,115.5 + ,91.4 + ,121.8 + ,115.6 + ,91.3 + ,121.3 + ,115.3 + ,89.5 + ,121.9 + ,117.3 + ,90.2 + ,122 + ,118.7 + ,90.9 + ,121.9 + ,118.3 + ,91.2 + ,122 + ,120.6 + ,91.3 + ,122.2 + ,119.3 + ,90.5 + ,123 + ,121.8 + ,89.9 + ,123.1 + ,120.8 + ,89.6 + ,124.9 + ,121.6 + ,90.9 + ,125.4 + ,121.6 + ,91.1 + ,124.7 + ,121.1 + ,91.1 + ,124.4 + ,122.4 + ,90.8 + ,124 + ,121.9 + ,89.5 + ,125 + ,125.1 + ,90.9 + ,125.1 + ,124.5 + ,91.9 + ,125.4 + ,123.5 + ,92.4 + ,125.7 + ,124.9 + ,92.7 + ,126.4 + ,125.2 + ,92.4 + ,125.7 + ,125.7 + ,91.3 + ,125.4 + ,124.5 + ,90.8 + ,126.4 + ,124.7 + ,92.5 + ,126.2 + ,122.9 + ,92.6) + ,dim=c(3 + ,60) + ,dimnames=list(c('x' + ,'y' + ,'z') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('x','y','z'),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 = '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 x y z t 1 114.0 106.3 93.5 1 2 113.8 107.2 93.1 2 3 113.6 107.8 91.0 3 4 113.7 109.2 91.1 4 5 114.2 109.7 91.9 5 6 114.8 108.7 92.4 6 7 115.2 109.3 92.8 7 8 115.3 110.4 92.5 8 9 114.9 111.1 91.3 9 10 115.1 110.1 91.2 10 11 116.0 109.5 92.8 11 12 116.0 109.0 92.9 12 13 116.0 108.5 93.0 13 14 115.9 108.8 92.4 14 15 115.6 109.8 90.7 15 16 116.6 110.7 91.3 16 17 116.9 110.6 91.7 17 18 117.9 111.2 92.2 18 19 117.9 112.0 92.3 19 20 117.7 111.1 92.1 20 21 117.4 111.6 90.5 21 22 117.3 110.2 90.1 22 23 119.0 111.5 91.7 23 24 119.1 110.6 92.1 24 25 119.0 110.6 92.4 25 26 118.5 110.3 92.4 26 27 117.0 111.7 90.0 27 28 117.5 113.8 90.5 28 29 118.2 113.9 91.8 29 30 118.2 114.3 91.7 30 31 118.3 113.8 91.6 31 32 118.2 114.3 91.4 32 33 117.9 116.4 89.8 33 34 117.8 115.6 89.7 34 35 118.6 115.2 90.9 35 36 118.9 113.6 91.0 36 37 120.8 115.5 91.4 37 38 121.8 115.6 91.3 38 39 121.3 115.3 89.5 39 40 121.9 117.3 90.2 40 41 122.0 118.7 90.9 41 42 121.9 118.3 91.2 42 43 122.0 120.6 91.3 43 44 122.2 119.3 90.5 44 45 123.0 121.8 89.9 45 46 123.1 120.8 89.6 46 47 124.9 121.6 90.9 47 48 125.4 121.6 91.1 48 49 124.7 121.1 91.1 49 50 124.4 122.4 90.8 50 51 124.0 121.9 89.5 51 52 125.0 125.1 90.9 52 53 125.1 124.5 91.9 53 54 125.4 123.5 92.4 54 55 125.7 124.9 92.7 55 56 126.4 125.2 92.4 56 57 125.7 125.7 91.3 57 58 125.4 124.5 90.8 58 59 126.4 124.7 92.5 59 60 126.2 122.9 92.6 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) y z t 49.8478 0.1991 0.4567 0.1662 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.68008 -0.32904 0.03636 0.41425 1.75971 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 49.84776 11.42229 4.364 5.55e-05 *** y 0.19910 0.06376 3.123 0.00283 ** z 0.45671 0.10830 4.217 9.12e-05 *** t 0.16616 0.02142 7.759 1.93e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7834 on 56 degrees of freedom Multiple R-squared: 0.9631, Adjusted R-squared: 0.9611 F-statistic: 486.6 on 3 and 56 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,] 3.330740e-03 6.661480e-03 0.9966692601 [2,] 4.201280e-04 8.402560e-04 0.9995798720 [3,] 1.736569e-04 3.473138e-04 0.9998263431 [4,] 9.682043e-05 1.936409e-04 0.9999031796 [5,] 1.563117e-05 3.126233e-05 0.9999843688 [6,] 7.852464e-06 1.570493e-05 0.9999921475 [7,] 5.638204e-06 1.127641e-05 0.9999943618 [8,] 2.155617e-06 4.311235e-06 0.9999978444 [9,] 3.847565e-07 7.695131e-07 0.9999996152 [10,] 5.717334e-07 1.143467e-06 0.9999994283 [11,] 2.574764e-07 5.149527e-07 0.9999997425 [12,] 3.125601e-06 6.251202e-06 0.9999968744 [13,] 1.004192e-06 2.008383e-06 0.9999989958 [14,] 2.698342e-07 5.396683e-07 0.9999997302 [15,] 8.809932e-08 1.761986e-07 0.9999999119 [16,] 3.648973e-08 7.297947e-08 0.9999999635 [17,] 5.897685e-07 1.179537e-06 0.9999994102 [18,] 1.477292e-06 2.954585e-06 0.9999985227 [19,] 1.665187e-06 3.330375e-06 0.9999983348 [20,] 1.142606e-05 2.285212e-05 0.9999885739 [21,] 5.806186e-04 1.161237e-03 0.9994193814 [22,] 4.831282e-03 9.662565e-03 0.9951687177 [23,] 1.253304e-02 2.506609e-02 0.9874669565 [24,] 1.830593e-02 3.661186e-02 0.9816940721 [25,] 2.057607e-02 4.115213e-02 0.9794239337 [26,] 2.571838e-02 5.143677e-02 0.9742816152 [27,] 3.816371e-02 7.632742e-02 0.9618362895 [28,] 1.230319e-01 2.460637e-01 0.8769681439 [29,] 2.626493e-01 5.252986e-01 0.7373507053 [30,] 4.984397e-01 9.968794e-01 0.5015602923 [31,] 5.452407e-01 9.095185e-01 0.4547592723 [32,] 6.808888e-01 6.382225e-01 0.3191112493 [33,] 7.468334e-01 5.063333e-01 0.2531666297 [34,] 7.884733e-01 4.230535e-01 0.2115267255 [35,] 7.622072e-01 4.755856e-01 0.2377927931 [36,] 7.394205e-01 5.211590e-01 0.2605794762 [37,] 8.848529e-01 2.302942e-01 0.1151470900 [38,] 9.748668e-01 5.026634e-02 0.0251331675 [39,] 9.846857e-01 3.062857e-02 0.0153142847 [40,] 9.916294e-01 1.674129e-02 0.0083706440 [41,] 9.905618e-01 1.887635e-02 0.0094381762 [42,] 9.993088e-01 1.382477e-03 0.0006912386 [43,] 9.993439e-01 1.312184e-03 0.0006560922 [44,] 9.976189e-01 4.762106e-03 0.0023810531 [45,] 9.949067e-01 1.018651e-02 0.0050932562 [46,] 9.882061e-01 2.358779e-02 0.0117938958 [47,] 9.573875e-01 8.522510e-02 0.0426125494 > postscript(file="/var/www/html/rcomp/tmp/1gyig1258647552.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/2ce6n1258647552.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/3ljkr1258647552.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/4xr651258647552.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/53q1r1258647552.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 0.11928080 -0.24338310 0.23009196 -0.16047741 -0.29155482 0.11303077 7 8 9 10 11 12 0.04472786 -0.10342710 -0.26090209 0.01771021 0.14027359 0.02799377 13 14 15 16 17 18 -0.08428604 -0.13614784 -0.02499716 0.35562776 0.32669468 0.81272065 19 20 21 22 23 24 0.44161114 0.34598458 0.51101402 0.70627959 1.25055342 1.18090015 25 26 27 28 29 30 0.77772821 0.17129956 -0.67749184 -0.99011551 -1.06990861 -1.27003598 31 32 33 34 35 36 -1.19097356 -1.46533978 -1.61886996 -1.68007761 -1.51464971 -1.10791979 37 38 39 40 41 42 0.06494761 0.92455017 1.14020166 0.85614572 0.19154964 -0.13198239 43 44 45 46 47 48 -0.70174154 -0.04370148 0.36641724 0.63637178 1.51720885 1.75970803 49 50 51 52 53 54 0.99309934 0.40512442 0.53224027 0.08956678 -0.31384313 -0.20925754 55 56 57 58 59 60 -0.49116914 0.11995571 -0.34337045 -0.34225372 -0.32464127 -0.37809139 > postscript(file="/var/www/html/rcomp/tmp/63ft71258647552.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 0.11928080 NA 1 -0.24338310 0.11928080 2 0.23009196 -0.24338310 3 -0.16047741 0.23009196 4 -0.29155482 -0.16047741 5 0.11303077 -0.29155482 6 0.04472786 0.11303077 7 -0.10342710 0.04472786 8 -0.26090209 -0.10342710 9 0.01771021 -0.26090209 10 0.14027359 0.01771021 11 0.02799377 0.14027359 12 -0.08428604 0.02799377 13 -0.13614784 -0.08428604 14 -0.02499716 -0.13614784 15 0.35562776 -0.02499716 16 0.32669468 0.35562776 17 0.81272065 0.32669468 18 0.44161114 0.81272065 19 0.34598458 0.44161114 20 0.51101402 0.34598458 21 0.70627959 0.51101402 22 1.25055342 0.70627959 23 1.18090015 1.25055342 24 0.77772821 1.18090015 25 0.17129956 0.77772821 26 -0.67749184 0.17129956 27 -0.99011551 -0.67749184 28 -1.06990861 -0.99011551 29 -1.27003598 -1.06990861 30 -1.19097356 -1.27003598 31 -1.46533978 -1.19097356 32 -1.61886996 -1.46533978 33 -1.68007761 -1.61886996 34 -1.51464971 -1.68007761 35 -1.10791979 -1.51464971 36 0.06494761 -1.10791979 37 0.92455017 0.06494761 38 1.14020166 0.92455017 39 0.85614572 1.14020166 40 0.19154964 0.85614572 41 -0.13198239 0.19154964 42 -0.70174154 -0.13198239 43 -0.04370148 -0.70174154 44 0.36641724 -0.04370148 45 0.63637178 0.36641724 46 1.51720885 0.63637178 47 1.75970803 1.51720885 48 0.99309934 1.75970803 49 0.40512442 0.99309934 50 0.53224027 0.40512442 51 0.08956678 0.53224027 52 -0.31384313 0.08956678 53 -0.20925754 -0.31384313 54 -0.49116914 -0.20925754 55 0.11995571 -0.49116914 56 -0.34337045 0.11995571 57 -0.34225372 -0.34337045 58 -0.32464127 -0.34225372 59 -0.37809139 -0.32464127 60 NA -0.37809139 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.24338310 0.11928080 [2,] 0.23009196 -0.24338310 [3,] -0.16047741 0.23009196 [4,] -0.29155482 -0.16047741 [5,] 0.11303077 -0.29155482 [6,] 0.04472786 0.11303077 [7,] -0.10342710 0.04472786 [8,] -0.26090209 -0.10342710 [9,] 0.01771021 -0.26090209 [10,] 0.14027359 0.01771021 [11,] 0.02799377 0.14027359 [12,] -0.08428604 0.02799377 [13,] -0.13614784 -0.08428604 [14,] -0.02499716 -0.13614784 [15,] 0.35562776 -0.02499716 [16,] 0.32669468 0.35562776 [17,] 0.81272065 0.32669468 [18,] 0.44161114 0.81272065 [19,] 0.34598458 0.44161114 [20,] 0.51101402 0.34598458 [21,] 0.70627959 0.51101402 [22,] 1.25055342 0.70627959 [23,] 1.18090015 1.25055342 [24,] 0.77772821 1.18090015 [25,] 0.17129956 0.77772821 [26,] -0.67749184 0.17129956 [27,] -0.99011551 -0.67749184 [28,] -1.06990861 -0.99011551 [29,] -1.27003598 -1.06990861 [30,] -1.19097356 -1.27003598 [31,] -1.46533978 -1.19097356 [32,] -1.61886996 -1.46533978 [33,] -1.68007761 -1.61886996 [34,] -1.51464971 -1.68007761 [35,] -1.10791979 -1.51464971 [36,] 0.06494761 -1.10791979 [37,] 0.92455017 0.06494761 [38,] 1.14020166 0.92455017 [39,] 0.85614572 1.14020166 [40,] 0.19154964 0.85614572 [41,] -0.13198239 0.19154964 [42,] -0.70174154 -0.13198239 [43,] -0.04370148 -0.70174154 [44,] 0.36641724 -0.04370148 [45,] 0.63637178 0.36641724 [46,] 1.51720885 0.63637178 [47,] 1.75970803 1.51720885 [48,] 0.99309934 1.75970803 [49,] 0.40512442 0.99309934 [50,] 0.53224027 0.40512442 [51,] 0.08956678 0.53224027 [52,] -0.31384313 0.08956678 [53,] -0.20925754 -0.31384313 [54,] -0.49116914 -0.20925754 [55,] 0.11995571 -0.49116914 [56,] -0.34337045 0.11995571 [57,] -0.34225372 -0.34337045 [58,] -0.32464127 -0.34225372 [59,] -0.37809139 -0.32464127 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.24338310 0.11928080 2 0.23009196 -0.24338310 3 -0.16047741 0.23009196 4 -0.29155482 -0.16047741 5 0.11303077 -0.29155482 6 0.04472786 0.11303077 7 -0.10342710 0.04472786 8 -0.26090209 -0.10342710 9 0.01771021 -0.26090209 10 0.14027359 0.01771021 11 0.02799377 0.14027359 12 -0.08428604 0.02799377 13 -0.13614784 -0.08428604 14 -0.02499716 -0.13614784 15 0.35562776 -0.02499716 16 0.32669468 0.35562776 17 0.81272065 0.32669468 18 0.44161114 0.81272065 19 0.34598458 0.44161114 20 0.51101402 0.34598458 21 0.70627959 0.51101402 22 1.25055342 0.70627959 23 1.18090015 1.25055342 24 0.77772821 1.18090015 25 0.17129956 0.77772821 26 -0.67749184 0.17129956 27 -0.99011551 -0.67749184 28 -1.06990861 -0.99011551 29 -1.27003598 -1.06990861 30 -1.19097356 -1.27003598 31 -1.46533978 -1.19097356 32 -1.61886996 -1.46533978 33 -1.68007761 -1.61886996 34 -1.51464971 -1.68007761 35 -1.10791979 -1.51464971 36 0.06494761 -1.10791979 37 0.92455017 0.06494761 38 1.14020166 0.92455017 39 0.85614572 1.14020166 40 0.19154964 0.85614572 41 -0.13198239 0.19154964 42 -0.70174154 -0.13198239 43 -0.04370148 -0.70174154 44 0.36641724 -0.04370148 45 0.63637178 0.36641724 46 1.51720885 0.63637178 47 1.75970803 1.51720885 48 0.99309934 1.75970803 49 0.40512442 0.99309934 50 0.53224027 0.40512442 51 0.08956678 0.53224027 52 -0.31384313 0.08956678 53 -0.20925754 -0.31384313 54 -0.49116914 -0.20925754 55 0.11995571 -0.49116914 56 -0.34337045 0.11995571 57 -0.34225372 -0.34337045 58 -0.32464127 -0.34225372 59 -0.37809139 -0.32464127 > 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/7oync1258647552.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/8k6ue1258647552.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/9mxy21258647552.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/10fkcv1258647552.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/11e6ff1258647552.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/12hpgd1258647552.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/13u6ar1258647553.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/146dg21258647553.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/15zmjs1258647553.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/16qkat1258647553.tab") + } > > system("convert tmp/1gyig1258647552.ps tmp/1gyig1258647552.png") > system("convert tmp/2ce6n1258647552.ps tmp/2ce6n1258647552.png") > system("convert tmp/3ljkr1258647552.ps tmp/3ljkr1258647552.png") > system("convert tmp/4xr651258647552.ps tmp/4xr651258647552.png") > system("convert tmp/53q1r1258647552.ps tmp/53q1r1258647552.png") > system("convert tmp/63ft71258647552.ps tmp/63ft71258647552.png") > system("convert tmp/7oync1258647552.ps tmp/7oync1258647552.png") > system("convert tmp/8k6ue1258647552.ps tmp/8k6ue1258647552.png") > system("convert tmp/9mxy21258647552.ps tmp/9mxy21258647552.png") > system("convert tmp/10fkcv1258647552.ps tmp/10fkcv1258647552.png") > > > proc.time() user system elapsed 2.448 1.531 2.869