R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(3 + ,4 + ,2 + ,4 + ,4 + ,3 + ,3 + ,2 + ,4 + ,2 + ,4 + ,4 + ,4 + ,3 + ,2 + ,3 + ,3 + ,3 + ,2 + ,2 + ,3 + ,3 + ,3 + ,3 + ,2 + ,3 + ,4 + ,1 + ,4 + ,2 + ,3 + ,4 + ,4 + ,5 + ,5 + ,2 + ,3 + ,2 + ,4 + ,4 + ,3 + ,4 + ,2 + ,4 + ,4 + ,3 + ,3 + ,2 + ,2 + ,2 + ,3 + ,4 + ,4 + ,2 + ,4 + ,3 + ,3 + ,3 + ,4 + ,2 + ,3 + ,4 + ,3 + ,4 + ,4 + ,2 + ,3 + ,2 + ,5 + ,4 + ,3 + ,3 + ,3 + ,5 + ,1 + ,3 + ,4 + ,2 + ,4 + ,4 + ,2 + ,3 + ,3 + ,3 + ,3 + ,3 + ,4 + ,3 + ,4 + ,4 + ,2 + ,3 + ,2 + ,4 + ,1 + ,1 + ,3 + ,2 + ,2 + ,2 + ,2 + ,4 + ,1 + ,4 + ,1 + ,3 + ,4 + ,4 + ,4 + ,4 + ,3 + ,3 + ,3 + ,4 + ,4 + ,3 + ,3 + ,2 + ,4 + ,1 + ,3 + ,4 + ,3 + ,4 + ,4 + ,3 + ,4 + ,3 + ,4 + ,5 + ,2 + ,4 + ,4 + ,4 + ,4 + ,3 + ,4 + ,3 + ,3 + ,4 + ,3 + ,4 + ,3 + ,3 + ,4 + ,4 + ,4 + ,2 + ,4 + ,2 + ,3 + ,2 + ,2 + ,3 + ,2 + ,3 + ,4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,3 + ,3 + ,4 + ,4 + ,3 + ,3 + ,1 + ,3 + ,4) + ,dim=c(5 + ,156) + ,dimnames=list(c('X1' + ,'X2' + ,'X3' + ,'X4' + ,'X5 ') + ,1:156)) > y <- array(NA,dim=c(5,156),dimnames=list(c('X1','X2','X3','X4','X5 '),1:156)) > 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 = '5' > #'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 X5\r X1 X2 X3 X4 1 4 3 4 2 4 2 2 3 3 2 4 3 2 4 4 4 3 4 2 3 3 3 2 5 2 3 3 3 3 6 2 3 4 1 4 7 5 3 4 4 5 8 4 2 3 2 4 9 4 3 4 2 4 10 2 3 3 2 2 11 4 3 4 4 2 12 2 3 3 3 4 13 4 3 4 3 4 14 4 2 3 2 5 15 1 3 3 3 5 16 4 3 4 2 4 17 3 2 3 3 3 18 4 3 4 3 4 19 1 2 3 2 4 20 2 1 3 2 2 21 1 2 4 1 4 22 4 3 4 4 4 23 4 3 3 3 4 24 1 3 3 2 4 25 4 3 4 3 4 26 5 3 4 3 4 27 4 2 4 4 4 28 4 3 4 3 3 29 4 3 4 3 3 30 2 4 4 2 4 31 2 3 2 2 3 32 4 3 4 4 4 33 4 3 4 4 4 34 2 3 4 2 4 35 3 2 3 2 4 36 4 3 4 3 4 37 3 3 4 3 4 38 2 3 3 3 3 39 4 3 4 3 4 40 4 4 4 4 4 41 3 3 3 3 4 42 1 3 4 1 3 43 2 1 3 2 5 44 4 2 3 2 4 45 2 3 3 3 4 46 3 4 3 4 4 47 4 4 4 3 4 48 1 2 2 2 5 49 3 1 3 2 4 50 4 3 4 3 4 51 1 3 3 3 4 52 4 1 3 4 3 53 3 3 4 3 4 54 1 2 3 2 4 55 1 3 4 2 5 56 4 3 4 2 4 57 4 2 4 2 3 58 4 4 5 3 3 59 2 1 4 1 4 60 4 3 4 5 4 61 2 2 3 2 4 62 4 4 3 3 4 63 5 3 3 4 3 64 3 4 4 4 3 65 2 3 3 2 3 66 4 3 4 3 4 67 4 3 3 3 4 68 2 3 3 3 4 69 3 3 3 3 4 70 1 1 1 1 5 71 4 3 4 3 3 72 4 3 4 3 4 73 4 3 4 3 3 74 4 2 4 4 2 75 3 3 4 3 4 76 4 3 4 4 4 77 3 3 3 3 5 78 3 2 3 3 2 79 2 3 3 2 4 80 1 2 3 1 4 81 2 2 4 2 4 82 4 3 3 3 NA 83 3 3 4 3 4 84 5 2 4 2 3 85 1 2 2 2 4 86 3 3 3 3 5 87 2 2 3 2 2 88 3 3 4 3 2 89 4 4 4 4 4 90 3 2 4 2 4 91 3 3 4 3 3 92 4 2 4 3 4 93 4 4 4 4 4 94 4 3 4 3 4 95 2 3 3 2 4 96 2 3 3 2 4 97 1 3 2 3 2 98 1 2 2 2 4 99 4 3 4 3 4 100 2 4 3 3 4 101 4 4 4 4 4 102 3 4 4 4 4 103 5 3 5 3 5 104 1 3 3 1 4 105 1 1 1 1 4 106 2 4 4 4 4 107 4 1 3 2 3 108 4 3 4 4 4 109 3 2 4 2 4 110 4 2 4 2 4 111 4 3 4 3 4 112 5 3 4 4 3 113 1 2 3 3 4 114 4 3 4 3 4 115 4 3 4 4 4 116 4 4 3 2 5 117 2 4 3 3 4 118 2 3 4 3 4 119 4 3 4 3 4 120 3 3 3 2 4 121 3 3 3 2 4 122 4 3 3 2 4 123 2 1 4 2 4 124 4 2 4 4 4 125 4 4 3 3 4 126 1 3 3 2 4 127 4 4 4 4 4 128 4 3 4 3 4 129 3 2 4 2 3 130 1 1 1 1 1 131 4 4 4 4 4 132 3 3 4 3 4 133 2 3 4 2 4 134 3 3 4 2 4 135 4 4 4 3 4 136 2 3 4 2 4 137 4 3 4 3 4 138 4 1 4 2 4 139 3 4 4 3 4 140 4 2 4 3 3 141 4 2 4 2 4 142 4 3 4 3 4 143 4 3 4 2 4 144 3 2 NA 2 4 145 3 3 4 2 4 146 1 3 4 3 4 147 2 2 4 2 4 148 4 NA 4 3 5 149 4 3 4 3 4 150 3 4 4 4 4 151 3 4 4 4 4 152 4 4 5 4 4 153 3 2 3 2 3 154 4 3 4 3 3 155 4 3 3 3 4 156 4 3 3 1 3 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X1 X2 X3 X4 -0.392463 -0.187300 0.722138 0.506052 0.007697 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.48313 -0.63724 0.02292 0.51687 2.25881 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.392463 0.549420 -0.714 0.476 X1 -0.187300 0.113328 -1.653 0.101 X2 0.722138 0.120629 5.986 1.55e-08 *** X3 0.506052 0.104599 4.838 3.26e-06 *** X4 0.007697 0.108946 0.071 0.944 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.9138 on 148 degrees of freedom (3 observations deleted due to missingness) Multiple R-squared: 0.387, Adjusted R-squared: 0.3704 F-statistic: 23.35 on 4 and 148 DF, p-value: 5.575e-15 > 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 + } Error in if (gqarr[mypoint - kp3 + 1, 2] < 0.01) numsignificant1 <- numsignificant1 + : missing value where TRUE/FALSE needed Execution halted