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(104.08,99.2,103.86,93.6,107.47,104.2,111.1,95.3,117.33,102.7,119.04,103.1,123.68,100,125.9,107.2,124.54,107,119.39,119,118.8,110.4,114.81,101.7,117.9,102.4,120.53,98.8,125.15,105.6,126.49,104.4,131.85,106.3,127.4,107.2,131.08,108.5,122.37,106.9,124.34,114.2,119.61,125.9,119.97,110.6,116.46,110.5,117.03,106.7,120.96,104.7,124.71,107.4,127.08,109.8,131.91,103.4,137.69,114.8,142.46,114.3,144.32,109.6,138.06,118.3,124.45,127.3,126.71,112.3,121.83,114.9,122.51,108.2,125.48,105.4,127.77,122.1,128.03,113.5,132.84,110,133.41,125.3,139.99,114.3,138.53,115.6,136.12,127.1,124.75,123,122.88,122.2,121.46,126.4,118.4,112.7,122.45,105.8,128.94,120.9,133.25,116.3,137.94,115.7,140.04,127.9,130.74,108.3,131.55,121.1,129.47,128.6,125.45,123.1,127.87,127.7,124.68,126.6),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 104.08 99.2 1 0 0 0 0 0 0 0 0 0 0 1 2 103.86 93.6 0 1 0 0 0 0 0 0 0 0 0 2 3 107.47 104.2 0 0 1 0 0 0 0 0 0 0 0 3 4 111.10 95.3 0 0 0 1 0 0 0 0 0 0 0 4 5 117.33 102.7 0 0 0 0 1 0 0 0 0 0 0 5 6 119.04 103.1 0 0 0 0 0 1 0 0 0 0 0 6 7 123.68 100.0 0 0 0 0 0 0 1 0 0 0 0 7 8 125.90 107.2 0 0 0 0 0 0 0 1 0 0 0 8 9 124.54 107.0 0 0 0 0 0 0 0 0 1 0 0 9 10 119.39 119.0 0 0 0 0 0 0 0 0 0 1 0 10 11 118.80 110.4 0 0 0 0 0 0 0 0 0 0 1 11 12 114.81 101.7 0 0 0 0 0 0 0 0 0 0 0 12 13 117.90 102.4 1 0 0 0 0 0 0 0 0 0 0 13 14 120.53 98.8 0 1 0 0 0 0 0 0 0 0 0 14 15 125.15 105.6 0 0 1 0 0 0 0 0 0 0 0 15 16 126.49 104.4 0 0 0 1 0 0 0 0 0 0 0 16 17 131.85 106.3 0 0 0 0 1 0 0 0 0 0 0 17 18 127.40 107.2 0 0 0 0 0 1 0 0 0 0 0 18 19 131.08 108.5 0 0 0 0 0 0 1 0 0 0 0 19 20 122.37 106.9 0 0 0 0 0 0 0 1 0 0 0 20 21 124.34 114.2 0 0 0 0 0 0 0 0 1 0 0 21 22 119.61 125.9 0 0 0 0 0 0 0 0 0 1 0 22 23 119.97 110.6 0 0 0 0 0 0 0 0 0 0 1 23 24 116.46 110.5 0 0 0 0 0 0 0 0 0 0 0 24 25 117.03 106.7 1 0 0 0 0 0 0 0 0 0 0 25 26 120.96 104.7 0 1 0 0 0 0 0 0 0 0 0 26 27 124.71 107.4 0 0 1 0 0 0 0 0 0 0 0 27 28 127.08 109.8 0 0 0 1 0 0 0 0 0 0 0 28 29 131.91 103.4 0 0 0 0 1 0 0 0 0 0 0 29 30 137.69 114.8 0 0 0 0 0 1 0 0 0 0 0 30 31 142.46 114.3 0 0 0 0 0 0 1 0 0 0 0 31 32 144.32 109.6 0 0 0 0 0 0 0 1 0 0 0 32 33 138.06 118.3 0 0 0 0 0 0 0 0 1 0 0 33 34 124.45 127.3 0 0 0 0 0 0 0 0 0 1 0 34 35 126.71 112.3 0 0 0 0 0 0 0 0 0 0 1 35 36 121.83 114.9 0 0 0 0 0 0 0 0 0 0 0 36 37 122.51 108.2 1 0 0 0 0 0 0 0 0 0 0 37 38 125.48 105.4 0 1 0 0 0 0 0 0 0 0 0 38 39 127.77 122.1 0 0 1 0 0 0 0 0 0 0 0 39 40 128.03 113.5 0 0 0 1 0 0 0 0 0 0 0 40 41 132.84 110.0 0 0 0 0 1 0 0 0 0 0 0 41 42 133.41 125.3 0 0 0 0 0 1 0 0 0 0 0 42 43 139.99 114.3 0 0 0 0 0 0 1 0 0 0 0 43 44 138.53 115.6 0 0 0 0 0 0 0 1 0 0 0 44 45 136.12 127.1 0 0 0 0 0 0 0 0 1 0 0 45 46 124.75 123.0 0 0 0 0 0 0 0 0 0 1 0 46 47 122.88 122.2 0 0 0 0 0 0 0 0 0 0 1 47 48 121.46 126.4 0 0 0 0 0 0 0 0 0 0 0 48 49 118.40 112.7 1 0 0 0 0 0 0 0 0 0 0 49 50 122.45 105.8 0 1 0 0 0 0 0 0 0 0 0 50 51 128.94 120.9 0 0 1 0 0 0 0 0 0 0 0 51 52 133.25 116.3 0 0 0 1 0 0 0 0 0 0 0 52 53 137.94 115.7 0 0 0 0 1 0 0 0 0 0 0 53 54 140.04 127.9 0 0 0 0 0 1 0 0 0 0 0 54 55 130.74 108.3 0 0 0 0 0 0 1 0 0 0 0 55 56 131.55 121.1 0 0 0 0 0 0 0 1 0 0 0 56 57 129.47 128.6 0 0 0 0 0 0 0 0 1 0 0 57 58 125.45 123.1 0 0 0 0 0 0 0 0 0 1 0 58 59 127.87 127.7 0 0 0 0 0 0 0 0 0 0 1 59 60 124.68 126.6 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 85.7644 0.2342 0.6316 4.0907 5.6196 8.7887 M5 M6 M7 M8 M9 M10 13.8370 12.9039 16.3271 14.3765 10.5265 1.4764 M11 t 3.4447 0.1919 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.8954 -2.6826 0.3722 2.8698 12.3669 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 85.76443 19.64365 4.366 7.11e-05 *** X 0.23422 0.18780 1.247 0.218639 M1 0.63160 3.41665 0.185 0.854153 M2 4.09070 3.79573 1.078 0.286783 M3 5.61958 3.19331 1.760 0.085091 . M4 8.78868 3.34336 2.629 0.011613 * M5 13.83696 3.37505 4.100 0.000167 *** M6 12.90391 3.19465 4.039 0.000202 *** M7 16.32714 3.32416 4.912 1.18e-05 *** M8 14.37655 3.21047 4.478 4.95e-05 *** M9 10.52646 3.26237 3.227 0.002310 ** M10 1.47644 3.53589 0.418 0.678214 M11 3.44472 3.17580 1.085 0.283717 t 0.19193 0.07491 2.562 0.013742 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.013 on 46 degrees of freedom Multiple R-squared: 0.7387, Adjusted R-squared: 0.6648 F-statistic: 10 on 13 and 46 DF, p-value: 1.777e-09 > 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.02861769 0.05723538 0.97138231 [2,] 0.14365228 0.28730456 0.85634772 [3,] 0.15414700 0.30829400 0.84585300 [4,] 0.79898903 0.40202193 0.20101097 [5,] 0.92549329 0.14901341 0.07450671 [6,] 0.94845883 0.10308234 0.05154117 [7,] 0.94480697 0.11038606 0.05519303 [8,] 0.94893511 0.10212978 0.05106489 [9,] 0.93820166 0.12359669 0.06179834 [10,] 0.91794237 0.16411526 0.08205763 [11,] 0.88191671 0.23616658 0.11808329 [12,] 0.85763841 0.28472317 0.14236159 [13,] 0.82590503 0.34818994 0.17409497 [14,] 0.77078778 0.45842443 0.22921222 [15,] 0.74297834 0.51404333 0.25702166 [16,] 0.87209043 0.25581915 0.12790957 [17,] 0.86293302 0.27413396 0.13706698 [18,] 0.83827727 0.32344547 0.16172273 [19,] 0.80097267 0.39805467 0.19902733 [20,] 0.75197588 0.49604825 0.24802412 [21,] 0.74097498 0.51805003 0.25902502 [22,] 0.65438052 0.69123897 0.34561948 [23,] 0.58611718 0.82776565 0.41388282 [24,] 0.54012209 0.91975582 0.45987791 [25,] 0.44793133 0.89586266 0.55206867 [26,] 0.48458865 0.96917729 0.51541135 [27,] 0.42447662 0.84895324 0.57552338 > postscript(file="/var/www/html/rcomp/tmp/1kqid1258763158.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/2mzab1258763158.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/34hrs1258763158.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/4xtv11258763158.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/5q9871258763158.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 = 60 Frequency = 1 1 2 3 4 5 6 7 -5.7424159 -8.3018260 -8.8953540 -6.5418438 -7.2852713 -4.9278438 -3.1769233 8 9 10 11 12 13 14 -0.8846400 1.4603628 2.3578319 1.6218968 2.9223804 5.0248982 4.8470516 15 16 17 18 19 20 21 6.1535530 4.4135826 4.0883555 0.1686739 -0.0709660 -6.6475620 -2.7291962 22 23 24 25 26 27 28 -1.3414615 0.4418657 0.2080722 0.8445723 1.5919765 2.9887728 1.4356166 29 30 31 32 33 34 35 2.5244011 6.3754277 7.6473806 12.3668613 7.7273215 0.8674455 4.4805073 36 37 38 39 40 41 42 2.2443245 3.6700575 3.6448363 0.3025768 -0.7841784 -0.3946269 -2.6670515 43 44 45 46 47 48 49 2.8741932 2.8683643 1.4230134 -0.1286033 -3.9714410 -3.1223730 -3.7971121 50 51 52 53 54 55 56 -1.7820384 -0.5495487 1.4768230 1.0671416 1.0507936 -7.2736846 -7.7030236 57 58 59 60 -7.8815014 -1.7552126 -2.5728288 -2.2524041 > postscript(file="/var/www/html/rcomp/tmp/69zsu1258763158.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -5.7424159 NA 1 -8.3018260 -5.7424159 2 -8.8953540 -8.3018260 3 -6.5418438 -8.8953540 4 -7.2852713 -6.5418438 5 -4.9278438 -7.2852713 6 -3.1769233 -4.9278438 7 -0.8846400 -3.1769233 8 1.4603628 -0.8846400 9 2.3578319 1.4603628 10 1.6218968 2.3578319 11 2.9223804 1.6218968 12 5.0248982 2.9223804 13 4.8470516 5.0248982 14 6.1535530 4.8470516 15 4.4135826 6.1535530 16 4.0883555 4.4135826 17 0.1686739 4.0883555 18 -0.0709660 0.1686739 19 -6.6475620 -0.0709660 20 -2.7291962 -6.6475620 21 -1.3414615 -2.7291962 22 0.4418657 -1.3414615 23 0.2080722 0.4418657 24 0.8445723 0.2080722 25 1.5919765 0.8445723 26 2.9887728 1.5919765 27 1.4356166 2.9887728 28 2.5244011 1.4356166 29 6.3754277 2.5244011 30 7.6473806 6.3754277 31 12.3668613 7.6473806 32 7.7273215 12.3668613 33 0.8674455 7.7273215 34 4.4805073 0.8674455 35 2.2443245 4.4805073 36 3.6700575 2.2443245 37 3.6448363 3.6700575 38 0.3025768 3.6448363 39 -0.7841784 0.3025768 40 -0.3946269 -0.7841784 41 -2.6670515 -0.3946269 42 2.8741932 -2.6670515 43 2.8683643 2.8741932 44 1.4230134 2.8683643 45 -0.1286033 1.4230134 46 -3.9714410 -0.1286033 47 -3.1223730 -3.9714410 48 -3.7971121 -3.1223730 49 -1.7820384 -3.7971121 50 -0.5495487 -1.7820384 51 1.4768230 -0.5495487 52 1.0671416 1.4768230 53 1.0507936 1.0671416 54 -7.2736846 1.0507936 55 -7.7030236 -7.2736846 56 -7.8815014 -7.7030236 57 -1.7552126 -7.8815014 58 -2.5728288 -1.7552126 59 -2.2524041 -2.5728288 60 NA -2.2524041 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -8.3018260 -5.7424159 [2,] -8.8953540 -8.3018260 [3,] -6.5418438 -8.8953540 [4,] -7.2852713 -6.5418438 [5,] -4.9278438 -7.2852713 [6,] -3.1769233 -4.9278438 [7,] -0.8846400 -3.1769233 [8,] 1.4603628 -0.8846400 [9,] 2.3578319 1.4603628 [10,] 1.6218968 2.3578319 [11,] 2.9223804 1.6218968 [12,] 5.0248982 2.9223804 [13,] 4.8470516 5.0248982 [14,] 6.1535530 4.8470516 [15,] 4.4135826 6.1535530 [16,] 4.0883555 4.4135826 [17,] 0.1686739 4.0883555 [18,] -0.0709660 0.1686739 [19,] -6.6475620 -0.0709660 [20,] -2.7291962 -6.6475620 [21,] -1.3414615 -2.7291962 [22,] 0.4418657 -1.3414615 [23,] 0.2080722 0.4418657 [24,] 0.8445723 0.2080722 [25,] 1.5919765 0.8445723 [26,] 2.9887728 1.5919765 [27,] 1.4356166 2.9887728 [28,] 2.5244011 1.4356166 [29,] 6.3754277 2.5244011 [30,] 7.6473806 6.3754277 [31,] 12.3668613 7.6473806 [32,] 7.7273215 12.3668613 [33,] 0.8674455 7.7273215 [34,] 4.4805073 0.8674455 [35,] 2.2443245 4.4805073 [36,] 3.6700575 2.2443245 [37,] 3.6448363 3.6700575 [38,] 0.3025768 3.6448363 [39,] -0.7841784 0.3025768 [40,] -0.3946269 -0.7841784 [41,] -2.6670515 -0.3946269 [42,] 2.8741932 -2.6670515 [43,] 2.8683643 2.8741932 [44,] 1.4230134 2.8683643 [45,] -0.1286033 1.4230134 [46,] -3.9714410 -0.1286033 [47,] -3.1223730 -3.9714410 [48,] -3.7971121 -3.1223730 [49,] -1.7820384 -3.7971121 [50,] -0.5495487 -1.7820384 [51,] 1.4768230 -0.5495487 [52,] 1.0671416 1.4768230 [53,] 1.0507936 1.0671416 [54,] -7.2736846 1.0507936 [55,] -7.7030236 -7.2736846 [56,] -7.8815014 -7.7030236 [57,] -1.7552126 -7.8815014 [58,] -2.5728288 -1.7552126 [59,] -2.2524041 -2.5728288 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -8.3018260 -5.7424159 2 -8.8953540 -8.3018260 3 -6.5418438 -8.8953540 4 -7.2852713 -6.5418438 5 -4.9278438 -7.2852713 6 -3.1769233 -4.9278438 7 -0.8846400 -3.1769233 8 1.4603628 -0.8846400 9 2.3578319 1.4603628 10 1.6218968 2.3578319 11 2.9223804 1.6218968 12 5.0248982 2.9223804 13 4.8470516 5.0248982 14 6.1535530 4.8470516 15 4.4135826 6.1535530 16 4.0883555 4.4135826 17 0.1686739 4.0883555 18 -0.0709660 0.1686739 19 -6.6475620 -0.0709660 20 -2.7291962 -6.6475620 21 -1.3414615 -2.7291962 22 0.4418657 -1.3414615 23 0.2080722 0.4418657 24 0.8445723 0.2080722 25 1.5919765 0.8445723 26 2.9887728 1.5919765 27 1.4356166 2.9887728 28 2.5244011 1.4356166 29 6.3754277 2.5244011 30 7.6473806 6.3754277 31 12.3668613 7.6473806 32 7.7273215 12.3668613 33 0.8674455 7.7273215 34 4.4805073 0.8674455 35 2.2443245 4.4805073 36 3.6700575 2.2443245 37 3.6448363 3.6700575 38 0.3025768 3.6448363 39 -0.7841784 0.3025768 40 -0.3946269 -0.7841784 41 -2.6670515 -0.3946269 42 2.8741932 -2.6670515 43 2.8683643 2.8741932 44 1.4230134 2.8683643 45 -0.1286033 1.4230134 46 -3.9714410 -0.1286033 47 -3.1223730 -3.9714410 48 -3.7971121 -3.1223730 49 -1.7820384 -3.7971121 50 -0.5495487 -1.7820384 51 1.4768230 -0.5495487 52 1.0671416 1.4768230 53 1.0507936 1.0671416 54 -7.2736846 1.0507936 55 -7.7030236 -7.2736846 56 -7.8815014 -7.7030236 57 -1.7552126 -7.8815014 58 -2.5728288 -1.7552126 59 -2.2524041 -2.5728288 > 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/7azhi1258763158.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/80tjm1258763158.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/917mb1258763158.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/10hsn81258763158.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/1172if1258763158.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/1232ge1258763158.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/1364r71258763158.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/14xxeg1258763158.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/15ahov1258763158.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/16z3e91258763158.tab") + } > > system("convert tmp/1kqid1258763158.ps tmp/1kqid1258763158.png") > system("convert tmp/2mzab1258763158.ps tmp/2mzab1258763158.png") > system("convert tmp/34hrs1258763158.ps tmp/34hrs1258763158.png") > system("convert tmp/4xtv11258763158.ps tmp/4xtv11258763158.png") > system("convert tmp/5q9871258763158.ps tmp/5q9871258763158.png") > system("convert tmp/69zsu1258763158.ps tmp/69zsu1258763158.png") > system("convert tmp/7azhi1258763158.ps tmp/7azhi1258763158.png") > system("convert tmp/80tjm1258763158.ps tmp/80tjm1258763158.png") > system("convert tmp/917mb1258763158.ps tmp/917mb1258763158.png") > system("convert tmp/10hsn81258763158.ps tmp/10hsn81258763158.png") > > > proc.time() user system elapsed 2.388 1.530 3.691