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(8.2 + ,103.9 + ,8.7 + ,9.3 + ,9.3 + ,8.3 + ,101.6 + ,8.2 + ,8.7 + ,9.3 + ,8.5 + ,94.6 + ,8.3 + ,8.2 + ,8.7 + ,8.6 + ,95.9 + ,8.5 + ,8.3 + ,8.2 + ,8.5 + ,104.7 + ,8.6 + ,8.5 + ,8.3 + ,8.2 + ,102.8 + ,8.5 + ,8.6 + ,8.5 + ,8.1 + ,98.1 + ,8.2 + ,8.5 + ,8.6 + ,7.9 + ,113.9 + ,8.1 + ,8.2 + ,8.5 + ,8.6 + ,80.9 + ,7.9 + ,8.1 + ,8.2 + ,8.7 + ,95.7 + ,8.6 + ,7.9 + ,8.1 + ,8.7 + ,113.2 + ,8.7 + ,8.6 + ,7.9 + ,8.5 + ,105.9 + ,8.7 + ,8.7 + ,8.6 + ,8.4 + ,108.8 + ,8.5 + ,8.7 + ,8.7 + ,8.5 + ,102.3 + ,8.4 + ,8.5 + ,8.7 + ,8.7 + ,99 + ,8.5 + ,8.4 + ,8.5 + ,8.7 + ,100.7 + ,8.7 + ,8.5 + ,8.4 + ,8.6 + ,115.5 + ,8.7 + ,8.7 + ,8.5 + ,8.5 + ,100.7 + ,8.6 + ,8.7 + ,8.7 + ,8.3 + ,109.9 + ,8.5 + ,8.6 + ,8.7 + ,8 + ,114.6 + ,8.3 + ,8.5 + ,8.6 + ,8.2 + ,85.4 + ,8 + ,8.3 + ,8.5 + ,8.1 + ,100.5 + ,8.2 + ,8 + ,8.3 + ,8.1 + ,114.8 + ,8.1 + ,8.2 + ,8 + ,8 + ,116.5 + ,8.1 + ,8.1 + ,8.2 + ,7.9 + ,112.9 + ,8 + ,8.1 + ,8.1 + ,7.9 + ,102 + ,7.9 + ,8 + ,8.1 + ,8 + ,106 + ,7.9 + ,7.9 + ,8 + ,8 + ,105.3 + ,8 + ,7.9 + ,7.9 + ,7.9 + ,118.8 + ,8 + ,8 + ,7.9 + ,8 + ,106.1 + ,7.9 + ,8 + ,8 + ,7.7 + ,109.3 + ,8 + ,7.9 + ,8 + ,7.2 + ,117.2 + ,7.7 + ,8 + ,7.9 + ,7.5 + ,92.5 + ,7.2 + ,7.7 + ,8 + ,7.3 + ,104.2 + ,7.5 + ,7.2 + ,7.7 + ,7 + ,112.5 + ,7.3 + ,7.5 + ,7.2 + ,7 + ,122.4 + ,7 + ,7.3 + ,7.5 + ,7 + ,113.3 + ,7 + ,7 + ,7.3 + ,7.2 + ,100 + ,7 + ,7 + ,7 + ,7.3 + ,110.7 + ,7.2 + ,7 + ,7 + ,7.1 + ,112.8 + ,7.3 + ,7.2 + ,7 + ,6.8 + ,109.8 + ,7.1 + ,7.3 + ,7.2 + ,6.4 + ,117.3 + ,6.8 + ,7.1 + ,7.3 + ,6.1 + ,109.1 + ,6.4 + ,6.8 + ,7.1 + ,6.5 + ,115.9 + ,6.1 + ,6.4 + ,6.8 + ,7.7 + ,96 + ,6.5 + ,6.1 + ,6.4 + ,7.9 + ,99.8 + ,7.7 + ,6.5 + ,6.1 + ,7.5 + ,116.8 + ,7.9 + ,7.7 + ,6.5 + ,6.9 + ,115.7 + ,7.5 + ,7.9 + ,7.7 + ,6.6 + ,99.4 + ,6.9 + ,7.5 + ,7.9 + ,6.9 + ,94.3 + ,6.6 + ,6.9 + ,7.5 + ,7.7 + ,91 + ,6.9 + ,6.6 + ,6.9 + ,8 + ,93.2 + ,7.7 + ,6.9 + ,6.6 + ,8 + ,103.1 + ,8 + ,7.7 + ,6.9 + ,7.7 + ,94.1 + ,8 + ,8 + ,7.7 + ,7.3 + ,91.8 + ,7.7 + ,8 + ,8 + ,7.4 + ,102.7 + ,7.3 + ,7.7 + ,8 + ,8.1 + ,82.6 + ,7.4 + ,7.3 + ,7.7) + ,dim=c(5 + ,57) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3') + ,1:57)) > y <- array(NA,dim=c(5,57),dimnames=list(c('Y','X','Y1','Y2','Y3'),1:57)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '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 t 1 8.2 103.9 8.7 9.3 9.3 1 2 8.3 101.6 8.2 8.7 9.3 2 3 8.5 94.6 8.3 8.2 8.7 3 4 8.6 95.9 8.5 8.3 8.2 4 5 8.5 104.7 8.6 8.5 8.3 5 6 8.2 102.8 8.5 8.6 8.5 6 7 8.1 98.1 8.2 8.5 8.6 7 8 7.9 113.9 8.1 8.2 8.5 8 9 8.6 80.9 7.9 8.1 8.2 9 10 8.7 95.7 8.6 7.9 8.1 10 11 8.7 113.2 8.7 8.6 7.9 11 12 8.5 105.9 8.7 8.7 8.6 12 13 8.4 108.8 8.5 8.7 8.7 13 14 8.5 102.3 8.4 8.5 8.7 14 15 8.7 99.0 8.5 8.4 8.5 15 16 8.7 100.7 8.7 8.5 8.4 16 17 8.6 115.5 8.7 8.7 8.5 17 18 8.5 100.7 8.6 8.7 8.7 18 19 8.3 109.9 8.5 8.6 8.7 19 20 8.0 114.6 8.3 8.5 8.6 20 21 8.2 85.4 8.0 8.3 8.5 21 22 8.1 100.5 8.2 8.0 8.3 22 23 8.1 114.8 8.1 8.2 8.0 23 24 8.0 116.5 8.1 8.1 8.2 24 25 7.9 112.9 8.0 8.1 8.1 25 26 7.9 102.0 7.9 8.0 8.1 26 27 8.0 106.0 7.9 7.9 8.0 27 28 8.0 105.3 8.0 7.9 7.9 28 29 7.9 118.8 8.0 8.0 7.9 29 30 8.0 106.1 7.9 8.0 8.0 30 31 7.7 109.3 8.0 7.9 8.0 31 32 7.2 117.2 7.7 8.0 7.9 32 33 7.5 92.5 7.2 7.7 8.0 33 34 7.3 104.2 7.5 7.2 7.7 34 35 7.0 112.5 7.3 7.5 7.2 35 36 7.0 122.4 7.0 7.3 7.5 36 37 7.0 113.3 7.0 7.0 7.3 37 38 7.2 100.0 7.0 7.0 7.0 38 39 7.3 110.7 7.2 7.0 7.0 39 40 7.1 112.8 7.3 7.2 7.0 40 41 6.8 109.8 7.1 7.3 7.2 41 42 6.4 117.3 6.8 7.1 7.3 42 43 6.1 109.1 6.4 6.8 7.1 43 44 6.5 115.9 6.1 6.4 6.8 44 45 7.7 96.0 6.5 6.1 6.4 45 46 7.9 99.8 7.7 6.5 6.1 46 47 7.5 116.8 7.9 7.7 6.5 47 48 6.9 115.7 7.5 7.9 7.7 48 49 6.6 99.4 6.9 7.5 7.9 49 50 6.9 94.3 6.6 6.9 7.5 50 51 7.7 91.0 6.9 6.6 6.9 51 52 8.0 93.2 7.7 6.9 6.6 52 53 8.0 103.1 8.0 7.7 6.9 53 54 7.7 94.1 8.0 8.0 7.7 54 55 7.3 91.8 7.7 8.0 8.0 55 56 7.4 102.7 7.3 7.7 8.0 56 57 8.1 82.6 7.4 7.3 7.7 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 t 4.562634 -0.017538 1.112872 -0.505979 0.074444 -0.008285 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.430218 -0.158363 -0.005221 0.153089 0.570173 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.562634 0.932637 4.892 1.04e-05 *** X -0.017538 0.003539 -4.956 8.33e-06 *** Y1 1.112872 0.125019 8.902 5.83e-12 *** Y2 -0.505979 0.182097 -2.779 0.00762 ** Y3 0.074444 0.127874 0.582 0.56302 t -0.008285 0.003277 -2.528 0.01462 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2228 on 51 degrees of freedom Multiple R-squared: 0.8967, Adjusted R-squared: 0.8866 F-statistic: 88.54 on 5 and 51 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.136037830 0.272075661 0.8639622 [2,] 0.127742922 0.255485845 0.8722571 [3,] 0.469709635 0.939419269 0.5302904 [4,] 0.342688889 0.685377777 0.6573111 [5,] 0.248493382 0.496986764 0.7515066 [6,] 0.168846468 0.337692936 0.8311535 [7,] 0.110363116 0.220726233 0.8896369 [8,] 0.067395928 0.134791857 0.9326041 [9,] 0.053230723 0.106461446 0.9467693 [10,] 0.041857515 0.083715029 0.9581425 [11,] 0.029530484 0.059060968 0.9704695 [12,] 0.027748878 0.055497755 0.9722511 [13,] 0.030351602 0.060703205 0.9696484 [14,] 0.041290034 0.082580067 0.9587100 [15,] 0.030949944 0.061899889 0.9690501 [16,] 0.019778625 0.039557250 0.9802214 [17,] 0.013247751 0.026495502 0.9867522 [18,] 0.009485855 0.018971710 0.9905141 [19,] 0.005672759 0.011345519 0.9943272 [20,] 0.003481739 0.006963477 0.9965183 [21,] 0.003462671 0.006925342 0.9965373 [22,] 0.004095613 0.008191226 0.9959044 [23,] 0.006695918 0.013391835 0.9933041 [24,] 0.014538056 0.029076112 0.9854619 [25,] 0.019142709 0.038285417 0.9808573 [26,] 0.026779411 0.053558822 0.9732206 [27,] 0.027893567 0.055787134 0.9721064 [28,] 0.063567761 0.127135522 0.9364322 [29,] 0.050747915 0.101495830 0.9492521 [30,] 0.043431624 0.086863249 0.9565684 [31,] 0.065642741 0.131285481 0.9343573 [32,] 0.099391425 0.198782851 0.9006086 [33,] 0.191813012 0.383626024 0.8081870 [34,] 0.184014982 0.368029963 0.8159850 [35,] 0.295186682 0.590373364 0.7048133 [36,] 0.392811891 0.785623782 0.6071881 [37,] 0.849322881 0.301354239 0.1506771 [38,] 0.758540814 0.482918373 0.2414592 [39,] 0.630603368 0.738793265 0.3693966 [40,] 0.655637035 0.688725929 0.3443630 > postscript(file="/var/www/html/rcomp/tmp/1m3wb1261080527.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/2frsw1261080527.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/3m5zw1261080527.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/42gga1261080527.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/5v66c1261080527.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 = 57 Frequency = 1 1 2 3 4 5 6 -0.200869420 0.119926175 -0.114164834 -0.117835201 -0.072752743 -0.250794077 7 8 9 10 11 12 -0.149118664 -0.096797146 0.227045727 -0.277870025 0.295115255 -0.026140220 13 14 15 16 17 18 0.148134148 0.152513513 0.155926708 0.029493740 0.291090880 0.036212454 19 20 21 22 23 24 0.066535088 0.036668681 -0.027043991 -0.213416051 0.280477056 0.153089243 25 26 27 28 29 30 0.116968854 -0.005220714 0.130062017 0.022227281 0.217871650 0.207267299 31 32 33 34 35 36 -0.190211907 -0.151473976 0.120821510 -0.430218030 -0.164778486 0.227463765 37 38 39 40 41 42 -0.060751655 -0.063388146 0.009977811 -0.154999356 -0.241045244 -0.276005118 43 44 45 46 47 48 -0.403287776 0.278057741 0.570173032 -0.265619251 -0.004367157 -0.158363186 49 50 51 52 53 54 -0.285504369 -0.006611499 0.302809315 -0.066492924 0.164005549 -0.193312998 55 56 57 -0.313837543 0.278965196 0.343392018 > postscript(file="/var/www/html/rcomp/tmp/6qfsi1261080527.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.200869420 NA 1 0.119926175 -0.200869420 2 -0.114164834 0.119926175 3 -0.117835201 -0.114164834 4 -0.072752743 -0.117835201 5 -0.250794077 -0.072752743 6 -0.149118664 -0.250794077 7 -0.096797146 -0.149118664 8 0.227045727 -0.096797146 9 -0.277870025 0.227045727 10 0.295115255 -0.277870025 11 -0.026140220 0.295115255 12 0.148134148 -0.026140220 13 0.152513513 0.148134148 14 0.155926708 0.152513513 15 0.029493740 0.155926708 16 0.291090880 0.029493740 17 0.036212454 0.291090880 18 0.066535088 0.036212454 19 0.036668681 0.066535088 20 -0.027043991 0.036668681 21 -0.213416051 -0.027043991 22 0.280477056 -0.213416051 23 0.153089243 0.280477056 24 0.116968854 0.153089243 25 -0.005220714 0.116968854 26 0.130062017 -0.005220714 27 0.022227281 0.130062017 28 0.217871650 0.022227281 29 0.207267299 0.217871650 30 -0.190211907 0.207267299 31 -0.151473976 -0.190211907 32 0.120821510 -0.151473976 33 -0.430218030 0.120821510 34 -0.164778486 -0.430218030 35 0.227463765 -0.164778486 36 -0.060751655 0.227463765 37 -0.063388146 -0.060751655 38 0.009977811 -0.063388146 39 -0.154999356 0.009977811 40 -0.241045244 -0.154999356 41 -0.276005118 -0.241045244 42 -0.403287776 -0.276005118 43 0.278057741 -0.403287776 44 0.570173032 0.278057741 45 -0.265619251 0.570173032 46 -0.004367157 -0.265619251 47 -0.158363186 -0.004367157 48 -0.285504369 -0.158363186 49 -0.006611499 -0.285504369 50 0.302809315 -0.006611499 51 -0.066492924 0.302809315 52 0.164005549 -0.066492924 53 -0.193312998 0.164005549 54 -0.313837543 -0.193312998 55 0.278965196 -0.313837543 56 0.343392018 0.278965196 57 NA 0.343392018 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.119926175 -0.200869420 [2,] -0.114164834 0.119926175 [3,] -0.117835201 -0.114164834 [4,] -0.072752743 -0.117835201 [5,] -0.250794077 -0.072752743 [6,] -0.149118664 -0.250794077 [7,] -0.096797146 -0.149118664 [8,] 0.227045727 -0.096797146 [9,] -0.277870025 0.227045727 [10,] 0.295115255 -0.277870025 [11,] -0.026140220 0.295115255 [12,] 0.148134148 -0.026140220 [13,] 0.152513513 0.148134148 [14,] 0.155926708 0.152513513 [15,] 0.029493740 0.155926708 [16,] 0.291090880 0.029493740 [17,] 0.036212454 0.291090880 [18,] 0.066535088 0.036212454 [19,] 0.036668681 0.066535088 [20,] -0.027043991 0.036668681 [21,] -0.213416051 -0.027043991 [22,] 0.280477056 -0.213416051 [23,] 0.153089243 0.280477056 [24,] 0.116968854 0.153089243 [25,] -0.005220714 0.116968854 [26,] 0.130062017 -0.005220714 [27,] 0.022227281 0.130062017 [28,] 0.217871650 0.022227281 [29,] 0.207267299 0.217871650 [30,] -0.190211907 0.207267299 [31,] -0.151473976 -0.190211907 [32,] 0.120821510 -0.151473976 [33,] -0.430218030 0.120821510 [34,] -0.164778486 -0.430218030 [35,] 0.227463765 -0.164778486 [36,] -0.060751655 0.227463765 [37,] -0.063388146 -0.060751655 [38,] 0.009977811 -0.063388146 [39,] -0.154999356 0.009977811 [40,] -0.241045244 -0.154999356 [41,] -0.276005118 -0.241045244 [42,] -0.403287776 -0.276005118 [43,] 0.278057741 -0.403287776 [44,] 0.570173032 0.278057741 [45,] -0.265619251 0.570173032 [46,] -0.004367157 -0.265619251 [47,] -0.158363186 -0.004367157 [48,] -0.285504369 -0.158363186 [49,] -0.006611499 -0.285504369 [50,] 0.302809315 -0.006611499 [51,] -0.066492924 0.302809315 [52,] 0.164005549 -0.066492924 [53,] -0.193312998 0.164005549 [54,] -0.313837543 -0.193312998 [55,] 0.278965196 -0.313837543 [56,] 0.343392018 0.278965196 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.119926175 -0.200869420 2 -0.114164834 0.119926175 3 -0.117835201 -0.114164834 4 -0.072752743 -0.117835201 5 -0.250794077 -0.072752743 6 -0.149118664 -0.250794077 7 -0.096797146 -0.149118664 8 0.227045727 -0.096797146 9 -0.277870025 0.227045727 10 0.295115255 -0.277870025 11 -0.026140220 0.295115255 12 0.148134148 -0.026140220 13 0.152513513 0.148134148 14 0.155926708 0.152513513 15 0.029493740 0.155926708 16 0.291090880 0.029493740 17 0.036212454 0.291090880 18 0.066535088 0.036212454 19 0.036668681 0.066535088 20 -0.027043991 0.036668681 21 -0.213416051 -0.027043991 22 0.280477056 -0.213416051 23 0.153089243 0.280477056 24 0.116968854 0.153089243 25 -0.005220714 0.116968854 26 0.130062017 -0.005220714 27 0.022227281 0.130062017 28 0.217871650 0.022227281 29 0.207267299 0.217871650 30 -0.190211907 0.207267299 31 -0.151473976 -0.190211907 32 0.120821510 -0.151473976 33 -0.430218030 0.120821510 34 -0.164778486 -0.430218030 35 0.227463765 -0.164778486 36 -0.060751655 0.227463765 37 -0.063388146 -0.060751655 38 0.009977811 -0.063388146 39 -0.154999356 0.009977811 40 -0.241045244 -0.154999356 41 -0.276005118 -0.241045244 42 -0.403287776 -0.276005118 43 0.278057741 -0.403287776 44 0.570173032 0.278057741 45 -0.265619251 0.570173032 46 -0.004367157 -0.265619251 47 -0.158363186 -0.004367157 48 -0.285504369 -0.158363186 49 -0.006611499 -0.285504369 50 0.302809315 -0.006611499 51 -0.066492924 0.302809315 52 0.164005549 -0.066492924 53 -0.193312998 0.164005549 54 -0.313837543 -0.193312998 55 0.278965196 -0.313837543 56 0.343392018 0.278965196 > 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/7vuut1261080527.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/8dizx1261080527.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/9nlty1261080527.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/10kkey1261080527.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/11a1mi1261080528.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/12j1el1261080528.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/13ge9q1261080528.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/14iq5n1261080528.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/15fbfd1261080528.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/16w6551261080528.tab") + } > > try(system("convert tmp/1m3wb1261080527.ps tmp/1m3wb1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/2frsw1261080527.ps tmp/2frsw1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/3m5zw1261080527.ps tmp/3m5zw1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/42gga1261080527.ps tmp/42gga1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/5v66c1261080527.ps tmp/5v66c1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/6qfsi1261080527.ps tmp/6qfsi1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/7vuut1261080527.ps tmp/7vuut1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/8dizx1261080527.ps tmp/8dizx1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/9nlty1261080527.ps tmp/9nlty1261080527.png",intern=TRUE)) character(0) > try(system("convert tmp/10kkey1261080527.ps tmp/10kkey1261080527.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.451 1.581 3.651