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(13.7 + ,15 + ,14.4 + ,15.3 + ,14.3 + ,14.5 + ,14.2 + ,15.5 + ,13.7 + ,14.4 + ,15.3 + ,14.3 + ,13.5 + ,15.1 + ,14.2 + ,13.7 + ,14.4 + ,15.3 + ,11.9 + ,11.7 + ,13.5 + ,14.2 + ,13.7 + ,14.4 + ,14.6 + ,16.3 + ,11.9 + ,13.5 + ,14.2 + ,13.7 + ,15.6 + ,16.7 + ,14.6 + ,11.9 + ,13.5 + ,14.2 + ,14.1 + ,15 + ,15.6 + ,14.6 + ,11.9 + ,13.5 + ,14.9 + ,14.9 + ,14.1 + ,15.6 + ,14.6 + ,11.9 + ,14.2 + ,14.6 + ,14.9 + ,14.1 + ,15.6 + ,14.6 + ,14.6 + ,15.3 + ,14.2 + ,14.9 + ,14.1 + ,15.6 + ,17.2 + ,17.9 + ,14.6 + ,14.2 + ,14.9 + ,14.1 + ,15.4 + ,16.4 + ,17.2 + ,14.6 + ,14.2 + ,14.9 + ,14.3 + ,15.4 + ,15.4 + ,17.2 + ,14.6 + ,14.2 + ,17.5 + ,17.9 + ,14.3 + ,15.4 + ,17.2 + ,14.6 + ,14.5 + ,15.9 + ,17.5 + ,14.3 + ,15.4 + ,17.2 + ,14.4 + ,13.9 + ,14.5 + ,17.5 + ,14.3 + ,15.4 + ,16.6 + ,17.8 + ,14.4 + ,14.5 + ,17.5 + ,14.3 + ,16.7 + ,17.9 + ,16.6 + ,14.4 + ,14.5 + ,17.5 + ,16.6 + ,17.4 + ,16.7 + ,16.6 + ,14.4 + ,14.5 + ,16.9 + ,16.7 + ,16.6 + ,16.7 + ,16.6 + ,14.4 + ,15.7 + ,16 + ,16.9 + ,16.6 + ,16.7 + ,16.6 + ,16.4 + ,16.6 + ,15.7 + ,16.9 + ,16.6 + ,16.7 + ,18.4 + ,19.1 + ,16.4 + ,15.7 + ,16.9 + ,16.6 + ,16.9 + ,17.8 + ,18.4 + ,16.4 + ,15.7 + ,16.9 + ,16.5 + ,17.2 + ,16.9 + ,18.4 + ,16.4 + ,15.7 + ,18.3 + ,18.6 + ,16.5 + ,16.9 + ,18.4 + ,16.4 + ,15.1 + ,16.3 + ,18.3 + ,16.5 + ,16.9 + ,18.4 + ,15.7 + ,15.1 + ,15.1 + ,18.3 + ,16.5 + ,16.9 + ,18.1 + ,19.2 + ,15.7 + ,15.1 + ,18.3 + ,16.5 + ,16.8 + ,17.7 + ,18.1 + ,15.7 + ,15.1 + ,18.3 + ,18.9 + ,19.1 + ,16.8 + ,18.1 + ,15.7 + ,15.1 + ,19 + ,18 + ,18.9 + ,16.8 + ,18.1 + ,15.7 + ,18.1 + ,17.5 + ,19 + ,18.9 + ,16.8 + ,18.1 + ,17.8 + ,17.8 + ,18.1 + ,19 + ,18.9 + ,16.8 + ,21.5 + ,21.1 + ,17.8 + ,18.1 + ,19 + ,18.9 + ,17.1 + ,17.2 + ,21.5 + ,17.8 + ,18.1 + ,19 + ,18.7 + ,19.4 + ,17.1 + ,21.5 + ,17.8 + ,18.1 + ,19 + ,19.8 + ,18.7 + ,17.1 + ,21.5 + ,17.8 + ,16.4 + ,17.6 + ,19 + ,18.7 + ,17.1 + ,21.5 + ,16.9 + ,16.2 + ,16.4 + ,19 + ,18.7 + ,17.1 + ,18.6 + ,19.5 + ,16.9 + ,16.4 + ,19 + ,18.7 + ,19.3 + ,19.9 + ,18.6 + ,16.9 + ,16.4 + ,19 + ,19.4 + ,20 + ,19.3 + ,18.6 + ,16.9 + ,16.4 + ,17.6 + ,17.3 + ,19.4 + ,19.3 + ,18.6 + ,16.9 + ,18.6 + ,18.9 + ,17.6 + ,19.4 + ,19.3 + ,18.6 + ,18.1 + ,18.6 + ,18.6 + ,17.6 + ,19.4 + ,19.3 + ,20.4 + ,21.4 + ,18.1 + ,18.6 + ,17.6 + ,19.4 + ,18.1 + ,18.6 + ,20.4 + ,18.1 + ,18.6 + ,17.6 + ,19.6 + ,19.8 + ,18.1 + ,20.4 + ,18.1 + ,18.6 + ,19.9 + ,20.8 + ,19.6 + ,18.1 + ,20.4 + ,18.1 + ,19.2 + ,19.6 + ,19.9 + ,19.6 + ,18.1 + ,20.4 + ,17.8 + ,17.7 + ,19.2 + ,19.9 + ,19.6 + ,18.1 + ,19.2 + ,19.8 + ,17.8 + ,19.2 + ,19.9 + ,19.6 + ,22 + ,22.2 + ,19.2 + ,17.8 + ,19.2 + ,19.9 + ,21.1 + ,20.7 + ,22 + ,19.2 + ,17.8 + ,19.2 + ,19.5 + ,17.9 + ,21.1 + ,22 + ,19.2 + ,17.8 + ,22.2 + ,20.9 + ,19.5 + ,21.1 + ,22 + ,19.2 + ,20.9 + ,21.2 + ,22.2 + ,19.5 + ,21.1 + ,22 + ,22.2 + ,21.4 + ,20.9 + ,22.2 + ,19.5 + ,21.1 + ,23.5 + ,23 + ,22.2 + ,20.9 + ,22.2 + ,19.5 + ,21.5 + ,21.3 + ,23.5 + ,22.2 + ,20.9 + ,22.2 + ,24.3 + ,23.9 + ,21.5 + ,23.5 + ,22.2 + ,20.9 + ,22.8 + ,22.4 + ,24.3 + ,21.5 + ,23.5 + ,22.2 + ,20.3 + ,18.3 + ,22.8 + ,24.3 + ,21.5 + ,23.5 + ,23.7 + ,22.8 + ,20.3 + ,22.8 + ,24.3 + ,21.5 + ,23.3 + ,22.3 + ,23.7 + ,20.3 + ,22.8 + ,24.3 + ,19.6 + ,17.8 + ,23.3 + ,23.7 + ,20.3 + ,22.8 + ,18 + ,16.4 + ,19.6 + ,23.3 + ,23.7 + ,20.3 + ,17.3 + ,16 + ,18 + ,19.6 + ,23.3 + ,23.7 + ,16.8 + ,16.4 + ,17.3 + ,18 + ,19.6 + ,23.3 + ,18.2 + ,17.7 + ,16.8 + ,17.3 + ,18 + ,19.6 + ,16.5 + ,16.6 + ,18.2 + ,16.8 + ,17.3 + ,18 + ,16 + ,16.2 + ,16.5 + ,18.2 + ,16.8 + ,17.3 + ,18.4 + ,18.3 + ,16 + ,16.5 + ,18.2 + ,16.8) + ,dim=c(6 + ,74) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:74)) > y <- array(NA,dim=c(6,74),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:74)) > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 13.7 15.0 14.4 15.3 14.3 14.5 1 0 0 0 0 0 0 0 0 0 0 1 2 14.2 15.5 13.7 14.4 15.3 14.3 0 1 0 0 0 0 0 0 0 0 0 2 3 13.5 15.1 14.2 13.7 14.4 15.3 0 0 1 0 0 0 0 0 0 0 0 3 4 11.9 11.7 13.5 14.2 13.7 14.4 0 0 0 1 0 0 0 0 0 0 0 4 5 14.6 16.3 11.9 13.5 14.2 13.7 0 0 0 0 1 0 0 0 0 0 0 5 6 15.6 16.7 14.6 11.9 13.5 14.2 0 0 0 0 0 1 0 0 0 0 0 6 7 14.1 15.0 15.6 14.6 11.9 13.5 0 0 0 0 0 0 1 0 0 0 0 7 8 14.9 14.9 14.1 15.6 14.6 11.9 0 0 0 0 0 0 0 1 0 0 0 8 9 14.2 14.6 14.9 14.1 15.6 14.6 0 0 0 0 0 0 0 0 1 0 0 9 10 14.6 15.3 14.2 14.9 14.1 15.6 0 0 0 0 0 0 0 0 0 1 0 10 11 17.2 17.9 14.6 14.2 14.9 14.1 0 0 0 0 0 0 0 0 0 0 1 11 12 15.4 16.4 17.2 14.6 14.2 14.9 0 0 0 0 0 0 0 0 0 0 0 12 13 14.3 15.4 15.4 17.2 14.6 14.2 1 0 0 0 0 0 0 0 0 0 0 13 14 17.5 17.9 14.3 15.4 17.2 14.6 0 1 0 0 0 0 0 0 0 0 0 14 15 14.5 15.9 17.5 14.3 15.4 17.2 0 0 1 0 0 0 0 0 0 0 0 15 16 14.4 13.9 14.5 17.5 14.3 15.4 0 0 0 1 0 0 0 0 0 0 0 16 17 16.6 17.8 14.4 14.5 17.5 14.3 0 0 0 0 1 0 0 0 0 0 0 17 18 16.7 17.9 16.6 14.4 14.5 17.5 0 0 0 0 0 1 0 0 0 0 0 18 19 16.6 17.4 16.7 16.6 14.4 14.5 0 0 0 0 0 0 1 0 0 0 0 19 20 16.9 16.7 16.6 16.7 16.6 14.4 0 0 0 0 0 0 0 1 0 0 0 20 21 15.7 16.0 16.9 16.6 16.7 16.6 0 0 0 0 0 0 0 0 1 0 0 21 22 16.4 16.6 15.7 16.9 16.6 16.7 0 0 0 0 0 0 0 0 0 1 0 22 23 18.4 19.1 16.4 15.7 16.9 16.6 0 0 0 0 0 0 0 0 0 0 1 23 24 16.9 17.8 18.4 16.4 15.7 16.9 0 0 0 0 0 0 0 0 0 0 0 24 25 16.5 17.2 16.9 18.4 16.4 15.7 1 0 0 0 0 0 0 0 0 0 0 25 26 18.3 18.6 16.5 16.9 18.4 16.4 0 1 0 0 0 0 0 0 0 0 0 26 27 15.1 16.3 18.3 16.5 16.9 18.4 0 0 1 0 0 0 0 0 0 0 0 27 28 15.7 15.1 15.1 18.3 16.5 16.9 0 0 0 1 0 0 0 0 0 0 0 28 29 18.1 19.2 15.7 15.1 18.3 16.5 0 0 0 0 1 0 0 0 0 0 0 29 30 16.8 17.7 18.1 15.7 15.1 18.3 0 0 0 0 0 1 0 0 0 0 0 30 31 18.9 19.1 16.8 18.1 15.7 15.1 0 0 0 0 0 0 1 0 0 0 0 31 32 19.0 18.0 18.9 16.8 18.1 15.7 0 0 0 0 0 0 0 1 0 0 0 32 33 18.1 17.5 19.0 18.9 16.8 18.1 0 0 0 0 0 0 0 0 1 0 0 33 34 17.8 17.8 18.1 19.0 18.9 16.8 0 0 0 0 0 0 0 0 0 1 0 34 35 21.5 21.1 17.8 18.1 19.0 18.9 0 0 0 0 0 0 0 0 0 0 1 35 36 17.1 17.2 21.5 17.8 18.1 19.0 0 0 0 0 0 0 0 0 0 0 0 36 37 18.7 19.4 17.1 21.5 17.8 18.1 1 0 0 0 0 0 0 0 0 0 0 37 38 19.0 19.8 18.7 17.1 21.5 17.8 0 1 0 0 0 0 0 0 0 0 0 38 39 16.4 17.6 19.0 18.7 17.1 21.5 0 0 1 0 0 0 0 0 0 0 0 39 40 16.9 16.2 16.4 19.0 18.7 17.1 0 0 0 1 0 0 0 0 0 0 0 40 41 18.6 19.5 16.9 16.4 19.0 18.7 0 0 0 0 1 0 0 0 0 0 0 41 42 19.3 19.9 18.6 16.9 16.4 19.0 0 0 0 0 0 1 0 0 0 0 0 42 43 19.4 20.0 19.3 18.6 16.9 16.4 0 0 0 0 0 0 1 0 0 0 0 43 44 17.6 17.3 19.4 19.3 18.6 16.9 0 0 0 0 0 0 0 1 0 0 0 44 45 18.6 18.9 17.6 19.4 19.3 18.6 0 0 0 0 0 0 0 0 1 0 0 45 46 18.1 18.6 18.6 17.6 19.4 19.3 0 0 0 0 0 0 0 0 0 1 0 46 47 20.4 21.4 18.1 18.6 17.6 19.4 0 0 0 0 0 0 0 0 0 0 1 47 48 18.1 18.6 20.4 18.1 18.6 17.6 0 0 0 0 0 0 0 0 0 0 0 48 49 19.6 19.8 18.1 20.4 18.1 18.6 1 0 0 0 0 0 0 0 0 0 0 49 50 19.9 20.8 19.6 18.1 20.4 18.1 0 1 0 0 0 0 0 0 0 0 0 50 51 19.2 19.6 19.9 19.6 18.1 20.4 0 0 1 0 0 0 0 0 0 0 0 51 52 17.8 17.7 19.2 19.9 19.6 18.1 0 0 0 1 0 0 0 0 0 0 0 52 53 19.2 19.8 17.8 19.2 19.9 19.6 0 0 0 0 1 0 0 0 0 0 0 53 54 22.0 22.2 19.2 17.8 19.2 19.9 0 0 0 0 0 1 0 0 0 0 0 54 55 21.1 20.7 22.0 19.2 17.8 19.2 0 0 0 0 0 0 1 0 0 0 0 55 56 19.5 17.9 21.1 22.0 19.2 17.8 0 0 0 0 0 0 0 1 0 0 0 56 57 22.2 20.9 19.5 21.1 22.0 19.2 0 0 0 0 0 0 0 0 1 0 0 57 58 20.9 21.2 22.2 19.5 21.1 22.0 0 0 0 0 0 0 0 0 0 1 0 58 59 22.2 21.4 20.9 22.2 19.5 21.1 0 0 0 0 0 0 0 0 0 0 1 59 60 23.5 23.0 22.2 20.9 22.2 19.5 0 0 0 0 0 0 0 0 0 0 0 60 61 21.5 21.3 23.5 22.2 20.9 22.2 1 0 0 0 0 0 0 0 0 0 0 61 62 24.3 23.9 21.5 23.5 22.2 20.9 0 1 0 0 0 0 0 0 0 0 0 62 63 22.8 22.4 24.3 21.5 23.5 22.2 0 0 1 0 0 0 0 0 0 0 0 63 64 20.3 18.3 22.8 24.3 21.5 23.5 0 0 0 1 0 0 0 0 0 0 0 64 65 23.7 22.8 20.3 22.8 24.3 21.5 0 0 0 0 1 0 0 0 0 0 0 65 66 23.3 22.3 23.7 20.3 22.8 24.3 0 0 0 0 0 1 0 0 0 0 0 66 67 19.6 17.8 23.3 23.7 20.3 22.8 0 0 0 0 0 0 1 0 0 0 0 67 68 18.0 16.4 19.6 23.3 23.7 20.3 0 0 0 0 0 0 0 1 0 0 0 68 69 17.3 16.0 18.0 19.6 23.3 23.7 0 0 0 0 0 0 0 0 1 0 0 69 70 16.8 16.4 17.3 18.0 19.6 23.3 0 0 0 0 0 0 0 0 0 1 0 70 71 18.2 17.7 16.8 17.3 18.0 19.6 0 0 0 0 0 0 0 0 0 0 1 71 72 16.5 16.6 18.2 16.8 17.3 18.0 0 0 0 0 0 0 0 0 0 0 0 72 73 16.0 16.2 16.5 18.2 16.8 17.3 1 0 0 0 0 0 0 0 0 0 0 73 74 18.4 18.3 16.0 16.5 18.2 16.8 0 1 0 0 0 0 0 0 0 0 0 74 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 -2.899990 0.873628 0.024549 0.145315 0.110702 -0.022539 M1 M2 M3 M4 M5 M6 -0.361337 -0.055659 -0.472649 0.625633 -0.223771 0.365365 M7 M8 M9 M10 M11 t 0.360499 0.676363 0.420586 0.048551 0.465681 0.006736 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.86404 -0.22635 0.04134 0.24195 0.72766 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2.899990 0.614110 -4.722 1.60e-05 *** X 0.873628 0.048506 18.011 < 2e-16 *** Y1 0.024549 0.052890 0.464 0.64434 Y2 0.145315 0.048801 2.978 0.00429 ** Y3 0.110702 0.050477 2.193 0.03247 * Y4 -0.022539 0.057631 -0.391 0.69721 M1 -0.361337 0.260616 -1.386 0.17110 M2 -0.055659 0.271460 -0.205 0.83829 M3 -0.472649 0.256836 -1.840 0.07103 . M4 0.625633 0.289713 2.159 0.03511 * M5 -0.223771 0.316335 -0.707 0.48226 M6 0.365365 0.296280 1.233 0.22266 M7 0.360499 0.243658 1.480 0.14460 M8 0.676363 0.284027 2.381 0.02067 * M9 0.420586 0.268535 1.566 0.12293 M10 0.048551 0.266358 0.182 0.85602 M11 0.465681 0.292402 1.593 0.11688 t 0.006736 0.004765 1.414 0.16299 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.3854 on 56 degrees of freedom Multiple R-squared: 0.9843, Adjusted R-squared: 0.9796 F-statistic: 207.1 on 17 and 56 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,] 6.419712e-02 1.283942e-01 0.9358029 [2,] 4.085154e-02 8.170307e-02 0.9591485 [3,] 1.572857e-02 3.145713e-02 0.9842714 [4,] 5.019520e-03 1.003904e-02 0.9949805 [5,] 1.447173e-03 2.894346e-03 0.9985528 [6,] 5.760603e-04 1.152121e-03 0.9994239 [7,] 1.694150e-04 3.388300e-04 0.9998306 [8,] 1.027830e-04 2.055660e-04 0.9998972 [9,] 3.327369e-05 6.654738e-05 0.9999667 [10,] 1.107922e-05 2.215843e-05 0.9999889 [11,] 3.286950e-06 6.573899e-06 0.9999967 [12,] 2.224590e-05 4.449180e-05 0.9999778 [13,] 1.529912e-04 3.059823e-04 0.9998470 [14,] 7.367471e-05 1.473494e-04 0.9999263 [15,] 1.094427e-02 2.188853e-02 0.9890557 [16,] 2.981430e-02 5.962860e-02 0.9701857 [17,] 2.060381e-02 4.120763e-02 0.9793962 [18,] 8.129365e-02 1.625873e-01 0.9187063 [19,] 5.757230e-02 1.151446e-01 0.9424277 [20,] 1.081168e-01 2.162336e-01 0.8918832 [21,] 1.132634e-01 2.265267e-01 0.8867366 [22,] 7.624663e-02 1.524933e-01 0.9237534 [23,] 8.159909e-02 1.631982e-01 0.9184009 [24,] 6.506434e-02 1.301287e-01 0.9349357 [25,] 1.145111e-01 2.290222e-01 0.8854889 [26,] 1.103438e-01 2.206876e-01 0.8896562 [27,] 2.515580e-01 5.031160e-01 0.7484420 [28,] 2.253759e-01 4.507517e-01 0.7746241 [29,] 4.555393e-01 9.110785e-01 0.5444607 [30,] 5.390079e-01 9.219842e-01 0.4609921 [31,] 4.575037e-01 9.150074e-01 0.5424963 [32,] 4.138323e-01 8.276647e-01 0.5861677 [33,] 2.677728e-01 5.355455e-01 0.7322272 > postscript(file="/var/www/html/rcomp/tmp/16oab1258796927.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/2n4v21258796927.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/3bblo1258796927.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/49c9s1258796927.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/5vzdu1258796927.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 = 74 Frequency = 1 1 2 3 4 5 6 0.017123958 -0.199345048 0.071976661 0.339026537 -0.067122901 0.242536175 7 8 9 10 11 12 -0.029720245 0.091594041 0.051210230 0.294494334 0.168726496 0.111681828 13 14 15 16 17 18 -0.153777924 0.559501126 0.056165010 0.288243425 -0.016875700 -0.235356678 19 20 21 22 23 24 -0.279107458 0.051957952 -0.241779288 0.298532149 -0.187674407 -0.104228405 25 26 27 28 29 30 0.016204879 0.302878512 -0.252454920 0.118342687 0.021136363 -0.315584730 31 32 33 34 35 36 0.104078124 0.727664738 0.403908652 -0.047091847 0.520480339 0.041222279 37 38 39 40 41 42 -0.342882405 -0.520997340 -0.458148503 -0.096149077 -0.068056288 -0.133184372 43 44 45 46 47 48 -0.500589276 -0.545492453 -0.703774383 -0.334661052 -0.836208834 -0.366183425 49 50 51 52 53 54 0.240192484 -0.614331560 0.225392364 -0.864035327 -0.319298141 0.041448054 55 56 57 58 59 60 0.317046806 0.269279958 0.489088775 -0.378737445 0.119071685 0.302250136 61 62 63 64 65 66 0.125963161 0.029092421 0.357069389 0.214571755 0.450216668 0.400141552 67 68 69 70 71 72 0.388292048 -0.595004234 0.001346013 0.167463862 0.215604721 0.015257586 73 74 0.097175847 0.443201889 > postscript(file="/var/www/html/rcomp/tmp/6sysq1258796927.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 = 74 Frequency = 1 lag(myerror, k = 1) myerror 0 0.017123958 NA 1 -0.199345048 0.017123958 2 0.071976661 -0.199345048 3 0.339026537 0.071976661 4 -0.067122901 0.339026537 5 0.242536175 -0.067122901 6 -0.029720245 0.242536175 7 0.091594041 -0.029720245 8 0.051210230 0.091594041 9 0.294494334 0.051210230 10 0.168726496 0.294494334 11 0.111681828 0.168726496 12 -0.153777924 0.111681828 13 0.559501126 -0.153777924 14 0.056165010 0.559501126 15 0.288243425 0.056165010 16 -0.016875700 0.288243425 17 -0.235356678 -0.016875700 18 -0.279107458 -0.235356678 19 0.051957952 -0.279107458 20 -0.241779288 0.051957952 21 0.298532149 -0.241779288 22 -0.187674407 0.298532149 23 -0.104228405 -0.187674407 24 0.016204879 -0.104228405 25 0.302878512 0.016204879 26 -0.252454920 0.302878512 27 0.118342687 -0.252454920 28 0.021136363 0.118342687 29 -0.315584730 0.021136363 30 0.104078124 -0.315584730 31 0.727664738 0.104078124 32 0.403908652 0.727664738 33 -0.047091847 0.403908652 34 0.520480339 -0.047091847 35 0.041222279 0.520480339 36 -0.342882405 0.041222279 37 -0.520997340 -0.342882405 38 -0.458148503 -0.520997340 39 -0.096149077 -0.458148503 40 -0.068056288 -0.096149077 41 -0.133184372 -0.068056288 42 -0.500589276 -0.133184372 43 -0.545492453 -0.500589276 44 -0.703774383 -0.545492453 45 -0.334661052 -0.703774383 46 -0.836208834 -0.334661052 47 -0.366183425 -0.836208834 48 0.240192484 -0.366183425 49 -0.614331560 0.240192484 50 0.225392364 -0.614331560 51 -0.864035327 0.225392364 52 -0.319298141 -0.864035327 53 0.041448054 -0.319298141 54 0.317046806 0.041448054 55 0.269279958 0.317046806 56 0.489088775 0.269279958 57 -0.378737445 0.489088775 58 0.119071685 -0.378737445 59 0.302250136 0.119071685 60 0.125963161 0.302250136 61 0.029092421 0.125963161 62 0.357069389 0.029092421 63 0.214571755 0.357069389 64 0.450216668 0.214571755 65 0.400141552 0.450216668 66 0.388292048 0.400141552 67 -0.595004234 0.388292048 68 0.001346013 -0.595004234 69 0.167463862 0.001346013 70 0.215604721 0.167463862 71 0.015257586 0.215604721 72 0.097175847 0.015257586 73 0.443201889 0.097175847 74 NA 0.443201889 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.199345048 0.017123958 [2,] 0.071976661 -0.199345048 [3,] 0.339026537 0.071976661 [4,] -0.067122901 0.339026537 [5,] 0.242536175 -0.067122901 [6,] -0.029720245 0.242536175 [7,] 0.091594041 -0.029720245 [8,] 0.051210230 0.091594041 [9,] 0.294494334 0.051210230 [10,] 0.168726496 0.294494334 [11,] 0.111681828 0.168726496 [12,] -0.153777924 0.111681828 [13,] 0.559501126 -0.153777924 [14,] 0.056165010 0.559501126 [15,] 0.288243425 0.056165010 [16,] -0.016875700 0.288243425 [17,] -0.235356678 -0.016875700 [18,] -0.279107458 -0.235356678 [19,] 0.051957952 -0.279107458 [20,] -0.241779288 0.051957952 [21,] 0.298532149 -0.241779288 [22,] -0.187674407 0.298532149 [23,] -0.104228405 -0.187674407 [24,] 0.016204879 -0.104228405 [25,] 0.302878512 0.016204879 [26,] -0.252454920 0.302878512 [27,] 0.118342687 -0.252454920 [28,] 0.021136363 0.118342687 [29,] -0.315584730 0.021136363 [30,] 0.104078124 -0.315584730 [31,] 0.727664738 0.104078124 [32,] 0.403908652 0.727664738 [33,] -0.047091847 0.403908652 [34,] 0.520480339 -0.047091847 [35,] 0.041222279 0.520480339 [36,] -0.342882405 0.041222279 [37,] -0.520997340 -0.342882405 [38,] -0.458148503 -0.520997340 [39,] -0.096149077 -0.458148503 [40,] -0.068056288 -0.096149077 [41,] -0.133184372 -0.068056288 [42,] -0.500589276 -0.133184372 [43,] -0.545492453 -0.500589276 [44,] -0.703774383 -0.545492453 [45,] -0.334661052 -0.703774383 [46,] -0.836208834 -0.334661052 [47,] -0.366183425 -0.836208834 [48,] 0.240192484 -0.366183425 [49,] -0.614331560 0.240192484 [50,] 0.225392364 -0.614331560 [51,] -0.864035327 0.225392364 [52,] -0.319298141 -0.864035327 [53,] 0.041448054 -0.319298141 [54,] 0.317046806 0.041448054 [55,] 0.269279958 0.317046806 [56,] 0.489088775 0.269279958 [57,] -0.378737445 0.489088775 [58,] 0.119071685 -0.378737445 [59,] 0.302250136 0.119071685 [60,] 0.125963161 0.302250136 [61,] 0.029092421 0.125963161 [62,] 0.357069389 0.029092421 [63,] 0.214571755 0.357069389 [64,] 0.450216668 0.214571755 [65,] 0.400141552 0.450216668 [66,] 0.388292048 0.400141552 [67,] -0.595004234 0.388292048 [68,] 0.001346013 -0.595004234 [69,] 0.167463862 0.001346013 [70,] 0.215604721 0.167463862 [71,] 0.015257586 0.215604721 [72,] 0.097175847 0.015257586 [73,] 0.443201889 0.097175847 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.199345048 0.017123958 2 0.071976661 -0.199345048 3 0.339026537 0.071976661 4 -0.067122901 0.339026537 5 0.242536175 -0.067122901 6 -0.029720245 0.242536175 7 0.091594041 -0.029720245 8 0.051210230 0.091594041 9 0.294494334 0.051210230 10 0.168726496 0.294494334 11 0.111681828 0.168726496 12 -0.153777924 0.111681828 13 0.559501126 -0.153777924 14 0.056165010 0.559501126 15 0.288243425 0.056165010 16 -0.016875700 0.288243425 17 -0.235356678 -0.016875700 18 -0.279107458 -0.235356678 19 0.051957952 -0.279107458 20 -0.241779288 0.051957952 21 0.298532149 -0.241779288 22 -0.187674407 0.298532149 23 -0.104228405 -0.187674407 24 0.016204879 -0.104228405 25 0.302878512 0.016204879 26 -0.252454920 0.302878512 27 0.118342687 -0.252454920 28 0.021136363 0.118342687 29 -0.315584730 0.021136363 30 0.104078124 -0.315584730 31 0.727664738 0.104078124 32 0.403908652 0.727664738 33 -0.047091847 0.403908652 34 0.520480339 -0.047091847 35 0.041222279 0.520480339 36 -0.342882405 0.041222279 37 -0.520997340 -0.342882405 38 -0.458148503 -0.520997340 39 -0.096149077 -0.458148503 40 -0.068056288 -0.096149077 41 -0.133184372 -0.068056288 42 -0.500589276 -0.133184372 43 -0.545492453 -0.500589276 44 -0.703774383 -0.545492453 45 -0.334661052 -0.703774383 46 -0.836208834 -0.334661052 47 -0.366183425 -0.836208834 48 0.240192484 -0.366183425 49 -0.614331560 0.240192484 50 0.225392364 -0.614331560 51 -0.864035327 0.225392364 52 -0.319298141 -0.864035327 53 0.041448054 -0.319298141 54 0.317046806 0.041448054 55 0.269279958 0.317046806 56 0.489088775 0.269279958 57 -0.378737445 0.489088775 58 0.119071685 -0.378737445 59 0.302250136 0.119071685 60 0.125963161 0.302250136 61 0.029092421 0.125963161 62 0.357069389 0.029092421 63 0.214571755 0.357069389 64 0.450216668 0.214571755 65 0.400141552 0.450216668 66 0.388292048 0.400141552 67 -0.595004234 0.388292048 68 0.001346013 -0.595004234 69 0.167463862 0.001346013 70 0.215604721 0.167463862 71 0.015257586 0.215604721 72 0.097175847 0.015257586 73 0.443201889 0.097175847 > 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/7lmxo1258796927.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/8nu3f1258796927.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/9grks1258796927.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/10bm851258796927.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/11i0wh1258796927.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/1279t01258796927.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/13oslr1258796927.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/14yzf11258796927.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/15otox1258796927.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/160hy81258796927.tab") + } > > system("convert tmp/16oab1258796927.ps tmp/16oab1258796927.png") > system("convert tmp/2n4v21258796927.ps tmp/2n4v21258796927.png") > system("convert tmp/3bblo1258796927.ps tmp/3bblo1258796927.png") > system("convert tmp/49c9s1258796927.ps tmp/49c9s1258796927.png") > system("convert tmp/5vzdu1258796927.ps tmp/5vzdu1258796927.png") > system("convert tmp/6sysq1258796927.ps tmp/6sysq1258796927.png") > system("convert tmp/7lmxo1258796927.ps tmp/7lmxo1258796927.png") > system("convert tmp/8nu3f1258796927.ps tmp/8nu3f1258796927.png") > system("convert tmp/9grks1258796927.ps tmp/9grks1258796927.png") > system("convert tmp/10bm851258796927.ps tmp/10bm851258796927.png") > > > proc.time() user system elapsed 2.615 1.569 3.095