R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-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(2 + ,7 + ,41 + ,38 + ,14 + ,12 + ,3 + ,2 + ,5 + ,39 + ,32 + ,18 + ,11 + ,5 + ,2 + ,5 + ,30 + ,35 + ,11 + ,14 + ,4 + ,1 + ,5 + ,31 + ,33 + ,12 + ,12 + ,4 + ,2 + ,8 + ,34 + ,37 + ,16 + ,21 + ,5 + ,2 + ,6 + ,35 + ,29 + ,18 + ,12 + ,5 + ,2 + ,5 + ,39 + ,31 + ,14 + ,22 + ,2 + ,2 + ,6 + ,34 + ,36 + ,14 + ,11 + ,5 + ,2 + ,5 + ,36 + ,35 + ,15 + ,10 + ,4 + ,2 + ,4 + ,37 + ,38 + ,15 + ,13 + ,4 + ,1 + ,6 + ,38 + ,31 + ,17 + ,10 + ,5 + ,2 + ,5 + ,36 + ,34 + ,19 + ,8 + ,3 + ,1 + ,5 + ,38 + ,35 + ,10 + ,15 + ,5 + ,2 + ,6 + ,39 + ,38 + ,16 + ,14 + ,3 + ,2 + ,7 + ,33 + ,37 + ,18 + ,10 + ,5 + ,1 + ,6 + ,32 + ,33 + ,14 + ,14 + ,3 + ,1 + ,7 + ,36 + ,32 + ,14 + ,14 + ,4 + ,2 + ,6 + ,38 + ,38 + ,17 + ,11 + ,5 + ,1 + ,8 + ,39 + ,38 + ,14 + ,10 + ,4 + ,2 + ,7 + ,32 + ,32 + ,16 + ,13 + ,3 + ,1 + ,5 + ,32 + ,33 + ,18 + ,7 + ,4 + ,2 + ,5 + ,31 + ,31 + ,11 + ,14 + ,4 + ,2 + ,7 + ,39 + ,38 + ,14 + ,12 + ,3 + ,2 + ,7 + ,37 + ,39 + ,12 + ,14 + ,3 + ,1 + ,5 + ,39 + ,32 + ,17 + ,11 + ,4 + ,2 + ,4 + ,41 + ,32 + ,9 + ,9 + ,5 + ,1 + ,10 + ,36 + ,35 + ,16 + ,11 + ,4 + ,2 + ,6 + ,33 + ,37 + ,14 + ,15 + ,4 + ,2 + ,5 + ,33 + ,33 + ,15 + ,14 + ,4 + ,1 + ,5 + ,34 + ,33 + ,11 + ,13 + ,4 + ,2 + ,5 + ,31 + ,28 + ,16 + ,9 + ,4 + ,1 + ,5 + ,27 + ,32 + ,13 + ,15 + ,3 + ,2 + ,6 + ,37 + ,31 + ,17 + ,10 + ,4 + ,2 + ,5 + ,34 + ,37 + ,15 + ,11 + ,5 + ,1 + ,5 + ,34 + ,30 + ,14 + ,13 + ,4 + ,1 + ,5 + ,32 + ,33 + ,16 + ,8 + ,4 + ,1 + ,5 + ,29 + ,31 + ,9 + ,20 + ,3 + ,1 + ,5 + ,36 + ,33 + ,15 + ,12 + ,4 + ,2 + ,5 + ,29 + ,31 + ,17 + ,10 + ,4 + ,1 + ,5 + ,35 + ,33 + ,13 + ,10 + ,4 + ,1 + ,5 + ,37 + ,32 + ,15 + ,9 + ,5 + ,2 + ,7 + ,34 + ,33 + ,16 + ,14 + ,4 + ,1 + ,5 + ,38 + ,32 + ,16 + ,8 + ,3 + ,1 + ,6 + ,35 + ,33 + ,12 + ,14 + ,3 + ,2 + ,7 + ,38 + ,28 + ,12 + ,11 + ,4 + ,2 + ,7 + ,37 + ,35 + ,11 + ,13 + ,4 + ,2 + ,5 + ,38 + ,39 + ,15 + ,9 + ,4 + ,2 + ,5 + ,33 + ,34 + ,15 + ,11 + ,5 + ,2 + ,4 + ,36 + ,38 + ,17 + ,15 + ,4 + ,1 + ,5 + ,38 + ,32 + ,13 + ,11 + ,5 + ,2 + ,4 + ,32 + ,38 + ,16 + ,10 + ,4 + ,1 + ,5 + ,32 + ,30 + ,14 + ,14 + ,4 + ,1 + ,5 + ,32 + ,33 + ,11 + ,18 + ,4 + ,2 + ,7 + ,34 + ,38 + ,12 + ,14 + ,4 + ,1 + ,5 + ,32 + ,32 + ,12 + ,11 + ,4 + ,2 + ,5 + ,37 + ,32 + ,15 + ,12 + ,5 + ,2 + ,6 + ,39 + ,34 + ,16 + ,13 + ,4 + ,2 + ,4 + ,29 + ,34 + ,15 + ,9 + ,4 + ,1 + ,6 + ,37 + ,36 + ,12 + ,10 + ,4 + ,2 + ,6 + ,35 + ,34 + ,12 + ,15 + ,4 + ,1 + ,5 + ,30 + ,28 + ,8 + ,20 + ,3 + ,1 + ,7 + ,38 + ,34 + ,13 + ,12 + ,4 + ,2 + ,6 + ,34 + ,35 + ,11 + ,12 + ,5 + ,2 + ,8 + ,31 + ,35 + ,14 + ,14 + ,1 + ,2 + ,7 + ,34 + ,31 + ,15 + ,13 + ,3 + ,1 + ,5 + ,35 + ,37 + ,10 + ,11 + ,5 + ,2 + ,6 + ,36 + ,35 + ,11 + ,17 + ,4 + ,1 + ,6 + ,30 + ,27 + ,12 + ,12 + ,4 + ,2 + ,5 + ,39 + ,40 + ,15 + ,13 + ,3 + ,1 + ,5 + ,35 + ,37 + ,15 + ,14 + ,4 + ,1 + ,5 + ,38 + ,36 + ,14 + ,13 + ,4 + ,2 + ,5 + ,31 + ,38 + ,16 + ,15 + ,3 + ,2 + ,4 + ,34 + ,39 + ,15 + ,13 + ,5 + ,1 + ,6 + ,38 + ,41 + ,15 + ,10 + ,4 + ,1 + ,6 + ,34 + ,27 + ,13 + ,11 + ,5 + ,2 + ,6 + ,39 + ,30 + ,12 + ,19 + ,4 + ,2 + ,6 + ,37 + ,37 + ,17 + ,13 + ,4 + ,2 + ,7 + ,34 + ,31 + ,13 + ,17 + ,4 + ,1 + ,5 + ,28 + ,31 + ,15 + ,13 + ,4 + ,1 + ,7 + ,37 + ,27 + ,13 + ,9 + ,3 + ,1 + ,6 + ,33 + ,36 + ,15 + ,11 + ,5 + ,1 + ,5 + ,37 + ,38 + ,16 + ,10 + ,NA + ,2 + ,5 + ,35 + ,37 + ,15 + ,9 + ,5 + ,1 + ,4 + ,37 + ,33 + ,16 + ,12 + ,4 + ,2 + ,8 + ,32 + ,34 + ,15 + ,12 + ,4 + ,2 + ,8 + ,33 + ,31 + ,14 + ,13 + ,5 + ,1 + ,5 + ,38 + ,39 + ,15 + ,13 + ,4 + ,2 + ,5 + ,33 + ,34 + ,14 + ,12 + ,4 + ,2 + ,6 + ,29 + ,32 + ,13 + ,15 + ,3 + ,2 + ,4 + ,33 + ,33 + ,7 + ,22 + ,4 + ,2 + ,5 + ,31 + ,36 + ,17 + ,13 + ,4 + ,2 + ,5 + ,36 + ,32 + ,13 + ,15 + ,3 + ,2 + ,5 + ,35 + ,41 + ,15 + ,13 + ,5 + ,2 + ,5 + ,32 + ,28 + ,14 + ,15 + ,5 + ,2 + ,6 + ,29 + ,30 + ,13 + ,10 + ,5 + ,2 + ,6 + ,39 + ,36 + ,16 + ,11 + ,4 + ,2 + ,5 + ,37 + ,35 + ,12 + ,16 + ,4 + ,2 + ,6 + ,35 + ,31 + ,14 + ,11 + ,4 + ,1 + ,5 + ,37 + ,34 + ,17 + ,11 + ,4 + ,1 + ,7 + ,32 + ,36 + ,15 + ,10 + ,4 + ,2 + ,5 + ,38 + ,36 + ,17 + ,10 + ,4 + ,1 + ,6 + ,37 + ,35 + ,12 + ,16 + ,4 + ,2 + ,6 + ,36 + ,37 + ,16 + ,12 + ,5 + ,1 + ,6 + ,32 + ,28 + ,11 + ,11 + ,4 + ,2 + ,4 + ,33 + ,39 + ,15 + ,16 + ,4 + ,1 + ,5 + ,40 + ,32 + ,9 + ,19 + ,3 + ,2 + ,5 + ,38 + ,35 + ,16 + ,11 + ,5 + ,1 + ,7 + ,41 + ,39 + ,15 + ,16 + ,4 + ,1 + ,6 + ,36 + ,35 + ,10 + ,15 + ,3 + ,2 + ,9 + ,43 + ,42 + ,10 + ,24 + ,2 + ,2 + ,6 + ,30 + ,34 + ,15 + ,14 + ,5 + ,2 + ,6 + ,31 + ,33 + ,11 + ,15 + ,4 + ,2 + ,5 + ,32 + ,41 + ,13 + ,11 + ,5 + ,1 + ,6 + ,32 + ,33 + ,14 + ,15 + ,1 + ,2 + ,5 + ,37 + ,34 + ,18 + ,12 + ,5 + ,1 + ,8 + ,37 + ,32 + ,16 + ,10 + ,5 + ,2 + ,7 + ,33 + ,40 + ,14 + ,14 + ,3 + ,2 + ,5 + ,34 + ,40 + ,14 + ,13 + ,4 + ,2 + ,7 + ,33 + ,35 + ,14 + ,9 + ,5 + ,2 + ,6 + ,38 + ,36 + ,14 + ,15 + ,5 + ,2 + ,6 + ,33 + ,37 + ,12 + ,15 + ,3 + ,2 + ,9 + ,31 + ,27 + ,14 + ,14 + ,4 + ,2 + ,7 + ,38 + ,39 + ,15 + ,11 + ,5 + ,2 + ,6 + ,37 + ,38 + ,15 + ,8 + ,4 + ,2 + ,5 + ,33 + ,31 + ,15 + ,11 + ,4 + ,2 + ,5 + ,31 + ,33 + ,13 + ,11 + ,4 + ,1 + ,6 + ,39 + ,32 + ,17 + ,8 + ,5 + ,2 + ,6 + ,44 + ,39 + ,17 + ,10 + ,4 + ,2 + ,7 + ,33 + ,36 + ,19 + ,11 + ,5 + ,2 + ,5 + ,35 + ,33 + ,15 + ,13 + ,4 + ,1 + ,5 + ,32 + ,33 + ,13 + ,11 + ,4 + ,1 + ,5 + ,28 + ,32 + ,9 + ,20 + ,4 + ,2 + ,6 + ,40 + ,37 + ,15 + ,10 + ,4 + ,1 + ,4 + ,27 + ,30 + ,15 + ,15 + ,3 + ,1 + ,5 + ,37 + ,38 + ,15 + ,12 + ,4 + ,2 + ,7 + ,32 + ,29 + ,16 + ,14 + ,5 + ,1 + ,5 + ,28 + ,22 + ,11 + ,23 + ,3 + ,1 + ,7 + ,34 + ,35 + ,14 + ,14 + ,4 + ,2 + ,7 + ,30 + ,35 + ,11 + ,16 + ,3 + ,2 + ,6 + ,35 + ,34 + ,15 + ,11 + ,4 + ,1 + ,5 + ,31 + ,35 + ,13 + ,12 + ,3 + ,2 + ,8 + ,32 + ,34 + ,15 + ,10 + ,3 + ,1 + ,5 + ,30 + ,34 + ,16 + ,14 + ,5 + ,2 + ,5 + ,30 + ,35 + ,14 + ,12 + ,5 + ,1 + ,5 + ,31 + ,23 + ,15 + ,12 + ,5 + ,2 + ,6 + ,40 + ,31 + ,16 + ,11 + ,5 + ,2 + ,4 + ,32 + ,27 + ,16 + ,12 + ,5 + ,1 + ,5 + ,36 + ,36 + ,11 + ,13 + ,4 + ,1 + ,5 + ,32 + ,31 + ,12 + ,11 + ,4 + ,1 + ,7 + ,35 + ,32 + ,9 + ,19 + ,4 + ,2 + ,6 + ,38 + ,39 + ,16 + ,12 + ,5 + ,2 + ,7 + ,42 + ,37 + ,13 + ,17 + ,5 + ,1 + ,10 + ,34 + ,38 + ,16 + ,9 + ,4 + ,2 + ,6 + ,35 + ,39 + ,12 + ,12 + ,4 + ,2 + ,8 + ,35 + ,34 + ,9 + ,19 + ,4 + ,2 + ,4 + ,33 + ,31 + ,13 + ,18 + ,5 + ,2 + ,5 + ,36 + ,32 + ,13 + ,15 + ,3 + ,2 + ,6 + ,32 + ,37 + ,14 + ,14 + ,4 + ,2 + ,7 + ,33 + ,36 + ,19 + ,11 + ,5 + ,2 + ,7 + ,34 + ,32 + ,13 + ,9 + ,5 + ,2 + ,6 + ,32 + ,35 + ,12 + ,18 + ,5 + ,2 + ,6 + ,34 + ,36 + ,13 + ,16 + ,5) + ,dim=c(7 + ,162) + ,dimnames=list(c('X_1t' + ,'X_2t' + ,'X_3t' + ,'X_4t' + ,'X_5t' + ,'X_6t' + ,'Y_t') + ,1:162)) > y <- array(NA,dim=c(7,162),dimnames=list(c('X_1t','X_2t','X_3t','X_4t','X_5t','X_6t','Y_t'),1:162)) > 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 = '7' > par3 <- 'No Linear Trend' > par2 <- 'Do not include Seasonal Dummies' > par1 <- '7' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), Multiple Regression (v1.0.29) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_multipleregression.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, 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_t X_1t X_2t X_3t X_4t X_5t X_6t 1 3 2 7 41 38 14 12 2 5 2 5 39 32 18 11 3 4 2 5 30 35 11 14 4 4 1 5 31 33 12 12 5 5 2 8 34 37 16 21 6 5 2 6 35 29 18 12 7 2 2 5 39 31 14 22 8 5 2 6 34 36 14 11 9 4 2 5 36 35 15 10 10 4 2 4 37 38 15 13 11 5 1 6 38 31 17 10 12 3 2 5 36 34 19 8 13 5 1 5 38 35 10 15 14 3 2 6 39 38 16 14 15 5 2 7 33 37 18 10 16 3 1 6 32 33 14 14 17 4 1 7 36 32 14 14 18 5 2 6 38 38 17 11 19 4 1 8 39 38 14 10 20 3 2 7 32 32 16 13 21 4 1 5 32 33 18 7 22 4 2 5 31 31 11 14 23 3 2 7 39 38 14 12 24 3 2 7 37 39 12 14 25 4 1 5 39 32 17 11 26 5 2 4 41 32 9 9 27 4 1 10 36 35 16 11 28 4 2 6 33 37 14 15 29 4 2 5 33 33 15 14 30 4 1 5 34 33 11 13 31 4 2 5 31 28 16 9 32 3 1 5 27 32 13 15 33 4 2 6 37 31 17 10 34 5 2 5 34 37 15 11 35 4 1 5 34 30 14 13 36 4 1 5 32 33 16 8 37 3 1 5 29 31 9 20 38 4 1 5 36 33 15 12 39 4 2 5 29 31 17 10 40 4 1 5 35 33 13 10 41 5 1 5 37 32 15 9 42 4 2 7 34 33 16 14 43 3 1 5 38 32 16 8 44 3 1 6 35 33 12 14 45 4 2 7 38 28 12 11 46 4 2 7 37 35 11 13 47 4 2 5 38 39 15 9 48 5 2 5 33 34 15 11 49 4 2 4 36 38 17 15 50 5 1 5 38 32 13 11 51 4 2 4 32 38 16 10 52 4 1 5 32 30 14 14 53 4 1 5 32 33 11 18 54 4 2 7 34 38 12 14 55 4 1 5 32 32 12 11 56 5 2 5 37 32 15 12 57 4 2 6 39 34 16 13 58 4 2 4 29 34 15 9 59 4 1 6 37 36 12 10 60 4 2 6 35 34 12 15 61 3 1 5 30 28 8 20 62 4 1 7 38 34 13 12 63 5 2 6 34 35 11 12 64 1 2 8 31 35 14 14 65 3 2 7 34 31 15 13 66 5 1 5 35 37 10 11 67 4 2 6 36 35 11 17 68 4 1 6 30 27 12 12 69 3 2 5 39 40 15 13 70 4 1 5 35 37 15 14 71 4 1 5 38 36 14 13 72 3 2 5 31 38 16 15 73 5 2 4 34 39 15 13 74 4 1 6 38 41 15 10 75 5 1 6 34 27 13 11 76 4 2 6 39 30 12 19 77 4 2 6 37 37 17 13 78 4 2 7 34 31 13 17 79 4 1 5 28 31 15 13 80 3 1 7 37 27 13 9 81 5 1 6 33 36 15 11 82 NA 1 5 37 38 16 10 83 5 2 5 35 37 15 9 84 4 1 4 37 33 16 12 85 4 2 8 32 34 15 12 86 5 2 8 33 31 14 13 87 4 1 5 38 39 15 13 88 4 2 5 33 34 14 12 89 3 2 6 29 32 13 15 90 4 2 4 33 33 7 22 91 4 2 5 31 36 17 13 92 3 2 5 36 32 13 15 93 5 2 5 35 41 15 13 94 5 2 5 32 28 14 15 95 5 2 6 29 30 13 10 96 4 2 6 39 36 16 11 97 4 2 5 37 35 12 16 98 4 2 6 35 31 14 11 99 4 1 5 37 34 17 11 100 4 1 7 32 36 15 10 101 4 2 5 38 36 17 10 102 4 1 6 37 35 12 16 103 5 2 6 36 37 16 12 104 4 1 6 32 28 11 11 105 4 2 4 33 39 15 16 106 3 1 5 40 32 9 19 107 5 2 5 38 35 16 11 108 4 1 7 41 39 15 16 109 3 1 6 36 35 10 15 110 2 2 9 43 42 10 24 111 5 2 6 30 34 15 14 112 4 2 6 31 33 11 15 113 5 2 5 32 41 13 11 114 1 1 6 32 33 14 15 115 5 2 5 37 34 18 12 116 5 1 8 37 32 16 10 117 3 2 7 33 40 14 14 118 4 2 5 34 40 14 13 119 5 2 7 33 35 14 9 120 5 2 6 38 36 14 15 121 3 2 6 33 37 12 15 122 4 2 9 31 27 14 14 123 5 2 7 38 39 15 11 124 4 2 6 37 38 15 8 125 4 2 5 33 31 15 11 126 4 2 5 31 33 13 11 127 5 1 6 39 32 17 8 128 4 2 6 44 39 17 10 129 5 2 7 33 36 19 11 130 4 2 5 35 33 15 13 131 4 1 5 32 33 13 11 132 4 1 5 28 32 9 20 133 4 2 6 40 37 15 10 134 3 1 4 27 30 15 15 135 4 1 5 37 38 15 12 136 5 2 7 32 29 16 14 137 3 1 5 28 22 11 23 138 4 1 7 34 35 14 14 139 3 2 7 30 35 11 16 140 4 2 6 35 34 15 11 141 3 1 5 31 35 13 12 142 3 2 8 32 34 15 10 143 5 1 5 30 34 16 14 144 5 2 5 30 35 14 12 145 5 1 5 31 23 15 12 146 5 2 6 40 31 16 11 147 5 2 4 32 27 16 12 148 4 1 5 36 36 11 13 149 4 1 5 32 31 12 11 150 4 1 7 35 32 9 19 151 5 2 6 38 39 16 12 152 5 2 7 42 37 13 17 153 4 1 10 34 38 16 9 154 4 2 6 35 39 12 12 155 4 2 8 35 34 9 19 156 5 2 4 33 31 13 18 157 3 2 5 36 32 13 15 158 4 2 6 32 37 14 14 159 5 2 7 33 36 19 11 160 5 2 7 34 32 13 9 161 5 2 6 32 35 12 18 162 5 2 6 34 36 13 16 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X_1t X_2t X_3t X_4t X_5t 4.86568 0.24504 -0.07269 0.01418 -0.01670 0.01578 X_6t -0.07144 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.85016 -0.40256 0.02114 0.64157 1.60924 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.86568 0.94774 5.134 8.45e-07 *** X_1t 0.24504 0.13113 1.869 0.06357 . X_2t -0.07269 0.05224 -1.391 0.16612 X_3t 0.01418 0.01927 0.736 0.46282 X_4t -0.01670 0.01871 -0.893 0.37350 X_5t 0.01578 0.03153 0.500 0.61756 X_6t -0.07144 0.02285 -3.126 0.00212 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7562 on 154 degrees of freedom (1 observation deleted due to missingness) Multiple R-squared: 0.1314, Adjusted R-squared: 0.09759 F-statistic: 3.884 on 6 and 154 DF, p-value: 0.001223 > 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.2320060 0.46401203 0.76799399 [2,] 0.1503966 0.30079311 0.84960345 [3,] 0.9517027 0.09659463 0.04829731 [4,] 0.9782621 0.04347571 0.02173786 [5,] 0.9758496 0.04830085 0.02415043 [6,] 0.9601425 0.07971501 0.03985751 [7,] 0.9898323 0.02033535 0.01016768 [8,] 0.9845533 0.03089343 0.01544672 [9,] 0.9833915 0.03321702 0.01660851 [10,] 0.9774813 0.04503749 0.02251874 [11,] 0.9869046 0.02619083 0.01309541 [12,] 0.9833090 0.03338193 0.01669096 [13,] 0.9746224 0.05075512 0.02537756 [14,] 0.9786798 0.04264036 0.02132018 [15,] 0.9768345 0.04633097 0.02316548 [16,] 0.9664369 0.06712630 0.03356315 [17,] 0.9705648 0.05887032 0.02943516 [18,] 0.9585453 0.08290946 0.04145473 [19,] 0.9431633 0.11367349 0.05683675 [20,] 0.9229988 0.15400250 0.07700125 [21,] 0.8979374 0.20412510 0.10206255 [22,] 0.8785186 0.24296276 0.12148138 [23,] 0.8787414 0.24251713 0.12125857 [24,] 0.8521927 0.29561462 0.14780731 [25,] 0.8571080 0.28578407 0.14289204 [26,] 0.8215388 0.35692232 0.17846116 [27,] 0.7876152 0.42476961 0.21238480 [28,] 0.7513556 0.49728889 0.24864444 [29,] 0.7043173 0.59136545 0.29568272 [30,] 0.6613315 0.67733701 0.33866850 [31,] 0.6105665 0.77886695 0.38943348 [32,] 0.6017140 0.79657207 0.39828604 [33,] 0.5494306 0.90113889 0.45056944 [34,] 0.6617734 0.67645317 0.33822659 [35,] 0.6621525 0.67569508 0.33784754 [36,] 0.6175499 0.76490021 0.38245010 [37,] 0.5661750 0.86765002 0.43382501 [38,] 0.5277938 0.94441247 0.47220624 [39,] 0.5315094 0.93698124 0.46849062 [40,] 0.4822663 0.96453270 0.51773365 [41,] 0.5055437 0.98891257 0.49445629 [42,] 0.4651126 0.93022524 0.53488738 [43,] 0.4170594 0.83411889 0.58294055 [44,] 0.3870759 0.77415184 0.61292408 [45,] 0.3408081 0.68161619 0.65919191 [46,] 0.2960912 0.59218247 0.70390876 [47,] 0.2986803 0.59736063 0.70131968 [48,] 0.2600001 0.52000026 0.73999987 [49,] 0.2336162 0.46723240 0.76638380 [50,] 0.1977940 0.39558806 0.80220597 [51,] 0.1657469 0.33149371 0.83425315 [52,] 0.1443314 0.28866273 0.85566864 [53,] 0.1183125 0.23662495 0.88168753 [54,] 0.1284633 0.25692652 0.87153674 [55,] 0.6365809 0.72683821 0.36341911 [56,] 0.6730538 0.65389233 0.32694616 [57,] 0.7029618 0.59407644 0.29703822 [58,] 0.6653803 0.66923934 0.33461967 [59,] 0.6237686 0.75246275 0.37623138 [60,] 0.6900234 0.61995326 0.30997663 [61,] 0.6482814 0.70343714 0.35171857 [62,] 0.6037760 0.79244801 0.39622401 [63,] 0.6342244 0.73155118 0.36577559 [64,] 0.6433206 0.71335873 0.35667937 [65,] 0.5997181 0.80056384 0.40028192 [66,] 0.6235165 0.75296696 0.37648348 [67,] 0.5831209 0.83375828 0.41687914 [68,] 0.5475501 0.90489986 0.45244993 [69,] 0.5102251 0.97954972 0.48977486 [70,] 0.4657626 0.93152529 0.53423735 [71,] 0.5351427 0.92971455 0.46485728 [72,] 0.5756919 0.84861618 0.42430809 [73,] 0.5563154 0.88736915 0.44368458 [74,] 0.5144546 0.97109079 0.48554539 [75,] 0.4757751 0.95155023 0.52422489 [76,] 0.5146437 0.97071259 0.48535629 [77,] 0.4680929 0.93618586 0.53190707 [78,] 0.4282796 0.85655918 0.57172041 [79,] 0.4577774 0.91555479 0.54222260 [80,] 0.4336899 0.86737982 0.56631009 [81,] 0.4012075 0.80241509 0.59879245 [82,] 0.4628864 0.92577287 0.53711356 [83,] 0.4768615 0.95372310 0.52313845 [84,] 0.4888453 0.97769061 0.51115469 [85,] 0.4801481 0.96029618 0.51985191 [86,] 0.4506051 0.90121028 0.54939486 [87,] 0.4039535 0.80790693 0.59604653 [88,] 0.3735387 0.74707739 0.62646130 [89,] 0.3353730 0.67074602 0.66462699 [90,] 0.2927762 0.58555242 0.70722379 [91,] 0.2844270 0.56885392 0.71557304 [92,] 0.2541680 0.50833607 0.74583197 [93,] 0.2496151 0.49923015 0.75038492 [94,] 0.2131078 0.42621569 0.78689215 [95,] 0.1806595 0.36131896 0.81934052 [96,] 0.1639031 0.32780621 0.83609689 [97,] 0.1468868 0.29377355 0.85311323 [98,] 0.1248851 0.24977013 0.87511493 [99,] 0.1152183 0.23043668 0.88478166 [100,] 0.1643620 0.32872397 0.83563802 [101,] 0.1779018 0.35580357 0.82209822 [102,] 0.1472970 0.29459400 0.85270300 [103,] 0.1684695 0.33693901 0.83153050 [104,] 0.7970895 0.40582098 0.20291049 [105,] 0.7697712 0.46045765 0.23022882 [106,] 0.7654101 0.46917988 0.23458994 [107,] 0.8045397 0.39092060 0.19546030 [108,] 0.7668833 0.46623343 0.23311671 [109,] 0.7850763 0.42984733 0.21492366 [110,] 0.7791931 0.44161386 0.22080693 [111,] 0.8123944 0.37521119 0.18760560 [112,] 0.7789361 0.44212780 0.22106390 [113,] 0.7686961 0.46260771 0.23130386 [114,] 0.7335852 0.53282968 0.26641484 [115,] 0.6992210 0.60155794 0.30077897 [116,] 0.6478407 0.70431852 0.35215926 [117,] 0.6232893 0.75342150 0.37671075 [118,] 0.6445334 0.71093318 0.35546659 [119,] 0.6037652 0.79246958 0.39623479 [120,] 0.5785217 0.84295659 0.42147829 [121,] 0.5182972 0.96340568 0.48170284 [122,] 0.5063307 0.98733860 0.49366930 [123,] 0.5139382 0.97212354 0.48606177 [124,] 0.5634850 0.87303000 0.43651500 [125,] 0.5285460 0.94290793 0.47145396 [126,] 0.5005943 0.99881139 0.49940570 [127,] 0.5856153 0.82876947 0.41438473 [128,] 0.5241956 0.95160887 0.47580443 [129,] 0.5489480 0.90210394 0.45105197 [130,] 0.5035563 0.99288745 0.49644372 [131,] 0.6093522 0.78129565 0.39064783 [132,] 0.8092199 0.38156018 0.19078009 [133,] 0.7678114 0.46437721 0.23218860 [134,] 0.7334856 0.53302878 0.26651439 [135,] 0.6747745 0.65045095 0.32522547 [136,] 0.5855346 0.82893081 0.41446540 [137,] 0.4913600 0.98272005 0.50863997 [138,] 0.3880243 0.77604857 0.61197571 [139,] 0.2956821 0.59136420 0.70431790 [140,] 0.2262347 0.45246935 0.77376533 [141,] 0.1545527 0.30910542 0.84544729 [142,] 0.2732383 0.54647655 0.72676172 [143,] 0.1419475 0.28389497 0.85805252 > postscript(file="/var/wessaorg/rcomp/tmp/1dc8u1383232324.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) Warning message: In x[, 1] - mysum$resid : longer object length is not a multiple of shorter object length > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/258141383232324.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/3det31383232324.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/4nkkm1383232324.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/5a14j1383232324.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 = 161 Frequency = 1 1 2 3 4 5 6 -1.157447270 0.490809395 -0.006705322 0.032099279 1.609238912 0.641571102 7 8 9 10 11 12 -1.676913345 0.764296641 -0.440668403 -0.263116829 0.750355699 -1.663357294 13 14 15 16 17 18 1.212107195 -1.090439969 0.733312277 -0.798063485 0.201201648 0.693636839 19 20 21 22 23 24 0.045758097 -1.090111746 -0.433954375 -0.087675164 -1.129085160 -0.909587478 25 26 27 28 29 30 -0.248372180 0.388865607 0.223471982 0.080945010 -0.145749515 0.076775303 31 32 33 34 35 36 -0.573862695 -0.729322770 -0.480505013 0.692530630 -0.020646264 -0.330958528 37 38 39 40 41 42 -0.354062794 -0.086135971 -0.439743125 -0.183286657 0.668658189 -0.030334130 43 44 45 46 47 48 -1.432742054 -0.809053332 -0.321765285 -0.032042135 -0.473684254 0.656620094 49 50 51 52 53 54 -0.137604033 0.828915511 -0.422315802 0.079158375 0.462350059 0.116258490 55 56 57 58 59 60 -0.070221502 0.637944010 -0.228671286 -0.502227295 -0.073093968 0.034044628 61 62 63 64 65 66 -0.402558781 0.079125533 0.866371950 -2.850156705 -1.119394394 1.002274636 67 68 69 70 71 72 0.195222487 0.018783702 -1.185397995 0.137718929 0.022812698 -0.978235551 73 74 75 76 77 78 0.796123532 -0.051119015 0.874840295 0.196301738 -0.165994244 0.197929041 79 80 81 83 84 85 0.065360602 -1.237901378 1.007742804 0.535464516 -0.188780235 -0.039696674 86 87 88 89 90 91 0.983249869 0.057127629 -0.256160718 -0.930040096 0.479317440 -0.170291662 92 93 94 95 96 97 -1.101994029 0.888023421 0.872164744 0.679352864 -0.338161950 0.021135695 98 99 100 101 102 103 -0.333370398 -0.186615676 0.023167879 -0.483886633 0.338864011 0.792520940 104 105 106 107 108 109 -0.048547081 0.024632175 -0.564799729 0.586635358 0.374285152 -0.686844146 110 111 112 113 114 115 -1.053230506 0.986177395 0.089848309 0.819234844 -2.726620956 0.624008427 116 117 118 119 120 121 0.942383708 -0.867719379 -0.098716063 0.691581990 0.993342539 -0.887501672 122 123 124 125 126 127 0.088952270 0.814573903 -0.474956376 -0.393471497 -0.300161676 0.609986782 128 129 130 131 132 133 -0.446194822 0.772280951 -0.245554154 -0.069300964 0.676815457 -0.391311679 134 135 136 137 138 139 -0.866957031 -0.016831042 0.931239192 -0.307382241 0.279655348 -0.718447164 140 141 142 143 144 145 -0.299055466 -0.950282986 -1.182581732 1.142755954 0.803079643 0.817797334 146 147 148 149 150 151 0.564171011 0.536900092 0.098504784 -0.086918699 0.651478644 0.797553224 152 153 154 155 156 157 1.184663784 0.159040623 -0.096796976 0.512517820 1.065492976 -1.101994029 158 159 160 161 162 0.023683535 0.772280951 0.643086004 1.307612576 1.137285946 > postscript(file="/var/wessaorg/rcomp/tmp/69du41383232324.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 = 161 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.157447270 NA 1 0.490809395 -1.157447270 2 -0.006705322 0.490809395 3 0.032099279 -0.006705322 4 1.609238912 0.032099279 5 0.641571102 1.609238912 6 -1.676913345 0.641571102 7 0.764296641 -1.676913345 8 -0.440668403 0.764296641 9 -0.263116829 -0.440668403 10 0.750355699 -0.263116829 11 -1.663357294 0.750355699 12 1.212107195 -1.663357294 13 -1.090439969 1.212107195 14 0.733312277 -1.090439969 15 -0.798063485 0.733312277 16 0.201201648 -0.798063485 17 0.693636839 0.201201648 18 0.045758097 0.693636839 19 -1.090111746 0.045758097 20 -0.433954375 -1.090111746 21 -0.087675164 -0.433954375 22 -1.129085160 -0.087675164 23 -0.909587478 -1.129085160 24 -0.248372180 -0.909587478 25 0.388865607 -0.248372180 26 0.223471982 0.388865607 27 0.080945010 0.223471982 28 -0.145749515 0.080945010 29 0.076775303 -0.145749515 30 -0.573862695 0.076775303 31 -0.729322770 -0.573862695 32 -0.480505013 -0.729322770 33 0.692530630 -0.480505013 34 -0.020646264 0.692530630 35 -0.330958528 -0.020646264 36 -0.354062794 -0.330958528 37 -0.086135971 -0.354062794 38 -0.439743125 -0.086135971 39 -0.183286657 -0.439743125 40 0.668658189 -0.183286657 41 -0.030334130 0.668658189 42 -1.432742054 -0.030334130 43 -0.809053332 -1.432742054 44 -0.321765285 -0.809053332 45 -0.032042135 -0.321765285 46 -0.473684254 -0.032042135 47 0.656620094 -0.473684254 48 -0.137604033 0.656620094 49 0.828915511 -0.137604033 50 -0.422315802 0.828915511 51 0.079158375 -0.422315802 52 0.462350059 0.079158375 53 0.116258490 0.462350059 54 -0.070221502 0.116258490 55 0.637944010 -0.070221502 56 -0.228671286 0.637944010 57 -0.502227295 -0.228671286 58 -0.073093968 -0.502227295 59 0.034044628 -0.073093968 60 -0.402558781 0.034044628 61 0.079125533 -0.402558781 62 0.866371950 0.079125533 63 -2.850156705 0.866371950 64 -1.119394394 -2.850156705 65 1.002274636 -1.119394394 66 0.195222487 1.002274636 67 0.018783702 0.195222487 68 -1.185397995 0.018783702 69 0.137718929 -1.185397995 70 0.022812698 0.137718929 71 -0.978235551 0.022812698 72 0.796123532 -0.978235551 73 -0.051119015 0.796123532 74 0.874840295 -0.051119015 75 0.196301738 0.874840295 76 -0.165994244 0.196301738 77 0.197929041 -0.165994244 78 0.065360602 0.197929041 79 -1.237901378 0.065360602 80 1.007742804 -1.237901378 81 0.535464516 1.007742804 82 -0.188780235 0.535464516 83 -0.039696674 -0.188780235 84 0.983249869 -0.039696674 85 0.057127629 0.983249869 86 -0.256160718 0.057127629 87 -0.930040096 -0.256160718 88 0.479317440 -0.930040096 89 -0.170291662 0.479317440 90 -1.101994029 -0.170291662 91 0.888023421 -1.101994029 92 0.872164744 0.888023421 93 0.679352864 0.872164744 94 -0.338161950 0.679352864 95 0.021135695 -0.338161950 96 -0.333370398 0.021135695 97 -0.186615676 -0.333370398 98 0.023167879 -0.186615676 99 -0.483886633 0.023167879 100 0.338864011 -0.483886633 101 0.792520940 0.338864011 102 -0.048547081 0.792520940 103 0.024632175 -0.048547081 104 -0.564799729 0.024632175 105 0.586635358 -0.564799729 106 0.374285152 0.586635358 107 -0.686844146 0.374285152 108 -1.053230506 -0.686844146 109 0.986177395 -1.053230506 110 0.089848309 0.986177395 111 0.819234844 0.089848309 112 -2.726620956 0.819234844 113 0.624008427 -2.726620956 114 0.942383708 0.624008427 115 -0.867719379 0.942383708 116 -0.098716063 -0.867719379 117 0.691581990 -0.098716063 118 0.993342539 0.691581990 119 -0.887501672 0.993342539 120 0.088952270 -0.887501672 121 0.814573903 0.088952270 122 -0.474956376 0.814573903 123 -0.393471497 -0.474956376 124 -0.300161676 -0.393471497 125 0.609986782 -0.300161676 126 -0.446194822 0.609986782 127 0.772280951 -0.446194822 128 -0.245554154 0.772280951 129 -0.069300964 -0.245554154 130 0.676815457 -0.069300964 131 -0.391311679 0.676815457 132 -0.866957031 -0.391311679 133 -0.016831042 -0.866957031 134 0.931239192 -0.016831042 135 -0.307382241 0.931239192 136 0.279655348 -0.307382241 137 -0.718447164 0.279655348 138 -0.299055466 -0.718447164 139 -0.950282986 -0.299055466 140 -1.182581732 -0.950282986 141 1.142755954 -1.182581732 142 0.803079643 1.142755954 143 0.817797334 0.803079643 144 0.564171011 0.817797334 145 0.536900092 0.564171011 146 0.098504784 0.536900092 147 -0.086918699 0.098504784 148 0.651478644 -0.086918699 149 0.797553224 0.651478644 150 1.184663784 0.797553224 151 0.159040623 1.184663784 152 -0.096796976 0.159040623 153 0.512517820 -0.096796976 154 1.065492976 0.512517820 155 -1.101994029 1.065492976 156 0.023683535 -1.101994029 157 0.772280951 0.023683535 158 0.643086004 0.772280951 159 1.307612576 0.643086004 160 1.137285946 1.307612576 161 NA 1.137285946 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.490809395 -1.157447270 [2,] -0.006705322 0.490809395 [3,] 0.032099279 -0.006705322 [4,] 1.609238912 0.032099279 [5,] 0.641571102 1.609238912 [6,] -1.676913345 0.641571102 [7,] 0.764296641 -1.676913345 [8,] -0.440668403 0.764296641 [9,] -0.263116829 -0.440668403 [10,] 0.750355699 -0.263116829 [11,] -1.663357294 0.750355699 [12,] 1.212107195 -1.663357294 [13,] -1.090439969 1.212107195 [14,] 0.733312277 -1.090439969 [15,] -0.798063485 0.733312277 [16,] 0.201201648 -0.798063485 [17,] 0.693636839 0.201201648 [18,] 0.045758097 0.693636839 [19,] -1.090111746 0.045758097 [20,] -0.433954375 -1.090111746 [21,] -0.087675164 -0.433954375 [22,] -1.129085160 -0.087675164 [23,] -0.909587478 -1.129085160 [24,] -0.248372180 -0.909587478 [25,] 0.388865607 -0.248372180 [26,] 0.223471982 0.388865607 [27,] 0.080945010 0.223471982 [28,] -0.145749515 0.080945010 [29,] 0.076775303 -0.145749515 [30,] -0.573862695 0.076775303 [31,] -0.729322770 -0.573862695 [32,] -0.480505013 -0.729322770 [33,] 0.692530630 -0.480505013 [34,] -0.020646264 0.692530630 [35,] -0.330958528 -0.020646264 [36,] -0.354062794 -0.330958528 [37,] -0.086135971 -0.354062794 [38,] -0.439743125 -0.086135971 [39,] -0.183286657 -0.439743125 [40,] 0.668658189 -0.183286657 [41,] -0.030334130 0.668658189 [42,] -1.432742054 -0.030334130 [43,] -0.809053332 -1.432742054 [44,] -0.321765285 -0.809053332 [45,] -0.032042135 -0.321765285 [46,] -0.473684254 -0.032042135 [47,] 0.656620094 -0.473684254 [48,] -0.137604033 0.656620094 [49,] 0.828915511 -0.137604033 [50,] -0.422315802 0.828915511 [51,] 0.079158375 -0.422315802 [52,] 0.462350059 0.079158375 [53,] 0.116258490 0.462350059 [54,] -0.070221502 0.116258490 [55,] 0.637944010 -0.070221502 [56,] -0.228671286 0.637944010 [57,] -0.502227295 -0.228671286 [58,] -0.073093968 -0.502227295 [59,] 0.034044628 -0.073093968 [60,] -0.402558781 0.034044628 [61,] 0.079125533 -0.402558781 [62,] 0.866371950 0.079125533 [63,] -2.850156705 0.866371950 [64,] -1.119394394 -2.850156705 [65,] 1.002274636 -1.119394394 [66,] 0.195222487 1.002274636 [67,] 0.018783702 0.195222487 [68,] -1.185397995 0.018783702 [69,] 0.137718929 -1.185397995 [70,] 0.022812698 0.137718929 [71,] -0.978235551 0.022812698 [72,] 0.796123532 -0.978235551 [73,] -0.051119015 0.796123532 [74,] 0.874840295 -0.051119015 [75,] 0.196301738 0.874840295 [76,] -0.165994244 0.196301738 [77,] 0.197929041 -0.165994244 [78,] 0.065360602 0.197929041 [79,] -1.237901378 0.065360602 [80,] 1.007742804 -1.237901378 [81,] 0.535464516 1.007742804 [82,] -0.188780235 0.535464516 [83,] -0.039696674 -0.188780235 [84,] 0.983249869 -0.039696674 [85,] 0.057127629 0.983249869 [86,] -0.256160718 0.057127629 [87,] -0.930040096 -0.256160718 [88,] 0.479317440 -0.930040096 [89,] -0.170291662 0.479317440 [90,] -1.101994029 -0.170291662 [91,] 0.888023421 -1.101994029 [92,] 0.872164744 0.888023421 [93,] 0.679352864 0.872164744 [94,] -0.338161950 0.679352864 [95,] 0.021135695 -0.338161950 [96,] -0.333370398 0.021135695 [97,] -0.186615676 -0.333370398 [98,] 0.023167879 -0.186615676 [99,] -0.483886633 0.023167879 [100,] 0.338864011 -0.483886633 [101,] 0.792520940 0.338864011 [102,] -0.048547081 0.792520940 [103,] 0.024632175 -0.048547081 [104,] -0.564799729 0.024632175 [105,] 0.586635358 -0.564799729 [106,] 0.374285152 0.586635358 [107,] -0.686844146 0.374285152 [108,] -1.053230506 -0.686844146 [109,] 0.986177395 -1.053230506 [110,] 0.089848309 0.986177395 [111,] 0.819234844 0.089848309 [112,] -2.726620956 0.819234844 [113,] 0.624008427 -2.726620956 [114,] 0.942383708 0.624008427 [115,] -0.867719379 0.942383708 [116,] -0.098716063 -0.867719379 [117,] 0.691581990 -0.098716063 [118,] 0.993342539 0.691581990 [119,] -0.887501672 0.993342539 [120,] 0.088952270 -0.887501672 [121,] 0.814573903 0.088952270 [122,] -0.474956376 0.814573903 [123,] -0.393471497 -0.474956376 [124,] -0.300161676 -0.393471497 [125,] 0.609986782 -0.300161676 [126,] -0.446194822 0.609986782 [127,] 0.772280951 -0.446194822 [128,] -0.245554154 0.772280951 [129,] -0.069300964 -0.245554154 [130,] 0.676815457 -0.069300964 [131,] -0.391311679 0.676815457 [132,] -0.866957031 -0.391311679 [133,] -0.016831042 -0.866957031 [134,] 0.931239192 -0.016831042 [135,] -0.307382241 0.931239192 [136,] 0.279655348 -0.307382241 [137,] -0.718447164 0.279655348 [138,] -0.299055466 -0.718447164 [139,] -0.950282986 -0.299055466 [140,] -1.182581732 -0.950282986 [141,] 1.142755954 -1.182581732 [142,] 0.803079643 1.142755954 [143,] 0.817797334 0.803079643 [144,] 0.564171011 0.817797334 [145,] 0.536900092 0.564171011 [146,] 0.098504784 0.536900092 [147,] -0.086918699 0.098504784 [148,] 0.651478644 -0.086918699 [149,] 0.797553224 0.651478644 [150,] 1.184663784 0.797553224 [151,] 0.159040623 1.184663784 [152,] -0.096796976 0.159040623 [153,] 0.512517820 -0.096796976 [154,] 1.065492976 0.512517820 [155,] -1.101994029 1.065492976 [156,] 0.023683535 -1.101994029 [157,] 0.772280951 0.023683535 [158,] 0.643086004 0.772280951 [159,] 1.307612576 0.643086004 [160,] 1.137285946 1.307612576 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.490809395 -1.157447270 2 -0.006705322 0.490809395 3 0.032099279 -0.006705322 4 1.609238912 0.032099279 5 0.641571102 1.609238912 6 -1.676913345 0.641571102 7 0.764296641 -1.676913345 8 -0.440668403 0.764296641 9 -0.263116829 -0.440668403 10 0.750355699 -0.263116829 11 -1.663357294 0.750355699 12 1.212107195 -1.663357294 13 -1.090439969 1.212107195 14 0.733312277 -1.090439969 15 -0.798063485 0.733312277 16 0.201201648 -0.798063485 17 0.693636839 0.201201648 18 0.045758097 0.693636839 19 -1.090111746 0.045758097 20 -0.433954375 -1.090111746 21 -0.087675164 -0.433954375 22 -1.129085160 -0.087675164 23 -0.909587478 -1.129085160 24 -0.248372180 -0.909587478 25 0.388865607 -0.248372180 26 0.223471982 0.388865607 27 0.080945010 0.223471982 28 -0.145749515 0.080945010 29 0.076775303 -0.145749515 30 -0.573862695 0.076775303 31 -0.729322770 -0.573862695 32 -0.480505013 -0.729322770 33 0.692530630 -0.480505013 34 -0.020646264 0.692530630 35 -0.330958528 -0.020646264 36 -0.354062794 -0.330958528 37 -0.086135971 -0.354062794 38 -0.439743125 -0.086135971 39 -0.183286657 -0.439743125 40 0.668658189 -0.183286657 41 -0.030334130 0.668658189 42 -1.432742054 -0.030334130 43 -0.809053332 -1.432742054 44 -0.321765285 -0.809053332 45 -0.032042135 -0.321765285 46 -0.473684254 -0.032042135 47 0.656620094 -0.473684254 48 -0.137604033 0.656620094 49 0.828915511 -0.137604033 50 -0.422315802 0.828915511 51 0.079158375 -0.422315802 52 0.462350059 0.079158375 53 0.116258490 0.462350059 54 -0.070221502 0.116258490 55 0.637944010 -0.070221502 56 -0.228671286 0.637944010 57 -0.502227295 -0.228671286 58 -0.073093968 -0.502227295 59 0.034044628 -0.073093968 60 -0.402558781 0.034044628 61 0.079125533 -0.402558781 62 0.866371950 0.079125533 63 -2.850156705 0.866371950 64 -1.119394394 -2.850156705 65 1.002274636 -1.119394394 66 0.195222487 1.002274636 67 0.018783702 0.195222487 68 -1.185397995 0.018783702 69 0.137718929 -1.185397995 70 0.022812698 0.137718929 71 -0.978235551 0.022812698 72 0.796123532 -0.978235551 73 -0.051119015 0.796123532 74 0.874840295 -0.051119015 75 0.196301738 0.874840295 76 -0.165994244 0.196301738 77 0.197929041 -0.165994244 78 0.065360602 0.197929041 79 -1.237901378 0.065360602 80 1.007742804 -1.237901378 81 0.535464516 1.007742804 82 -0.188780235 0.535464516 83 -0.039696674 -0.188780235 84 0.983249869 -0.039696674 85 0.057127629 0.983249869 86 -0.256160718 0.057127629 87 -0.930040096 -0.256160718 88 0.479317440 -0.930040096 89 -0.170291662 0.479317440 90 -1.101994029 -0.170291662 91 0.888023421 -1.101994029 92 0.872164744 0.888023421 93 0.679352864 0.872164744 94 -0.338161950 0.679352864 95 0.021135695 -0.338161950 96 -0.333370398 0.021135695 97 -0.186615676 -0.333370398 98 0.023167879 -0.186615676 99 -0.483886633 0.023167879 100 0.338864011 -0.483886633 101 0.792520940 0.338864011 102 -0.048547081 0.792520940 103 0.024632175 -0.048547081 104 -0.564799729 0.024632175 105 0.586635358 -0.564799729 106 0.374285152 0.586635358 107 -0.686844146 0.374285152 108 -1.053230506 -0.686844146 109 0.986177395 -1.053230506 110 0.089848309 0.986177395 111 0.819234844 0.089848309 112 -2.726620956 0.819234844 113 0.624008427 -2.726620956 114 0.942383708 0.624008427 115 -0.867719379 0.942383708 116 -0.098716063 -0.867719379 117 0.691581990 -0.098716063 118 0.993342539 0.691581990 119 -0.887501672 0.993342539 120 0.088952270 -0.887501672 121 0.814573903 0.088952270 122 -0.474956376 0.814573903 123 -0.393471497 -0.474956376 124 -0.300161676 -0.393471497 125 0.609986782 -0.300161676 126 -0.446194822 0.609986782 127 0.772280951 -0.446194822 128 -0.245554154 0.772280951 129 -0.069300964 -0.245554154 130 0.676815457 -0.069300964 131 -0.391311679 0.676815457 132 -0.866957031 -0.391311679 133 -0.016831042 -0.866957031 134 0.931239192 -0.016831042 135 -0.307382241 0.931239192 136 0.279655348 -0.307382241 137 -0.718447164 0.279655348 138 -0.299055466 -0.718447164 139 -0.950282986 -0.299055466 140 -1.182581732 -0.950282986 141 1.142755954 -1.182581732 142 0.803079643 1.142755954 143 0.817797334 0.803079643 144 0.564171011 0.817797334 145 0.536900092 0.564171011 146 0.098504784 0.536900092 147 -0.086918699 0.098504784 148 0.651478644 -0.086918699 149 0.797553224 0.651478644 150 1.184663784 0.797553224 151 0.159040623 1.184663784 152 -0.096796976 0.159040623 153 0.512517820 -0.096796976 154 1.065492976 0.512517820 155 -1.101994029 1.065492976 156 0.023683535 -1.101994029 157 0.772280951 0.023683535 158 0.643086004 0.772280951 159 1.307612576 0.643086004 160 1.137285946 1.307612576 > 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/7nb6l1383232324.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/81xuk1383232324.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/9g4691383232324.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/101eo91383232324.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, signif(mysum$coefficients[i,1],6), 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/11m2rv1383232325.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,signif(mysum$coefficients[i,1],6)) + a<-table.element(a, signif(mysum$coefficients[i,2],6)) + a<-table.element(a, signif(mysum$coefficients[i,3],4)) + a<-table.element(a, signif(mysum$coefficients[i,4],6)) + a<-table.element(a, signif(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/12y21p1383232325.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, signif(sqrt(mysum$r.squared),6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, signif(mysum$r.squared,6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, signif(mysum$adj.r.squared,6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, signif(mysum$fstatistic[1],6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, signif(mysum$fstatistic[2],6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, signif(mysum$fstatistic[3],6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, signif(1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]),6)) > 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, signif(mysum$sigma,6)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, signif(sum(myerror*myerror),6)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/13awmq1383232325.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,signif(x[i],6)) + a<-table.element(a,signif(x[i]-mysum$resid[i],6)) + a<-table.element(a,signif(mysum$resid[i],6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/144hni1383232325.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,signif(gqarr[mypoint-kp3+1,1],6)) + a<-table.element(a,signif(gqarr[mypoint-kp3+1,2],6)) + a<-table.element(a,signif(gqarr[mypoint-kp3+1,3],6)) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/157a021383232325.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,signif(numsignificant1,6)) + a<-table.element(a,signif(numsignificant1/numgqtests,6)) + 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,signif(numsignificant5,6)) + a<-table.element(a,signif(numsignificant5/numgqtests,6)) + 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,signif(numsignificant10,6)) + a<-table.element(a,signif(numsignificant10/numgqtests,6)) + 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/16wk7b1383232325.tab") + } > > try(system("convert tmp/1dc8u1383232324.ps tmp/1dc8u1383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/258141383232324.ps tmp/258141383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/3det31383232324.ps tmp/3det31383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/4nkkm1383232324.ps tmp/4nkkm1383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/5a14j1383232324.ps tmp/5a14j1383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/69du41383232324.ps tmp/69du41383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/7nb6l1383232324.ps tmp/7nb6l1383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/81xuk1383232324.ps tmp/81xuk1383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/9g4691383232324.ps tmp/9g4691383232324.png",intern=TRUE)) character(0) > try(system("convert tmp/101eo91383232324.ps tmp/101eo91383232324.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 12.144 2.474 14.611