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(2.6,30.5,2.4,28.6,2.5,30,2.7,28.2,3.2,27.6,2.8,24.9,2.8,23.8,3,24.3,3.1,23.6,3.1,24.2,3,28.1,2.4,30.1,2.7,31.1,3,32,2.7,32.4,2.7,34,2,35.1,2.4,37.1,2.6,37.3,2.4,38.1,2.3,39.5,2.4,38.3,2.5,37.3,2.6,38.7,2.6,37.5,2.6,38.7,2.7,37.9,2.8,36.6,2.6,35.5,2.6,37.6,2,38.6,2,40.3,2.1,39,1.9,36.8,2,36.5,2.5,34.1,2.9,34.2,3.3,31.9,3.5,33.7,3.8,33.5,4.6,33.8,4.4,29.9,5.3,32.3,5.8,30.5,5.9,28.5,5.6,29,5.8,23.8,5.5,17.9,4.6,9.9,4.2,3,4,4.2,3.5,0.4,2.3,0,2.2,2.4,1.4,4.2,0.6,8.2,0,9,0.5,13.6,0.1,14,0.1,17.6),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 2.6 30.5 1 0 0 0 0 0 0 0 0 0 0 2 2.4 28.6 0 1 0 0 0 0 0 0 0 0 0 3 2.5 30.0 0 0 1 0 0 0 0 0 0 0 0 4 2.7 28.2 0 0 0 1 0 0 0 0 0 0 0 5 3.2 27.6 0 0 0 0 1 0 0 0 0 0 0 6 2.8 24.9 0 0 0 0 0 1 0 0 0 0 0 7 2.8 23.8 0 0 0 0 0 0 1 0 0 0 0 8 3.0 24.3 0 0 0 0 0 0 0 1 0 0 0 9 3.1 23.6 0 0 0 0 0 0 0 0 1 0 0 10 3.1 24.2 0 0 0 0 0 0 0 0 0 1 0 11 3.0 28.1 0 0 0 0 0 0 0 0 0 0 1 12 2.4 30.1 0 0 0 0 0 0 0 0 0 0 0 13 2.7 31.1 1 0 0 0 0 0 0 0 0 0 0 14 3.0 32.0 0 1 0 0 0 0 0 0 0 0 0 15 2.7 32.4 0 0 1 0 0 0 0 0 0 0 0 16 2.7 34.0 0 0 0 1 0 0 0 0 0 0 0 17 2.0 35.1 0 0 0 0 1 0 0 0 0 0 0 18 2.4 37.1 0 0 0 0 0 1 0 0 0 0 0 19 2.6 37.3 0 0 0 0 0 0 1 0 0 0 0 20 2.4 38.1 0 0 0 0 0 0 0 1 0 0 0 21 2.3 39.5 0 0 0 0 0 0 0 0 1 0 0 22 2.4 38.3 0 0 0 0 0 0 0 0 0 1 0 23 2.5 37.3 0 0 0 0 0 0 0 0 0 0 1 24 2.6 38.7 0 0 0 0 0 0 0 0 0 0 0 25 2.6 37.5 1 0 0 0 0 0 0 0 0 0 0 26 2.6 38.7 0 1 0 0 0 0 0 0 0 0 0 27 2.7 37.9 0 0 1 0 0 0 0 0 0 0 0 28 2.8 36.6 0 0 0 1 0 0 0 0 0 0 0 29 2.6 35.5 0 0 0 0 1 0 0 0 0 0 0 30 2.6 37.6 0 0 0 0 0 1 0 0 0 0 0 31 2.0 38.6 0 0 0 0 0 0 1 0 0 0 0 32 2.0 40.3 0 0 0 0 0 0 0 1 0 0 0 33 2.1 39.0 0 0 0 0 0 0 0 0 1 0 0 34 1.9 36.8 0 0 0 0 0 0 0 0 0 1 0 35 2.0 36.5 0 0 0 0 0 0 0 0 0 0 1 36 2.5 34.1 0 0 0 0 0 0 0 0 0 0 0 37 2.9 34.2 1 0 0 0 0 0 0 0 0 0 0 38 3.3 31.9 0 1 0 0 0 0 0 0 0 0 0 39 3.5 33.7 0 0 1 0 0 0 0 0 0 0 0 40 3.8 33.5 0 0 0 1 0 0 0 0 0 0 0 41 4.6 33.8 0 0 0 0 1 0 0 0 0 0 0 42 4.4 29.9 0 0 0 0 0 1 0 0 0 0 0 43 5.3 32.3 0 0 0 0 0 0 1 0 0 0 0 44 5.8 30.5 0 0 0 0 0 0 0 1 0 0 0 45 5.9 28.5 0 0 0 0 0 0 0 0 1 0 0 46 5.6 29.0 0 0 0 0 0 0 0 0 0 1 0 47 5.8 23.8 0 0 0 0 0 0 0 0 0 0 1 48 5.5 17.9 0 0 0 0 0 0 0 0 0 0 0 49 4.6 9.9 1 0 0 0 0 0 0 0 0 0 0 50 4.2 3.0 0 1 0 0 0 0 0 0 0 0 0 51 4.0 4.2 0 0 1 0 0 0 0 0 0 0 0 52 3.5 0.4 0 0 0 1 0 0 0 0 0 0 0 53 2.3 0.0 0 0 0 0 1 0 0 0 0 0 0 54 2.2 2.4 0 0 0 0 0 1 0 0 0 0 0 55 1.4 4.2 0 0 0 0 0 0 1 0 0 0 0 56 0.6 8.2 0 0 0 0 0 0 0 1 0 0 0 57 0.0 9.0 0 0 0 0 0 0 0 0 1 0 0 58 0.5 13.6 0 0 0 0 0 0 0 0 0 1 0 59 0.1 14.0 0 0 0 0 0 0 0 0 0 0 1 60 0.1 17.6 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 2.374701 0.008862 0.451493 0.487444 0.460354 0.490103 M5 M6 M7 M8 M9 M10 0.331343 0.271521 0.203899 0.134683 0.057873 0.073797 M11 0.057696 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.5123 -0.5815 -0.3837 0.3840 3.2149 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.374701 0.803879 2.954 0.00489 ** X 0.008862 0.016647 0.532 0.59700 M1 0.451493 0.931689 0.485 0.63021 M2 0.487444 0.931657 0.523 0.60329 M3 0.460354 0.931552 0.494 0.62348 M4 0.490103 0.931745 0.526 0.60136 M5 0.331343 0.931796 0.356 0.72373 M6 0.271521 0.931803 0.291 0.77203 M7 0.203899 0.931581 0.219 0.82770 M8 0.134683 0.931605 0.145 0.88567 M9 0.057873 0.931560 0.062 0.95073 M10 0.073797 0.931625 0.079 0.93720 M11 0.057696 0.931562 0.062 0.95088 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.473 on 47 degrees of freedom Multiple R-squared: 0.02394, Adjusted R-squared: -0.2253 F-statistic: 0.09606 on 12 and 47 DF, p-value: 1 > 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,] 2.505299e-03 5.010598e-03 0.9974947 [2,] 6.340614e-03 1.268123e-02 0.9936594 [3,] 1.360373e-03 2.720747e-03 0.9986396 [4,] 2.938182e-04 5.876364e-04 0.9997062 [5,] 5.262595e-05 1.052519e-04 0.9999474 [6,] 9.289055e-06 1.857811e-05 0.9999907 [7,] 1.458368e-06 2.916737e-06 0.9999985 [8,] 2.130175e-07 4.260349e-07 0.9999998 [9,] 6.778133e-08 1.355627e-07 0.9999999 [10,] 1.163536e-08 2.327073e-08 1.0000000 [11,] 2.006944e-09 4.013888e-09 1.0000000 [12,] 4.431652e-10 8.863303e-10 1.0000000 [13,] 8.417889e-11 1.683578e-10 1.0000000 [14,] 1.222241e-11 2.444482e-11 1.0000000 [15,] 1.931548e-12 3.863095e-12 1.0000000 [16,] 7.277373e-13 1.455475e-12 1.0000000 [17,] 2.244792e-13 4.489585e-13 1.0000000 [18,] 5.391372e-14 1.078274e-13 1.0000000 [19,] 4.483288e-14 8.966576e-14 1.0000000 [20,] 2.884186e-14 5.768371e-14 1.0000000 [21,] 4.101944e-15 8.203887e-15 1.0000000 [22,] 2.137892e-15 4.275785e-15 1.0000000 [23,] 3.420607e-15 6.841214e-15 1.0000000 [24,] 3.197981e-14 6.395963e-14 1.0000000 [25,] 1.498490e-12 2.996979e-12 1.0000000 [26,] 2.357040e-09 4.714080e-09 1.0000000 [27,] 1.056206e-07 2.112413e-07 0.9999999 [28,] 3.857837e-05 7.715674e-05 0.9999614 [29,] 4.622034e-04 9.244067e-04 0.9995378 > postscript(file="/var/www/html/rcomp/tmp/1osz41261396196.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/2qgb11261396196.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/3m49g1261396196.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/4ilun1261396196.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/5ou3v1261396196.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.49648321 -0.71559702 -0.60091418 -0.41471082 0.24936567 -0.06688433 7 8 9 10 11 12 0.01048508 0.27527053 0.45828359 0.43704292 0.31858209 -0.24144590 13 14 15 16 17 18 -0.40180038 -0.14572762 -0.42218285 -0.46611009 -1.01709890 -0.57500002 19 20 21 22 23 24 -0.30915114 -0.44702427 -0.48262129 -0.38791047 -0.26294778 -0.11765861 25 26 27 28 29 30 -0.55851681 -0.60510264 -0.47092353 -0.38915114 -0.42064368 -0.37943099 31 32 33 34 35 36 -0.92067167 -0.86652055 -0.67819032 -0.87461756 -0.75585823 -0.17689367 37 38 39 40 41 42 -0.22927240 0.15515857 0.36629663 0.63832088 1.59442163 1.48880596 43 44 45 46 47 48 2.43515857 3.02032649 3.21486007 2.89450560 3.15668844 2.96666980 49 50 51 52 53 54 1.68607280 1.31126871 1.12772393 0.63165118 -0.40604472 -0.46749062 55 56 57 58 59 60 -1.21582085 -1.98205220 -2.51233205 -2.06902049 -2.45646452 -2.43067162 > postscript(file="/var/www/html/rcomp/tmp/6mx211261396196.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.49648321 NA 1 -0.71559702 -0.49648321 2 -0.60091418 -0.71559702 3 -0.41471082 -0.60091418 4 0.24936567 -0.41471082 5 -0.06688433 0.24936567 6 0.01048508 -0.06688433 7 0.27527053 0.01048508 8 0.45828359 0.27527053 9 0.43704292 0.45828359 10 0.31858209 0.43704292 11 -0.24144590 0.31858209 12 -0.40180038 -0.24144590 13 -0.14572762 -0.40180038 14 -0.42218285 -0.14572762 15 -0.46611009 -0.42218285 16 -1.01709890 -0.46611009 17 -0.57500002 -1.01709890 18 -0.30915114 -0.57500002 19 -0.44702427 -0.30915114 20 -0.48262129 -0.44702427 21 -0.38791047 -0.48262129 22 -0.26294778 -0.38791047 23 -0.11765861 -0.26294778 24 -0.55851681 -0.11765861 25 -0.60510264 -0.55851681 26 -0.47092353 -0.60510264 27 -0.38915114 -0.47092353 28 -0.42064368 -0.38915114 29 -0.37943099 -0.42064368 30 -0.92067167 -0.37943099 31 -0.86652055 -0.92067167 32 -0.67819032 -0.86652055 33 -0.87461756 -0.67819032 34 -0.75585823 -0.87461756 35 -0.17689367 -0.75585823 36 -0.22927240 -0.17689367 37 0.15515857 -0.22927240 38 0.36629663 0.15515857 39 0.63832088 0.36629663 40 1.59442163 0.63832088 41 1.48880596 1.59442163 42 2.43515857 1.48880596 43 3.02032649 2.43515857 44 3.21486007 3.02032649 45 2.89450560 3.21486007 46 3.15668844 2.89450560 47 2.96666980 3.15668844 48 1.68607280 2.96666980 49 1.31126871 1.68607280 50 1.12772393 1.31126871 51 0.63165118 1.12772393 52 -0.40604472 0.63165118 53 -0.46749062 -0.40604472 54 -1.21582085 -0.46749062 55 -1.98205220 -1.21582085 56 -2.51233205 -1.98205220 57 -2.06902049 -2.51233205 58 -2.45646452 -2.06902049 59 -2.43067162 -2.45646452 60 NA -2.43067162 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.71559702 -0.49648321 [2,] -0.60091418 -0.71559702 [3,] -0.41471082 -0.60091418 [4,] 0.24936567 -0.41471082 [5,] -0.06688433 0.24936567 [6,] 0.01048508 -0.06688433 [7,] 0.27527053 0.01048508 [8,] 0.45828359 0.27527053 [9,] 0.43704292 0.45828359 [10,] 0.31858209 0.43704292 [11,] -0.24144590 0.31858209 [12,] -0.40180038 -0.24144590 [13,] -0.14572762 -0.40180038 [14,] -0.42218285 -0.14572762 [15,] -0.46611009 -0.42218285 [16,] -1.01709890 -0.46611009 [17,] -0.57500002 -1.01709890 [18,] -0.30915114 -0.57500002 [19,] -0.44702427 -0.30915114 [20,] -0.48262129 -0.44702427 [21,] -0.38791047 -0.48262129 [22,] -0.26294778 -0.38791047 [23,] -0.11765861 -0.26294778 [24,] -0.55851681 -0.11765861 [25,] -0.60510264 -0.55851681 [26,] -0.47092353 -0.60510264 [27,] -0.38915114 -0.47092353 [28,] -0.42064368 -0.38915114 [29,] -0.37943099 -0.42064368 [30,] -0.92067167 -0.37943099 [31,] -0.86652055 -0.92067167 [32,] -0.67819032 -0.86652055 [33,] -0.87461756 -0.67819032 [34,] -0.75585823 -0.87461756 [35,] -0.17689367 -0.75585823 [36,] -0.22927240 -0.17689367 [37,] 0.15515857 -0.22927240 [38,] 0.36629663 0.15515857 [39,] 0.63832088 0.36629663 [40,] 1.59442163 0.63832088 [41,] 1.48880596 1.59442163 [42,] 2.43515857 1.48880596 [43,] 3.02032649 2.43515857 [44,] 3.21486007 3.02032649 [45,] 2.89450560 3.21486007 [46,] 3.15668844 2.89450560 [47,] 2.96666980 3.15668844 [48,] 1.68607280 2.96666980 [49,] 1.31126871 1.68607280 [50,] 1.12772393 1.31126871 [51,] 0.63165118 1.12772393 [52,] -0.40604472 0.63165118 [53,] -0.46749062 -0.40604472 [54,] -1.21582085 -0.46749062 [55,] -1.98205220 -1.21582085 [56,] -2.51233205 -1.98205220 [57,] -2.06902049 -2.51233205 [58,] -2.45646452 -2.06902049 [59,] -2.43067162 -2.45646452 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.71559702 -0.49648321 2 -0.60091418 -0.71559702 3 -0.41471082 -0.60091418 4 0.24936567 -0.41471082 5 -0.06688433 0.24936567 6 0.01048508 -0.06688433 7 0.27527053 0.01048508 8 0.45828359 0.27527053 9 0.43704292 0.45828359 10 0.31858209 0.43704292 11 -0.24144590 0.31858209 12 -0.40180038 -0.24144590 13 -0.14572762 -0.40180038 14 -0.42218285 -0.14572762 15 -0.46611009 -0.42218285 16 -1.01709890 -0.46611009 17 -0.57500002 -1.01709890 18 -0.30915114 -0.57500002 19 -0.44702427 -0.30915114 20 -0.48262129 -0.44702427 21 -0.38791047 -0.48262129 22 -0.26294778 -0.38791047 23 -0.11765861 -0.26294778 24 -0.55851681 -0.11765861 25 -0.60510264 -0.55851681 26 -0.47092353 -0.60510264 27 -0.38915114 -0.47092353 28 -0.42064368 -0.38915114 29 -0.37943099 -0.42064368 30 -0.92067167 -0.37943099 31 -0.86652055 -0.92067167 32 -0.67819032 -0.86652055 33 -0.87461756 -0.67819032 34 -0.75585823 -0.87461756 35 -0.17689367 -0.75585823 36 -0.22927240 -0.17689367 37 0.15515857 -0.22927240 38 0.36629663 0.15515857 39 0.63832088 0.36629663 40 1.59442163 0.63832088 41 1.48880596 1.59442163 42 2.43515857 1.48880596 43 3.02032649 2.43515857 44 3.21486007 3.02032649 45 2.89450560 3.21486007 46 3.15668844 2.89450560 47 2.96666980 3.15668844 48 1.68607280 2.96666980 49 1.31126871 1.68607280 50 1.12772393 1.31126871 51 0.63165118 1.12772393 52 -0.40604472 0.63165118 53 -0.46749062 -0.40604472 54 -1.21582085 -0.46749062 55 -1.98205220 -1.21582085 56 -2.51233205 -1.98205220 57 -2.06902049 -2.51233205 58 -2.45646452 -2.06902049 59 -2.43067162 -2.45646452 > 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/7r7nj1261396196.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/8b92h1261396196.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/9shpo1261396196.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/10wxo91261396196.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/119otr1261396196.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/126z8s1261396196.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/13kt941261396196.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/147h6l1261396196.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/15lofw1261396196.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/163chd1261396196.tab") + } > > try(system("convert tmp/1osz41261396196.ps tmp/1osz41261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/2qgb11261396196.ps tmp/2qgb11261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/3m49g1261396196.ps tmp/3m49g1261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/4ilun1261396196.ps tmp/4ilun1261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/5ou3v1261396196.ps tmp/5ou3v1261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/6mx211261396196.ps tmp/6mx211261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/7r7nj1261396196.ps tmp/7r7nj1261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/8b92h1261396196.ps tmp/8b92h1261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/9shpo1261396196.ps tmp/9shpo1261396196.png",intern=TRUE)) character(0) > try(system("convert tmp/10wxo91261396196.ps tmp/10wxo91261396196.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.377 1.573 2.996