R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(9 + ,24 + ,14 + ,11 + ,12 + ,24 + ,26 + ,9 + ,25 + ,11 + ,7 + ,8 + ,25 + ,23 + ,9 + ,17 + ,6 + ,17 + ,8 + ,30 + ,25 + ,9 + ,18 + ,12 + ,10 + ,8 + ,19 + ,23 + ,9 + ,18 + ,8 + ,12 + ,9 + ,22 + ,19 + ,9 + ,16 + ,10 + ,12 + ,7 + ,22 + ,29 + ,10 + ,20 + ,10 + ,11 + ,4 + ,25 + ,25 + ,10 + ,16 + ,11 + ,11 + ,11 + ,23 + ,21 + ,10 + ,18 + ,16 + ,12 + ,7 + ,17 + ,22 + ,10 + ,17 + ,11 + ,13 + ,7 + ,21 + ,25 + ,10 + ,23 + ,13 + ,14 + ,12 + ,19 + ,24 + ,10 + ,30 + ,12 + ,16 + ,10 + ,19 + ,18 + ,10 + ,23 + ,8 + ,11 + ,10 + ,15 + ,22 + ,10 + ,18 + ,12 + ,10 + ,8 + ,16 + ,15 + ,10 + ,15 + ,11 + ,11 + ,8 + ,23 + ,22 + ,10 + ,12 + ,4 + ,15 + ,4 + ,27 + ,28 + ,10 + ,21 + ,9 + ,9 + ,9 + ,22 + ,20 + ,10 + ,15 + ,8 + ,11 + ,8 + ,14 + ,12 + ,10 + ,20 + ,8 + ,17 + ,7 + ,22 + ,24 + ,10 + ,31 + ,14 + ,17 + ,11 + ,23 + ,20 + ,10 + ,27 + ,15 + ,11 + ,9 + ,23 + ,21 + ,10 + ,34 + ,16 + ,18 + ,11 + ,21 + ,20 + ,10 + ,21 + ,9 + ,14 + ,13 + ,19 + ,21 + ,10 + ,31 + ,14 + ,10 + ,8 + ,18 + ,23 + ,10 + ,19 + ,11 + ,11 + ,8 + ,20 + ,28 + ,10 + ,16 + ,8 + ,15 + ,9 + ,23 + ,24 + ,10 + ,20 + ,9 + ,15 + ,6 + ,25 + ,24 + ,10 + ,21 + ,9 + ,13 + ,9 + ,19 + ,24 + ,10 + ,22 + ,9 + ,16 + ,9 + ,24 + ,23 + ,10 + ,17 + ,9 + ,13 + ,6 + ,22 + ,23 + ,10 + ,24 + ,10 + ,9 + ,6 + ,25 + ,29 + ,10 + ,25 + ,16 + ,18 + ,16 + ,26 + ,24 + ,10 + ,26 + ,11 + ,18 + ,5 + ,29 + ,18 + ,10 + ,25 + ,8 + ,12 + ,7 + ,32 + ,25 + ,10 + ,17 + ,9 + ,17 + ,9 + ,25 + ,21 + ,10 + ,32 + ,16 + ,9 + ,6 + ,29 + ,26 + ,10 + ,33 + ,11 + ,9 + ,6 + ,28 + ,22 + ,10 + ,13 + ,16 + ,12 + ,5 + ,17 + ,22 + ,10 + ,32 + ,12 + ,18 + ,12 + ,28 + ,22 + ,10 + ,25 + ,12 + ,12 + ,7 + ,29 + ,23 + ,10 + ,29 + ,14 + ,18 + ,10 + ,26 + ,30 + ,10 + ,22 + ,9 + ,14 + ,9 + ,25 + ,23 + ,10 + ,18 + ,10 + ,15 + ,8 + ,14 + ,17 + ,10 + ,17 + ,9 + ,16 + ,5 + ,25 + ,23 + ,10 + ,20 + ,10 + ,10 + ,8 + ,26 + ,23 + ,10 + ,15 + ,12 + ,11 + ,8 + ,20 + ,25 + ,10 + ,20 + ,14 + ,14 + ,10 + ,18 + ,24 + ,10 + ,33 + ,14 + ,9 + ,6 + ,32 + ,24 + ,10 + ,29 + ,10 + ,12 + ,8 + ,25 + ,23 + ,10 + ,23 + ,14 + ,17 + ,7 + ,25 + ,21 + ,10 + ,26 + ,16 + ,5 + ,4 + ,23 + ,24 + ,10 + ,18 + ,9 + ,12 + ,8 + ,21 + ,24 + ,10 + ,20 + ,10 + ,12 + ,8 + ,20 + ,28 + ,10 + ,11 + ,6 + ,6 + ,4 + ,15 + ,16 + ,10 + ,28 + ,8 + ,24 + ,20 + ,30 + ,20 + ,10 + ,26 + ,13 + ,12 + ,8 + ,24 + ,29 + ,10 + ,22 + ,10 + ,12 + ,8 + ,26 + ,27 + ,10 + ,17 + ,8 + ,14 + ,6 + ,24 + ,22 + ,10 + ,12 + ,7 + ,7 + ,4 + ,22 + ,28 + ,10 + ,14 + ,15 + ,13 + ,8 + ,14 + ,16 + ,10 + ,17 + ,9 + ,12 + ,9 + ,24 + ,25 + ,10 + ,21 + ,10 + ,13 + ,6 + ,24 + ,24 + ,10 + ,19 + ,12 + ,14 + ,7 + ,24 + ,28 + ,10 + ,18 + ,13 + ,8 + ,9 + ,24 + ,24 + ,10 + ,10 + ,10 + ,11 + ,5 + ,19 + ,23 + ,10 + ,29 + ,11 + ,9 + ,5 + ,31 + ,30 + ,10 + ,31 + ,8 + ,11 + ,8 + ,22 + ,24 + ,10 + ,19 + ,9 + ,13 + ,8 + ,27 + ,21 + ,10 + ,9 + ,13 + ,10 + ,6 + ,19 + ,25 + ,10 + ,20 + ,11 + ,11 + ,8 + ,25 + ,25 + ,10 + ,28 + ,8 + ,12 + ,7 + ,20 + ,22 + ,10 + ,19 + ,9 + ,9 + ,7 + ,21 + ,23 + ,10 + ,30 + ,9 + ,15 + ,9 + ,27 + ,26 + ,10 + ,29 + ,15 + ,18 + ,11 + ,23 + ,23 + ,10 + ,26 + ,9 + ,15 + ,6 + ,25 + ,25 + ,10 + ,23 + ,10 + ,12 + ,8 + ,20 + ,21 + ,10 + ,13 + ,14 + ,13 + ,6 + ,21 + ,25 + ,10 + ,21 + ,12 + ,14 + ,9 + ,22 + ,24 + ,10 + ,19 + ,12 + ,10 + ,8 + ,23 + ,29 + ,10 + ,28 + ,11 + ,13 + ,6 + ,25 + ,22 + ,10 + ,23 + ,14 + ,13 + ,10 + ,25 + ,27 + ,10 + ,18 + ,6 + ,11 + ,8 + ,17 + ,26 + ,10 + ,21 + ,12 + ,13 + ,8 + ,19 + ,22 + ,10 + ,20 + ,8 + ,16 + ,10 + ,25 + ,24 + ,10 + ,23 + ,14 + ,8 + ,5 + ,19 + ,27 + ,10 + ,21 + ,11 + ,16 + ,7 + ,20 + ,24 + ,10 + ,21 + ,10 + ,11 + ,5 + ,26 + ,24 + ,10 + ,15 + ,14 + ,9 + ,8 + ,23 + ,29 + ,10 + ,28 + ,12 + ,16 + ,14 + ,27 + ,22 + ,10 + ,19 + ,10 + ,12 + ,7 + ,17 + ,21 + ,10 + ,26 + ,14 + ,14 + ,8 + ,17 + ,24 + ,10 + ,10 + ,5 + ,8 + ,6 + ,19 + ,24 + ,10 + ,16 + ,11 + ,9 + ,5 + ,17 + ,23 + ,10 + ,22 + ,10 + ,15 + ,6 + ,22 + ,20 + ,10 + ,19 + ,9 + ,11 + ,10 + ,21 + ,27 + ,10 + ,31 + ,10 + ,21 + ,12 + ,32 + ,26 + ,10 + ,31 + ,16 + ,14 + ,9 + ,21 + ,25 + ,10 + ,29 + ,13 + ,18 + ,12 + ,21 + ,21 + ,10 + ,19 + ,9 + ,12 + ,7 + ,18 + ,21 + ,10 + ,22 + ,10 + ,13 + ,8 + ,18 + ,19 + ,10 + ,23 + ,10 + ,15 + ,10 + ,23 + ,21 + ,10 + ,15 + ,7 + ,12 + ,6 + ,19 + ,21 + ,10 + ,20 + ,9 + ,19 + ,10 + ,20 + ,16 + ,10 + ,18 + ,8 + ,15 + ,10 + ,21 + ,22 + ,10 + ,23 + ,14 + ,11 + ,10 + ,20 + ,29 + ,10 + ,25 + ,14 + ,11 + ,5 + ,17 + ,15 + ,10 + ,21 + ,8 + ,10 + ,7 + ,18 + ,17 + ,10 + ,24 + ,9 + ,13 + ,10 + ,19 + ,15 + ,10 + ,25 + ,14 + ,15 + ,11 + ,22 + ,21 + ,10 + ,17 + ,14 + ,12 + ,6 + ,15 + ,21 + ,10 + ,13 + ,8 + ,12 + ,7 + ,14 + ,19 + ,10 + ,28 + ,8 + ,16 + ,12 + ,18 + ,24 + ,10 + ,21 + ,8 + ,9 + ,11 + ,24 + ,20 + ,10 + ,25 + ,7 + ,18 + ,11 + ,35 + ,17 + ,10 + ,9 + ,6 + ,8 + ,11 + ,29 + ,23 + ,10 + ,16 + ,8 + ,13 + ,5 + ,21 + ,24 + ,10 + ,19 + ,6 + ,17 + ,8 + ,25 + ,14 + ,10 + ,17 + ,11 + ,9 + ,6 + ,20 + ,19 + ,10 + ,25 + ,14 + ,15 + ,9 + ,22 + ,24 + ,10 + ,20 + ,11 + ,8 + ,4 + ,13 + ,13 + ,10 + ,29 + ,11 + ,7 + ,4 + ,26 + ,22 + ,10 + ,14 + ,11 + ,12 + ,7 + ,17 + ,16 + ,10 + ,22 + ,14 + ,14 + ,11 + ,25 + ,19 + ,10 + ,15 + ,8 + ,6 + ,6 + ,20 + ,25 + ,10 + ,19 + ,20 + ,8 + ,7 + ,19 + ,25 + ,10 + ,20 + ,11 + ,17 + ,8 + ,21 + ,23 + ,10 + ,15 + ,8 + ,10 + ,4 + ,22 + ,24 + ,10 + ,20 + ,11 + ,11 + ,8 + ,24 + ,26 + ,10 + ,18 + ,10 + ,14 + ,9 + ,21 + ,26 + ,10 + ,33 + ,14 + ,11 + ,8 + ,26 + ,25 + ,10 + ,22 + ,11 + ,13 + ,11 + ,24 + ,18 + ,10 + ,16 + ,9 + ,12 + ,8 + ,16 + ,21 + ,10 + ,17 + ,9 + ,11 + ,5 + ,23 + ,26 + ,10 + ,16 + ,8 + ,9 + ,4 + ,18 + ,23 + ,10 + ,21 + ,10 + ,12 + ,8 + ,16 + ,23 + ,10 + ,26 + ,13 + ,20 + ,10 + ,26 + ,22 + ,10 + ,18 + ,13 + ,12 + ,6 + ,19 + ,20 + ,10 + ,18 + ,12 + ,13 + ,9 + ,21 + ,13 + ,10 + ,17 + ,8 + ,12 + ,9 + ,21 + ,24 + ,10 + ,22 + ,13 + ,12 + ,13 + ,22 + ,15 + ,10 + ,30 + ,14 + ,9 + ,9 + ,23 + ,14 + ,10 + ,30 + ,12 + ,15 + ,10 + ,29 + ,22 + ,10 + ,24 + ,14 + ,24 + ,20 + ,21 + ,10 + ,10 + ,21 + ,15 + ,7 + ,5 + ,21 + ,24 + ,10 + ,21 + ,13 + ,17 + ,11 + ,23 + ,22 + ,10 + ,29 + ,16 + ,11 + ,6 + ,27 + ,24 + ,10 + ,31 + ,9 + ,17 + ,9 + ,25 + ,19 + ,10 + ,20 + ,9 + ,11 + ,7 + ,21 + ,20 + ,10 + ,16 + ,9 + ,12 + ,9 + ,10 + ,13 + ,10 + ,22 + ,8 + ,14 + ,10 + ,20 + ,20 + ,10 + ,20 + ,7 + ,11 + ,9 + ,26 + ,22 + ,10 + ,28 + ,16 + ,16 + ,8 + ,24 + ,24 + ,10 + ,38 + ,11 + ,21 + ,7 + ,29 + ,29 + ,10 + ,22 + ,9 + ,14 + ,6 + ,19 + ,12 + ,10 + ,20 + ,11 + ,20 + ,13 + ,24 + ,20 + ,10 + ,17 + ,9 + ,13 + ,6 + ,19 + ,21 + ,10 + ,28 + ,14 + ,11 + ,8 + ,24 + ,24 + ,10 + ,22 + ,13 + ,15 + ,10 + ,22 + ,22 + ,10 + ,31 + ,16 + ,19 + ,16 + ,17 + ,20) + ,dim=c(7 + ,159) + ,dimnames=list(c('T1' + ,'YT' + ,'X1' + ,'X2' + ,'X3' + ,'X4' + ,'X5 ') + ,1:159)) > y <- array(NA,dim=c(7,159),dimnames=list(c('T1','YT','X1','X2','X3','X4','X5 '),1:159)) > 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 = 'Do not include Seasonal Dummies' > par1 = '2' > library(lattice) > library(lmtest) Loading required package: zoo > 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 YT T1 X1 X2 X3 X4 X5\r t 1 24 9 14 11 12 24 26 1 2 25 9 11 7 8 25 23 2 3 17 9 6 17 8 30 25 3 4 18 9 12 10 8 19 23 4 5 18 9 8 12 9 22 19 5 6 16 9 10 12 7 22 29 6 7 20 10 10 11 4 25 25 7 8 16 10 11 11 11 23 21 8 9 18 10 16 12 7 17 22 9 10 17 10 11 13 7 21 25 10 11 23 10 13 14 12 19 24 11 12 30 10 12 16 10 19 18 12 13 23 10 8 11 10 15 22 13 14 18 10 12 10 8 16 15 14 15 15 10 11 11 8 23 22 15 16 12 10 4 15 4 27 28 16 17 21 10 9 9 9 22 20 17 18 15 10 8 11 8 14 12 18 19 20 10 8 17 7 22 24 19 20 31 10 14 17 11 23 20 20 21 27 10 15 11 9 23 21 21 22 34 10 16 18 11 21 20 22 23 21 10 9 14 13 19 21 23 24 31 10 14 10 8 18 23 24 25 19 10 11 11 8 20 28 25 26 16 10 8 15 9 23 24 26 27 20 10 9 15 6 25 24 27 28 21 10 9 13 9 19 24 28 29 22 10 9 16 9 24 23 29 30 17 10 9 13 6 22 23 30 31 24 10 10 9 6 25 29 31 32 25 10 16 18 16 26 24 32 33 26 10 11 18 5 29 18 33 34 25 10 8 12 7 32 25 34 35 17 10 9 17 9 25 21 35 36 32 10 16 9 6 29 26 36 37 33 10 11 9 6 28 22 37 38 13 10 16 12 5 17 22 38 39 32 10 12 18 12 28 22 39 40 25 10 12 12 7 29 23 40 41 29 10 14 18 10 26 30 41 42 22 10 9 14 9 25 23 42 43 18 10 10 15 8 14 17 43 44 17 10 9 16 5 25 23 44 45 20 10 10 10 8 26 23 45 46 15 10 12 11 8 20 25 46 47 20 10 14 14 10 18 24 47 48 33 10 14 9 6 32 24 48 49 29 10 10 12 8 25 23 49 50 23 10 14 17 7 25 21 50 51 26 10 16 5 4 23 24 51 52 18 10 9 12 8 21 24 52 53 20 10 10 12 8 20 28 53 54 11 10 6 6 4 15 16 54 55 28 10 8 24 20 30 20 55 56 26 10 13 12 8 24 29 56 57 22 10 10 12 8 26 27 57 58 17 10 8 14 6 24 22 58 59 12 10 7 7 4 22 28 59 60 14 10 15 13 8 14 16 60 61 17 10 9 12 9 24 25 61 62 21 10 10 13 6 24 24 62 63 19 10 12 14 7 24 28 63 64 18 10 13 8 9 24 24 64 65 10 10 10 11 5 19 23 65 66 29 10 11 9 5 31 30 66 67 31 10 8 11 8 22 24 67 68 19 10 9 13 8 27 21 68 69 9 10 13 10 6 19 25 69 70 20 10 11 11 8 25 25 70 71 28 10 8 12 7 20 22 71 72 19 10 9 9 7 21 23 72 73 30 10 9 15 9 27 26 73 74 29 10 15 18 11 23 23 74 75 26 10 9 15 6 25 25 75 76 23 10 10 12 8 20 21 76 77 13 10 14 13 6 21 25 77 78 21 10 12 14 9 22 24 78 79 19 10 12 10 8 23 29 79 80 28 10 11 13 6 25 22 80 81 23 10 14 13 10 25 27 81 82 18 10 6 11 8 17 26 82 83 21 10 12 13 8 19 22 83 84 20 10 8 16 10 25 24 84 85 23 10 14 8 5 19 27 85 86 21 10 11 16 7 20 24 86 87 21 10 10 11 5 26 24 87 88 15 10 14 9 8 23 29 88 89 28 10 12 16 14 27 22 89 90 19 10 10 12 7 17 21 90 91 26 10 14 14 8 17 24 91 92 10 10 5 8 6 19 24 92 93 16 10 11 9 5 17 23 93 94 22 10 10 15 6 22 20 94 95 19 10 9 11 10 21 27 95 96 31 10 10 21 12 32 26 96 97 31 10 16 14 9 21 25 97 98 29 10 13 18 12 21 21 98 99 19 10 9 12 7 18 21 99 100 22 10 10 13 8 18 19 100 101 23 10 10 15 10 23 21 101 102 15 10 7 12 6 19 21 102 103 20 10 9 19 10 20 16 103 104 18 10 8 15 10 21 22 104 105 23 10 14 11 10 20 29 105 106 25 10 14 11 5 17 15 106 107 21 10 8 10 7 18 17 107 108 24 10 9 13 10 19 15 108 109 25 10 14 15 11 22 21 109 110 17 10 14 12 6 15 21 110 111 13 10 8 12 7 14 19 111 112 28 10 8 16 12 18 24 112 113 21 10 8 9 11 24 20 113 114 25 10 7 18 11 35 17 114 115 9 10 6 8 11 29 23 115 116 16 10 8 13 5 21 24 116 117 19 10 6 17 8 25 14 117 118 17 10 11 9 6 20 19 118 119 25 10 14 15 9 22 24 119 120 20 10 11 8 4 13 13 120 121 29 10 11 7 4 26 22 121 122 14 10 11 12 7 17 16 122 123 22 10 14 14 11 25 19 123 124 15 10 8 6 6 20 25 124 125 19 10 20 8 7 19 25 125 126 20 10 11 17 8 21 23 126 127 15 10 8 10 4 22 24 127 128 20 10 11 11 8 24 26 128 129 18 10 10 14 9 21 26 129 130 33 10 14 11 8 26 25 130 131 22 10 11 13 11 24 18 131 132 16 10 9 12 8 16 21 132 133 17 10 9 11 5 23 26 133 134 16 10 8 9 4 18 23 134 135 21 10 10 12 8 16 23 135 136 26 10 13 20 10 26 22 136 137 18 10 13 12 6 19 20 137 138 18 10 12 13 9 21 13 138 139 17 10 8 12 9 21 24 139 140 22 10 13 12 13 22 15 140 141 30 10 14 9 9 23 14 141 142 30 10 12 15 10 29 22 142 143 24 10 14 24 20 21 10 143 144 21 10 15 7 5 21 24 144 145 21 10 13 17 11 23 22 145 146 29 10 16 11 6 27 24 146 147 31 10 9 17 9 25 19 147 148 20 10 9 11 7 21 20 148 149 16 10 9 12 9 10 13 149 150 22 10 8 14 10 20 20 150 151 20 10 7 11 9 26 22 151 152 28 10 16 16 8 24 24 152 153 38 10 11 21 7 29 29 153 154 22 10 9 14 6 19 12 154 155 20 10 11 20 13 24 20 155 156 17 10 9 13 6 19 21 156 157 28 10 14 11 8 24 24 157 158 22 10 13 15 10 22 22 158 159 31 10 16 19 16 17 20 159 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) T1 X1 X2 X3 X4 -18.359171 1.588385 0.798757 0.233450 0.207083 0.571863 `X5\r` t -0.099982 0.003548 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -12.1552 -2.6153 -0.3347 2.7709 12.4415 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -18.359171 19.993412 -0.918 0.3599 T1 1.588385 2.002175 0.793 0.4288 X1 0.798757 0.131148 6.090 8.93e-09 *** X2 0.233450 0.134333 1.738 0.0843 . X3 0.207083 0.170009 1.218 0.2251 X4 0.571863 0.096247 5.942 1.87e-08 *** `X5\r` -0.099982 0.105485 -0.948 0.3447 t 0.003548 0.008438 0.420 0.6747 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.491 on 151 degrees of freedom Multiple R-squared: 0.4116, Adjusted R-squared: 0.3843 F-statistic: 15.09 on 7 and 151 DF, p-value: 7.363e-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 + } [,1] [,2] [,3] [1,] 0.48291930 0.96583860 0.51708070 [2,] 0.55407324 0.89185352 0.44592676 [3,] 0.77857121 0.44285759 0.22142879 [4,] 0.80440138 0.39119724 0.19559862 [5,] 0.74477356 0.51045287 0.25522644 [6,] 0.66423254 0.67153491 0.33576746 [7,] 0.62352777 0.75294446 0.37647223 [8,] 0.58141591 0.83716818 0.41858409 [9,] 0.54156382 0.91687237 0.45843618 [10,] 0.56215048 0.87569904 0.43784952 [11,] 0.48534876 0.97069752 0.51465124 [12,] 0.45592491 0.91184981 0.54407509 [13,] 0.41802931 0.83605863 0.58197069 [14,] 0.52513187 0.94973626 0.47486813 [15,] 0.49659457 0.99318914 0.50340543 [16,] 0.52843031 0.94313938 0.47156969 [17,] 0.46245647 0.92491294 0.53754353 [18,] 0.39943287 0.79886574 0.60056713 [19,] 0.33749912 0.67499824 0.66250088 [20,] 0.30344943 0.60689885 0.69655057 [21,] 0.29206881 0.58413762 0.70793119 [22,] 0.42789051 0.85578103 0.57210949 [23,] 0.36777097 0.73554195 0.63222903 [24,] 0.33892162 0.67784325 0.66107838 [25,] 0.38991198 0.77982395 0.61008802 [26,] 0.35418446 0.70836892 0.64581554 [27,] 0.46542689 0.93085378 0.53457311 [28,] 0.76151440 0.47697120 0.23848560 [29,] 0.74804292 0.50391416 0.25195708 [30,] 0.71141077 0.57717846 0.28858923 [31,] 0.67644720 0.64710560 0.32355280 [32,] 0.62816508 0.74366985 0.37183492 [33,] 0.57642272 0.84715455 0.42357728 [34,] 0.56404384 0.87191233 0.43595616 [35,] 0.54714583 0.90570834 0.45285417 [36,] 0.57919269 0.84161463 0.42080731 [37,] 0.53547654 0.92904693 0.46452346 [38,] 0.52598491 0.94803018 0.47401509 [39,] 0.58621035 0.82757929 0.41378965 [40,] 0.55732133 0.88535734 0.44267867 [41,] 0.52641974 0.94716053 0.47358026 [42,] 0.47667903 0.95335805 0.52332097 [43,] 0.43300872 0.86601744 0.56699128 [44,] 0.38821469 0.77642938 0.61178531 [45,] 0.34733624 0.69467249 0.65266376 [46,] 0.31872280 0.63744560 0.68127720 [47,] 0.27585571 0.55171142 0.72414429 [48,] 0.24782998 0.49565995 0.75217002 [49,] 0.22954422 0.45908845 0.77045578 [50,] 0.26460700 0.52921401 0.73539300 [51,] 0.24812764 0.49625528 0.75187236 [52,] 0.21413018 0.42826036 0.78586982 [53,] 0.19690753 0.39381507 0.80309247 [54,] 0.21794668 0.43589336 0.78205332 [55,] 0.26697941 0.53395882 0.73302059 [56,] 0.27592913 0.55185825 0.72407087 [57,] 0.63776942 0.72446116 0.36223058 [58,] 0.62191817 0.75616365 0.37808183 [59,] 0.79519529 0.40960942 0.20480471 [60,] 0.76781475 0.46437050 0.23218525 [61,] 0.91275316 0.17449369 0.08724684 [62,] 0.89372712 0.21254576 0.10627288 [63,] 0.92429261 0.15141478 0.07570739 [64,] 0.91249702 0.17500596 0.08750298 [65,] 0.91633097 0.16733806 0.08366903 [66,] 0.91066247 0.17867506 0.08933753 [67,] 0.96209409 0.07581183 0.03790591 [68,] 0.95268524 0.09462951 0.04731476 [69,] 0.94347393 0.11305214 0.05652607 [70,] 0.94794285 0.10411429 0.05205715 [71,] 0.93826524 0.12346952 0.06173476 [72,] 0.93758272 0.12483455 0.06241728 [73,] 0.92205334 0.15589333 0.07794666 [74,] 0.90657425 0.18685150 0.09342575 [75,] 0.89676328 0.20647344 0.10323672 [76,] 0.87808005 0.24383990 0.12191995 [77,] 0.85337558 0.29324885 0.14662442 [78,] 0.90533019 0.18933962 0.09466981 [79,] 0.88615559 0.22768882 0.11384441 [80,] 0.86364771 0.27270458 0.13635229 [81,] 0.86582748 0.26834504 0.13417252 [82,] 0.85438478 0.29123044 0.14561522 [83,] 0.82983170 0.34033660 0.17016830 [84,] 0.79955375 0.40089251 0.20044625 [85,] 0.76368845 0.47262311 0.23631155 [86,] 0.73105557 0.53788885 0.26894443 [87,] 0.75174193 0.49651615 0.24825807 [88,] 0.74934651 0.50130699 0.25065349 [89,] 0.71223470 0.57553061 0.28776530 [90,] 0.68974486 0.62051027 0.31025514 [91,] 0.64943492 0.70113016 0.35056508 [92,] 0.60663485 0.78673031 0.39336515 [93,] 0.56324422 0.87351157 0.43675578 [94,] 0.51865416 0.96269169 0.48134584 [95,] 0.47588065 0.95176130 0.52411935 [96,] 0.46361214 0.92722428 0.53638786 [97,] 0.47077905 0.94155810 0.52922095 [98,] 0.50953281 0.98093439 0.49046719 [99,] 0.47097176 0.94194351 0.52902824 [100,] 0.42861169 0.85722338 0.57138831 [101,] 0.38145151 0.76290301 0.61854849 [102,] 0.71128864 0.57742272 0.28871136 [103,] 0.74739754 0.50520491 0.25260246 [104,] 0.72003227 0.55993547 0.27996773 [105,] 0.85465217 0.29069567 0.14534783 [106,] 0.82271620 0.35456760 0.17728380 [107,] 0.78959837 0.42080325 0.21040163 [108,] 0.75240502 0.49518997 0.24759498 [109,] 0.72177684 0.55644631 0.27822316 [110,] 0.77389257 0.45221485 0.22610743 [111,] 0.86094268 0.27811464 0.13905732 [112,] 0.83849371 0.32301257 0.16150629 [113,] 0.81442815 0.37114370 0.18557185 [114,] 0.77154930 0.45690141 0.22845070 [115,] 0.77469828 0.45060344 0.22530172 [116,] 0.72591221 0.54817558 0.27408779 [117,] 0.69067689 0.61864623 0.30932311 [118,] 0.63977800 0.72044399 0.36022200 [119,] 0.59073689 0.81852623 0.40926311 [120,] 0.71850322 0.56299357 0.28149678 [121,] 0.66032378 0.67935244 0.33967622 [122,] 0.59512693 0.80974614 0.40487307 [123,] 0.55371876 0.89256247 0.44628124 [124,] 0.48144577 0.96289155 0.51855423 [125,] 0.50489984 0.99020032 0.49510016 [126,] 0.43240056 0.86480113 0.56759944 [127,] 0.38385109 0.76770218 0.61614891 [128,] 0.39624875 0.79249751 0.60375125 [129,] 0.32376316 0.64752632 0.67623684 [130,] 0.25440300 0.50880600 0.74559700 [131,] 0.34404718 0.68809436 0.65595282 [132,] 0.29457591 0.58915181 0.70542409 [133,] 0.22644559 0.45289117 0.77355441 [134,] 0.15969886 0.31939772 0.84030114 [135,] 0.23993008 0.47986016 0.76006992 [136,] 0.16934831 0.33869661 0.83065169 [137,] 0.16052128 0.32104257 0.83947872 [138,] 0.08730809 0.17461618 0.91269191 > postscript(file="/var/wessaorg/rcomp/tmp/1317e1321974848.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/wessaorg/rcomp/tmp/2sndn1321974848.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/wessaorg/rcomp/tmp/3bgdo1321974848.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/wessaorg/rcomp/tmp/4zy4b1321974848.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/wessaorg/rcomp/tmp/5t81o1321974848.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 = 159 Frequency = 1 1 2 3 4 5 0.699428707 4.982477533 -4.021139979 -0.092550079 0.309432197 6 7 8 9 10 -1.877648378 -0.730396894 -6.238481966 -4.109776690 -3.340495644 11 12 13 14 15 0.833321996 7.975906252 8.022016670 -0.800677630 -6.542086945 16 17 18 19 20 -5.747367265 1.680049372 -0.009510227 0.418198993 4.821988291 21 22 23 24 25 1.934533236 7.127653446 1.478748932 10.222457081 -0.262087388 26 27 28 29 30 -4.125763163 -1.450545389 2.822736033 0.159541394 -2.378681268 31 32 33 34 35 3.637116958 -5.402626037 -0.449955914 0.913587819 -5.867022028 36 37 38 39 40 4.239439239 9.401613363 -8.798498333 4.252209886 -0.787102564 41 42 43 44 45 2.005343802 0.008457742 0.870385856 -4.637207857 -2.231921021 46 47 48 49 50 -5.435293788 -2.107128831 4.878828002 6.858849478 -3.499859609 51 52 53 54 55 2.765402487 -0.965604254 1.203879954 -0.716070994 -1.010580477 56 57 58 59 60 2.609495654 -0.341469545 -3.156421048 -3.569277879 -6.816793556 61 62 63 64 65 -3.820224182 -0.334712950 -3.976381837 -5.192075888 -7.912040557 66 67 68 69 70 4.590073481 12.441523081 -3.986941409 -11.096172326 -2.580998457 71 72 73 74 75 10.344726359 0.770891644 6.821243744 1.898142550 4.479140251 76 77 78 79 80 3.422408610 -9.767389027 -1.699965699 -2.634583681 5.030842986 81 82 83 84 85 -2.697399203 4.045096838 0.238453441 -1.915796187 2.922252116 86 87 88 89 90 0.161398850 -0.893150604 -8.030577944 0.699416456 1.295409990 91 92 93 94 95 4.722794800 -3.420796193 -1.199510529 0.828654603 0.001068714 96 97 98 99 100 2.059621623 5.709441371 4.147188382 1.490373855 3.047572489 101 102 103 104 105 0.503607615 -1.287535418 -1.422852509 -1.665814523 0.743630757 106 107 108 109 110 4.091342564 4.327722848 4.431992288 -0.355023507 -2.619766861 111 112 113 114 115 -1.665955169 9.573738336 0.580323549 -3.315956539 -12.155176423 116 117 118 119 120 -2.006110633 -2.254461384 -2.610803774 0.323608466 4.432866261 121 122 123 124 125 7.128387389 -5.116785766 -5.086794180 -0.935578418 -6.626332593 126 127 128 129 130 -2.092892027 -2.709565404 -2.114928381 -2.511564958 7.237997476 131 132 133 134 135 -2.013573856 -0.690061844 -2.342042296 0.686519682 3.700500739 136 137 138 139 140 -1.799696895 -3.304233866 -5.207320015 -1.682591312 -2.979952893 141 142 143 144 145 5.074580192 2.429437275 -5.968383587 -1.296046975 -4.622770453 146 147 148 149 150 1.326039057 7.535657534 0.734410644 1.673866028 2.776335212 151 152 153 154 155 -0.752234725 0.438922517 11.109584884 2.563727727 -5.947077399 156 157 158 159 -1.310083076 3.185949922 -2.423045831 4.660187228 > postscript(file="/var/wessaorg/rcomp/tmp/6roja1321974848.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 = 159 Frequency = 1 lag(myerror, k = 1) myerror 0 0.699428707 NA 1 4.982477533 0.699428707 2 -4.021139979 4.982477533 3 -0.092550079 -4.021139979 4 0.309432197 -0.092550079 5 -1.877648378 0.309432197 6 -0.730396894 -1.877648378 7 -6.238481966 -0.730396894 8 -4.109776690 -6.238481966 9 -3.340495644 -4.109776690 10 0.833321996 -3.340495644 11 7.975906252 0.833321996 12 8.022016670 7.975906252 13 -0.800677630 8.022016670 14 -6.542086945 -0.800677630 15 -5.747367265 -6.542086945 16 1.680049372 -5.747367265 17 -0.009510227 1.680049372 18 0.418198993 -0.009510227 19 4.821988291 0.418198993 20 1.934533236 4.821988291 21 7.127653446 1.934533236 22 1.478748932 7.127653446 23 10.222457081 1.478748932 24 -0.262087388 10.222457081 25 -4.125763163 -0.262087388 26 -1.450545389 -4.125763163 27 2.822736033 -1.450545389 28 0.159541394 2.822736033 29 -2.378681268 0.159541394 30 3.637116958 -2.378681268 31 -5.402626037 3.637116958 32 -0.449955914 -5.402626037 33 0.913587819 -0.449955914 34 -5.867022028 0.913587819 35 4.239439239 -5.867022028 36 9.401613363 4.239439239 37 -8.798498333 9.401613363 38 4.252209886 -8.798498333 39 -0.787102564 4.252209886 40 2.005343802 -0.787102564 41 0.008457742 2.005343802 42 0.870385856 0.008457742 43 -4.637207857 0.870385856 44 -2.231921021 -4.637207857 45 -5.435293788 -2.231921021 46 -2.107128831 -5.435293788 47 4.878828002 -2.107128831 48 6.858849478 4.878828002 49 -3.499859609 6.858849478 50 2.765402487 -3.499859609 51 -0.965604254 2.765402487 52 1.203879954 -0.965604254 53 -0.716070994 1.203879954 54 -1.010580477 -0.716070994 55 2.609495654 -1.010580477 56 -0.341469545 2.609495654 57 -3.156421048 -0.341469545 58 -3.569277879 -3.156421048 59 -6.816793556 -3.569277879 60 -3.820224182 -6.816793556 61 -0.334712950 -3.820224182 62 -3.976381837 -0.334712950 63 -5.192075888 -3.976381837 64 -7.912040557 -5.192075888 65 4.590073481 -7.912040557 66 12.441523081 4.590073481 67 -3.986941409 12.441523081 68 -11.096172326 -3.986941409 69 -2.580998457 -11.096172326 70 10.344726359 -2.580998457 71 0.770891644 10.344726359 72 6.821243744 0.770891644 73 1.898142550 6.821243744 74 4.479140251 1.898142550 75 3.422408610 4.479140251 76 -9.767389027 3.422408610 77 -1.699965699 -9.767389027 78 -2.634583681 -1.699965699 79 5.030842986 -2.634583681 80 -2.697399203 5.030842986 81 4.045096838 -2.697399203 82 0.238453441 4.045096838 83 -1.915796187 0.238453441 84 2.922252116 -1.915796187 85 0.161398850 2.922252116 86 -0.893150604 0.161398850 87 -8.030577944 -0.893150604 88 0.699416456 -8.030577944 89 1.295409990 0.699416456 90 4.722794800 1.295409990 91 -3.420796193 4.722794800 92 -1.199510529 -3.420796193 93 0.828654603 -1.199510529 94 0.001068714 0.828654603 95 2.059621623 0.001068714 96 5.709441371 2.059621623 97 4.147188382 5.709441371 98 1.490373855 4.147188382 99 3.047572489 1.490373855 100 0.503607615 3.047572489 101 -1.287535418 0.503607615 102 -1.422852509 -1.287535418 103 -1.665814523 -1.422852509 104 0.743630757 -1.665814523 105 4.091342564 0.743630757 106 4.327722848 4.091342564 107 4.431992288 4.327722848 108 -0.355023507 4.431992288 109 -2.619766861 -0.355023507 110 -1.665955169 -2.619766861 111 9.573738336 -1.665955169 112 0.580323549 9.573738336 113 -3.315956539 0.580323549 114 -12.155176423 -3.315956539 115 -2.006110633 -12.155176423 116 -2.254461384 -2.006110633 117 -2.610803774 -2.254461384 118 0.323608466 -2.610803774 119 4.432866261 0.323608466 120 7.128387389 4.432866261 121 -5.116785766 7.128387389 122 -5.086794180 -5.116785766 123 -0.935578418 -5.086794180 124 -6.626332593 -0.935578418 125 -2.092892027 -6.626332593 126 -2.709565404 -2.092892027 127 -2.114928381 -2.709565404 128 -2.511564958 -2.114928381 129 7.237997476 -2.511564958 130 -2.013573856 7.237997476 131 -0.690061844 -2.013573856 132 -2.342042296 -0.690061844 133 0.686519682 -2.342042296 134 3.700500739 0.686519682 135 -1.799696895 3.700500739 136 -3.304233866 -1.799696895 137 -5.207320015 -3.304233866 138 -1.682591312 -5.207320015 139 -2.979952893 -1.682591312 140 5.074580192 -2.979952893 141 2.429437275 5.074580192 142 -5.968383587 2.429437275 143 -1.296046975 -5.968383587 144 -4.622770453 -1.296046975 145 1.326039057 -4.622770453 146 7.535657534 1.326039057 147 0.734410644 7.535657534 148 1.673866028 0.734410644 149 2.776335212 1.673866028 150 -0.752234725 2.776335212 151 0.438922517 -0.752234725 152 11.109584884 0.438922517 153 2.563727727 11.109584884 154 -5.947077399 2.563727727 155 -1.310083076 -5.947077399 156 3.185949922 -1.310083076 157 -2.423045831 3.185949922 158 4.660187228 -2.423045831 159 NA 4.660187228 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.982477533 0.699428707 [2,] -4.021139979 4.982477533 [3,] -0.092550079 -4.021139979 [4,] 0.309432197 -0.092550079 [5,] -1.877648378 0.309432197 [6,] -0.730396894 -1.877648378 [7,] -6.238481966 -0.730396894 [8,] -4.109776690 -6.238481966 [9,] -3.340495644 -4.109776690 [10,] 0.833321996 -3.340495644 [11,] 7.975906252 0.833321996 [12,] 8.022016670 7.975906252 [13,] -0.800677630 8.022016670 [14,] -6.542086945 -0.800677630 [15,] -5.747367265 -6.542086945 [16,] 1.680049372 -5.747367265 [17,] -0.009510227 1.680049372 [18,] 0.418198993 -0.009510227 [19,] 4.821988291 0.418198993 [20,] 1.934533236 4.821988291 [21,] 7.127653446 1.934533236 [22,] 1.478748932 7.127653446 [23,] 10.222457081 1.478748932 [24,] -0.262087388 10.222457081 [25,] -4.125763163 -0.262087388 [26,] -1.450545389 -4.125763163 [27,] 2.822736033 -1.450545389 [28,] 0.159541394 2.822736033 [29,] -2.378681268 0.159541394 [30,] 3.637116958 -2.378681268 [31,] -5.402626037 3.637116958 [32,] -0.449955914 -5.402626037 [33,] 0.913587819 -0.449955914 [34,] -5.867022028 0.913587819 [35,] 4.239439239 -5.867022028 [36,] 9.401613363 4.239439239 [37,] -8.798498333 9.401613363 [38,] 4.252209886 -8.798498333 [39,] -0.787102564 4.252209886 [40,] 2.005343802 -0.787102564 [41,] 0.008457742 2.005343802 [42,] 0.870385856 0.008457742 [43,] -4.637207857 0.870385856 [44,] -2.231921021 -4.637207857 [45,] -5.435293788 -2.231921021 [46,] -2.107128831 -5.435293788 [47,] 4.878828002 -2.107128831 [48,] 6.858849478 4.878828002 [49,] -3.499859609 6.858849478 [50,] 2.765402487 -3.499859609 [51,] -0.965604254 2.765402487 [52,] 1.203879954 -0.965604254 [53,] -0.716070994 1.203879954 [54,] -1.010580477 -0.716070994 [55,] 2.609495654 -1.010580477 [56,] -0.341469545 2.609495654 [57,] -3.156421048 -0.341469545 [58,] -3.569277879 -3.156421048 [59,] -6.816793556 -3.569277879 [60,] -3.820224182 -6.816793556 [61,] -0.334712950 -3.820224182 [62,] -3.976381837 -0.334712950 [63,] -5.192075888 -3.976381837 [64,] -7.912040557 -5.192075888 [65,] 4.590073481 -7.912040557 [66,] 12.441523081 4.590073481 [67,] -3.986941409 12.441523081 [68,] -11.096172326 -3.986941409 [69,] -2.580998457 -11.096172326 [70,] 10.344726359 -2.580998457 [71,] 0.770891644 10.344726359 [72,] 6.821243744 0.770891644 [73,] 1.898142550 6.821243744 [74,] 4.479140251 1.898142550 [75,] 3.422408610 4.479140251 [76,] -9.767389027 3.422408610 [77,] -1.699965699 -9.767389027 [78,] -2.634583681 -1.699965699 [79,] 5.030842986 -2.634583681 [80,] -2.697399203 5.030842986 [81,] 4.045096838 -2.697399203 [82,] 0.238453441 4.045096838 [83,] -1.915796187 0.238453441 [84,] 2.922252116 -1.915796187 [85,] 0.161398850 2.922252116 [86,] -0.893150604 0.161398850 [87,] -8.030577944 -0.893150604 [88,] 0.699416456 -8.030577944 [89,] 1.295409990 0.699416456 [90,] 4.722794800 1.295409990 [91,] -3.420796193 4.722794800 [92,] -1.199510529 -3.420796193 [93,] 0.828654603 -1.199510529 [94,] 0.001068714 0.828654603 [95,] 2.059621623 0.001068714 [96,] 5.709441371 2.059621623 [97,] 4.147188382 5.709441371 [98,] 1.490373855 4.147188382 [99,] 3.047572489 1.490373855 [100,] 0.503607615 3.047572489 [101,] -1.287535418 0.503607615 [102,] -1.422852509 -1.287535418 [103,] -1.665814523 -1.422852509 [104,] 0.743630757 -1.665814523 [105,] 4.091342564 0.743630757 [106,] 4.327722848 4.091342564 [107,] 4.431992288 4.327722848 [108,] -0.355023507 4.431992288 [109,] -2.619766861 -0.355023507 [110,] -1.665955169 -2.619766861 [111,] 9.573738336 -1.665955169 [112,] 0.580323549 9.573738336 [113,] -3.315956539 0.580323549 [114,] -12.155176423 -3.315956539 [115,] -2.006110633 -12.155176423 [116,] -2.254461384 -2.006110633 [117,] -2.610803774 -2.254461384 [118,] 0.323608466 -2.610803774 [119,] 4.432866261 0.323608466 [120,] 7.128387389 4.432866261 [121,] -5.116785766 7.128387389 [122,] -5.086794180 -5.116785766 [123,] -0.935578418 -5.086794180 [124,] -6.626332593 -0.935578418 [125,] -2.092892027 -6.626332593 [126,] -2.709565404 -2.092892027 [127,] -2.114928381 -2.709565404 [128,] -2.511564958 -2.114928381 [129,] 7.237997476 -2.511564958 [130,] -2.013573856 7.237997476 [131,] -0.690061844 -2.013573856 [132,] -2.342042296 -0.690061844 [133,] 0.686519682 -2.342042296 [134,] 3.700500739 0.686519682 [135,] -1.799696895 3.700500739 [136,] -3.304233866 -1.799696895 [137,] -5.207320015 -3.304233866 [138,] -1.682591312 -5.207320015 [139,] -2.979952893 -1.682591312 [140,] 5.074580192 -2.979952893 [141,] 2.429437275 5.074580192 [142,] -5.968383587 2.429437275 [143,] -1.296046975 -5.968383587 [144,] -4.622770453 -1.296046975 [145,] 1.326039057 -4.622770453 [146,] 7.535657534 1.326039057 [147,] 0.734410644 7.535657534 [148,] 1.673866028 0.734410644 [149,] 2.776335212 1.673866028 [150,] -0.752234725 2.776335212 [151,] 0.438922517 -0.752234725 [152,] 11.109584884 0.438922517 [153,] 2.563727727 11.109584884 [154,] -5.947077399 2.563727727 [155,] -1.310083076 -5.947077399 [156,] 3.185949922 -1.310083076 [157,] -2.423045831 3.185949922 [158,] 4.660187228 -2.423045831 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.982477533 0.699428707 2 -4.021139979 4.982477533 3 -0.092550079 -4.021139979 4 0.309432197 -0.092550079 5 -1.877648378 0.309432197 6 -0.730396894 -1.877648378 7 -6.238481966 -0.730396894 8 -4.109776690 -6.238481966 9 -3.340495644 -4.109776690 10 0.833321996 -3.340495644 11 7.975906252 0.833321996 12 8.022016670 7.975906252 13 -0.800677630 8.022016670 14 -6.542086945 -0.800677630 15 -5.747367265 -6.542086945 16 1.680049372 -5.747367265 17 -0.009510227 1.680049372 18 0.418198993 -0.009510227 19 4.821988291 0.418198993 20 1.934533236 4.821988291 21 7.127653446 1.934533236 22 1.478748932 7.127653446 23 10.222457081 1.478748932 24 -0.262087388 10.222457081 25 -4.125763163 -0.262087388 26 -1.450545389 -4.125763163 27 2.822736033 -1.450545389 28 0.159541394 2.822736033 29 -2.378681268 0.159541394 30 3.637116958 -2.378681268 31 -5.402626037 3.637116958 32 -0.449955914 -5.402626037 33 0.913587819 -0.449955914 34 -5.867022028 0.913587819 35 4.239439239 -5.867022028 36 9.401613363 4.239439239 37 -8.798498333 9.401613363 38 4.252209886 -8.798498333 39 -0.787102564 4.252209886 40 2.005343802 -0.787102564 41 0.008457742 2.005343802 42 0.870385856 0.008457742 43 -4.637207857 0.870385856 44 -2.231921021 -4.637207857 45 -5.435293788 -2.231921021 46 -2.107128831 -5.435293788 47 4.878828002 -2.107128831 48 6.858849478 4.878828002 49 -3.499859609 6.858849478 50 2.765402487 -3.499859609 51 -0.965604254 2.765402487 52 1.203879954 -0.965604254 53 -0.716070994 1.203879954 54 -1.010580477 -0.716070994 55 2.609495654 -1.010580477 56 -0.341469545 2.609495654 57 -3.156421048 -0.341469545 58 -3.569277879 -3.156421048 59 -6.816793556 -3.569277879 60 -3.820224182 -6.816793556 61 -0.334712950 -3.820224182 62 -3.976381837 -0.334712950 63 -5.192075888 -3.976381837 64 -7.912040557 -5.192075888 65 4.590073481 -7.912040557 66 12.441523081 4.590073481 67 -3.986941409 12.441523081 68 -11.096172326 -3.986941409 69 -2.580998457 -11.096172326 70 10.344726359 -2.580998457 71 0.770891644 10.344726359 72 6.821243744 0.770891644 73 1.898142550 6.821243744 74 4.479140251 1.898142550 75 3.422408610 4.479140251 76 -9.767389027 3.422408610 77 -1.699965699 -9.767389027 78 -2.634583681 -1.699965699 79 5.030842986 -2.634583681 80 -2.697399203 5.030842986 81 4.045096838 -2.697399203 82 0.238453441 4.045096838 83 -1.915796187 0.238453441 84 2.922252116 -1.915796187 85 0.161398850 2.922252116 86 -0.893150604 0.161398850 87 -8.030577944 -0.893150604 88 0.699416456 -8.030577944 89 1.295409990 0.699416456 90 4.722794800 1.295409990 91 -3.420796193 4.722794800 92 -1.199510529 -3.420796193 93 0.828654603 -1.199510529 94 0.001068714 0.828654603 95 2.059621623 0.001068714 96 5.709441371 2.059621623 97 4.147188382 5.709441371 98 1.490373855 4.147188382 99 3.047572489 1.490373855 100 0.503607615 3.047572489 101 -1.287535418 0.503607615 102 -1.422852509 -1.287535418 103 -1.665814523 -1.422852509 104 0.743630757 -1.665814523 105 4.091342564 0.743630757 106 4.327722848 4.091342564 107 4.431992288 4.327722848 108 -0.355023507 4.431992288 109 -2.619766861 -0.355023507 110 -1.665955169 -2.619766861 111 9.573738336 -1.665955169 112 0.580323549 9.573738336 113 -3.315956539 0.580323549 114 -12.155176423 -3.315956539 115 -2.006110633 -12.155176423 116 -2.254461384 -2.006110633 117 -2.610803774 -2.254461384 118 0.323608466 -2.610803774 119 4.432866261 0.323608466 120 7.128387389 4.432866261 121 -5.116785766 7.128387389 122 -5.086794180 -5.116785766 123 -0.935578418 -5.086794180 124 -6.626332593 -0.935578418 125 -2.092892027 -6.626332593 126 -2.709565404 -2.092892027 127 -2.114928381 -2.709565404 128 -2.511564958 -2.114928381 129 7.237997476 -2.511564958 130 -2.013573856 7.237997476 131 -0.690061844 -2.013573856 132 -2.342042296 -0.690061844 133 0.686519682 -2.342042296 134 3.700500739 0.686519682 135 -1.799696895 3.700500739 136 -3.304233866 -1.799696895 137 -5.207320015 -3.304233866 138 -1.682591312 -5.207320015 139 -2.979952893 -1.682591312 140 5.074580192 -2.979952893 141 2.429437275 5.074580192 142 -5.968383587 2.429437275 143 -1.296046975 -5.968383587 144 -4.622770453 -1.296046975 145 1.326039057 -4.622770453 146 7.535657534 1.326039057 147 0.734410644 7.535657534 148 1.673866028 0.734410644 149 2.776335212 1.673866028 150 -0.752234725 2.776335212 151 0.438922517 -0.752234725 152 11.109584884 0.438922517 153 2.563727727 11.109584884 154 -5.947077399 2.563727727 155 -1.310083076 -5.947077399 156 3.185949922 -1.310083076 157 -2.423045831 3.185949922 158 4.660187228 -2.423045831 > 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/wessaorg/rcomp/tmp/7yjnm1321974848.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/wessaorg/rcomp/tmp/8c6zf1321974848.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/wessaorg/rcomp/tmp/986u01321974848.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/wessaorg/rcomp/tmp/10u8o61321974848.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11o1uo1321974848.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/wessaorg/rcomp/tmp/12zzzt1321974848.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/wessaorg/rcomp/tmp/1371hy1321974848.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/wessaorg/rcomp/tmp/14p19o1321974848.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/wessaorg/rcomp/tmp/15kxbx1321974848.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/wessaorg/rcomp/tmp/163bdc1321974848.tab") + } > > try(system("convert tmp/1317e1321974848.ps tmp/1317e1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/2sndn1321974848.ps tmp/2sndn1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/3bgdo1321974848.ps tmp/3bgdo1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/4zy4b1321974848.ps tmp/4zy4b1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/5t81o1321974848.ps tmp/5t81o1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/6roja1321974848.ps tmp/6roja1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/7yjnm1321974848.ps tmp/7yjnm1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/8c6zf1321974848.ps tmp/8c6zf1321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/986u01321974848.ps tmp/986u01321974848.png",intern=TRUE)) character(0) > try(system("convert tmp/10u8o61321974848.ps tmp/10u8o61321974848.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.889 0.528 5.502