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(56.6,0,56,0,54.8,0,52.7,0,50.9,0,50.6,0,52.1,0,53.3,0,53.9,0,54.3,0,54.2,0,54.2,0,53.5,0,51.4,0,50.5,0,50.3,0,49.8,0,50.7,0,52.8,0,55.3,0,57.3,0,57.5,0,56.8,0,56.4,0,56.3,0,56.4,0,57,0,57.9,0,58.9,0,58.8,0,56.5,1,51.9,1,47.4,1,44.9,1,43.9,1,43.4,1,42.9,1,42.6,1,42.2,1,41.2,1,40.2,1,39.3,1,38.5,1,38.3,1,37.9,1,37.6,1,37.3,1,36,1,34.5,1,33.5,1,32.9,1,32.9,1,32.8,1,31.9,1,30.5,1,29.2,1,28.7,1,28.4,1,28,1,27.4,1,26.9,1),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > 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 56.6 0 1 0 0 0 0 0 0 0 0 0 0 2 56.0 0 0 1 0 0 0 0 0 0 0 0 0 3 54.8 0 0 0 1 0 0 0 0 0 0 0 0 4 52.7 0 0 0 0 1 0 0 0 0 0 0 0 5 50.9 0 0 0 0 0 1 0 0 0 0 0 0 6 50.6 0 0 0 0 0 0 1 0 0 0 0 0 7 52.1 0 0 0 0 0 0 0 1 0 0 0 0 8 53.3 0 0 0 0 0 0 0 0 1 0 0 0 9 53.9 0 0 0 0 0 0 0 0 0 1 0 0 10 54.3 0 0 0 0 0 0 0 0 0 0 1 0 11 54.2 0 0 0 0 0 0 0 0 0 0 0 1 12 54.2 0 0 0 0 0 0 0 0 0 0 0 0 13 53.5 0 1 0 0 0 0 0 0 0 0 0 0 14 51.4 0 0 1 0 0 0 0 0 0 0 0 0 15 50.5 0 0 0 1 0 0 0 0 0 0 0 0 16 50.3 0 0 0 0 1 0 0 0 0 0 0 0 17 49.8 0 0 0 0 0 1 0 0 0 0 0 0 18 50.7 0 0 0 0 0 0 1 0 0 0 0 0 19 52.8 0 0 0 0 0 0 0 1 0 0 0 0 20 55.3 0 0 0 0 0 0 0 0 1 0 0 0 21 57.3 0 0 0 0 0 0 0 0 0 1 0 0 22 57.5 0 0 0 0 0 0 0 0 0 0 1 0 23 56.8 0 0 0 0 0 0 0 0 0 0 0 1 24 56.4 0 0 0 0 0 0 0 0 0 0 0 0 25 56.3 0 1 0 0 0 0 0 0 0 0 0 0 26 56.4 0 0 1 0 0 0 0 0 0 0 0 0 27 57.0 0 0 0 1 0 0 0 0 0 0 0 0 28 57.9 0 0 0 0 1 0 0 0 0 0 0 0 29 58.9 0 0 0 0 0 1 0 0 0 0 0 0 30 58.8 0 0 0 0 0 0 1 0 0 0 0 0 31 56.5 1 0 0 0 0 0 0 1 0 0 0 0 32 51.9 1 0 0 0 0 0 0 0 1 0 0 0 33 47.4 1 0 0 0 0 0 0 0 0 1 0 0 34 44.9 1 0 0 0 0 0 0 0 0 0 1 0 35 43.9 1 0 0 0 0 0 0 0 0 0 0 1 36 43.4 1 0 0 0 0 0 0 0 0 0 0 0 37 42.9 1 1 0 0 0 0 0 0 0 0 0 0 38 42.6 1 0 1 0 0 0 0 0 0 0 0 0 39 42.2 1 0 0 1 0 0 0 0 0 0 0 0 40 41.2 1 0 0 0 1 0 0 0 0 0 0 0 41 40.2 1 0 0 0 0 1 0 0 0 0 0 0 42 39.3 1 0 0 0 0 0 1 0 0 0 0 0 43 38.5 1 0 0 0 0 0 0 1 0 0 0 0 44 38.3 1 0 0 0 0 0 0 0 1 0 0 0 45 37.9 1 0 0 0 0 0 0 0 0 1 0 0 46 37.6 1 0 0 0 0 0 0 0 0 0 1 0 47 37.3 1 0 0 0 0 0 0 0 0 0 0 1 48 36.0 1 0 0 0 0 0 0 0 0 0 0 0 49 34.5 1 1 0 0 0 0 0 0 0 0 0 0 50 33.5 1 0 1 0 0 0 0 0 0 0 0 0 51 32.9 1 0 0 1 0 0 0 0 0 0 0 0 52 32.9 1 0 0 0 1 0 0 0 0 0 0 0 53 32.8 1 0 0 0 0 1 0 0 0 0 0 0 54 31.9 1 0 0 0 0 0 1 0 0 0 0 0 55 30.5 1 0 0 0 0 0 0 1 0 0 0 0 56 29.2 1 0 0 0 0 0 0 0 1 0 0 0 57 28.7 1 0 0 0 0 0 0 0 0 1 0 0 58 28.4 1 0 0 0 0 0 0 0 0 0 1 0 59 28.0 1 0 0 0 0 0 0 0 0 0 0 1 60 27.4 1 0 0 0 0 0 0 0 0 0 0 0 61 26.9 1 1 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 53.78898 -17.18163 -0.08150 1.06367 0.56367 0.08367 M5 M6 M7 M8 M9 M10 -0.39633 -0.65633 2.60000 2.12000 1.56000 1.06000 M11 0.56000 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.6259 -3.5727 -0.2673 2.8925 17.2927 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 53.78898 2.87546 18.706 < 2e-16 *** X -17.18163 1.58289 -10.855 1.61e-14 *** M1 -0.08150 3.67831 -0.022 0.982 M2 1.06367 3.85134 0.276 0.784 M3 0.56367 3.85134 0.146 0.884 M4 0.08367 3.85134 0.022 0.983 M5 -0.39633 3.85134 -0.103 0.918 M6 -0.65633 3.85134 -0.170 0.865 M7 2.60000 3.83831 0.677 0.501 M8 2.12000 3.83831 0.552 0.583 M9 1.56000 3.83831 0.406 0.686 M10 1.06000 3.83831 0.276 0.784 M11 0.56000 3.83831 0.146 0.885 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.069 on 48 degrees of freedom Multiple R-squared: 0.7154, Adjusted R-squared: 0.6443 F-statistic: 10.06 on 12 and 48 DF, p-value: 1.919e-09 > 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,] 9.079147e-02 1.815829e-01 0.9092085 [2,] 3.242297e-02 6.484593e-02 0.9675770 [3,] 1.012050e-02 2.024100e-02 0.9898795 [4,] 3.178133e-03 6.356267e-03 0.9968219 [5,] 1.068430e-03 2.136861e-03 0.9989316 [6,] 5.092090e-04 1.018418e-03 0.9994908 [7,] 2.226142e-04 4.452284e-04 0.9997774 [8,] 8.049479e-05 1.609896e-04 0.9999195 [9,] 2.578105e-05 5.156210e-05 0.9999742 [10,] 6.888331e-06 1.377666e-05 0.9999931 [11,] 2.821655e-06 5.643310e-06 0.9999972 [12,] 2.517789e-06 5.035579e-06 0.9999975 [13,] 6.186122e-06 1.237224e-05 0.9999938 [14,] 2.971767e-05 5.943534e-05 0.9999703 [15,] 6.048083e-05 1.209617e-04 0.9999395 [16,] 1.126712e-04 2.253424e-04 0.9998873 [17,] 2.888042e-04 5.776084e-04 0.9997112 [18,] 9.768205e-04 1.953641e-03 0.9990232 [19,] 2.498306e-03 4.996611e-03 0.9975017 [20,] 4.497090e-03 8.994181e-03 0.9955029 [21,] 7.941696e-03 1.588339e-02 0.9920583 [22,] 1.694496e-02 3.388993e-02 0.9830550 [23,] 1.753881e-02 3.507762e-02 0.9824612 [24,] 1.834696e-02 3.669392e-02 0.9816530 [25,] 1.765549e-02 3.531099e-02 0.9823445 [26,] 1.559258e-02 3.118516e-02 0.9844074 [27,] 1.440667e-02 2.881335e-02 0.9855933 [28,] 2.182926e-02 4.365852e-02 0.9781707 [29,] 3.348491e-02 6.696982e-02 0.9665151 [30,] 4.649602e-02 9.299203e-02 0.9535040 > postscript(file="/var/www/html/rcomp/tmp/1kvt51258648079.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/2wzae1258648079.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/3mpqx1258648079.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/41rdv1258648079.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/5z2kx1258648079.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 = 61 Frequency = 1 1 2 3 4 5 6 2.89251701 1.14734694 0.44734694 -1.17265306 -2.49265306 -2.53265306 7 8 9 10 11 12 -4.28897959 -2.60897959 -1.44897959 -0.54897959 -0.14897959 0.41102041 13 14 15 16 17 18 -0.20748299 -3.45265306 -3.85265306 -3.57265306 -3.59265306 -2.43265306 19 20 21 22 23 24 -3.58897959 -0.60897959 1.95102041 2.65102041 2.45102041 2.61102041 25 26 27 28 29 30 2.59251701 1.54734694 2.64734694 4.02734694 5.50734694 5.66734694 31 32 33 34 35 36 17.29265306 13.17265306 9.23265306 7.23265306 6.73265306 6.79265306 37 38 39 40 41 42 6.37414966 4.92897959 5.02897959 4.50897959 3.98897959 3.34897959 43 44 45 46 47 48 -0.70734694 -0.42734694 -0.26734694 -0.06734694 0.13265306 -0.60734694 49 50 51 52 53 54 -2.02585034 -4.17102041 -4.27102041 -3.79102041 -3.41102041 -4.05102041 55 56 57 58 59 60 -8.70734694 -9.52734694 -9.46734694 -9.26734694 -9.16734694 -9.20734694 61 -9.62585034 > postscript(file="/var/www/html/rcomp/tmp/63hzn1258648079.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 2.89251701 NA 1 1.14734694 2.89251701 2 0.44734694 1.14734694 3 -1.17265306 0.44734694 4 -2.49265306 -1.17265306 5 -2.53265306 -2.49265306 6 -4.28897959 -2.53265306 7 -2.60897959 -4.28897959 8 -1.44897959 -2.60897959 9 -0.54897959 -1.44897959 10 -0.14897959 -0.54897959 11 0.41102041 -0.14897959 12 -0.20748299 0.41102041 13 -3.45265306 -0.20748299 14 -3.85265306 -3.45265306 15 -3.57265306 -3.85265306 16 -3.59265306 -3.57265306 17 -2.43265306 -3.59265306 18 -3.58897959 -2.43265306 19 -0.60897959 -3.58897959 20 1.95102041 -0.60897959 21 2.65102041 1.95102041 22 2.45102041 2.65102041 23 2.61102041 2.45102041 24 2.59251701 2.61102041 25 1.54734694 2.59251701 26 2.64734694 1.54734694 27 4.02734694 2.64734694 28 5.50734694 4.02734694 29 5.66734694 5.50734694 30 17.29265306 5.66734694 31 13.17265306 17.29265306 32 9.23265306 13.17265306 33 7.23265306 9.23265306 34 6.73265306 7.23265306 35 6.79265306 6.73265306 36 6.37414966 6.79265306 37 4.92897959 6.37414966 38 5.02897959 4.92897959 39 4.50897959 5.02897959 40 3.98897959 4.50897959 41 3.34897959 3.98897959 42 -0.70734694 3.34897959 43 -0.42734694 -0.70734694 44 -0.26734694 -0.42734694 45 -0.06734694 -0.26734694 46 0.13265306 -0.06734694 47 -0.60734694 0.13265306 48 -2.02585034 -0.60734694 49 -4.17102041 -2.02585034 50 -4.27102041 -4.17102041 51 -3.79102041 -4.27102041 52 -3.41102041 -3.79102041 53 -4.05102041 -3.41102041 54 -8.70734694 -4.05102041 55 -9.52734694 -8.70734694 56 -9.46734694 -9.52734694 57 -9.26734694 -9.46734694 58 -9.16734694 -9.26734694 59 -9.20734694 -9.16734694 60 -9.62585034 -9.20734694 61 NA -9.62585034 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.14734694 2.89251701 [2,] 0.44734694 1.14734694 [3,] -1.17265306 0.44734694 [4,] -2.49265306 -1.17265306 [5,] -2.53265306 -2.49265306 [6,] -4.28897959 -2.53265306 [7,] -2.60897959 -4.28897959 [8,] -1.44897959 -2.60897959 [9,] -0.54897959 -1.44897959 [10,] -0.14897959 -0.54897959 [11,] 0.41102041 -0.14897959 [12,] -0.20748299 0.41102041 [13,] -3.45265306 -0.20748299 [14,] -3.85265306 -3.45265306 [15,] -3.57265306 -3.85265306 [16,] -3.59265306 -3.57265306 [17,] -2.43265306 -3.59265306 [18,] -3.58897959 -2.43265306 [19,] -0.60897959 -3.58897959 [20,] 1.95102041 -0.60897959 [21,] 2.65102041 1.95102041 [22,] 2.45102041 2.65102041 [23,] 2.61102041 2.45102041 [24,] 2.59251701 2.61102041 [25,] 1.54734694 2.59251701 [26,] 2.64734694 1.54734694 [27,] 4.02734694 2.64734694 [28,] 5.50734694 4.02734694 [29,] 5.66734694 5.50734694 [30,] 17.29265306 5.66734694 [31,] 13.17265306 17.29265306 [32,] 9.23265306 13.17265306 [33,] 7.23265306 9.23265306 [34,] 6.73265306 7.23265306 [35,] 6.79265306 6.73265306 [36,] 6.37414966 6.79265306 [37,] 4.92897959 6.37414966 [38,] 5.02897959 4.92897959 [39,] 4.50897959 5.02897959 [40,] 3.98897959 4.50897959 [41,] 3.34897959 3.98897959 [42,] -0.70734694 3.34897959 [43,] -0.42734694 -0.70734694 [44,] -0.26734694 -0.42734694 [45,] -0.06734694 -0.26734694 [46,] 0.13265306 -0.06734694 [47,] -0.60734694 0.13265306 [48,] -2.02585034 -0.60734694 [49,] -4.17102041 -2.02585034 [50,] -4.27102041 -4.17102041 [51,] -3.79102041 -4.27102041 [52,] -3.41102041 -3.79102041 [53,] -4.05102041 -3.41102041 [54,] -8.70734694 -4.05102041 [55,] -9.52734694 -8.70734694 [56,] -9.46734694 -9.52734694 [57,] -9.26734694 -9.46734694 [58,] -9.16734694 -9.26734694 [59,] -9.20734694 -9.16734694 [60,] -9.62585034 -9.20734694 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.14734694 2.89251701 2 0.44734694 1.14734694 3 -1.17265306 0.44734694 4 -2.49265306 -1.17265306 5 -2.53265306 -2.49265306 6 -4.28897959 -2.53265306 7 -2.60897959 -4.28897959 8 -1.44897959 -2.60897959 9 -0.54897959 -1.44897959 10 -0.14897959 -0.54897959 11 0.41102041 -0.14897959 12 -0.20748299 0.41102041 13 -3.45265306 -0.20748299 14 -3.85265306 -3.45265306 15 -3.57265306 -3.85265306 16 -3.59265306 -3.57265306 17 -2.43265306 -3.59265306 18 -3.58897959 -2.43265306 19 -0.60897959 -3.58897959 20 1.95102041 -0.60897959 21 2.65102041 1.95102041 22 2.45102041 2.65102041 23 2.61102041 2.45102041 24 2.59251701 2.61102041 25 1.54734694 2.59251701 26 2.64734694 1.54734694 27 4.02734694 2.64734694 28 5.50734694 4.02734694 29 5.66734694 5.50734694 30 17.29265306 5.66734694 31 13.17265306 17.29265306 32 9.23265306 13.17265306 33 7.23265306 9.23265306 34 6.73265306 7.23265306 35 6.79265306 6.73265306 36 6.37414966 6.79265306 37 4.92897959 6.37414966 38 5.02897959 4.92897959 39 4.50897959 5.02897959 40 3.98897959 4.50897959 41 3.34897959 3.98897959 42 -0.70734694 3.34897959 43 -0.42734694 -0.70734694 44 -0.26734694 -0.42734694 45 -0.06734694 -0.26734694 46 0.13265306 -0.06734694 47 -0.60734694 0.13265306 48 -2.02585034 -0.60734694 49 -4.17102041 -2.02585034 50 -4.27102041 -4.17102041 51 -3.79102041 -4.27102041 52 -3.41102041 -3.79102041 53 -4.05102041 -3.41102041 54 -8.70734694 -4.05102041 55 -9.52734694 -8.70734694 56 -9.46734694 -9.52734694 57 -9.26734694 -9.46734694 58 -9.16734694 -9.26734694 59 -9.20734694 -9.16734694 60 -9.62585034 -9.20734694 > 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/7b8cc1258648079.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/8uvg41258648079.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/9lqu21258648079.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/104woa1258648079.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/11afvz1258648079.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/1294rr1258648079.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/13beq71258648079.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/148gdv1258648079.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/155cq21258648079.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/16w0by1258648079.tab") + } > > system("convert tmp/1kvt51258648079.ps tmp/1kvt51258648079.png") > system("convert tmp/2wzae1258648079.ps tmp/2wzae1258648079.png") > system("convert tmp/3mpqx1258648079.ps tmp/3mpqx1258648079.png") > system("convert tmp/41rdv1258648079.ps tmp/41rdv1258648079.png") > system("convert tmp/5z2kx1258648079.ps tmp/5z2kx1258648079.png") > system("convert tmp/63hzn1258648079.ps tmp/63hzn1258648079.png") > system("convert tmp/7b8cc1258648079.ps tmp/7b8cc1258648079.png") > system("convert tmp/8uvg41258648079.ps tmp/8uvg41258648079.png") > system("convert tmp/9lqu21258648079.ps tmp/9lqu21258648079.png") > system("convert tmp/104woa1258648079.ps tmp/104woa1258648079.png") > > > proc.time() user system elapsed 2.390 1.555 2.819