R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. 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(103.91 + ,100.30 + ,103.88 + ,103.77 + ,103.66 + ,103.64 + ,103.63 + ,103.91 + ,98.50 + ,103.91 + ,103.88 + ,103.77 + ,103.66 + ,103.64 + ,103.92 + ,95.10 + ,103.91 + ,103.91 + ,103.88 + ,103.77 + ,103.66 + ,104.05 + ,93.10 + ,103.92 + ,103.91 + ,103.91 + ,103.88 + ,103.77 + ,104.23 + ,92.20 + ,104.05 + ,103.92 + ,103.91 + ,103.91 + ,103.88 + ,104.30 + ,89.00 + ,104.23 + ,104.05 + ,103.92 + ,103.91 + ,103.91 + ,104.31 + ,86.40 + ,104.30 + ,104.23 + ,104.05 + ,103.92 + ,103.91 + ,104.31 + ,84.50 + ,104.31 + ,104.30 + ,104.23 + ,104.05 + ,103.92 + ,104.34 + ,82.70 + ,104.31 + ,104.31 + ,104.30 + ,104.23 + ,104.05 + ,104.55 + ,80.80 + ,104.34 + ,104.31 + ,104.31 + ,104.30 + ,104.23 + ,104.65 + ,81.80 + ,104.55 + ,104.34 + ,104.31 + ,104.31 + ,104.30 + ,104.73 + ,81.80 + ,104.65 + ,104.55 + ,104.34 + ,104.31 + ,104.31 + ,104.75 + ,82.90 + ,104.73 + ,104.65 + ,104.55 + ,104.34 + ,104.31 + ,104.75 + ,83.80 + ,104.75 + ,104.73 + ,104.65 + ,104.55 + ,104.34 + ,104.76 + ,86.20 + ,104.75 + ,104.75 + ,104.73 + ,104.65 + ,104.55 + ,104.94 + ,86.10 + ,104.76 + ,104.75 + ,104.75 + ,104.73 + ,104.65 + ,105.29 + ,86.20 + ,104.94 + ,104.76 + ,104.75 + ,104.75 + ,104.73 + ,105.38 + ,88.80 + ,105.29 + ,104.94 + ,104.76 + ,104.75 + ,104.75 + ,105.43 + ,89.60 + ,105.38 + ,105.29 + ,104.94 + ,104.76 + ,104.75 + ,105.43 + ,87.80 + ,105.43 + ,105.38 + ,105.29 + ,104.94 + ,104.76 + ,105.42 + ,88.30 + ,105.43 + ,105.43 + ,105.38 + ,105.29 + ,104.94 + ,105.52 + ,88.60 + ,105.42 + ,105.43 + ,105.43 + ,105.38 + ,105.29 + ,105.69 + ,91.00 + ,105.52 + ,105.42 + ,105.43 + ,105.43 + ,105.38 + ,105.72 + ,91.50 + ,105.69 + ,105.52 + ,105.42 + ,105.43 + ,105.43 + ,105.74 + ,95.40 + ,105.72 + ,105.69 + ,105.52 + ,105.42 + ,105.43 + ,105.74 + ,98.70 + ,105.74 + ,105.72 + ,105.69 + ,105.52 + ,105.42 + ,105.74 + ,99.90 + ,105.74 + ,105.74 + ,105.72 + ,105.69 + ,105.52 + ,105.95 + ,98.60 + ,105.74 + ,105.74 + ,105.74 + ,105.72 + ,105.69 + ,106.17 + ,100.30 + ,105.95 + ,105.74 + ,105.74 + ,105.74 + ,105.72 + ,106.34 + ,100.20 + ,106.17 + ,105.95 + ,105.74 + ,105.74 + ,105.74 + ,106.37 + ,100.40 + ,106.34 + ,106.17 + ,105.95 + ,105.74 + ,105.74 + ,106.37 + ,101.40 + ,106.37 + ,106.34 + ,106.17 + ,105.95 + ,105.74 + ,106.36 + ,103.00 + ,106.37 + ,106.37 + ,106.34 + ,106.17 + ,105.95 + ,106.44 + ,109.10 + ,106.36 + ,106.37 + ,106.37 + ,106.34 + ,106.17 + ,106.29 + ,111.40 + ,106.44 + ,106.36 + ,106.37 + ,106.37 + ,106.34 + ,106.23 + ,114.10 + ,106.29 + ,106.44 + ,106.36 + ,106.37 + ,106.37 + ,106.23 + ,121.80 + ,106.23 + ,106.29 + ,106.44 + ,106.36 + ,106.37 + ,106.23 + ,127.60 + ,106.23 + ,106.23 + ,106.29 + ,106.44 + ,106.36 + ,106.23 + ,129.90 + ,106.23 + ,106.23 + ,106.23 + ,106.29 + ,106.44 + ,106.34 + ,128.00 + ,106.23 + ,106.23 + ,106.23 + ,106.23 + ,106.29 + ,106.44 + ,123.50 + ,106.34 + ,106.23 + ,106.23 + ,106.23 + ,106.23 + ,106.44 + ,124.00 + ,106.44 + ,106.34 + ,106.23 + ,106.23 + ,106.23 + ,106.48 + ,127.40 + ,106.44 + ,106.44 + ,106.34 + ,106.23 + ,106.23 + ,106.50 + ,127.60 + ,106.48 + ,106.44 + ,106.44 + ,106.34 + ,106.23 + ,106.57 + ,128.40 + ,106.50 + ,106.48 + ,106.44 + ,106.44 + ,106.34 + ,106.40 + ,131.40 + ,106.57 + ,106.50 + ,106.48 + ,106.44 + ,106.44 + ,106.37 + ,135.10 + ,106.40 + ,106.57 + ,106.50 + ,106.48 + ,106.44 + ,106.25 + ,134.00 + ,106.37 + ,106.40 + ,106.57 + ,106.50 + ,106.48 + ,106.21 + ,144.50 + ,106.25 + ,106.37 + ,106.40 + ,106.57 + ,106.50 + ,106.21 + ,147.30 + ,106.21 + ,106.25 + ,106.37 + ,106.40 + ,106.57 + ,106.24 + ,150.90 + ,106.21 + ,106.21 + ,106.25 + ,106.37 + ,106.40 + ,106.19 + ,148.70 + ,106.24 + ,106.21 + ,106.21 + ,106.25 + ,106.37 + ,106.08 + ,141.40 + ,106.19 + ,106.24 + ,106.21 + ,106.21 + ,106.25 + ,106.13 + ,138.90 + ,106.08 + ,106.19 + ,106.24 + ,106.21 + ,106.21 + ,106.09 + ,139.80 + ,106.13 + ,106.08 + ,106.19 + ,106.24 + ,106.21) + ,dim=c(7 + ,55) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4' + ,'Y5 ') + ,1:55)) > y <- array(NA,dim=c(7,55),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4','Y5 '),1:55)) > 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 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X Y1 Y2 Y3 Y4 Y5\r M1 M2 M3 M4 M5 M6 M7 M8 M9 1 103.91 100.3 103.88 103.77 103.66 103.64 103.63 1 0 0 0 0 0 0 0 0 2 103.91 98.5 103.91 103.88 103.77 103.66 103.64 0 1 0 0 0 0 0 0 0 3 103.92 95.1 103.91 103.91 103.88 103.77 103.66 0 0 1 0 0 0 0 0 0 4 104.05 93.1 103.92 103.91 103.91 103.88 103.77 0 0 0 1 0 0 0 0 0 5 104.23 92.2 104.05 103.92 103.91 103.91 103.88 0 0 0 0 1 0 0 0 0 6 104.30 89.0 104.23 104.05 103.92 103.91 103.91 0 0 0 0 0 1 0 0 0 7 104.31 86.4 104.30 104.23 104.05 103.92 103.91 0 0 0 0 0 0 1 0 0 8 104.31 84.5 104.31 104.30 104.23 104.05 103.92 0 0 0 0 0 0 0 1 0 9 104.34 82.7 104.31 104.31 104.30 104.23 104.05 0 0 0 0 0 0 0 0 1 10 104.55 80.8 104.34 104.31 104.31 104.30 104.23 0 0 0 0 0 0 0 0 0 11 104.65 81.8 104.55 104.34 104.31 104.31 104.30 0 0 0 0 0 0 0 0 0 12 104.73 81.8 104.65 104.55 104.34 104.31 104.31 0 0 0 0 0 0 0 0 0 13 104.75 82.9 104.73 104.65 104.55 104.34 104.31 1 0 0 0 0 0 0 0 0 14 104.75 83.8 104.75 104.73 104.65 104.55 104.34 0 1 0 0 0 0 0 0 0 15 104.76 86.2 104.75 104.75 104.73 104.65 104.55 0 0 1 0 0 0 0 0 0 16 104.94 86.1 104.76 104.75 104.75 104.73 104.65 0 0 0 1 0 0 0 0 0 17 105.29 86.2 104.94 104.76 104.75 104.75 104.73 0 0 0 0 1 0 0 0 0 18 105.38 88.8 105.29 104.94 104.76 104.75 104.75 0 0 0 0 0 1 0 0 0 19 105.43 89.6 105.38 105.29 104.94 104.76 104.75 0 0 0 0 0 0 1 0 0 20 105.43 87.8 105.43 105.38 105.29 104.94 104.76 0 0 0 0 0 0 0 1 0 21 105.42 88.3 105.43 105.43 105.38 105.29 104.94 0 0 0 0 0 0 0 0 1 22 105.52 88.6 105.42 105.43 105.43 105.38 105.29 0 0 0 0 0 0 0 0 0 23 105.69 91.0 105.52 105.42 105.43 105.43 105.38 0 0 0 0 0 0 0 0 0 24 105.72 91.5 105.69 105.52 105.42 105.43 105.43 0 0 0 0 0 0 0 0 0 25 105.74 95.4 105.72 105.69 105.52 105.42 105.43 1 0 0 0 0 0 0 0 0 26 105.74 98.7 105.74 105.72 105.69 105.52 105.42 0 1 0 0 0 0 0 0 0 27 105.74 99.9 105.74 105.74 105.72 105.69 105.52 0 0 1 0 0 0 0 0 0 28 105.95 98.6 105.74 105.74 105.74 105.72 105.69 0 0 0 1 0 0 0 0 0 29 106.17 100.3 105.95 105.74 105.74 105.74 105.72 0 0 0 0 1 0 0 0 0 30 106.34 100.2 106.17 105.95 105.74 105.74 105.74 0 0 0 0 0 1 0 0 0 31 106.37 100.4 106.34 106.17 105.95 105.74 105.74 0 0 0 0 0 0 1 0 0 32 106.37 101.4 106.37 106.34 106.17 105.95 105.74 0 0 0 0 0 0 0 1 0 33 106.36 103.0 106.37 106.37 106.34 106.17 105.95 0 0 0 0 0 0 0 0 1 34 106.44 109.1 106.36 106.37 106.37 106.34 106.17 0 0 0 0 0 0 0 0 0 35 106.29 111.4 106.44 106.36 106.37 106.37 106.34 0 0 0 0 0 0 0 0 0 36 106.23 114.1 106.29 106.44 106.36 106.37 106.37 0 0 0 0 0 0 0 0 0 37 106.23 121.8 106.23 106.29 106.44 106.36 106.37 1 0 0 0 0 0 0 0 0 38 106.23 127.6 106.23 106.23 106.29 106.44 106.36 0 1 0 0 0 0 0 0 0 39 106.23 129.9 106.23 106.23 106.23 106.29 106.44 0 0 1 0 0 0 0 0 0 40 106.34 128.0 106.23 106.23 106.23 106.23 106.29 0 0 0 1 0 0 0 0 0 41 106.44 123.5 106.34 106.23 106.23 106.23 106.23 0 0 0 0 1 0 0 0 0 42 106.44 124.0 106.44 106.34 106.23 106.23 106.23 0 0 0 0 0 1 0 0 0 43 106.48 127.4 106.44 106.44 106.34 106.23 106.23 0 0 0 0 0 0 1 0 0 44 106.50 127.6 106.48 106.44 106.44 106.34 106.23 0 0 0 0 0 0 0 1 0 45 106.57 128.4 106.50 106.48 106.44 106.44 106.34 0 0 0 0 0 0 0 0 1 46 106.40 131.4 106.57 106.50 106.48 106.44 106.44 0 0 0 0 0 0 0 0 0 47 106.37 135.1 106.40 106.57 106.50 106.48 106.44 0 0 0 0 0 0 0 0 0 48 106.25 134.0 106.37 106.40 106.57 106.50 106.48 0 0 0 0 0 0 0 0 0 49 106.21 144.5 106.25 106.37 106.40 106.57 106.50 1 0 0 0 0 0 0 0 0 50 106.21 147.3 106.21 106.25 106.37 106.40 106.57 0 1 0 0 0 0 0 0 0 51 106.24 150.9 106.21 106.21 106.25 106.37 106.40 0 0 1 0 0 0 0 0 0 52 106.19 148.7 106.24 106.21 106.21 106.25 106.37 0 0 0 1 0 0 0 0 0 53 106.08 141.4 106.19 106.24 106.21 106.21 106.25 0 0 0 0 1 0 0 0 0 54 106.13 138.9 106.08 106.19 106.24 106.21 106.21 0 0 0 0 0 1 0 0 0 55 106.09 139.8 106.13 106.08 106.19 106.24 106.21 0 0 0 0 0 0 1 0 0 M10 M11 t 1 0 0 1 2 0 0 2 3 0 0 3 4 0 0 4 5 0 0 5 6 0 0 6 7 0 0 7 8 0 0 8 9 0 0 9 10 1 0 10 11 0 1 11 12 0 0 12 13 0 0 13 14 0 0 14 15 0 0 15 16 0 0 16 17 0 0 17 18 0 0 18 19 0 0 19 20 0 0 20 21 0 0 21 22 1 0 22 23 0 1 23 24 0 0 24 25 0 0 25 26 0 0 26 27 0 0 27 28 0 0 28 29 0 0 29 30 0 0 30 31 0 0 31 32 0 0 32 33 0 0 33 34 1 0 34 35 0 1 35 36 0 0 36 37 0 0 37 38 0 0 38 39 0 0 39 40 0 0 40 41 0 0 41 42 0 0 42 43 0 0 43 44 0 0 44 45 0 0 45 46 1 0 46 47 0 1 47 48 0 0 48 49 0 0 49 50 0 0 50 51 0 0 51 52 0 0 52 53 0 0 53 54 0 0 54 55 0 0 55 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 -2.8310397 -0.0049797 0.9327138 -0.0849262 -0.2950205 0.1793902 `Y5\r` M1 M2 M3 M4 M5 0.2996729 0.0662920 0.0702756 0.0678099 0.1555106 0.1819848 M6 M7 M8 M9 M10 M11 0.1284070 0.1233565 0.1441148 0.1027503 0.0801148 0.0357875 t -0.0001492 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.167730 -0.036947 0.003218 0.031243 0.116239 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2.8310397 4.3422505 -0.652 0.51856 X -0.0049797 0.0016434 -3.030 0.00451 ** Y1 0.9327138 0.1577453 5.913 9.09e-07 *** Y2 -0.0849262 0.2246089 -0.378 0.70757 Y3 -0.2950205 0.2437821 -1.210 0.23410 Y4 0.1793902 0.2394235 0.749 0.45857 `Y5\r` 0.2996729 0.1858830 1.612 0.11566 M1 0.0662920 0.0497117 1.334 0.19073 M2 0.0702756 0.0512925 1.370 0.17914 M3 0.0678099 0.0502295 1.350 0.18544 M4 0.1555106 0.0486286 3.198 0.00288 ** M5 0.1819848 0.0511739 3.556 0.00108 ** M6 0.1284070 0.0537281 2.390 0.02221 * M7 0.1233565 0.0550833 2.239 0.03140 * M8 0.1441148 0.0657718 2.191 0.03500 * M9 0.1027503 0.0617912 1.663 0.10502 M10 0.0801148 0.0517506 1.548 0.13035 M11 0.0357875 0.0505545 0.708 0.48357 t -0.0001492 0.0036034 -0.041 0.96719 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.07019 on 36 degrees of freedom Multiple R-squared: 0.9955, Adjusted R-squared: 0.9932 F-statistic: 437.9 on 18 and 36 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,] 0.17104780 0.3420956 0.8289522 [2,] 0.07907249 0.1581450 0.9209275 [3,] 0.05536821 0.1107364 0.9446318 [4,] 0.09036578 0.1807316 0.9096342 [5,] 0.20446263 0.4089253 0.7955374 [6,] 0.23377112 0.4675422 0.7662289 [7,] 0.14608847 0.2921769 0.8539115 [8,] 0.15843515 0.3168703 0.8415648 [9,] 0.15935509 0.3187102 0.8406449 [10,] 0.08838058 0.1767612 0.9116194 [11,] 0.30631536 0.6126307 0.6936846 [12,] 0.33906040 0.6781208 0.6609396 > postscript(file="/var/www/html/rcomp/tmp/1orbs1258207131.ps",horizontal=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/html/rcomp/tmp/2zjom1258207131.ps",horizontal=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/html/rcomp/tmp/33v301258207131.ps",horizontal=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/html/rcomp/tmp/49pa81258207131.ps",horizontal=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/html/rcomp/tmp/536j11258207131.ps",horizontal=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 = 55 Frequency = 1 1 2 3 4 5 0.0315487618 0.0259790536 0.0309366911 0.0102524229 0.0006964371 6 7 8 9 10 -0.0543995861 -0.0655916295 -0.0722581594 -0.0594548699 0.0723387888 11 12 13 14 15 0.0057019024 0.0520555955 0.0018386408 -0.0265343410 -0.0575382868 16 17 18 19 20 -0.0133328970 0.1162392134 -0.0412928765 0.0149802533 0.0143856315 21 22 23 24 25 -0.0375403053 -0.0102141421 0.0861529551 -0.0134230901 -0.0223930067 26 27 28 29 30 0.0093102544 -0.0320136472 0.0335356506 0.0272282470 0.0571013539 31 32 33 34 35 0.0153736683 0.0134329337 0.0032183227 0.0581325859 -0.1677300395 36 37 38 39 40 -0.0435873839 -0.0027669950 -0.0384223166 -0.0391205791 0.0295809517 41 42 43 44 45 -0.0037708253 -0.0314833992 0.0715921112 0.0444395942 0.0937768525 46 47 48 49 50 -0.1202572326 0.0758751821 0.0049548785 -0.0082274010 0.0296673497 51 52 53 54 55 0.0977358220 -0.0600361282 -0.1403930721 0.0700745079 -0.0363544034 > postscript(file="/var/www/html/rcomp/tmp/6cvsi1258207131.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 55 Frequency = 1 lag(myerror, k = 1) myerror 0 0.0315487618 NA 1 0.0259790536 0.0315487618 2 0.0309366911 0.0259790536 3 0.0102524229 0.0309366911 4 0.0006964371 0.0102524229 5 -0.0543995861 0.0006964371 6 -0.0655916295 -0.0543995861 7 -0.0722581594 -0.0655916295 8 -0.0594548699 -0.0722581594 9 0.0723387888 -0.0594548699 10 0.0057019024 0.0723387888 11 0.0520555955 0.0057019024 12 0.0018386408 0.0520555955 13 -0.0265343410 0.0018386408 14 -0.0575382868 -0.0265343410 15 -0.0133328970 -0.0575382868 16 0.1162392134 -0.0133328970 17 -0.0412928765 0.1162392134 18 0.0149802533 -0.0412928765 19 0.0143856315 0.0149802533 20 -0.0375403053 0.0143856315 21 -0.0102141421 -0.0375403053 22 0.0861529551 -0.0102141421 23 -0.0134230901 0.0861529551 24 -0.0223930067 -0.0134230901 25 0.0093102544 -0.0223930067 26 -0.0320136472 0.0093102544 27 0.0335356506 -0.0320136472 28 0.0272282470 0.0335356506 29 0.0571013539 0.0272282470 30 0.0153736683 0.0571013539 31 0.0134329337 0.0153736683 32 0.0032183227 0.0134329337 33 0.0581325859 0.0032183227 34 -0.1677300395 0.0581325859 35 -0.0435873839 -0.1677300395 36 -0.0027669950 -0.0435873839 37 -0.0384223166 -0.0027669950 38 -0.0391205791 -0.0384223166 39 0.0295809517 -0.0391205791 40 -0.0037708253 0.0295809517 41 -0.0314833992 -0.0037708253 42 0.0715921112 -0.0314833992 43 0.0444395942 0.0715921112 44 0.0937768525 0.0444395942 45 -0.1202572326 0.0937768525 46 0.0758751821 -0.1202572326 47 0.0049548785 0.0758751821 48 -0.0082274010 0.0049548785 49 0.0296673497 -0.0082274010 50 0.0977358220 0.0296673497 51 -0.0600361282 0.0977358220 52 -0.1403930721 -0.0600361282 53 0.0700745079 -0.1403930721 54 -0.0363544034 0.0700745079 55 NA -0.0363544034 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0259790536 0.0315487618 [2,] 0.0309366911 0.0259790536 [3,] 0.0102524229 0.0309366911 [4,] 0.0006964371 0.0102524229 [5,] -0.0543995861 0.0006964371 [6,] -0.0655916295 -0.0543995861 [7,] -0.0722581594 -0.0655916295 [8,] -0.0594548699 -0.0722581594 [9,] 0.0723387888 -0.0594548699 [10,] 0.0057019024 0.0723387888 [11,] 0.0520555955 0.0057019024 [12,] 0.0018386408 0.0520555955 [13,] -0.0265343410 0.0018386408 [14,] -0.0575382868 -0.0265343410 [15,] -0.0133328970 -0.0575382868 [16,] 0.1162392134 -0.0133328970 [17,] -0.0412928765 0.1162392134 [18,] 0.0149802533 -0.0412928765 [19,] 0.0143856315 0.0149802533 [20,] -0.0375403053 0.0143856315 [21,] -0.0102141421 -0.0375403053 [22,] 0.0861529551 -0.0102141421 [23,] -0.0134230901 0.0861529551 [24,] -0.0223930067 -0.0134230901 [25,] 0.0093102544 -0.0223930067 [26,] -0.0320136472 0.0093102544 [27,] 0.0335356506 -0.0320136472 [28,] 0.0272282470 0.0335356506 [29,] 0.0571013539 0.0272282470 [30,] 0.0153736683 0.0571013539 [31,] 0.0134329337 0.0153736683 [32,] 0.0032183227 0.0134329337 [33,] 0.0581325859 0.0032183227 [34,] -0.1677300395 0.0581325859 [35,] -0.0435873839 -0.1677300395 [36,] -0.0027669950 -0.0435873839 [37,] -0.0384223166 -0.0027669950 [38,] -0.0391205791 -0.0384223166 [39,] 0.0295809517 -0.0391205791 [40,] -0.0037708253 0.0295809517 [41,] -0.0314833992 -0.0037708253 [42,] 0.0715921112 -0.0314833992 [43,] 0.0444395942 0.0715921112 [44,] 0.0937768525 0.0444395942 [45,] -0.1202572326 0.0937768525 [46,] 0.0758751821 -0.1202572326 [47,] 0.0049548785 0.0758751821 [48,] -0.0082274010 0.0049548785 [49,] 0.0296673497 -0.0082274010 [50,] 0.0977358220 0.0296673497 [51,] -0.0600361282 0.0977358220 [52,] -0.1403930721 -0.0600361282 [53,] 0.0700745079 -0.1403930721 [54,] -0.0363544034 0.0700745079 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0259790536 0.0315487618 2 0.0309366911 0.0259790536 3 0.0102524229 0.0309366911 4 0.0006964371 0.0102524229 5 -0.0543995861 0.0006964371 6 -0.0655916295 -0.0543995861 7 -0.0722581594 -0.0655916295 8 -0.0594548699 -0.0722581594 9 0.0723387888 -0.0594548699 10 0.0057019024 0.0723387888 11 0.0520555955 0.0057019024 12 0.0018386408 0.0520555955 13 -0.0265343410 0.0018386408 14 -0.0575382868 -0.0265343410 15 -0.0133328970 -0.0575382868 16 0.1162392134 -0.0133328970 17 -0.0412928765 0.1162392134 18 0.0149802533 -0.0412928765 19 0.0143856315 0.0149802533 20 -0.0375403053 0.0143856315 21 -0.0102141421 -0.0375403053 22 0.0861529551 -0.0102141421 23 -0.0134230901 0.0861529551 24 -0.0223930067 -0.0134230901 25 0.0093102544 -0.0223930067 26 -0.0320136472 0.0093102544 27 0.0335356506 -0.0320136472 28 0.0272282470 0.0335356506 29 0.0571013539 0.0272282470 30 0.0153736683 0.0571013539 31 0.0134329337 0.0153736683 32 0.0032183227 0.0134329337 33 0.0581325859 0.0032183227 34 -0.1677300395 0.0581325859 35 -0.0435873839 -0.1677300395 36 -0.0027669950 -0.0435873839 37 -0.0384223166 -0.0027669950 38 -0.0391205791 -0.0384223166 39 0.0295809517 -0.0391205791 40 -0.0037708253 0.0295809517 41 -0.0314833992 -0.0037708253 42 0.0715921112 -0.0314833992 43 0.0444395942 0.0715921112 44 0.0937768525 0.0444395942 45 -0.1202572326 0.0937768525 46 0.0758751821 -0.1202572326 47 0.0049548785 0.0758751821 48 -0.0082274010 0.0049548785 49 0.0296673497 -0.0082274010 50 0.0977358220 0.0296673497 51 -0.0600361282 0.0977358220 52 -0.1403930721 -0.0600361282 53 0.0700745079 -0.1403930721 54 -0.0363544034 0.0700745079 > 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/html/rcomp/tmp/7z7k21258207131.ps",horizontal=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/html/rcomp/tmp/89qqy1258207131.ps",horizontal=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/html/rcomp/tmp/9krzm1258207131.ps",horizontal=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/html/rcomp/tmp/106c3j1258207131.ps",horizontal=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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11iico1258207131.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/12cx1x1258207131.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/13yrp11258207131.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/14rxo21258207131.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/1515z11258207131.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/16yztw1258207131.tab") + } > > system("convert tmp/1orbs1258207131.ps tmp/1orbs1258207131.png") > system("convert tmp/2zjom1258207131.ps tmp/2zjom1258207131.png") > system("convert tmp/33v301258207131.ps tmp/33v301258207131.png") > system("convert tmp/49pa81258207131.ps tmp/49pa81258207131.png") > system("convert tmp/536j11258207131.ps tmp/536j11258207131.png") > system("convert tmp/6cvsi1258207131.ps tmp/6cvsi1258207131.png") > system("convert tmp/7z7k21258207131.ps tmp/7z7k21258207131.png") > system("convert tmp/89qqy1258207131.ps tmp/89qqy1258207131.png") > system("convert tmp/9krzm1258207131.ps tmp/9krzm1258207131.png") > system("convert tmp/106c3j1258207131.ps tmp/106c3j1258207131.png") > > > proc.time() user system elapsed 2.399 1.620 3.466