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(1.79,194.9,1.95,195.5,2.26,196.0,2.04,196.2,2.16,196.2,2.75,196.2,2.79,196.2,2.88,197.0,3.36,197.7,2.97,198.0,3.10,198.2,2.49,198.5,2.2,198.6,2.25,199.5,2.09,200,2.79,201.3,3.14,202.2,2.93,202.9,2.65,203.5,2.67,203.5,2.26,204,2.35,204.1,2.13,204.3,2.18,204.5,2.9,204.8,2.63,205.1,2.67,205.7,1.81,206.5,1.33,206.9,0.88,207.1,1.28,207.8,1.26,208,1.26,208.5,1.29,208.6,1.1,209,1.37,209.1,1.21,209.7,1.74,209.8,1.76,209.9,1.48,210,1.04,210.8,1.62,211.4,1.49,211.7,1.79,212,1.8,212.2,1.58,212.4,1.86,212.9,1.74,213.4,1.59,213.7,1.26,214,1.13,214.3,1.92,214.8,2.61,215,2.26,215.9,2.41,216.4,2.26,216.9,2.03,217.2,2.86,217.5,2.55,217.9,2.27,218.1,2.26,218.6,2.57,218.9,3.07,219.3,2.76,220.4,2.51,220.9,2.87,221,3.14,221.8,3.11,222,3.16,222.2,2.47,222.5,2.57,222.9,2.89,223.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 = '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 t 1 1.79 194.9 1 0 0 0 0 0 0 0 0 0 0 1 2 1.95 195.5 0 1 0 0 0 0 0 0 0 0 0 2 3 2.26 196.0 0 0 1 0 0 0 0 0 0 0 0 3 4 2.04 196.2 0 0 0 1 0 0 0 0 0 0 0 4 5 2.16 196.2 0 0 0 0 1 0 0 0 0 0 0 5 6 2.75 196.2 0 0 0 0 0 1 0 0 0 0 0 6 7 2.79 196.2 0 0 0 0 0 0 1 0 0 0 0 7 8 2.88 197.0 0 0 0 0 0 0 0 1 0 0 0 8 9 3.36 197.7 0 0 0 0 0 0 0 0 1 0 0 9 10 2.97 198.0 0 0 0 0 0 0 0 0 0 1 0 10 11 3.10 198.2 0 0 0 0 0 0 0 0 0 0 1 11 12 2.49 198.5 0 0 0 0 0 0 0 0 0 0 0 12 13 2.20 198.6 1 0 0 0 0 0 0 0 0 0 0 13 14 2.25 199.5 0 1 0 0 0 0 0 0 0 0 0 14 15 2.09 200.0 0 0 1 0 0 0 0 0 0 0 0 15 16 2.79 201.3 0 0 0 1 0 0 0 0 0 0 0 16 17 3.14 202.2 0 0 0 0 1 0 0 0 0 0 0 17 18 2.93 202.9 0 0 0 0 0 1 0 0 0 0 0 18 19 2.65 203.5 0 0 0 0 0 0 1 0 0 0 0 19 20 2.67 203.5 0 0 0 0 0 0 0 1 0 0 0 20 21 2.26 204.0 0 0 0 0 0 0 0 0 1 0 0 21 22 2.35 204.1 0 0 0 0 0 0 0 0 0 1 0 22 23 2.13 204.3 0 0 0 0 0 0 0 0 0 0 1 23 24 2.18 204.5 0 0 0 0 0 0 0 0 0 0 0 24 25 2.90 204.8 1 0 0 0 0 0 0 0 0 0 0 25 26 2.63 205.1 0 1 0 0 0 0 0 0 0 0 0 26 27 2.67 205.7 0 0 1 0 0 0 0 0 0 0 0 27 28 1.81 206.5 0 0 0 1 0 0 0 0 0 0 0 28 29 1.33 206.9 0 0 0 0 1 0 0 0 0 0 0 29 30 0.88 207.1 0 0 0 0 0 1 0 0 0 0 0 30 31 1.28 207.8 0 0 0 0 0 0 1 0 0 0 0 31 32 1.26 208.0 0 0 0 0 0 0 0 1 0 0 0 32 33 1.26 208.5 0 0 0 0 0 0 0 0 1 0 0 33 34 1.29 208.6 0 0 0 0 0 0 0 0 0 1 0 34 35 1.10 209.0 0 0 0 0 0 0 0 0 0 0 1 35 36 1.37 209.1 0 0 0 0 0 0 0 0 0 0 0 36 37 1.21 209.7 1 0 0 0 0 0 0 0 0 0 0 37 38 1.74 209.8 0 1 0 0 0 0 0 0 0 0 0 38 39 1.76 209.9 0 0 1 0 0 0 0 0 0 0 0 39 40 1.48 210.0 0 0 0 1 0 0 0 0 0 0 0 40 41 1.04 210.8 0 0 0 0 1 0 0 0 0 0 0 41 42 1.62 211.4 0 0 0 0 0 1 0 0 0 0 0 42 43 1.49 211.7 0 0 0 0 0 0 1 0 0 0 0 43 44 1.79 212.0 0 0 0 0 0 0 0 1 0 0 0 44 45 1.80 212.2 0 0 0 0 0 0 0 0 1 0 0 45 46 1.58 212.4 0 0 0 0 0 0 0 0 0 1 0 46 47 1.86 212.9 0 0 0 0 0 0 0 0 0 0 1 47 48 1.74 213.4 0 0 0 0 0 0 0 0 0 0 0 48 49 1.59 213.7 1 0 0 0 0 0 0 0 0 0 0 49 50 1.26 214.0 0 1 0 0 0 0 0 0 0 0 0 50 51 1.13 214.3 0 0 1 0 0 0 0 0 0 0 0 51 52 1.92 214.8 0 0 0 1 0 0 0 0 0 0 0 52 53 2.61 215.0 0 0 0 0 1 0 0 0 0 0 0 53 54 2.26 215.9 0 0 0 0 0 1 0 0 0 0 0 54 55 2.41 216.4 0 0 0 0 0 0 1 0 0 0 0 55 56 2.26 216.9 0 0 0 0 0 0 0 1 0 0 0 56 57 2.03 217.2 0 0 0 0 0 0 0 0 1 0 0 57 58 2.86 217.5 0 0 0 0 0 0 0 0 0 1 0 58 59 2.55 217.9 0 0 0 0 0 0 0 0 0 0 1 59 60 2.27 218.1 0 0 0 0 0 0 0 0 0 0 0 60 61 2.26 218.6 1 0 0 0 0 0 0 0 0 0 0 61 62 2.57 218.9 0 1 0 0 0 0 0 0 0 0 0 62 63 3.07 219.3 0 0 1 0 0 0 0 0 0 0 0 63 64 2.76 220.4 0 0 0 1 0 0 0 0 0 0 0 64 65 2.51 220.9 0 0 0 0 1 0 0 0 0 0 0 65 66 2.87 221.0 0 0 0 0 0 1 0 0 0 0 0 66 67 3.14 221.8 0 0 0 0 0 0 1 0 0 0 0 67 68 3.11 222.0 0 0 0 0 0 0 0 1 0 0 0 68 69 3.16 222.2 0 0 0 0 0 0 0 0 1 0 0 69 70 2.47 222.5 0 0 0 0 0 0 0 0 0 1 0 70 71 2.57 222.9 0 0 0 0 0 0 0 0 0 0 1 71 72 2.89 223.1 0 0 0 0 0 0 0 0 0 0 0 72 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 34.265574 -0.165158 -0.169195 -0.091061 0.005987 0.020411 M5 M6 M7 M8 M9 M10 0.030136 0.119937 0.209081 0.233452 0.217166 0.128936 M11 t 0.086059 0.065682 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.2718 -0.4716 0.0737 0.4914 1.1226 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 34.265574 30.273129 1.132 0.262 X -0.165158 0.155704 -1.061 0.293 M1 -0.169195 0.400678 -0.422 0.674 M2 -0.091061 0.400246 -0.228 0.821 M3 0.005987 0.399872 0.015 0.988 M4 0.020411 0.401650 0.051 0.960 M5 0.030136 0.402600 0.075 0.941 M6 0.119937 0.402740 0.298 0.767 M7 0.209081 0.404560 0.517 0.607 M8 0.233452 0.402817 0.580 0.564 M9 0.217166 0.402734 0.539 0.592 M10 0.128936 0.399511 0.323 0.748 M11 0.086059 0.398957 0.216 0.830 t 0.065682 0.062038 1.059 0.294 Residual standard error: 0.6898 on 58 degrees of freedom Multiple R-squared: 0.04215, Adjusted R-squared: -0.1725 F-statistic: 0.1963 on 13 and 58 DF, p-value: 0.9987 > 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.04756686 0.095133729 0.952433135 [2,] 0.09175438 0.183508769 0.908245615 [3,] 0.09130759 0.182615190 0.908692405 [4,] 0.07387856 0.147757120 0.926121440 [5,] 0.22268300 0.445366009 0.777316996 [6,] 0.21191556 0.423831122 0.788084439 [7,] 0.25934563 0.518691256 0.740654372 [8,] 0.21542184 0.430843678 0.784578161 [9,] 0.49161697 0.983233947 0.508383026 [10,] 0.65753751 0.684924977 0.342462488 [11,] 0.85474084 0.290518330 0.145259165 [12,] 0.92884087 0.142318261 0.071159131 [13,] 0.98436780 0.031264408 0.015632204 [14,] 0.99848697 0.003026051 0.001513026 [15,] 0.99875812 0.002483762 0.001241881 [16,] 0.99884620 0.002307607 0.001153804 [17,] 0.99874646 0.002507082 0.001253541 [18,] 0.99817034 0.003659319 0.001829660 [19,] 0.99759471 0.004810585 0.002405292 [20,] 0.99558251 0.008834990 0.004417495 [21,] 0.99181280 0.016374393 0.008187196 [22,] 0.99287316 0.014253683 0.007126842 [23,] 0.99470857 0.010582860 0.005291430 [24,] 0.99011434 0.019771325 0.009885663 [25,] 0.98628505 0.027429898 0.013714949 [26,] 0.97712044 0.045759129 0.022879564 [27,] 0.96396723 0.072065534 0.036032767 [28,] 0.94196130 0.116077404 0.058038702 [29,] 0.91168074 0.176638521 0.088319260 [30,] 0.86581666 0.268366685 0.134183343 [31,] 0.82341227 0.353175457 0.176587728 [32,] 0.78167017 0.436659666 0.218329833 [33,] 0.70442126 0.591157474 0.295578737 [34,] 0.63682100 0.726358001 0.363179001 [35,] 0.83733069 0.325338619 0.162669310 [36,] 0.80636465 0.387270697 0.193635349 [37,] 0.81467698 0.370646037 0.185323018 [38,] 0.70604276 0.587914485 0.293957242 [39,] 0.59636256 0.807274883 0.403637441 > postscript(file="/var/www/html/rcomp/tmp/1bg4v1291470694.ps",horizontal=F,onefile=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/2bg4v1291470694.ps",horizontal=F,onefile=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/3eznb1291470695.ps",horizontal=F,onefile=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/4eznb1291470695.ps",horizontal=F,onefile=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/5eznb1291470695.ps",horizontal=F,onefile=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 -0.182827592 -0.067548682 0.162300421 -0.104773168 -0.060180091 0.374337538 7 8 9 10 11 12 0.259511321 0.391584910 0.937798884 0.619895358 0.760121705 0.220046256 13 14 15 16 17 18 0.050074883 0.104901100 -0.135249798 0.699350073 1.122585072 0.872713084 19 20 21 22 23 24 0.536981481 0.466928918 0.090111354 0.219176290 0.009402636 0.112811418 25 26 27 28 29 30 0.985871583 0.621603186 0.597968058 -0.210010917 -0.699354763 -1.271805596 31 32 33 34 35 36 -0.911021430 -0.988042455 -0.954860019 -0.885795083 -1.032537199 -0.725644186 37 38 39 40 41 42 -0.683036714 -0.280336649 -0.406550623 -0.750139981 -1.133420750 -0.609808507 43 44 45 46 47 48 -0.845087417 -0.585592673 -0.591957545 -0.756376840 -0.416603186 -0.433647097 49 50 51 52 53 54 -0.430586932 -0.854855329 -1.098037765 -0.305564047 0.342060569 -0.014779880 55 56 57 58 59 60 0.062972748 -0.094500970 -0.324350073 0.577746401 0.311004286 0.084413068 61 62 63 64 65 66 0.260504771 0.476236374 0.879569707 0.671138040 0.428309963 0.649343361 67 68 69 70 71 72 0.896643296 0.809622271 0.843257399 0.225353874 0.368611758 0.742020540 > postscript(file="/var/www/html/rcomp/tmp/67rne1291470695.ps",horizontal=F,onefile=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.182827592 NA 1 -0.067548682 -0.182827592 2 0.162300421 -0.067548682 3 -0.104773168 0.162300421 4 -0.060180091 -0.104773168 5 0.374337538 -0.060180091 6 0.259511321 0.374337538 7 0.391584910 0.259511321 8 0.937798884 0.391584910 9 0.619895358 0.937798884 10 0.760121705 0.619895358 11 0.220046256 0.760121705 12 0.050074883 0.220046256 13 0.104901100 0.050074883 14 -0.135249798 0.104901100 15 0.699350073 -0.135249798 16 1.122585072 0.699350073 17 0.872713084 1.122585072 18 0.536981481 0.872713084 19 0.466928918 0.536981481 20 0.090111354 0.466928918 21 0.219176290 0.090111354 22 0.009402636 0.219176290 23 0.112811418 0.009402636 24 0.985871583 0.112811418 25 0.621603186 0.985871583 26 0.597968058 0.621603186 27 -0.210010917 0.597968058 28 -0.699354763 -0.210010917 29 -1.271805596 -0.699354763 30 -0.911021430 -1.271805596 31 -0.988042455 -0.911021430 32 -0.954860019 -0.988042455 33 -0.885795083 -0.954860019 34 -1.032537199 -0.885795083 35 -0.725644186 -1.032537199 36 -0.683036714 -0.725644186 37 -0.280336649 -0.683036714 38 -0.406550623 -0.280336649 39 -0.750139981 -0.406550623 40 -1.133420750 -0.750139981 41 -0.609808507 -1.133420750 42 -0.845087417 -0.609808507 43 -0.585592673 -0.845087417 44 -0.591957545 -0.585592673 45 -0.756376840 -0.591957545 46 -0.416603186 -0.756376840 47 -0.433647097 -0.416603186 48 -0.430586932 -0.433647097 49 -0.854855329 -0.430586932 50 -1.098037765 -0.854855329 51 -0.305564047 -1.098037765 52 0.342060569 -0.305564047 53 -0.014779880 0.342060569 54 0.062972748 -0.014779880 55 -0.094500970 0.062972748 56 -0.324350073 -0.094500970 57 0.577746401 -0.324350073 58 0.311004286 0.577746401 59 0.084413068 0.311004286 60 0.260504771 0.084413068 61 0.476236374 0.260504771 62 0.879569707 0.476236374 63 0.671138040 0.879569707 64 0.428309963 0.671138040 65 0.649343361 0.428309963 66 0.896643296 0.649343361 67 0.809622271 0.896643296 68 0.843257399 0.809622271 69 0.225353874 0.843257399 70 0.368611758 0.225353874 71 0.742020540 0.368611758 72 NA 0.742020540 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.067548682 -0.182827592 [2,] 0.162300421 -0.067548682 [3,] -0.104773168 0.162300421 [4,] -0.060180091 -0.104773168 [5,] 0.374337538 -0.060180091 [6,] 0.259511321 0.374337538 [7,] 0.391584910 0.259511321 [8,] 0.937798884 0.391584910 [9,] 0.619895358 0.937798884 [10,] 0.760121705 0.619895358 [11,] 0.220046256 0.760121705 [12,] 0.050074883 0.220046256 [13,] 0.104901100 0.050074883 [14,] -0.135249798 0.104901100 [15,] 0.699350073 -0.135249798 [16,] 1.122585072 0.699350073 [17,] 0.872713084 1.122585072 [18,] 0.536981481 0.872713084 [19,] 0.466928918 0.536981481 [20,] 0.090111354 0.466928918 [21,] 0.219176290 0.090111354 [22,] 0.009402636 0.219176290 [23,] 0.112811418 0.009402636 [24,] 0.985871583 0.112811418 [25,] 0.621603186 0.985871583 [26,] 0.597968058 0.621603186 [27,] -0.210010917 0.597968058 [28,] -0.699354763 -0.210010917 [29,] -1.271805596 -0.699354763 [30,] -0.911021430 -1.271805596 [31,] -0.988042455 -0.911021430 [32,] -0.954860019 -0.988042455 [33,] -0.885795083 -0.954860019 [34,] -1.032537199 -0.885795083 [35,] -0.725644186 -1.032537199 [36,] -0.683036714 -0.725644186 [37,] -0.280336649 -0.683036714 [38,] -0.406550623 -0.280336649 [39,] -0.750139981 -0.406550623 [40,] -1.133420750 -0.750139981 [41,] -0.609808507 -1.133420750 [42,] -0.845087417 -0.609808507 [43,] -0.585592673 -0.845087417 [44,] -0.591957545 -0.585592673 [45,] -0.756376840 -0.591957545 [46,] -0.416603186 -0.756376840 [47,] -0.433647097 -0.416603186 [48,] -0.430586932 -0.433647097 [49,] -0.854855329 -0.430586932 [50,] -1.098037765 -0.854855329 [51,] -0.305564047 -1.098037765 [52,] 0.342060569 -0.305564047 [53,] -0.014779880 0.342060569 [54,] 0.062972748 -0.014779880 [55,] -0.094500970 0.062972748 [56,] -0.324350073 -0.094500970 [57,] 0.577746401 -0.324350073 [58,] 0.311004286 0.577746401 [59,] 0.084413068 0.311004286 [60,] 0.260504771 0.084413068 [61,] 0.476236374 0.260504771 [62,] 0.879569707 0.476236374 [63,] 0.671138040 0.879569707 [64,] 0.428309963 0.671138040 [65,] 0.649343361 0.428309963 [66,] 0.896643296 0.649343361 [67,] 0.809622271 0.896643296 [68,] 0.843257399 0.809622271 [69,] 0.225353874 0.843257399 [70,] 0.368611758 0.225353874 [71,] 0.742020540 0.368611758 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.067548682 -0.182827592 2 0.162300421 -0.067548682 3 -0.104773168 0.162300421 4 -0.060180091 -0.104773168 5 0.374337538 -0.060180091 6 0.259511321 0.374337538 7 0.391584910 0.259511321 8 0.937798884 0.391584910 9 0.619895358 0.937798884 10 0.760121705 0.619895358 11 0.220046256 0.760121705 12 0.050074883 0.220046256 13 0.104901100 0.050074883 14 -0.135249798 0.104901100 15 0.699350073 -0.135249798 16 1.122585072 0.699350073 17 0.872713084 1.122585072 18 0.536981481 0.872713084 19 0.466928918 0.536981481 20 0.090111354 0.466928918 21 0.219176290 0.090111354 22 0.009402636 0.219176290 23 0.112811418 0.009402636 24 0.985871583 0.112811418 25 0.621603186 0.985871583 26 0.597968058 0.621603186 27 -0.210010917 0.597968058 28 -0.699354763 -0.210010917 29 -1.271805596 -0.699354763 30 -0.911021430 -1.271805596 31 -0.988042455 -0.911021430 32 -0.954860019 -0.988042455 33 -0.885795083 -0.954860019 34 -1.032537199 -0.885795083 35 -0.725644186 -1.032537199 36 -0.683036714 -0.725644186 37 -0.280336649 -0.683036714 38 -0.406550623 -0.280336649 39 -0.750139981 -0.406550623 40 -1.133420750 -0.750139981 41 -0.609808507 -1.133420750 42 -0.845087417 -0.609808507 43 -0.585592673 -0.845087417 44 -0.591957545 -0.585592673 45 -0.756376840 -0.591957545 46 -0.416603186 -0.756376840 47 -0.433647097 -0.416603186 48 -0.430586932 -0.433647097 49 -0.854855329 -0.430586932 50 -1.098037765 -0.854855329 51 -0.305564047 -1.098037765 52 0.342060569 -0.305564047 53 -0.014779880 0.342060569 54 0.062972748 -0.014779880 55 -0.094500970 0.062972748 56 -0.324350073 -0.094500970 57 0.577746401 -0.324350073 58 0.311004286 0.577746401 59 0.084413068 0.311004286 60 0.260504771 0.084413068 61 0.476236374 0.260504771 62 0.879569707 0.476236374 63 0.671138040 0.879569707 64 0.428309963 0.671138040 65 0.649343361 0.428309963 66 0.896643296 0.649343361 67 0.809622271 0.896643296 68 0.843257399 0.809622271 69 0.225353874 0.843257399 70 0.368611758 0.225353874 71 0.742020540 0.368611758 > 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/70i4z1291470695.ps",horizontal=F,onefile=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/80i4z1291470695.ps",horizontal=F,onefile=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/90i4z1291470695.ps",horizontal=F,onefile=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/10brlk1291470695.ps",horizontal=F,onefile=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/11wa271291470695.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/12zsiv1291470695.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/13v2gm1291470695.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/14zlea1291470695.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/15klvg1291470695.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/16omc41291470695.tab") + } > > try(system("convert tmp/1bg4v1291470694.ps tmp/1bg4v1291470694.png",intern=TRUE)) character(0) > try(system("convert tmp/2bg4v1291470694.ps tmp/2bg4v1291470694.png",intern=TRUE)) character(0) > try(system("convert tmp/3eznb1291470695.ps tmp/3eznb1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/4eznb1291470695.ps tmp/4eznb1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/5eznb1291470695.ps tmp/5eznb1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/67rne1291470695.ps tmp/67rne1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/70i4z1291470695.ps tmp/70i4z1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/80i4z1291470695.ps tmp/80i4z1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/90i4z1291470695.ps tmp/90i4z1291470695.png",intern=TRUE)) character(0) > try(system("convert tmp/10brlk1291470695.ps tmp/10brlk1291470695.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.700 1.715 107.727