R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(1 + ,1 + ,1 + ,6 + ,6 + ,100 + ,100 + ,6 + ,6 + ,9 + ,9 + ,1 + ,2 + ,2 + ,9 + ,9 + ,99 + ,99 + ,2 + ,2 + ,8 + ,8 + ,1 + ,3 + ,3 + ,7 + ,7 + ,108 + ,108 + ,4 + ,4 + ,3 + ,3 + ,1 + ,4 + ,4 + ,8 + ,8 + ,103 + ,103 + ,0 + ,0 + ,4 + ,4 + ,1 + ,5 + ,5 + ,1 + ,1 + ,99 + ,99 + ,8 + ,8 + ,7 + ,7 + ,1 + ,6 + ,6 + ,9 + ,9 + ,115 + ,115 + ,0 + ,0 + ,7 + ,7 + ,1 + ,7 + ,7 + ,9 + ,9 + ,90 + ,90 + ,8 + ,8 + ,1 + ,1 + ,1 + ,8 + ,8 + ,7 + ,7 + ,95 + ,95 + ,9 + ,9 + ,9 + ,9 + ,1 + ,9 + ,9 + ,2 + ,2 + ,114 + ,114 + ,4 + ,4 + ,4 + ,4 + ,1 + ,10 + ,10 + ,9 + ,9 + ,108 + ,108 + ,2 + ,2 + ,9 + ,9 + ,1 + ,11 + ,11 + ,8 + ,8 + ,112 + ,112 + ,6 + ,6 + ,3 + ,3 + ,1 + ,12 + ,12 + ,3 + ,3 + ,109 + ,109 + ,1 + ,1 + ,3 + ,3 + ,1 + ,13 + ,13 + ,0 + ,0 + ,105 + ,105 + ,0 + ,0 + ,3 + ,3 + ,1 + ,14 + ,14 + ,7 + ,7 + ,105 + ,105 + ,0 + ,0 + ,2 + ,2 + ,1 + ,15 + ,15 + ,5 + ,5 + ,118 + ,118 + ,5 + ,5 + ,8 + ,8 + ,1 + ,16 + ,16 + ,7 + ,7 + ,103 + ,103 + ,7 + ,7 + ,6 + ,6 + ,1 + ,17 + ,17 + ,9 + ,9 + ,112 + ,112 + ,5 + ,5 + ,2 + ,2 + ,1 + ,18 + ,18 + ,6 + ,6 + ,116 + ,116 + ,6 + ,6 + ,6 + ,6 + ,1 + ,19 + ,19 + ,4 + ,4 + ,96 + ,96 + ,6 + ,6 + ,6 + ,6 + ,1 + ,20 + ,20 + ,5 + ,5 + ,101 + ,101 + ,9 + ,9 + ,0 + ,0 + ,1 + ,21 + ,21 + ,8 + ,8 + ,116 + ,116 + ,5 + ,5 + ,4 + ,4 + ,1 + ,22 + ,22 + ,5 + ,5 + ,119 + ,119 + ,3 + ,3 + ,9 + ,9 + ,1 + ,23 + ,23 + ,9 + ,9 + ,115 + ,115 + ,4 + ,4 + ,5 + ,5 + ,1 + ,24 + ,24 + ,0 + ,0 + ,108 + ,108 + ,5 + ,5 + ,2 + ,2 + ,1 + ,25 + ,25 + ,0 + ,0 + ,111 + ,111 + ,5 + ,5 + ,8 + ,8 + ,1 + ,26 + ,26 + ,3 + ,3 + ,108 + ,108 + ,8 + ,8 + ,3 + ,3 + ,1 + ,27 + ,27 + ,8 + ,8 + ,121 + ,121 + ,8 + ,8 + ,9 + ,9 + ,1 + ,28 + ,28 + ,1 + ,1 + ,109 + ,109 + ,6 + ,6 + ,8 + ,8 + ,1 + ,29 + ,29 + ,3 + ,3 + ,112 + ,112 + ,2 + ,2 + ,8 + ,8 + ,1 + ,30 + ,30 + ,2 + ,2 + ,119 + ,119 + ,6 + ,6 + ,8 + ,8 + ,1 + ,31 + ,31 + ,5 + ,5 + ,104 + ,104 + ,1 + ,1 + ,5 + ,5 + ,1 + ,32 + ,32 + ,2 + ,2 + ,105 + ,105 + ,3 + ,3 + ,4 + ,4 + ,1 + ,33 + ,33 + ,5 + ,5 + ,115 + ,115 + ,0 + ,0 + ,4 + ,4 + ,1 + ,34 + ,34 + ,4 + ,4 + ,124 + ,124 + ,1 + ,1 + ,1 + ,1 + ,1 + ,35 + ,35 + ,3 + ,3 + ,116 + ,116 + ,8 + ,8 + ,6 + ,6 + ,1 + ,36 + ,36 + ,0 + ,0 + ,107 + ,107 + ,5 + ,5 + ,2 + ,2 + ,1 + ,37 + ,37 + ,7 + ,7 + ,115 + ,115 + ,6 + ,6 + ,1 + ,1 + ,1 + ,38 + ,38 + ,8 + ,8 + ,116 + ,116 + ,2 + ,2 + ,3 + ,3 + ,1 + ,39 + ,39 + ,8 + ,8 + ,116 + ,116 + ,3 + ,3 + ,8 + ,8 + ,1 + ,40 + ,40 + ,3 + ,3 + ,119 + ,119 + ,0 + ,0 + ,9 + ,9 + ,1 + ,41 + ,41 + ,1 + ,1 + ,111 + ,111 + ,9 + ,9 + ,1 + ,1 + ,1 + ,42 + ,42 + ,9 + ,9 + ,118 + ,118 + ,6 + ,6 + ,7 + ,7 + ,1 + ,43 + ,43 + ,0 + ,0 + ,106 + ,106 + ,9 + ,9 + ,2 + ,2 + ,1 + ,44 + ,44 + ,8 + ,8 + ,103 + ,103 + ,2 + ,2 + ,5 + ,5 + ,1 + ,45 + ,45 + ,8 + ,8 + ,118 + ,118 + ,6 + ,6 + ,0 + ,0 + ,1 + ,46 + ,46 + ,7 + ,7 + ,118 + ,118 + ,7 + ,7 + ,5 + ,5 + ,1 + ,47 + ,47 + ,4 + ,4 + ,102 + ,102 + ,8 + ,8 + ,0 + ,0 + ,1 + ,48 + ,48 + ,3 + ,3 + ,100 + ,100 + ,6 + ,6 + ,1 + ,1 + ,1 + ,49 + ,49 + ,0 + ,0 + ,94 + ,94 + ,9 + ,9 + ,6 + ,6 + ,1 + ,50 + ,50 + ,2 + ,2 + ,94 + ,94 + ,5 + ,5 + ,3 + ,3 + ,1 + ,51 + ,51 + ,1 + ,1 + ,102 + ,102 + ,9 + ,9 + ,9 + ,9 + ,1 + ,52 + ,52 + ,1 + ,1 + ,95 + ,95 + ,3 + ,3 + ,3 + ,3 + ,1 + ,53 + ,53 + ,8 + ,8 + ,92 + ,92 + ,5 + ,5 + ,5 + ,5 + ,1 + ,54 + ,54 + ,7 + ,7 + ,102 + ,102 + ,7 + ,7 + ,8 + ,8 + ,1 + ,55 + ,55 + ,6 + ,6 + ,91 + ,91 + ,5 + ,5 + ,7 + ,7 + ,1 + ,56 + ,56 + ,1 + ,1 + ,89 + ,89 + ,5 + ,5 + ,4 + ,4 + ,1 + ,57 + ,57 + ,5 + ,5 + ,104 + ,104 + ,2 + ,2 + ,8 + ,8 + ,1 + ,58 + ,58 + ,1 + ,1 + ,105 + ,105 + ,2 + ,2 + ,1 + ,1 + ,1 + ,59 + ,59 + ,1 + ,1 + ,99 + ,99 + ,0 + ,0 + ,2 + ,2 + ,1 + ,60 + ,60 + ,7 + ,7 + ,95 + ,95 + ,5 + ,5 + ,0 + ,0 + ,1 + ,61 + ,61 + ,3 + ,3 + ,90 + ,90 + ,5 + ,5 + ,8 + ,8 + ,1 + ,62 + ,62 + ,8 + ,8 + ,96 + ,96 + ,1 + ,1 + ,7 + ,7 + ,1 + ,63 + ,63 + ,5 + ,5 + ,113 + ,113 + ,0 + ,0 + ,5 + ,5 + ,1 + ,64 + ,64 + ,7 + ,7 + ,101 + ,101 + ,9 + ,9 + ,0 + ,0 + ,1 + ,65 + ,65 + ,5 + ,5 + ,101 + ,101 + ,4 + ,4 + ,9 + ,9 + ,1 + ,66 + ,66 + ,7 + ,7 + ,113 + ,113 + ,6 + ,6 + ,8 + ,8 + ,1 + ,67 + ,67 + ,2 + ,2 + ,96 + ,96 + ,6 + ,6 + ,2 + ,2 + ,1 + ,68 + ,68 + ,4 + ,4 + ,97 + ,97 + ,8 + ,8 + ,2 + ,2 + ,1 + ,69 + ,69 + ,0 + ,0 + ,114 + ,114 + ,9 + ,9 + ,9 + ,9 + ,1 + ,70 + ,70 + ,0 + ,0 + ,112 + ,112 + ,5 + ,5 + ,5 + ,5 + ,1 + ,71 + ,71 + ,5 + ,5 + ,108 + ,108 + ,4 + ,4 + ,9 + ,9 + ,1 + ,72 + ,72 + ,3 + ,3 + ,107 + ,107 + ,0 + ,0 + ,0 + ,0 + ,1 + ,73 + ,73 + ,1 + ,1 + ,103 + ,103 + ,5 + ,5 + ,9 + ,9 + ,1 + ,74 + ,74 + ,1 + ,1 + ,107 + ,107 + ,5 + ,5 + ,0 + ,0 + ,1 + ,75 + ,75 + ,3 + ,3 + ,122 + ,122 + ,3 + ,3 + ,9 + ,9) + ,dim=c(11 + ,75) + ,dimnames=list(c('Pop_t' + ,'maand' + ,'maand' + ,'Steenkool' + ,'Steenkool' + ,'Aardolie' + ,'Aardolie' + ,'Uranium' + ,'Uranium' + ,'Metaal' + ,'Metaal ') + ,1:75)) > y <- array(NA,dim=c(11,75),dimnames=list(c('Pop_t','maand','maand','Steenkool','Steenkool','Aardolie','Aardolie','Uranium','Uranium','Metaal','Metaal '),1:75)) > 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 = '8' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) 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 Uranium Pop_t maand maand Steenkool Steenkool Aardolie Aardolie Uranium 1 6 1 1 1 6 6 100 100 6 2 2 1 2 2 9 9 99 99 2 3 4 1 3 3 7 7 108 108 4 4 0 1 4 4 8 8 103 103 0 5 8 1 5 5 1 1 99 99 8 6 0 1 6 6 9 9 115 115 0 7 8 1 7 7 9 9 90 90 8 8 9 1 8 8 7 7 95 95 9 9 4 1 9 9 2 2 114 114 4 10 2 1 10 10 9 9 108 108 2 11 6 1 11 11 8 8 112 112 6 12 1 1 12 12 3 3 109 109 1 13 0 1 13 13 0 0 105 105 0 14 0 1 14 14 7 7 105 105 0 15 5 1 15 15 5 5 118 118 5 16 7 1 16 16 7 7 103 103 7 17 5 1 17 17 9 9 112 112 5 18 6 1 18 18 6 6 116 116 6 19 6 1 19 19 4 4 96 96 6 20 9 1 20 20 5 5 101 101 9 21 5 1 21 21 8 8 116 116 5 22 3 1 22 22 5 5 119 119 3 23 4 1 23 23 9 9 115 115 4 24 5 1 24 24 0 0 108 108 5 25 5 1 25 25 0 0 111 111 5 26 8 1 26 26 3 3 108 108 8 27 8 1 27 27 8 8 121 121 8 28 6 1 28 28 1 1 109 109 6 29 2 1 29 29 3 3 112 112 2 30 6 1 30 30 2 2 119 119 6 31 1 1 31 31 5 5 104 104 1 32 3 1 32 32 2 2 105 105 3 33 0 1 33 33 5 5 115 115 0 34 1 1 34 34 4 4 124 124 1 35 8 1 35 35 3 3 116 116 8 36 5 1 36 36 0 0 107 107 5 37 6 1 37 37 7 7 115 115 6 38 2 1 38 38 8 8 116 116 2 39 3 1 39 39 8 8 116 116 3 40 0 1 40 40 3 3 119 119 0 41 9 1 41 41 1 1 111 111 9 42 6 1 42 42 9 9 118 118 6 43 9 1 43 43 0 0 106 106 9 44 2 1 44 44 8 8 103 103 2 45 6 1 45 45 8 8 118 118 6 46 7 1 46 46 7 7 118 118 7 47 8 1 47 47 4 4 102 102 8 48 6 1 48 48 3 3 100 100 6 49 9 1 49 49 0 0 94 94 9 50 5 1 50 50 2 2 94 94 5 51 9 1 51 51 1 1 102 102 9 52 3 1 52 52 1 1 95 95 3 53 5 1 53 53 8 8 92 92 5 54 7 1 54 54 7 7 102 102 7 55 5 1 55 55 6 6 91 91 5 56 5 1 56 56 1 1 89 89 5 57 2 1 57 57 5 5 104 104 2 58 2 1 58 58 1 1 105 105 2 59 0 1 59 59 1 1 99 99 0 60 5 1 60 60 7 7 95 95 5 61 5 1 61 61 3 3 90 90 5 62 1 1 62 62 8 8 96 96 1 63 0 1 63 63 5 5 113 113 0 64 9 1 64 64 7 7 101 101 9 65 4 1 65 65 5 5 101 101 4 66 6 1 66 66 7 7 113 113 6 67 6 1 67 67 2 2 96 96 6 68 8 1 68 68 4 4 97 97 8 69 9 1 69 69 0 0 114 114 9 70 5 1 70 70 0 0 112 112 5 71 4 1 71 71 5 5 108 108 4 72 0 1 72 72 3 3 107 107 0 73 5 1 73 73 1 1 103 103 5 74 5 1 74 74 1 1 107 107 5 75 3 1 75 75 3 3 122 122 3 Metaal Metaal\r 1 9 9 2 8 8 3 3 3 4 4 4 5 7 7 6 7 7 7 1 1 8 9 9 9 4 4 10 9 9 11 3 3 12 3 3 13 3 3 14 2 2 15 8 8 16 6 6 17 2 2 18 6 6 19 6 6 20 0 0 21 4 4 22 9 9 23 5 5 24 2 2 25 8 8 26 3 3 27 9 9 28 8 8 29 8 8 30 8 8 31 5 5 32 4 4 33 4 4 34 1 1 35 6 6 36 2 2 37 1 1 38 3 3 39 8 8 40 9 9 41 1 1 42 7 7 43 2 2 44 5 5 45 0 0 46 5 5 47 0 0 48 1 1 49 6 6 50 3 3 51 9 9 52 3 3 53 5 5 54 8 8 55 7 7 56 4 4 57 8 8 58 1 1 59 2 2 60 0 0 61 8 8 62 7 7 63 5 5 64 0 0 65 9 9 66 8 8 67 2 2 68 2 2 69 9 9 70 5 5 71 9 9 72 0 0 73 9 9 74 0 0 75 9 9 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Pop_t maand Steenkool Aardolie Metaal 1.042e+01 NA -3.238e-05 -9.840e-02 -5.028e-02 8.317e-03 `Metaal\\r` NA Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : the response appeared on the right-hand side and was dropped 2: In model.matrix.default(mt, mf, contrasts) : problem with term 5 in model.matrix: no columns are assigned > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.3612 -2.3390 0.0447 2.3145 4.3745 Coefficients: (2 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept) 1.042e+01 4.175e+00 2.496 0.0149 * Pop_t NA NA NA NA maand -3.238e-05 1.601e-02 -0.002 0.9984 Steenkool -9.840e-02 1.153e-01 -0.853 0.3964 Aardolie -5.028e-02 3.808e-02 -1.320 0.1910 Metaal 8.317e-03 1.086e-01 0.077 0.9392 `Metaal\\r` NA NA NA NA --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.828 on 70 degrees of freedom Multiple R-squared: 0.03971, Adjusted R-squared: -0.01516 F-statistic: 0.7237 on 4 and 70 DF, p-value: 0.5787 > 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.9020653 0.1958694 0.09793469 [2,] 0.9008990 0.1982019 0.09910096 [3,] 0.8698487 0.2603027 0.13015133 [4,] 0.8403431 0.3193138 0.15965688 [5,] 0.8038649 0.3922703 0.19613515 [6,] 0.7527499 0.4945001 0.24725006 [7,] 0.7679064 0.4641871 0.23209356 [8,] 0.6994448 0.6011104 0.30055519 [9,] 0.6446933 0.7106133 0.35530665 [10,] 0.5682462 0.8635076 0.43175378 [11,] 0.4893963 0.9787927 0.51060365 [12,] 0.4133919 0.8267837 0.58660814 [13,] 0.3799687 0.7599374 0.62003128 [14,] 0.4021046 0.8042092 0.59789539 [15,] 0.3414745 0.6829490 0.65852549 [16,] 0.4053956 0.8107912 0.59460442 [17,] 0.3452859 0.6905717 0.65471413 [18,] 0.5118372 0.9763256 0.48816281 [19,] 0.4982315 0.9964629 0.50176854 [20,] 0.5972745 0.8054510 0.40272548 [21,] 0.6007858 0.7984283 0.39921417 [22,] 0.6054935 0.7890130 0.39450652 [23,] 0.5416041 0.9167917 0.45839587 [24,] 0.4858768 0.9717536 0.51412318 [25,] 0.4700324 0.9400648 0.52996759 [26,] 0.4269778 0.8539556 0.57302219 [27,] 0.6238297 0.7523407 0.37617034 [28,] 0.6320044 0.7359913 0.36799563 [29,] 0.5717194 0.8565612 0.42828058 [30,] 0.5511050 0.8977900 0.44889499 [31,] 0.6028954 0.7942091 0.39710457 [32,] 0.5402145 0.9195710 0.45978550 [33,] 0.4942808 0.9885615 0.50571923 [34,] 0.4778148 0.9556295 0.52218525 [35,] 0.4171820 0.8343640 0.58281798 [36,] 0.4133370 0.8266740 0.58666298 [37,] 0.3593951 0.7187902 0.64060489 [38,] 0.4440119 0.8880239 0.55598807 [39,] 0.4151516 0.8303031 0.58484843 [40,] 0.3451048 0.6902095 0.65489525 [41,] 0.3632863 0.7265726 0.63671370 [42,] 0.3001510 0.6003021 0.69984896 [43,] 0.2443345 0.4886691 0.75566546 [44,] 0.1998185 0.3996370 0.80018152 [45,] 0.1587519 0.3175038 0.84124809 [46,] 0.2440249 0.4880498 0.75597511 [47,] 0.1708214 0.3416427 0.82917865 [48,] 0.1186204 0.2372407 0.88137964 There were 50 or more warnings (use warnings() to see the first 50) > postscript(file="/var/fisher/rcomp/tmp/1uyrk1353441492.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/fisher/rcomp/tmp/2gzgm1353441492.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/fisher/rcomp/tmp/3f9lt1353441492.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/fisher/rcomp/tmp/4n3tx1353441492.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/fisher/rcomp/tmp/5q7d31353441492.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 = 75 Frequency = 1 1 2 3 4 5 6 1.120977348 -2.625754365 -0.328434707 -4.489709506 2.595468158 -3.812862482 7 8 9 10 11 12 2.980125416 3.968213751 -0.526885016 -2.181311682 1.971334638 -3.671461213 13 14 15 16 17 18 -5.167737020 -4.470595124 0.936349772 2.395646275 1.078244782 1.950924015 19 20 21 22 23 24 0.748601708 4.148323753 1.164452881 -1.021462646 0.204321823 -0.008230397 25 26 27 28 29 30 0.092733983 3.278714270 4.374451762 1.090674386 -2.561661829 1.691916490 31 32 33 34 35 36 -3.742071145 -1.978640831 -4.180633223 -2.801548463 3.656277653 -0.058119674 37 38 39 40 41 42 2.041244943 -1.826679734 -0.868231955 -4.217677686 4.249869451 2.339136728 43 44 45 46 47 48 3.891829148 -2.496731215 2.299053368 3.159102205 3.101076918 0.893837755 49 50 51 52 53 54 3.255421667 -0.522797307 3.731157331 -2.570853649 -0.049496034 2.329965045 55 56 57 58 59 60 -0.313140839 -0.880708089 -2.766180019 -3.051247126 -5.361198706 0.044749807 61 62 63 64 65 66 -0.666738144 -3.864727092 -4.288534415 4.346546369 -0.925071417 1.883409850 67 68 69 70 71 72 0.586625758 2.833733862 4.236675315 0.169419696 -0.572932254 -4.745123317 73 74 75 -0.217852463 0.058143559 -1.065710856 > postscript(file="/var/fisher/rcomp/tmp/694rs1353441492.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 = 75 Frequency = 1 lag(myerror, k = 1) myerror 0 1.120977348 NA 1 -2.625754365 1.120977348 2 -0.328434707 -2.625754365 3 -4.489709506 -0.328434707 4 2.595468158 -4.489709506 5 -3.812862482 2.595468158 6 2.980125416 -3.812862482 7 3.968213751 2.980125416 8 -0.526885016 3.968213751 9 -2.181311682 -0.526885016 10 1.971334638 -2.181311682 11 -3.671461213 1.971334638 12 -5.167737020 -3.671461213 13 -4.470595124 -5.167737020 14 0.936349772 -4.470595124 15 2.395646275 0.936349772 16 1.078244782 2.395646275 17 1.950924015 1.078244782 18 0.748601708 1.950924015 19 4.148323753 0.748601708 20 1.164452881 4.148323753 21 -1.021462646 1.164452881 22 0.204321823 -1.021462646 23 -0.008230397 0.204321823 24 0.092733983 -0.008230397 25 3.278714270 0.092733983 26 4.374451762 3.278714270 27 1.090674386 4.374451762 28 -2.561661829 1.090674386 29 1.691916490 -2.561661829 30 -3.742071145 1.691916490 31 -1.978640831 -3.742071145 32 -4.180633223 -1.978640831 33 -2.801548463 -4.180633223 34 3.656277653 -2.801548463 35 -0.058119674 3.656277653 36 2.041244943 -0.058119674 37 -1.826679734 2.041244943 38 -0.868231955 -1.826679734 39 -4.217677686 -0.868231955 40 4.249869451 -4.217677686 41 2.339136728 4.249869451 42 3.891829148 2.339136728 43 -2.496731215 3.891829148 44 2.299053368 -2.496731215 45 3.159102205 2.299053368 46 3.101076918 3.159102205 47 0.893837755 3.101076918 48 3.255421667 0.893837755 49 -0.522797307 3.255421667 50 3.731157331 -0.522797307 51 -2.570853649 3.731157331 52 -0.049496034 -2.570853649 53 2.329965045 -0.049496034 54 -0.313140839 2.329965045 55 -0.880708089 -0.313140839 56 -2.766180019 -0.880708089 57 -3.051247126 -2.766180019 58 -5.361198706 -3.051247126 59 0.044749807 -5.361198706 60 -0.666738144 0.044749807 61 -3.864727092 -0.666738144 62 -4.288534415 -3.864727092 63 4.346546369 -4.288534415 64 -0.925071417 4.346546369 65 1.883409850 -0.925071417 66 0.586625758 1.883409850 67 2.833733862 0.586625758 68 4.236675315 2.833733862 69 0.169419696 4.236675315 70 -0.572932254 0.169419696 71 -4.745123317 -0.572932254 72 -0.217852463 -4.745123317 73 0.058143559 -0.217852463 74 -1.065710856 0.058143559 75 NA -1.065710856 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.625754365 1.120977348 [2,] -0.328434707 -2.625754365 [3,] -4.489709506 -0.328434707 [4,] 2.595468158 -4.489709506 [5,] -3.812862482 2.595468158 [6,] 2.980125416 -3.812862482 [7,] 3.968213751 2.980125416 [8,] -0.526885016 3.968213751 [9,] -2.181311682 -0.526885016 [10,] 1.971334638 -2.181311682 [11,] -3.671461213 1.971334638 [12,] -5.167737020 -3.671461213 [13,] -4.470595124 -5.167737020 [14,] 0.936349772 -4.470595124 [15,] 2.395646275 0.936349772 [16,] 1.078244782 2.395646275 [17,] 1.950924015 1.078244782 [18,] 0.748601708 1.950924015 [19,] 4.148323753 0.748601708 [20,] 1.164452881 4.148323753 [21,] -1.021462646 1.164452881 [22,] 0.204321823 -1.021462646 [23,] -0.008230397 0.204321823 [24,] 0.092733983 -0.008230397 [25,] 3.278714270 0.092733983 [26,] 4.374451762 3.278714270 [27,] 1.090674386 4.374451762 [28,] -2.561661829 1.090674386 [29,] 1.691916490 -2.561661829 [30,] -3.742071145 1.691916490 [31,] -1.978640831 -3.742071145 [32,] -4.180633223 -1.978640831 [33,] -2.801548463 -4.180633223 [34,] 3.656277653 -2.801548463 [35,] -0.058119674 3.656277653 [36,] 2.041244943 -0.058119674 [37,] -1.826679734 2.041244943 [38,] -0.868231955 -1.826679734 [39,] -4.217677686 -0.868231955 [40,] 4.249869451 -4.217677686 [41,] 2.339136728 4.249869451 [42,] 3.891829148 2.339136728 [43,] -2.496731215 3.891829148 [44,] 2.299053368 -2.496731215 [45,] 3.159102205 2.299053368 [46,] 3.101076918 3.159102205 [47,] 0.893837755 3.101076918 [48,] 3.255421667 0.893837755 [49,] -0.522797307 3.255421667 [50,] 3.731157331 -0.522797307 [51,] -2.570853649 3.731157331 [52,] -0.049496034 -2.570853649 [53,] 2.329965045 -0.049496034 [54,] -0.313140839 2.329965045 [55,] -0.880708089 -0.313140839 [56,] -2.766180019 -0.880708089 [57,] -3.051247126 -2.766180019 [58,] -5.361198706 -3.051247126 [59,] 0.044749807 -5.361198706 [60,] -0.666738144 0.044749807 [61,] -3.864727092 -0.666738144 [62,] -4.288534415 -3.864727092 [63,] 4.346546369 -4.288534415 [64,] -0.925071417 4.346546369 [65,] 1.883409850 -0.925071417 [66,] 0.586625758 1.883409850 [67,] 2.833733862 0.586625758 [68,] 4.236675315 2.833733862 [69,] 0.169419696 4.236675315 [70,] -0.572932254 0.169419696 [71,] -4.745123317 -0.572932254 [72,] -0.217852463 -4.745123317 [73,] 0.058143559 -0.217852463 [74,] -1.065710856 0.058143559 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.625754365 1.120977348 2 -0.328434707 -2.625754365 3 -4.489709506 -0.328434707 4 2.595468158 -4.489709506 5 -3.812862482 2.595468158 6 2.980125416 -3.812862482 7 3.968213751 2.980125416 8 -0.526885016 3.968213751 9 -2.181311682 -0.526885016 10 1.971334638 -2.181311682 11 -3.671461213 1.971334638 12 -5.167737020 -3.671461213 13 -4.470595124 -5.167737020 14 0.936349772 -4.470595124 15 2.395646275 0.936349772 16 1.078244782 2.395646275 17 1.950924015 1.078244782 18 0.748601708 1.950924015 19 4.148323753 0.748601708 20 1.164452881 4.148323753 21 -1.021462646 1.164452881 22 0.204321823 -1.021462646 23 -0.008230397 0.204321823 24 0.092733983 -0.008230397 25 3.278714270 0.092733983 26 4.374451762 3.278714270 27 1.090674386 4.374451762 28 -2.561661829 1.090674386 29 1.691916490 -2.561661829 30 -3.742071145 1.691916490 31 -1.978640831 -3.742071145 32 -4.180633223 -1.978640831 33 -2.801548463 -4.180633223 34 3.656277653 -2.801548463 35 -0.058119674 3.656277653 36 2.041244943 -0.058119674 37 -1.826679734 2.041244943 38 -0.868231955 -1.826679734 39 -4.217677686 -0.868231955 40 4.249869451 -4.217677686 41 2.339136728 4.249869451 42 3.891829148 2.339136728 43 -2.496731215 3.891829148 44 2.299053368 -2.496731215 45 3.159102205 2.299053368 46 3.101076918 3.159102205 47 0.893837755 3.101076918 48 3.255421667 0.893837755 49 -0.522797307 3.255421667 50 3.731157331 -0.522797307 51 -2.570853649 3.731157331 52 -0.049496034 -2.570853649 53 2.329965045 -0.049496034 54 -0.313140839 2.329965045 55 -0.880708089 -0.313140839 56 -2.766180019 -0.880708089 57 -3.051247126 -2.766180019 58 -5.361198706 -3.051247126 59 0.044749807 -5.361198706 60 -0.666738144 0.044749807 61 -3.864727092 -0.666738144 62 -4.288534415 -3.864727092 63 4.346546369 -4.288534415 64 -0.925071417 4.346546369 65 1.883409850 -0.925071417 66 0.586625758 1.883409850 67 2.833733862 0.586625758 68 4.236675315 2.833733862 69 0.169419696 4.236675315 70 -0.572932254 0.169419696 71 -4.745123317 -0.572932254 72 -0.217852463 -4.745123317 73 0.058143559 -0.217852463 74 -1.065710856 0.058143559 > 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/fisher/rcomp/tmp/75tol1353441492.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/fisher/rcomp/tmp/8s38t1353441492.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/fisher/rcomp/tmp/9f1ka1353441492.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') Warning messages: 1: In model.matrix.default(object, data = list(Uranium = c(6, 2, 4, : the response appeared on the right-hand side and was dropped 2: In model.matrix.default(object, data = list(Uranium = c(6, 2, 4, : problem with term 5 in model.matrix: no columns are assigned > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/fisher/rcomp/tmp/10928v1353441492.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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='') + } + } Error: subscript out of bounds Execution halted