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(7.3,-0.8,7.6,-0.2,7.5,0.2,7.6,1,7.9,0,7.9,-0.2,8.1,1,8.2,0.4,8,1,7.5,1.7,6.8,3.1,6.5,3.3,6.6,3.1,7.6,3.5,8,6,8.1,5.7,7.7,4.7,7.5,4.2,7.6,3.6,7.8,4.4,7.8,2.5,7.8,-0.6,7.5,-1.9,7.5,-1.9,7.1,0.7,7.5,-0.9,7.5,-1.7,7.6,-3.1,7.7,-2.1,7.7,0.2,7.9,1.2,8.1,3.8,8.2,4,8.2,6.6,8.2,5.3,7.9,7.6,7.3,4.7,6.9,6.6,6.6,4.4,6.7,4.6,6.9,6,7,4.8,7.1,4,7.2,2.7,7.1,3,6.9,4.1,7,4,6.8,2.7,6.4,2.6,6.7,3.1,6.6,4.4,6.4,3,6.3,2,6.2,1.3,6.5,1.5,6.8,1.3,6.8,3.2,6.4,1.8,6.1,3.3,5.8,1,6.1,2.4,7.2,0.4,7.3,-0.1,6.9,1.3,6.1,-1.1,5.8,-4.4,6.2,-7.5,7.1,-12.2,7.7,-14.5,7.9,-16,7.7,-16.7,7.4,-16.3,7.5,-16.9),dim=c(2,73),dimnames=list(c('WGM','EcGr'),1:73)) > y <- array(NA,dim=c(2,73),dimnames=list(c('WGM','EcGr'),1:73)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x WGM EcGr 1 7.3 -0.8 2 7.6 -0.2 3 7.5 0.2 4 7.6 1.0 5 7.9 0.0 6 7.9 -0.2 7 8.1 1.0 8 8.2 0.4 9 8.0 1.0 10 7.5 1.7 11 6.8 3.1 12 6.5 3.3 13 6.6 3.1 14 7.6 3.5 15 8.0 6.0 16 8.1 5.7 17 7.7 4.7 18 7.5 4.2 19 7.6 3.6 20 7.8 4.4 21 7.8 2.5 22 7.8 -0.6 23 7.5 -1.9 24 7.5 -1.9 25 7.1 0.7 26 7.5 -0.9 27 7.5 -1.7 28 7.6 -3.1 29 7.7 -2.1 30 7.7 0.2 31 7.9 1.2 32 8.1 3.8 33 8.2 4.0 34 8.2 6.6 35 8.2 5.3 36 7.9 7.6 37 7.3 4.7 38 6.9 6.6 39 6.6 4.4 40 6.7 4.6 41 6.9 6.0 42 7.0 4.8 43 7.1 4.0 44 7.2 2.7 45 7.1 3.0 46 6.9 4.1 47 7.0 4.0 48 6.8 2.7 49 6.4 2.6 50 6.7 3.1 51 6.6 4.4 52 6.4 3.0 53 6.3 2.0 54 6.2 1.3 55 6.5 1.5 56 6.8 1.3 57 6.8 3.2 58 6.4 1.8 59 6.1 3.3 60 5.8 1.0 61 6.1 2.4 62 7.2 0.4 63 7.3 -0.1 64 6.9 1.3 65 6.1 -1.1 66 5.8 -4.4 67 6.2 -7.5 68 7.1 -12.2 69 7.7 -14.5 70 7.9 -16.0 71 7.7 -16.7 72 7.4 -16.3 73 7.5 -16.9 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) EcGr 7.229693 -0.008373 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.46654 -0.41881 0.06947 0.47198 1.02557 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.229693 0.076331 94.715 <2e-16 *** EcGr -0.008373 0.013810 -0.606 0.546 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6483 on 71 degrees of freedom Multiple R-squared: 0.005151, Adjusted R-squared: -0.008861 F-statistic: 0.3676 on 1 and 71 DF, p-value: 0.5462 > 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.052229536 0.104459072 0.947770464 [2,] 0.036552591 0.073105181 0.963447409 [3,] 0.023014340 0.046028679 0.976985660 [4,] 0.024822885 0.049645769 0.975177115 [5,] 0.010514937 0.021029874 0.989485063 [6,] 0.015054054 0.030108107 0.984945946 [7,] 0.045899858 0.091799716 0.954100142 [8,] 0.054636014 0.109272028 0.945363986 [9,] 0.040620200 0.081240399 0.959379800 [10,] 0.060917909 0.121835818 0.939082091 [11,] 0.204496405 0.408992811 0.795503595 [12,] 0.263141574 0.526283149 0.736858426 [13,] 0.213463183 0.426926366 0.786536817 [14,] 0.160889141 0.321778283 0.839110859 [15,] 0.120805671 0.241611342 0.879194329 [16,] 0.100295131 0.200590261 0.899704869 [17,] 0.081219001 0.162438002 0.918780999 [18,] 0.063380684 0.126761368 0.936619316 [19,] 0.045625484 0.091250968 0.954374516 [20,] 0.032011474 0.064022948 0.967988526 [21,] 0.027864257 0.055728514 0.972135743 [22,] 0.018985640 0.037971280 0.981014360 [23,] 0.012681976 0.025363952 0.987318024 [24,] 0.008514112 0.017028225 0.991485888 [25,] 0.006106229 0.012212459 0.993893771 [26,] 0.004496106 0.008992213 0.995503894 [27,] 0.004512070 0.009024141 0.995487930 [28,] 0.007729018 0.015458037 0.992270982 [29,] 0.017980106 0.035960212 0.982019894 [30,] 0.045591337 0.091182673 0.954408663 [31,] 0.124358067 0.248716133 0.875641933 [32,] 0.238871234 0.477742467 0.761128766 [33,] 0.277273652 0.554547304 0.722726348 [34,] 0.353389000 0.706778000 0.646611000 [35,] 0.455175406 0.910350812 0.544824594 [36,] 0.503640885 0.992718230 0.496359115 [37,] 0.518894793 0.962210414 0.481105207 [38,] 0.526339685 0.947320630 0.473660315 [39,] 0.540063953 0.919872095 0.459936047 [40,] 0.565300464 0.869399072 0.434699536 [41,] 0.588366745 0.823266509 0.411633255 [42,] 0.605810704 0.788378593 0.394189296 [43,] 0.641803230 0.716393539 0.358196770 [44,] 0.650936637 0.698126726 0.349063363 [45,] 0.681201336 0.637597328 0.318798664 [46,] 0.678713707 0.642572586 0.321286293 [47,] 0.678357267 0.643285466 0.321642733 [48,] 0.677294340 0.645411319 0.322705660 [49,] 0.683154702 0.633690596 0.316845298 [50,] 0.701447667 0.597104666 0.298552333 [51,] 0.666980910 0.666038181 0.333019090 [52,] 0.632495860 0.735008279 0.367504140 [53,] 0.625974650 0.748050701 0.374025350 [54,] 0.582796507 0.834406986 0.417203493 [55,] 0.556276149 0.887447702 0.443723851 [56,] 0.633382729 0.733234543 0.366617271 [57,] 0.605943154 0.788113692 0.394056846 [58,] 0.618685300 0.762629399 0.381314700 [59,] 0.769750323 0.460499354 0.230249677 [60,] 0.976287015 0.047425970 0.023712985 [61,] 0.991361655 0.017276689 0.008638345 [62,] 0.978680123 0.042639753 0.021319877 [63,] 0.963836771 0.072326459 0.036163229 [64,] 0.957087288 0.085825424 0.042912712 > postscript(file="/var/www/html/rcomp/tmp/1r2391258730055.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/2vlc71258730055.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/3pkqf1258730055.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/4vzv61258730055.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/5z5a01258730055.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 = 73 Frequency = 1 1 2 3 4 5 6 0.063608392 0.368632365 0.271981680 0.378680311 0.670307022 0.668632365 7 8 9 10 11 12 0.878680311 0.973656338 0.778680311 0.284541613 -0.403735783 -0.702061126 13 14 15 16 17 18 -0.603735783 0.399613532 0.820546753 0.918034766 0.509661478 0.305474834 19 20 21 22 23 24 0.400450861 0.607149492 0.591240244 0.565283049 0.254397774 0.254397774 25 26 27 28 29 30 -0.123831676 0.262771063 0.256072432 0.344349828 0.452723117 0.471981680 31 32 33 34 35 36 0.680354969 0.902125518 1.003800176 1.025570726 1.014685451 0.733944014 37 38 39 40 41 42 0.109661478 -0.274429274 -0.592850508 -0.491175851 -0.279453247 -0.189501193 43 44 45 46 47 48 -0.096199824 -0.007085099 -0.104573112 -0.295362495 -0.196199824 -0.407085099 49 50 51 52 53 54 -0.807922428 -0.503735783 -0.592850508 -0.804573112 -0.912946401 -1.018807703 55 56 57 58 59 60 -0.717133045 -0.418807703 -0.402898455 -0.814621058 -1.102061126 -1.421319689 61 62 63 64 65 66 -1.109597085 -0.026343662 0.069469694 -0.318807703 -1.138903595 -1.466535447 67 68 69 70 71 72 -1.092492641 -0.231847096 0.348894340 0.536334408 0.330473106 0.033822421 73 0.128798448 > postscript(file="/var/www/html/rcomp/tmp/6d86v1258730055.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 = 73 Frequency = 1 lag(myerror, k = 1) myerror 0 0.063608392 NA 1 0.368632365 0.063608392 2 0.271981680 0.368632365 3 0.378680311 0.271981680 4 0.670307022 0.378680311 5 0.668632365 0.670307022 6 0.878680311 0.668632365 7 0.973656338 0.878680311 8 0.778680311 0.973656338 9 0.284541613 0.778680311 10 -0.403735783 0.284541613 11 -0.702061126 -0.403735783 12 -0.603735783 -0.702061126 13 0.399613532 -0.603735783 14 0.820546753 0.399613532 15 0.918034766 0.820546753 16 0.509661478 0.918034766 17 0.305474834 0.509661478 18 0.400450861 0.305474834 19 0.607149492 0.400450861 20 0.591240244 0.607149492 21 0.565283049 0.591240244 22 0.254397774 0.565283049 23 0.254397774 0.254397774 24 -0.123831676 0.254397774 25 0.262771063 -0.123831676 26 0.256072432 0.262771063 27 0.344349828 0.256072432 28 0.452723117 0.344349828 29 0.471981680 0.452723117 30 0.680354969 0.471981680 31 0.902125518 0.680354969 32 1.003800176 0.902125518 33 1.025570726 1.003800176 34 1.014685451 1.025570726 35 0.733944014 1.014685451 36 0.109661478 0.733944014 37 -0.274429274 0.109661478 38 -0.592850508 -0.274429274 39 -0.491175851 -0.592850508 40 -0.279453247 -0.491175851 41 -0.189501193 -0.279453247 42 -0.096199824 -0.189501193 43 -0.007085099 -0.096199824 44 -0.104573112 -0.007085099 45 -0.295362495 -0.104573112 46 -0.196199824 -0.295362495 47 -0.407085099 -0.196199824 48 -0.807922428 -0.407085099 49 -0.503735783 -0.807922428 50 -0.592850508 -0.503735783 51 -0.804573112 -0.592850508 52 -0.912946401 -0.804573112 53 -1.018807703 -0.912946401 54 -0.717133045 -1.018807703 55 -0.418807703 -0.717133045 56 -0.402898455 -0.418807703 57 -0.814621058 -0.402898455 58 -1.102061126 -0.814621058 59 -1.421319689 -1.102061126 60 -1.109597085 -1.421319689 61 -0.026343662 -1.109597085 62 0.069469694 -0.026343662 63 -0.318807703 0.069469694 64 -1.138903595 -0.318807703 65 -1.466535447 -1.138903595 66 -1.092492641 -1.466535447 67 -0.231847096 -1.092492641 68 0.348894340 -0.231847096 69 0.536334408 0.348894340 70 0.330473106 0.536334408 71 0.033822421 0.330473106 72 0.128798448 0.033822421 73 NA 0.128798448 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.368632365 0.063608392 [2,] 0.271981680 0.368632365 [3,] 0.378680311 0.271981680 [4,] 0.670307022 0.378680311 [5,] 0.668632365 0.670307022 [6,] 0.878680311 0.668632365 [7,] 0.973656338 0.878680311 [8,] 0.778680311 0.973656338 [9,] 0.284541613 0.778680311 [10,] -0.403735783 0.284541613 [11,] -0.702061126 -0.403735783 [12,] -0.603735783 -0.702061126 [13,] 0.399613532 -0.603735783 [14,] 0.820546753 0.399613532 [15,] 0.918034766 0.820546753 [16,] 0.509661478 0.918034766 [17,] 0.305474834 0.509661478 [18,] 0.400450861 0.305474834 [19,] 0.607149492 0.400450861 [20,] 0.591240244 0.607149492 [21,] 0.565283049 0.591240244 [22,] 0.254397774 0.565283049 [23,] 0.254397774 0.254397774 [24,] -0.123831676 0.254397774 [25,] 0.262771063 -0.123831676 [26,] 0.256072432 0.262771063 [27,] 0.344349828 0.256072432 [28,] 0.452723117 0.344349828 [29,] 0.471981680 0.452723117 [30,] 0.680354969 0.471981680 [31,] 0.902125518 0.680354969 [32,] 1.003800176 0.902125518 [33,] 1.025570726 1.003800176 [34,] 1.014685451 1.025570726 [35,] 0.733944014 1.014685451 [36,] 0.109661478 0.733944014 [37,] -0.274429274 0.109661478 [38,] -0.592850508 -0.274429274 [39,] -0.491175851 -0.592850508 [40,] -0.279453247 -0.491175851 [41,] -0.189501193 -0.279453247 [42,] -0.096199824 -0.189501193 [43,] -0.007085099 -0.096199824 [44,] -0.104573112 -0.007085099 [45,] -0.295362495 -0.104573112 [46,] -0.196199824 -0.295362495 [47,] -0.407085099 -0.196199824 [48,] -0.807922428 -0.407085099 [49,] -0.503735783 -0.807922428 [50,] -0.592850508 -0.503735783 [51,] -0.804573112 -0.592850508 [52,] -0.912946401 -0.804573112 [53,] -1.018807703 -0.912946401 [54,] -0.717133045 -1.018807703 [55,] -0.418807703 -0.717133045 [56,] -0.402898455 -0.418807703 [57,] -0.814621058 -0.402898455 [58,] -1.102061126 -0.814621058 [59,] -1.421319689 -1.102061126 [60,] -1.109597085 -1.421319689 [61,] -0.026343662 -1.109597085 [62,] 0.069469694 -0.026343662 [63,] -0.318807703 0.069469694 [64,] -1.138903595 -0.318807703 [65,] -1.466535447 -1.138903595 [66,] -1.092492641 -1.466535447 [67,] -0.231847096 -1.092492641 [68,] 0.348894340 -0.231847096 [69,] 0.536334408 0.348894340 [70,] 0.330473106 0.536334408 [71,] 0.033822421 0.330473106 [72,] 0.128798448 0.033822421 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.368632365 0.063608392 2 0.271981680 0.368632365 3 0.378680311 0.271981680 4 0.670307022 0.378680311 5 0.668632365 0.670307022 6 0.878680311 0.668632365 7 0.973656338 0.878680311 8 0.778680311 0.973656338 9 0.284541613 0.778680311 10 -0.403735783 0.284541613 11 -0.702061126 -0.403735783 12 -0.603735783 -0.702061126 13 0.399613532 -0.603735783 14 0.820546753 0.399613532 15 0.918034766 0.820546753 16 0.509661478 0.918034766 17 0.305474834 0.509661478 18 0.400450861 0.305474834 19 0.607149492 0.400450861 20 0.591240244 0.607149492 21 0.565283049 0.591240244 22 0.254397774 0.565283049 23 0.254397774 0.254397774 24 -0.123831676 0.254397774 25 0.262771063 -0.123831676 26 0.256072432 0.262771063 27 0.344349828 0.256072432 28 0.452723117 0.344349828 29 0.471981680 0.452723117 30 0.680354969 0.471981680 31 0.902125518 0.680354969 32 1.003800176 0.902125518 33 1.025570726 1.003800176 34 1.014685451 1.025570726 35 0.733944014 1.014685451 36 0.109661478 0.733944014 37 -0.274429274 0.109661478 38 -0.592850508 -0.274429274 39 -0.491175851 -0.592850508 40 -0.279453247 -0.491175851 41 -0.189501193 -0.279453247 42 -0.096199824 -0.189501193 43 -0.007085099 -0.096199824 44 -0.104573112 -0.007085099 45 -0.295362495 -0.104573112 46 -0.196199824 -0.295362495 47 -0.407085099 -0.196199824 48 -0.807922428 -0.407085099 49 -0.503735783 -0.807922428 50 -0.592850508 -0.503735783 51 -0.804573112 -0.592850508 52 -0.912946401 -0.804573112 53 -1.018807703 -0.912946401 54 -0.717133045 -1.018807703 55 -0.418807703 -0.717133045 56 -0.402898455 -0.418807703 57 -0.814621058 -0.402898455 58 -1.102061126 -0.814621058 59 -1.421319689 -1.102061126 60 -1.109597085 -1.421319689 61 -0.026343662 -1.109597085 62 0.069469694 -0.026343662 63 -0.318807703 0.069469694 64 -1.138903595 -0.318807703 65 -1.466535447 -1.138903595 66 -1.092492641 -1.466535447 67 -0.231847096 -1.092492641 68 0.348894340 -0.231847096 69 0.536334408 0.348894340 70 0.330473106 0.536334408 71 0.033822421 0.330473106 72 0.128798448 0.033822421 > 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/7e8rs1258730056.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/8apph1258730056.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/951yy1258730056.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/10o0os1258730056.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/118pr11258730056.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/126rqa1258730056.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/13cigz1258730056.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/14bwza1258730056.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/15uzs91258730056.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/1632l41258730056.tab") + } > > system("convert tmp/1r2391258730055.ps tmp/1r2391258730055.png") > system("convert tmp/2vlc71258730055.ps tmp/2vlc71258730055.png") > system("convert tmp/3pkqf1258730055.ps tmp/3pkqf1258730055.png") > system("convert tmp/4vzv61258730055.ps tmp/4vzv61258730055.png") > system("convert tmp/5z5a01258730055.ps tmp/5z5a01258730055.png") > system("convert tmp/6d86v1258730055.ps tmp/6d86v1258730055.png") > system("convert tmp/7e8rs1258730056.ps tmp/7e8rs1258730056.png") > system("convert tmp/8apph1258730056.ps tmp/8apph1258730056.png") > system("convert tmp/951yy1258730056.ps tmp/951yy1258730056.png") > system("convert tmp/10o0os1258730056.ps tmp/10o0os1258730056.png") > > > proc.time() user system elapsed 2.581 1.547 3.008