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(96.3 + ,94.0 + ,96.2 + ,100.0 + ,107.2 + ,91.1 + ,96.3 + ,96.2 + ,114.9 + ,93.1 + ,107.2 + ,96.3 + ,92.6 + ,93.9 + ,114.9 + ,107.2 + ,115.0 + ,92.6 + ,92.6 + ,114.9 + ,107.1 + ,94.4 + ,115.0 + ,92.6 + ,117.8 + ,96.3 + ,107.1 + ,115.0 + ,107.4 + ,100.4 + ,117.8 + ,107.1 + ,106.3 + ,101.5 + ,107.4 + ,117.8 + ,114.5 + ,99.4 + ,106.3 + ,107.4 + ,98.0 + ,99.7 + ,114.5 + ,106.3 + ,103.1 + ,101.7 + ,98.0 + ,114.5 + ,100.3 + ,103.7 + ,103.1 + ,98.0 + ,104.6 + ,103.1 + ,100.3 + ,103.1 + ,111.2 + ,101.0 + ,104.6 + ,100.3 + ,105.0 + ,102.3 + ,111.2 + ,104.6 + ,109.9 + ,101.6 + ,105.0 + ,111.2 + ,111.5 + ,99.6 + ,109.9 + ,105.0 + ,132.5 + ,95.7 + ,111.5 + ,109.9 + ,100.3 + ,96.6 + ,132.5 + ,111.5 + ,123.1 + ,96.3 + ,100.3 + ,132.5 + ,114.2 + ,95.4 + ,123.1 + ,100.3 + ,104.6 + ,96.0 + ,114.2 + ,123.1 + ,109.1 + ,96.9 + ,104.6 + ,114.2 + ,107.0 + ,94.9 + ,109.1 + ,104.6 + ,133.7 + ,92.5 + ,107.0 + ,109.1 + ,124.9 + ,94.0 + ,133.7 + ,107.0 + ,122.5 + ,93.5 + ,124.9 + ,133.7 + ,116.8 + ,92.3 + ,122.5 + ,124.9 + ,116.0 + ,90.4 + ,116.8 + ,122.5 + ,129.8 + ,90.4 + ,116.0 + ,116.8 + ,125.2 + ,91.0 + ,129.8 + ,116.0 + ,143.8 + ,89.1 + ,125.2 + ,129.8 + ,127.9 + ,89.7 + ,143.8 + ,125.2 + ,130.3 + ,87.9 + ,127.9 + ,143.8 + ,108.4 + ,85.9 + ,130.3 + ,127.9 + ,129.4 + ,83.2 + ,108.4 + ,130.3 + ,143.7 + ,83.9 + ,129.4 + ,108.4 + ,131.9 + ,83.0 + ,143.7 + ,129.4 + ,117.6 + ,82.8 + ,131.9 + ,143.7 + ,119.0 + ,78.7 + ,117.6 + ,131.9 + ,104.8 + ,77.6 + ,119.0 + ,117.6 + ,134.6 + ,78.5 + ,104.8 + ,119.0 + ,140.4 + ,78.6 + ,134.6 + ,104.8 + ,143.8 + ,77.5 + ,140.4 + ,134.6 + ,153.4 + ,81.6 + ,143.8 + ,140.4 + ,153.3 + ,85.0 + ,153.4 + ,143.8 + ,127.3 + ,91.7 + ,153.3 + ,153.4 + ,153.6 + ,96.0 + ,127.3 + ,153.3 + ,136.9 + ,90.8 + ,153.6 + ,127.3 + ,131.8 + ,92.3 + ,136.9 + ,153.6 + ,144.3 + ,95.6 + ,131.8 + ,136.9 + ,107.4 + ,93.6 + ,144.3 + ,131.8 + ,113.6 + ,92.6 + ,107.4 + ,144.3 + ,124.2 + ,89.5 + ,113.6 + ,107.4 + ,102.1 + ,87.2 + ,124.2 + ,113.6 + ,96.4 + ,86.7 + ,102.1 + ,124.2 + ,111.7 + ,85.6 + ,96.4 + ,102.1) + ,dim=c(4 + ,58) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2') + ,1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58)) > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 96.3 94.0 96.2 100.0 1 0 0 0 0 0 0 0 0 0 0 1 2 107.2 91.1 96.3 96.2 0 1 0 0 0 0 0 0 0 0 0 2 3 114.9 93.1 107.2 96.3 0 0 1 0 0 0 0 0 0 0 0 3 4 92.6 93.9 114.9 107.2 0 0 0 1 0 0 0 0 0 0 0 4 5 115.0 92.6 92.6 114.9 0 0 0 0 1 0 0 0 0 0 0 5 6 107.1 94.4 115.0 92.6 0 0 0 0 0 1 0 0 0 0 0 6 7 117.8 96.3 107.1 115.0 0 0 0 0 0 0 1 0 0 0 0 7 8 107.4 100.4 117.8 107.1 0 0 0 0 0 0 0 1 0 0 0 8 9 106.3 101.5 107.4 117.8 0 0 0 0 0 0 0 0 1 0 0 9 10 114.5 99.4 106.3 107.4 0 0 0 0 0 0 0 0 0 1 0 10 11 98.0 99.7 114.5 106.3 0 0 0 0 0 0 0 0 0 0 1 11 12 103.1 101.7 98.0 114.5 0 0 0 0 0 0 0 0 0 0 0 12 13 100.3 103.7 103.1 98.0 1 0 0 0 0 0 0 0 0 0 0 13 14 104.6 103.1 100.3 103.1 0 1 0 0 0 0 0 0 0 0 0 14 15 111.2 101.0 104.6 100.3 0 0 1 0 0 0 0 0 0 0 0 15 16 105.0 102.3 111.2 104.6 0 0 0 1 0 0 0 0 0 0 0 16 17 109.9 101.6 105.0 111.2 0 0 0 0 1 0 0 0 0 0 0 17 18 111.5 99.6 109.9 105.0 0 0 0 0 0 1 0 0 0 0 0 18 19 132.5 95.7 111.5 109.9 0 0 0 0 0 0 1 0 0 0 0 19 20 100.3 96.6 132.5 111.5 0 0 0 0 0 0 0 1 0 0 0 20 21 123.1 96.3 100.3 132.5 0 0 0 0 0 0 0 0 1 0 0 21 22 114.2 95.4 123.1 100.3 0 0 0 0 0 0 0 0 0 1 0 22 23 104.6 96.0 114.2 123.1 0 0 0 0 0 0 0 0 0 0 1 23 24 109.1 96.9 104.6 114.2 0 0 0 0 0 0 0 0 0 0 0 24 25 107.0 94.9 109.1 104.6 1 0 0 0 0 0 0 0 0 0 0 25 26 133.7 92.5 107.0 109.1 0 1 0 0 0 0 0 0 0 0 0 26 27 124.9 94.0 133.7 107.0 0 0 1 0 0 0 0 0 0 0 0 27 28 122.5 93.5 124.9 133.7 0 0 0 1 0 0 0 0 0 0 0 28 29 116.8 92.3 122.5 124.9 0 0 0 0 1 0 0 0 0 0 0 29 30 116.0 90.4 116.8 122.5 0 0 0 0 0 1 0 0 0 0 0 30 31 129.8 90.4 116.0 116.8 0 0 0 0 0 0 1 0 0 0 0 31 32 125.2 91.0 129.8 116.0 0 0 0 0 0 0 0 1 0 0 0 32 33 143.8 89.1 125.2 129.8 0 0 0 0 0 0 0 0 1 0 0 33 34 127.9 89.7 143.8 125.2 0 0 0 0 0 0 0 0 0 1 0 34 35 130.3 87.9 127.9 143.8 0 0 0 0 0 0 0 0 0 0 1 35 36 108.4 85.9 130.3 127.9 0 0 0 0 0 0 0 0 0 0 0 36 37 129.4 83.2 108.4 130.3 1 0 0 0 0 0 0 0 0 0 0 37 38 143.7 83.9 129.4 108.4 0 1 0 0 0 0 0 0 0 0 0 38 39 131.9 83.0 143.7 129.4 0 0 1 0 0 0 0 0 0 0 0 39 40 117.6 82.8 131.9 143.7 0 0 0 1 0 0 0 0 0 0 0 40 41 119.0 78.7 117.6 131.9 0 0 0 0 1 0 0 0 0 0 0 41 42 104.8 77.6 119.0 117.6 0 0 0 0 0 1 0 0 0 0 0 42 43 134.6 78.5 104.8 119.0 0 0 0 0 0 0 1 0 0 0 0 43 44 140.4 78.6 134.6 104.8 0 0 0 0 0 0 0 1 0 0 0 44 45 143.8 77.5 140.4 134.6 0 0 0 0 0 0 0 0 1 0 0 45 46 153.4 81.6 143.8 140.4 0 0 0 0 0 0 0 0 0 1 0 46 47 153.3 85.0 153.4 143.8 0 0 0 0 0 0 0 0 0 0 1 47 48 127.3 91.7 153.3 153.4 0 0 0 0 0 0 0 0 0 0 0 48 49 153.6 96.0 127.3 153.3 1 0 0 0 0 0 0 0 0 0 0 49 50 136.9 90.8 153.6 127.3 0 1 0 0 0 0 0 0 0 0 0 50 51 131.8 92.3 136.9 153.6 0 0 1 0 0 0 0 0 0 0 0 51 52 144.3 95.6 131.8 136.9 0 0 0 1 0 0 0 0 0 0 0 52 53 107.4 93.6 144.3 131.8 0 0 0 0 1 0 0 0 0 0 0 53 54 113.6 92.6 107.4 144.3 0 0 0 0 0 1 0 0 0 0 0 54 55 124.2 89.5 113.6 107.4 0 0 0 0 0 0 1 0 0 0 0 55 56 102.1 87.2 124.2 113.6 0 0 0 0 0 0 0 1 0 0 0 56 57 96.4 86.7 102.1 124.2 0 0 0 0 0 0 0 0 1 0 0 57 58 111.7 85.6 96.4 102.1 0 0 0 0 0 0 0 0 0 1 0 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 M1 M2 56.66882 -0.41455 0.33464 0.43666 13.87102 21.80948 M3 M4 M5 M6 M7 M8 13.40853 4.64012 4.34175 4.82811 23.95296 7.17288 M9 M10 M11 t 11.36575 16.14628 5.96355 -0.06853 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -20.1877 -7.5815 0.7094 6.5224 22.3003 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 56.66882 35.49524 1.597 0.11787 X -0.41455 0.28441 -1.458 0.15240 Y1 0.33464 0.14150 2.365 0.02273 * Y2 0.43666 0.16111 2.710 0.00969 ** M1 13.87102 7.78780 1.781 0.08213 . M2 21.80948 8.07614 2.700 0.00994 ** M3 13.40853 7.85937 1.706 0.09538 . M4 4.64012 7.65385 0.606 0.54761 M5 4.34175 7.70778 0.563 0.57623 M6 4.82811 7.87274 0.613 0.54301 M7 23.95296 8.03343 2.982 0.00476 ** M8 7.17288 8.33558 0.861 0.39439 M9 11.36575 7.77975 1.461 0.15147 M10 16.14628 8.02186 2.013 0.05058 . M11 5.96355 8.10663 0.736 0.46604 t -0.06853 0.14526 -0.472 0.63956 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.38 on 42 degrees of freedom Multiple R-squared: 0.6132, Adjusted R-squared: 0.4751 F-statistic: 4.439 on 15 and 42 DF, p-value: 6.608e-05 > 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.0517249140 0.1034498281 0.9482751 [2,] 0.0217229742 0.0434459484 0.9782770 [3,] 0.0102476507 0.0204953013 0.9897523 [4,] 0.0031940976 0.0063881952 0.9968059 [5,] 0.0012258084 0.0024516167 0.9987742 [6,] 0.0004083086 0.0008166172 0.9995917 [7,] 0.0001539230 0.0003078460 0.9998461 [8,] 0.0072055329 0.0144110658 0.9927945 [9,] 0.0073298701 0.0146597403 0.9926701 [10,] 0.0049143558 0.0098287116 0.9950856 [11,] 0.0026725513 0.0053451027 0.9973274 [12,] 0.0026231345 0.0052462690 0.9973769 [13,] 0.0016566905 0.0033133810 0.9983433 [14,] 0.0008018773 0.0016037546 0.9991981 [15,] 0.0027478898 0.0054957797 0.9972521 [16,] 0.0017116056 0.0034232113 0.9982884 [17,] 0.0022987229 0.0045974458 0.9977013 [18,] 0.0037648942 0.0075297884 0.9962351 [19,] 0.0025030836 0.0050061672 0.9974969 [20,] 0.0014389263 0.0028778526 0.9985611 [21,] 0.0021957402 0.0043914804 0.9978043 > postscript(file="/var/www/html/rcomp/tmp/1rd0w1258748789.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/2xnga1258748789.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/3aca01258748789.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/44dda1258748789.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/5z1jm1258748789.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 = 58 Frequency = 1 1 2 3 4 5 6 -11.0626466 -7.6089199 5.6983495 -14.7694167 11.5588804 6.2286622 7 8 9 10 11 12 -8.4774721 -0.4603338 -6.4206152 1.1061878 -7.2819491 6.6202573 13 14 15 16 17 18 -3.6549738 -8.7635805 5.2190147 4.3085758 8.4781440 9.8987350 19 20 21 22 23 24 7.5506292 -15.1538752 5.0031539 -2.5514459 -8.6289278 9.3750867 25 26 27 28 29 30 -4.6704843 11.9024697 4.1757272 1.6914880 0.5066715 1.4566499 31 32 33 34 35 36 -1.0430005 7.1855536 16.3870536 -8.1919892 0.9120967 -9.6452012 37 38 39 40 41 42 2.7137673 11.9693002 -5.6895654 -13.5309431 -3.5256955 -12.8238239 43 44 45 46 47 48 2.4335828 21.3517694 5.2180673 8.1352894 14.9987801 -6.3501428 49 50 51 52 53 54 16.6743374 -7.4992695 -9.4035261 22.3002959 -17.0180003 -4.7602231 55 56 57 58 -0.4637395 -12.9231140 -20.1876596 1.5019579 > postscript(file="/var/www/html/rcomp/tmp/6o7uu1258748789.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -11.0626466 NA 1 -7.6089199 -11.0626466 2 5.6983495 -7.6089199 3 -14.7694167 5.6983495 4 11.5588804 -14.7694167 5 6.2286622 11.5588804 6 -8.4774721 6.2286622 7 -0.4603338 -8.4774721 8 -6.4206152 -0.4603338 9 1.1061878 -6.4206152 10 -7.2819491 1.1061878 11 6.6202573 -7.2819491 12 -3.6549738 6.6202573 13 -8.7635805 -3.6549738 14 5.2190147 -8.7635805 15 4.3085758 5.2190147 16 8.4781440 4.3085758 17 9.8987350 8.4781440 18 7.5506292 9.8987350 19 -15.1538752 7.5506292 20 5.0031539 -15.1538752 21 -2.5514459 5.0031539 22 -8.6289278 -2.5514459 23 9.3750867 -8.6289278 24 -4.6704843 9.3750867 25 11.9024697 -4.6704843 26 4.1757272 11.9024697 27 1.6914880 4.1757272 28 0.5066715 1.6914880 29 1.4566499 0.5066715 30 -1.0430005 1.4566499 31 7.1855536 -1.0430005 32 16.3870536 7.1855536 33 -8.1919892 16.3870536 34 0.9120967 -8.1919892 35 -9.6452012 0.9120967 36 2.7137673 -9.6452012 37 11.9693002 2.7137673 38 -5.6895654 11.9693002 39 -13.5309431 -5.6895654 40 -3.5256955 -13.5309431 41 -12.8238239 -3.5256955 42 2.4335828 -12.8238239 43 21.3517694 2.4335828 44 5.2180673 21.3517694 45 8.1352894 5.2180673 46 14.9987801 8.1352894 47 -6.3501428 14.9987801 48 16.6743374 -6.3501428 49 -7.4992695 16.6743374 50 -9.4035261 -7.4992695 51 22.3002959 -9.4035261 52 -17.0180003 22.3002959 53 -4.7602231 -17.0180003 54 -0.4637395 -4.7602231 55 -12.9231140 -0.4637395 56 -20.1876596 -12.9231140 57 1.5019579 -20.1876596 58 NA 1.5019579 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -7.6089199 -11.0626466 [2,] 5.6983495 -7.6089199 [3,] -14.7694167 5.6983495 [4,] 11.5588804 -14.7694167 [5,] 6.2286622 11.5588804 [6,] -8.4774721 6.2286622 [7,] -0.4603338 -8.4774721 [8,] -6.4206152 -0.4603338 [9,] 1.1061878 -6.4206152 [10,] -7.2819491 1.1061878 [11,] 6.6202573 -7.2819491 [12,] -3.6549738 6.6202573 [13,] -8.7635805 -3.6549738 [14,] 5.2190147 -8.7635805 [15,] 4.3085758 5.2190147 [16,] 8.4781440 4.3085758 [17,] 9.8987350 8.4781440 [18,] 7.5506292 9.8987350 [19,] -15.1538752 7.5506292 [20,] 5.0031539 -15.1538752 [21,] -2.5514459 5.0031539 [22,] -8.6289278 -2.5514459 [23,] 9.3750867 -8.6289278 [24,] -4.6704843 9.3750867 [25,] 11.9024697 -4.6704843 [26,] 4.1757272 11.9024697 [27,] 1.6914880 4.1757272 [28,] 0.5066715 1.6914880 [29,] 1.4566499 0.5066715 [30,] -1.0430005 1.4566499 [31,] 7.1855536 -1.0430005 [32,] 16.3870536 7.1855536 [33,] -8.1919892 16.3870536 [34,] 0.9120967 -8.1919892 [35,] -9.6452012 0.9120967 [36,] 2.7137673 -9.6452012 [37,] 11.9693002 2.7137673 [38,] -5.6895654 11.9693002 [39,] -13.5309431 -5.6895654 [40,] -3.5256955 -13.5309431 [41,] -12.8238239 -3.5256955 [42,] 2.4335828 -12.8238239 [43,] 21.3517694 2.4335828 [44,] 5.2180673 21.3517694 [45,] 8.1352894 5.2180673 [46,] 14.9987801 8.1352894 [47,] -6.3501428 14.9987801 [48,] 16.6743374 -6.3501428 [49,] -7.4992695 16.6743374 [50,] -9.4035261 -7.4992695 [51,] 22.3002959 -9.4035261 [52,] -17.0180003 22.3002959 [53,] -4.7602231 -17.0180003 [54,] -0.4637395 -4.7602231 [55,] -12.9231140 -0.4637395 [56,] -20.1876596 -12.9231140 [57,] 1.5019579 -20.1876596 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -7.6089199 -11.0626466 2 5.6983495 -7.6089199 3 -14.7694167 5.6983495 4 11.5588804 -14.7694167 5 6.2286622 11.5588804 6 -8.4774721 6.2286622 7 -0.4603338 -8.4774721 8 -6.4206152 -0.4603338 9 1.1061878 -6.4206152 10 -7.2819491 1.1061878 11 6.6202573 -7.2819491 12 -3.6549738 6.6202573 13 -8.7635805 -3.6549738 14 5.2190147 -8.7635805 15 4.3085758 5.2190147 16 8.4781440 4.3085758 17 9.8987350 8.4781440 18 7.5506292 9.8987350 19 -15.1538752 7.5506292 20 5.0031539 -15.1538752 21 -2.5514459 5.0031539 22 -8.6289278 -2.5514459 23 9.3750867 -8.6289278 24 -4.6704843 9.3750867 25 11.9024697 -4.6704843 26 4.1757272 11.9024697 27 1.6914880 4.1757272 28 0.5066715 1.6914880 29 1.4566499 0.5066715 30 -1.0430005 1.4566499 31 7.1855536 -1.0430005 32 16.3870536 7.1855536 33 -8.1919892 16.3870536 34 0.9120967 -8.1919892 35 -9.6452012 0.9120967 36 2.7137673 -9.6452012 37 11.9693002 2.7137673 38 -5.6895654 11.9693002 39 -13.5309431 -5.6895654 40 -3.5256955 -13.5309431 41 -12.8238239 -3.5256955 42 2.4335828 -12.8238239 43 21.3517694 2.4335828 44 5.2180673 21.3517694 45 8.1352894 5.2180673 46 14.9987801 8.1352894 47 -6.3501428 14.9987801 48 16.6743374 -6.3501428 49 -7.4992695 16.6743374 50 -9.4035261 -7.4992695 51 22.3002959 -9.4035261 52 -17.0180003 22.3002959 53 -4.7602231 -17.0180003 54 -0.4637395 -4.7602231 55 -12.9231140 -0.4637395 56 -20.1876596 -12.9231140 57 1.5019579 -20.1876596 > 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/7ks491258748789.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/8cx871258748789.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/9r3o41258748789.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/10ncft1258748789.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/11c0gq1258748789.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/127ic31258748789.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/1368qx1258748789.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/145wfl1258748789.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/15ekf31258748789.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/16liep1258748789.tab") + } > > system("convert tmp/1rd0w1258748789.ps tmp/1rd0w1258748789.png") > system("convert tmp/2xnga1258748789.ps tmp/2xnga1258748789.png") > system("convert tmp/3aca01258748789.ps tmp/3aca01258748789.png") > system("convert tmp/44dda1258748789.ps tmp/44dda1258748789.png") > system("convert tmp/5z1jm1258748789.ps tmp/5z1jm1258748789.png") > system("convert tmp/6o7uu1258748789.ps tmp/6o7uu1258748789.png") > system("convert tmp/7ks491258748789.ps tmp/7ks491258748789.png") > system("convert tmp/8cx871258748789.ps tmp/8cx871258748789.png") > system("convert tmp/9r3o41258748789.ps tmp/9r3o41258748789.png") > system("convert tmp/10ncft1258748789.ps tmp/10ncft1258748789.png") > > > proc.time() user system elapsed 2.367 1.550 2.744