R version 2.12.1 (2010-12-16) Copyright (C) 2010 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(1966 + ,1 + ,41 + ,1966 + ,2 + ,39 + ,1966 + ,3 + ,50 + ,1966 + ,4 + ,40 + ,1966 + ,5 + ,43 + ,1966 + ,6 + ,38 + ,1966 + ,7 + ,44 + ,1966 + ,8 + ,35 + ,1966 + ,9 + ,39 + ,1966 + ,10 + ,35 + ,1966 + ,11 + ,29 + ,1966 + ,12 + ,49 + ,1967 + ,1 + ,50 + ,1967 + ,2 + ,59 + ,1967 + ,3 + ,63 + ,1967 + ,4 + ,32 + ,1967 + ,5 + ,39 + ,1967 + ,6 + ,47 + ,1967 + ,7 + ,53 + ,1967 + ,8 + ,60 + ,1967 + ,9 + ,57 + ,1967 + ,10 + ,52 + ,1967 + ,11 + ,70 + ,1967 + ,12 + ,90 + ,1968 + ,1 + ,74 + ,1968 + ,2 + ,62 + ,1968 + ,3 + ,55 + ,1968 + ,4 + ,84 + ,1968 + ,5 + ,94 + ,1968 + ,6 + ,70 + ,1968 + ,7 + ,108 + ,1968 + ,8 + ,139 + ,1968 + ,9 + ,120 + ,1968 + ,10 + ,97 + ,1968 + ,11 + ,126 + ,1968 + ,12 + ,149 + ,1969 + ,1 + ,158 + ,1969 + ,2 + ,124 + ,1969 + ,3 + ,140 + ,1969 + ,4 + ,109 + ,1969 + ,5 + ,114 + ,1969 + ,6 + ,77 + ,1969 + ,7 + ,120 + ,1969 + ,8 + ,133 + ,1969 + ,9 + ,110 + ,1969 + ,10 + ,92 + ,1969 + ,11 + ,97 + ,1969 + ,12 + ,78 + ,1970 + ,1 + ,99 + ,1970 + ,2 + ,107 + ,1970 + ,3 + ,112 + ,1970 + ,4 + ,90 + ,1970 + ,5 + ,98 + ,1970 + ,6 + ,125 + ,1970 + ,7 + ,155 + ,1970 + ,8 + ,190 + ,1970 + ,9 + ,236 + ,1970 + ,10 + ,189 + ,1970 + ,11 + ,174 + ,1970 + ,12 + ,178 + ,1971 + ,1 + ,136 + ,1971 + ,2 + ,161 + ,1971 + ,3 + ,171 + ,1971 + ,4 + ,149 + ,1971 + ,5 + ,184 + ,1971 + ,6 + ,155 + ,1971 + ,7 + ,276 + ,1971 + ,8 + ,224 + ,1971 + ,9 + ,213 + ,1971 + ,10 + ,279 + ,1971 + ,11 + ,268 + ,1971 + ,12 + ,287 + ,1972 + ,1 + ,238 + ,1972 + ,2 + ,213 + ,1972 + ,3 + ,257 + ,1972 + ,4 + ,293 + ,1972 + ,5 + ,212 + ,1972 + ,6 + ,246 + ,1972 + ,7 + ,353 + ,1972 + ,8 + ,339 + ,1972 + ,9 + ,308 + ,1972 + ,10 + ,247 + ,1972 + ,11 + ,257 + ,1972 + ,12 + ,322 + ,1973 + ,1 + ,298 + ,1973 + ,2 + ,273 + ,1973 + ,3 + ,312 + ,1973 + ,4 + ,249 + ,1973 + ,5 + ,286 + ,1973 + ,6 + ,279 + ,1973 + ,7 + ,309 + ,1973 + ,8 + ,401 + ,1973 + ,9 + ,309 + ,1973 + ,10 + ,328 + ,1973 + ,11 + ,353 + ,1973 + ,12 + ,354 + ,1974 + ,1 + ,327 + ,1974 + ,2 + ,324 + ,1974 + ,3 + ,285 + ,1974 + ,4 + ,243 + ,1974 + ,5 + ,241 + ,1974 + ,6 + ,287 + ,1974 + ,7 + ,355 + ,1974 + ,8 + ,460 + ,1974 + ,9 + ,364 + ,1974 + ,10 + ,487 + ,1974 + ,11 + ,452 + ,1974 + ,12 + ,391 + ,1975 + ,1 + ,500 + ,1975 + ,2 + ,451 + ,1975 + ,3 + ,375 + ,1975 + ,4 + ,372 + ,1975 + ,5 + ,302 + ,1975 + ,6 + ,316 + ,1975 + ,7 + ,398 + ,1975 + ,8 + ,394 + ,1975 + ,9 + ,431 + ,1975 + ,10 + ,431) + ,dim=c(3 + ,118) + ,dimnames=list(c('year' + ,'month' + ,'robberies') + ,1:118)) > y <- array(NA,dim=c(3,118),dimnames=list(c('year','month','robberies'),1:118)) > 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 = '3' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo > 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 robberies year month t 1 41 1966 1 1 2 39 1966 2 2 3 50 1966 3 3 4 40 1966 4 4 5 43 1966 5 5 6 38 1966 6 6 7 44 1966 7 7 8 35 1966 8 8 9 39 1966 9 9 10 35 1966 10 10 11 29 1966 11 11 12 49 1966 12 12 13 50 1967 1 13 14 59 1967 2 14 15 63 1967 3 15 16 32 1967 4 16 17 39 1967 5 17 18 47 1967 6 18 19 53 1967 7 19 20 60 1967 8 20 21 57 1967 9 21 22 52 1967 10 22 23 70 1967 11 23 24 90 1967 12 24 25 74 1968 1 25 26 62 1968 2 26 27 55 1968 3 27 28 84 1968 4 28 29 94 1968 5 29 30 70 1968 6 30 31 108 1968 7 31 32 139 1968 8 32 33 120 1968 9 33 34 97 1968 10 34 35 126 1968 11 35 36 149 1968 12 36 37 158 1969 1 37 38 124 1969 2 38 39 140 1969 3 39 40 109 1969 4 40 41 114 1969 5 41 42 77 1969 6 42 43 120 1969 7 43 44 133 1969 8 44 45 110 1969 9 45 46 92 1969 10 46 47 97 1969 11 47 48 78 1969 12 48 49 99 1970 1 49 50 107 1970 2 50 51 112 1970 3 51 52 90 1970 4 52 53 98 1970 5 53 54 125 1970 6 54 55 155 1970 7 55 56 190 1970 8 56 57 236 1970 9 57 58 189 1970 10 58 59 174 1970 11 59 60 178 1970 12 60 61 136 1971 1 61 62 161 1971 2 62 63 171 1971 3 63 64 149 1971 4 64 65 184 1971 5 65 66 155 1971 6 66 67 276 1971 7 67 68 224 1971 8 68 69 213 1971 9 69 70 279 1971 10 70 71 268 1971 11 71 72 287 1971 12 72 73 238 1972 1 73 74 213 1972 2 74 75 257 1972 3 75 76 293 1972 4 76 77 212 1972 5 77 78 246 1972 6 78 79 353 1972 7 79 80 339 1972 8 80 81 308 1972 9 81 82 247 1972 10 82 83 257 1972 11 83 84 322 1972 12 84 85 298 1973 1 85 86 273 1973 2 86 87 312 1973 3 87 88 249 1973 4 88 89 286 1973 5 89 90 279 1973 6 90 91 309 1973 7 91 92 401 1973 8 92 93 309 1973 9 93 94 328 1973 10 94 95 353 1973 11 95 96 354 1973 12 96 97 327 1974 1 97 98 324 1974 2 98 99 285 1974 3 99 100 243 1974 4 100 101 241 1974 5 101 102 287 1974 6 102 103 355 1974 7 103 104 460 1974 8 104 105 364 1974 9 105 106 487 1974 10 106 107 452 1974 11 107 108 391 1974 12 108 109 500 1975 1 109 110 451 1975 2 110 111 375 1975 3 111 112 372 1975 4 112 113 302 1975 5 113 114 316 1975 6 114 115 398 1975 7 115 116 394 1975 8 116 117 431 1975 9 117 118 431 1975 10 118 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) year month t -82575.792 41.988 5.802 NA > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -97.238 -26.131 1.727 24.547 142.983 Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept) -82575.792 2808.959 -29.397 < 2e-16 *** year 41.988 1.425 29.457 < 2e-16 *** month 5.802 1.182 4.907 3.08e-06 *** t NA NA NA NA --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 43.87 on 115 degrees of freedom Multiple R-squared: 0.8846, Adjusted R-squared: 0.8826 F-statistic: 440.8 on 2 and 115 DF, p-value: < 2.2e-16 > 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,] 3.184625e-03 6.369251e-03 0.9968154 [2,] 5.772481e-04 1.154496e-03 0.9994228 [3,] 6.418653e-05 1.283731e-04 0.9999358 [4,] 7.548104e-06 1.509621e-05 0.9999925 [5,] 1.666597e-06 3.333195e-06 0.9999983 [6,] 2.933859e-06 5.867717e-06 0.9999971 [7,] 4.226096e-07 8.452192e-07 0.9999996 [8,] 1.057493e-07 2.114987e-07 0.9999999 [9,] 3.040858e-08 6.081717e-08 1.0000000 [10,] 2.258185e-07 4.516369e-07 0.9999998 [11,] 7.341812e-08 1.468362e-07 0.9999999 [12,] 1.368325e-08 2.736651e-08 1.0000000 [13,] 3.322383e-09 6.644766e-09 1.0000000 [14,] 1.639150e-09 3.278299e-09 1.0000000 [15,] 4.306613e-10 8.613226e-10 1.0000000 [16,] 7.847129e-11 1.569426e-10 1.0000000 [17,] 1.081867e-10 2.163734e-10 1.0000000 [18,] 2.670387e-09 5.340775e-09 1.0000000 [19,] 7.760940e-10 1.552188e-09 1.0000000 [20,] 2.238874e-10 4.477747e-10 1.0000000 [21,] 9.582207e-11 1.916441e-10 1.0000000 [22,] 5.689808e-11 1.137962e-10 1.0000000 [23,] 7.328490e-11 1.465698e-10 1.0000000 [24,] 1.928408e-11 3.856815e-11 1.0000000 [25,] 9.168873e-11 1.833775e-10 1.0000000 [26,] 1.770828e-08 3.541657e-08 1.0000000 [27,] 2.308794e-08 4.617588e-08 1.0000000 [28,] 8.015016e-09 1.603003e-08 1.0000000 [29,] 8.246730e-09 1.649346e-08 1.0000000 [30,] 3.567308e-08 7.134616e-08 1.0000000 [31,] 2.733491e-07 5.466981e-07 0.9999997 [32,] 1.445139e-07 2.890277e-07 0.9999999 [33,] 1.119402e-07 2.238804e-07 0.9999999 [34,] 6.748656e-08 1.349731e-07 0.9999999 [35,] 3.506554e-08 7.013109e-08 1.0000000 [36,] 1.577613e-07 3.155226e-07 0.9999998 [37,] 7.098580e-08 1.419716e-07 0.9999999 [38,] 3.178174e-08 6.356349e-08 1.0000000 [39,] 1.893793e-08 3.787586e-08 1.0000000 [40,] 3.078773e-08 6.157546e-08 1.0000000 [41,] 3.404752e-08 6.809503e-08 1.0000000 [42,] 1.473826e-07 2.947652e-07 0.9999999 [43,] 1.539388e-07 3.078776e-07 0.9999998 [44,] 1.019859e-07 2.039717e-07 0.9999999 [45,] 5.734974e-08 1.146995e-07 0.9999999 [46,] 9.105411e-08 1.821082e-07 0.9999999 [47,] 9.775872e-08 1.955174e-07 0.9999999 [48,] 5.151217e-08 1.030243e-07 0.9999999 [49,] 3.644614e-08 7.289228e-08 1.0000000 [50,] 1.167885e-07 2.335771e-07 0.9999999 [51,] 5.720928e-06 1.144186e-05 0.9999943 [52,] 5.505810e-06 1.101162e-05 0.9999945 [53,] 3.640705e-06 7.281411e-06 0.9999964 [54,] 2.544218e-06 5.088435e-06 0.9999975 [55,] 1.666493e-06 3.332986e-06 0.9999983 [56,] 8.851189e-07 1.770238e-06 0.9999991 [57,] 4.847507e-07 9.695015e-07 0.9999995 [58,] 3.684140e-07 7.368280e-07 0.9999996 [59,] 2.313285e-07 4.626569e-07 0.9999998 [60,] 2.398885e-07 4.797770e-07 0.9999998 [61,] 7.199810e-06 1.439962e-05 0.9999928 [62,] 6.824686e-06 1.364937e-05 0.9999932 [63,] 5.296593e-06 1.059319e-05 0.9999947 [64,] 2.189724e-05 4.379448e-05 0.9999781 [65,] 3.310453e-05 6.620907e-05 0.9999669 [66,] 6.338890e-05 1.267778e-04 0.9999366 [67,] 5.065125e-05 1.013025e-04 0.9999493 [68,] 3.095380e-05 6.190759e-05 0.9999690 [69,] 2.709586e-05 5.419171e-05 0.9999729 [70,] 5.599491e-05 1.119898e-04 0.9999440 [71,] 4.279487e-05 8.558974e-05 0.9999572 [72,] 2.677134e-05 5.354269e-05 0.9999732 [73,] 3.212937e-04 6.425874e-04 0.9996787 [74,] 9.757713e-04 1.951543e-03 0.9990242 [75,] 9.350110e-04 1.870022e-03 0.9990650 [76,] 7.025569e-04 1.405114e-03 0.9992974 [77,] 5.386711e-04 1.077342e-03 0.9994613 [78,] 4.435274e-04 8.870547e-04 0.9995565 [79,] 3.766590e-04 7.533180e-04 0.9996233 [80,] 2.224690e-04 4.449380e-04 0.9997775 [81,] 1.941874e-04 3.883748e-04 0.9998058 [82,] 1.393760e-04 2.787519e-04 0.9998606 [83,] 7.819624e-05 1.563925e-04 0.9999218 [84,] 4.688625e-05 9.377251e-05 0.9999531 [85,] 2.616799e-05 5.233598e-05 0.9999738 [86,] 1.457391e-04 2.914782e-04 0.9998543 [87,] 8.112644e-05 1.622529e-04 0.9999189 [88,] 4.436124e-05 8.872248e-05 0.9999556 [89,] 2.701630e-05 5.403260e-05 0.9999730 [90,] 1.506065e-05 3.012130e-05 0.9999849 [91,] 8.702574e-06 1.740515e-05 0.9999913 [92,] 4.472946e-06 8.945892e-06 0.9999955 [93,] 2.700473e-06 5.400946e-06 0.9999973 [94,] 1.306798e-05 2.613596e-05 0.9999869 [95,] 2.986439e-04 5.972878e-04 0.9997014 [96,] 2.655797e-03 5.311594e-03 0.9973442 [97,] 4.667609e-03 9.335217e-03 0.9953324 [98,] 6.393590e-03 1.278718e-02 0.9936064 [99,] 1.050737e-02 2.101473e-02 0.9894926 [100,] 1.773713e-02 3.547426e-02 0.9822629 [101,] 1.671936e-02 3.343872e-02 0.9832806 [102,] 8.667514e-03 1.733503e-02 0.9913325 [103,] 7.419244e-02 1.483849e-01 0.9258076 [104,] 3.157536e-01 6.315071e-01 0.6842464 [105,] 3.457313e-01 6.914627e-01 0.6542687 > postscript(file="/var/www/rcomp/tmp/15m171321996199.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/www/rcomp/tmp/2fc981321996199.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/www/rcomp/tmp/3bb1w1321996199.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/www/rcomp/tmp/4mqrw1321996199.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/www/rcomp/tmp/5uzrl1321996199.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 = 118 Frequency = 1 1 2 3 4 5 6 7 61.878007 54.075688 59.273368 43.471049 40.668729 29.866410 30.064090 8 9 10 11 12 13 14 15.261771 13.459451 3.657132 -8.145187 6.052493 28.889649 32.087330 15 16 17 18 19 20 21 30.285011 -6.517309 -5.319628 -3.121948 -2.924267 -1.726587 -10.528906 22 23 24 25 26 27 28 -21.331226 -9.133545 5.064135 10.901292 -6.901028 -19.703347 3.494333 29 30 31 32 33 34 35 7.692014 -22.110306 10.087375 35.285056 10.482736 -18.319583 4.878097 36 37 38 39 40 41 42 22.075778 52.912934 13.110615 23.308295 -13.494024 -14.296344 -57.098663 43 44 45 46 47 48 49 -19.900983 -12.703302 -41.505622 -65.307941 -66.110260 -90.912580 -48.075424 50 51 52 53 54 55 56 -45.877743 -46.680063 -74.482382 -72.284701 -51.087021 -26.889340 2.308340 57 58 59 60 61 62 63 42.506021 -10.296299 -31.098618 -32.900938 -53.063781 -33.866101 -29.668420 64 65 66 67 68 69 70 -57.470740 -28.273059 -63.075379 52.122302 -5.680017 -22.482337 37.715344 71 72 73 74 75 76 77 20.913024 34.110705 6.947861 -23.854458 14.343222 44.540903 -42.261417 78 79 80 81 82 83 84 -14.063736 87.133944 67.331625 30.529305 -36.273014 -32.075333 27.122347 85 86 87 88 89 90 91 24.959503 -5.842816 27.354864 -41.447455 -10.249774 -23.052094 1.145587 92 93 94 95 96 97 98 87.343267 -10.459052 2.738628 21.936309 17.133989 11.971146 3.168826 99 100 101 102 103 104 105 -41.633493 -89.435813 -97.238132 -57.040452 5.157229 104.354910 2.552590 106 107 108 109 110 111 112 119.750271 78.947951 12.145632 142.982788 88.180469 6.378149 -2.424170 113 114 115 116 117 118 -78.226490 -70.028809 6.168871 -3.633448 27.564232 21.761913 > postscript(file="/var/www/rcomp/tmp/6ptsh1321996199.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 = 118 Frequency = 1 lag(myerror, k = 1) myerror 0 61.878007 NA 1 54.075688 61.878007 2 59.273368 54.075688 3 43.471049 59.273368 4 40.668729 43.471049 5 29.866410 40.668729 6 30.064090 29.866410 7 15.261771 30.064090 8 13.459451 15.261771 9 3.657132 13.459451 10 -8.145187 3.657132 11 6.052493 -8.145187 12 28.889649 6.052493 13 32.087330 28.889649 14 30.285011 32.087330 15 -6.517309 30.285011 16 -5.319628 -6.517309 17 -3.121948 -5.319628 18 -2.924267 -3.121948 19 -1.726587 -2.924267 20 -10.528906 -1.726587 21 -21.331226 -10.528906 22 -9.133545 -21.331226 23 5.064135 -9.133545 24 10.901292 5.064135 25 -6.901028 10.901292 26 -19.703347 -6.901028 27 3.494333 -19.703347 28 7.692014 3.494333 29 -22.110306 7.692014 30 10.087375 -22.110306 31 35.285056 10.087375 32 10.482736 35.285056 33 -18.319583 10.482736 34 4.878097 -18.319583 35 22.075778 4.878097 36 52.912934 22.075778 37 13.110615 52.912934 38 23.308295 13.110615 39 -13.494024 23.308295 40 -14.296344 -13.494024 41 -57.098663 -14.296344 42 -19.900983 -57.098663 43 -12.703302 -19.900983 44 -41.505622 -12.703302 45 -65.307941 -41.505622 46 -66.110260 -65.307941 47 -90.912580 -66.110260 48 -48.075424 -90.912580 49 -45.877743 -48.075424 50 -46.680063 -45.877743 51 -74.482382 -46.680063 52 -72.284701 -74.482382 53 -51.087021 -72.284701 54 -26.889340 -51.087021 55 2.308340 -26.889340 56 42.506021 2.308340 57 -10.296299 42.506021 58 -31.098618 -10.296299 59 -32.900938 -31.098618 60 -53.063781 -32.900938 61 -33.866101 -53.063781 62 -29.668420 -33.866101 63 -57.470740 -29.668420 64 -28.273059 -57.470740 65 -63.075379 -28.273059 66 52.122302 -63.075379 67 -5.680017 52.122302 68 -22.482337 -5.680017 69 37.715344 -22.482337 70 20.913024 37.715344 71 34.110705 20.913024 72 6.947861 34.110705 73 -23.854458 6.947861 74 14.343222 -23.854458 75 44.540903 14.343222 76 -42.261417 44.540903 77 -14.063736 -42.261417 78 87.133944 -14.063736 79 67.331625 87.133944 80 30.529305 67.331625 81 -36.273014 30.529305 82 -32.075333 -36.273014 83 27.122347 -32.075333 84 24.959503 27.122347 85 -5.842816 24.959503 86 27.354864 -5.842816 87 -41.447455 27.354864 88 -10.249774 -41.447455 89 -23.052094 -10.249774 90 1.145587 -23.052094 91 87.343267 1.145587 92 -10.459052 87.343267 93 2.738628 -10.459052 94 21.936309 2.738628 95 17.133989 21.936309 96 11.971146 17.133989 97 3.168826 11.971146 98 -41.633493 3.168826 99 -89.435813 -41.633493 100 -97.238132 -89.435813 101 -57.040452 -97.238132 102 5.157229 -57.040452 103 104.354910 5.157229 104 2.552590 104.354910 105 119.750271 2.552590 106 78.947951 119.750271 107 12.145632 78.947951 108 142.982788 12.145632 109 88.180469 142.982788 110 6.378149 88.180469 111 -2.424170 6.378149 112 -78.226490 -2.424170 113 -70.028809 -78.226490 114 6.168871 -70.028809 115 -3.633448 6.168871 116 27.564232 -3.633448 117 21.761913 27.564232 118 NA 21.761913 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 54.075688 61.878007 [2,] 59.273368 54.075688 [3,] 43.471049 59.273368 [4,] 40.668729 43.471049 [5,] 29.866410 40.668729 [6,] 30.064090 29.866410 [7,] 15.261771 30.064090 [8,] 13.459451 15.261771 [9,] 3.657132 13.459451 [10,] -8.145187 3.657132 [11,] 6.052493 -8.145187 [12,] 28.889649 6.052493 [13,] 32.087330 28.889649 [14,] 30.285011 32.087330 [15,] -6.517309 30.285011 [16,] -5.319628 -6.517309 [17,] -3.121948 -5.319628 [18,] -2.924267 -3.121948 [19,] -1.726587 -2.924267 [20,] -10.528906 -1.726587 [21,] -21.331226 -10.528906 [22,] -9.133545 -21.331226 [23,] 5.064135 -9.133545 [24,] 10.901292 5.064135 [25,] -6.901028 10.901292 [26,] -19.703347 -6.901028 [27,] 3.494333 -19.703347 [28,] 7.692014 3.494333 [29,] -22.110306 7.692014 [30,] 10.087375 -22.110306 [31,] 35.285056 10.087375 [32,] 10.482736 35.285056 [33,] -18.319583 10.482736 [34,] 4.878097 -18.319583 [35,] 22.075778 4.878097 [36,] 52.912934 22.075778 [37,] 13.110615 52.912934 [38,] 23.308295 13.110615 [39,] -13.494024 23.308295 [40,] -14.296344 -13.494024 [41,] -57.098663 -14.296344 [42,] -19.900983 -57.098663 [43,] -12.703302 -19.900983 [44,] -41.505622 -12.703302 [45,] -65.307941 -41.505622 [46,] -66.110260 -65.307941 [47,] -90.912580 -66.110260 [48,] -48.075424 -90.912580 [49,] -45.877743 -48.075424 [50,] -46.680063 -45.877743 [51,] -74.482382 -46.680063 [52,] -72.284701 -74.482382 [53,] -51.087021 -72.284701 [54,] -26.889340 -51.087021 [55,] 2.308340 -26.889340 [56,] 42.506021 2.308340 [57,] -10.296299 42.506021 [58,] -31.098618 -10.296299 [59,] -32.900938 -31.098618 [60,] -53.063781 -32.900938 [61,] -33.866101 -53.063781 [62,] -29.668420 -33.866101 [63,] -57.470740 -29.668420 [64,] -28.273059 -57.470740 [65,] -63.075379 -28.273059 [66,] 52.122302 -63.075379 [67,] -5.680017 52.122302 [68,] -22.482337 -5.680017 [69,] 37.715344 -22.482337 [70,] 20.913024 37.715344 [71,] 34.110705 20.913024 [72,] 6.947861 34.110705 [73,] -23.854458 6.947861 [74,] 14.343222 -23.854458 [75,] 44.540903 14.343222 [76,] -42.261417 44.540903 [77,] -14.063736 -42.261417 [78,] 87.133944 -14.063736 [79,] 67.331625 87.133944 [80,] 30.529305 67.331625 [81,] -36.273014 30.529305 [82,] -32.075333 -36.273014 [83,] 27.122347 -32.075333 [84,] 24.959503 27.122347 [85,] -5.842816 24.959503 [86,] 27.354864 -5.842816 [87,] -41.447455 27.354864 [88,] -10.249774 -41.447455 [89,] -23.052094 -10.249774 [90,] 1.145587 -23.052094 [91,] 87.343267 1.145587 [92,] -10.459052 87.343267 [93,] 2.738628 -10.459052 [94,] 21.936309 2.738628 [95,] 17.133989 21.936309 [96,] 11.971146 17.133989 [97,] 3.168826 11.971146 [98,] -41.633493 3.168826 [99,] -89.435813 -41.633493 [100,] -97.238132 -89.435813 [101,] -57.040452 -97.238132 [102,] 5.157229 -57.040452 [103,] 104.354910 5.157229 [104,] 2.552590 104.354910 [105,] 119.750271 2.552590 [106,] 78.947951 119.750271 [107,] 12.145632 78.947951 [108,] 142.982788 12.145632 [109,] 88.180469 142.982788 [110,] 6.378149 88.180469 [111,] -2.424170 6.378149 [112,] -78.226490 -2.424170 [113,] -70.028809 -78.226490 [114,] 6.168871 -70.028809 [115,] -3.633448 6.168871 [116,] 27.564232 -3.633448 [117,] 21.761913 27.564232 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 54.075688 61.878007 2 59.273368 54.075688 3 43.471049 59.273368 4 40.668729 43.471049 5 29.866410 40.668729 6 30.064090 29.866410 7 15.261771 30.064090 8 13.459451 15.261771 9 3.657132 13.459451 10 -8.145187 3.657132 11 6.052493 -8.145187 12 28.889649 6.052493 13 32.087330 28.889649 14 30.285011 32.087330 15 -6.517309 30.285011 16 -5.319628 -6.517309 17 -3.121948 -5.319628 18 -2.924267 -3.121948 19 -1.726587 -2.924267 20 -10.528906 -1.726587 21 -21.331226 -10.528906 22 -9.133545 -21.331226 23 5.064135 -9.133545 24 10.901292 5.064135 25 -6.901028 10.901292 26 -19.703347 -6.901028 27 3.494333 -19.703347 28 7.692014 3.494333 29 -22.110306 7.692014 30 10.087375 -22.110306 31 35.285056 10.087375 32 10.482736 35.285056 33 -18.319583 10.482736 34 4.878097 -18.319583 35 22.075778 4.878097 36 52.912934 22.075778 37 13.110615 52.912934 38 23.308295 13.110615 39 -13.494024 23.308295 40 -14.296344 -13.494024 41 -57.098663 -14.296344 42 -19.900983 -57.098663 43 -12.703302 -19.900983 44 -41.505622 -12.703302 45 -65.307941 -41.505622 46 -66.110260 -65.307941 47 -90.912580 -66.110260 48 -48.075424 -90.912580 49 -45.877743 -48.075424 50 -46.680063 -45.877743 51 -74.482382 -46.680063 52 -72.284701 -74.482382 53 -51.087021 -72.284701 54 -26.889340 -51.087021 55 2.308340 -26.889340 56 42.506021 2.308340 57 -10.296299 42.506021 58 -31.098618 -10.296299 59 -32.900938 -31.098618 60 -53.063781 -32.900938 61 -33.866101 -53.063781 62 -29.668420 -33.866101 63 -57.470740 -29.668420 64 -28.273059 -57.470740 65 -63.075379 -28.273059 66 52.122302 -63.075379 67 -5.680017 52.122302 68 -22.482337 -5.680017 69 37.715344 -22.482337 70 20.913024 37.715344 71 34.110705 20.913024 72 6.947861 34.110705 73 -23.854458 6.947861 74 14.343222 -23.854458 75 44.540903 14.343222 76 -42.261417 44.540903 77 -14.063736 -42.261417 78 87.133944 -14.063736 79 67.331625 87.133944 80 30.529305 67.331625 81 -36.273014 30.529305 82 -32.075333 -36.273014 83 27.122347 -32.075333 84 24.959503 27.122347 85 -5.842816 24.959503 86 27.354864 -5.842816 87 -41.447455 27.354864 88 -10.249774 -41.447455 89 -23.052094 -10.249774 90 1.145587 -23.052094 91 87.343267 1.145587 92 -10.459052 87.343267 93 2.738628 -10.459052 94 21.936309 2.738628 95 17.133989 21.936309 96 11.971146 17.133989 97 3.168826 11.971146 98 -41.633493 3.168826 99 -89.435813 -41.633493 100 -97.238132 -89.435813 101 -57.040452 -97.238132 102 5.157229 -57.040452 103 104.354910 5.157229 104 2.552590 104.354910 105 119.750271 2.552590 106 78.947951 119.750271 107 12.145632 78.947951 108 142.982788 12.145632 109 88.180469 142.982788 110 6.378149 88.180469 111 -2.424170 6.378149 112 -78.226490 -2.424170 113 -70.028809 -78.226490 114 6.168871 -70.028809 115 -3.633448 6.168871 116 27.564232 -3.633448 117 21.761913 27.564232 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/75z2m1321996199.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/www/rcomp/tmp/8iezn1321996199.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/www/rcomp/tmp/901vg1321996199.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/www/rcomp/tmp/10d4op1321996199.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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