R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(48 + ,81 + ,0 + ,4 + ,1 + ,6 + ,0 + ,1 + ,6 + ,56 + ,38 + ,1 + ,4 + ,1 + ,3 + ,0 + ,1 + ,6 + ,47 + ,89 + ,0 + ,1 + ,1 + ,2 + ,0 + ,1 + ,6 + ,48 + ,80 + ,1 + ,2 + ,1 + ,2 + ,0 + ,2 + ,6 + ,45 + ,79 + ,1 + ,2 + ,1 + ,2 + ,0 + ,1 + ,6 + ,56 + ,61 + ,1 + ,2 + ,1 + ,1 + ,0 + ,1 + ,6 + ,48 + ,42 + ,0 + ,2 + ,1 + ,2 + ,0 + ,1 + ,6 + ,45 + ,67 + ,0 + ,2 + ,2 + ,2 + ,0 + ,1 + ,6 + ,52 + ,47 + ,1 + ,2 + ,1 + ,2 + ,0 + ,1 + ,6 + ,47 + ,55 + ,1 + ,2 + ,2 + ,3 + ,0 + ,1 + ,7 + ,52 + ,85 + ,1 + ,4 + ,1 + ,2 + ,0 + ,1 + ,7 + ,60 + ,75 + ,0 + ,4 + ,1 + ,3 + ,0 + ,1 + ,7 + ,45 + ,66 + ,0 + ,4 + ,1 + ,2 + ,0 + ,1 + ,7 + ,48 + ,53 + ,1 + ,4 + ,1 + ,2 + ,0 + ,2 + ,7 + ,56 + ,67 + ,0 + ,1 + ,1 + ,1 + ,0 + ,1 + ,7 + ,60 + ,63 + ,1 + ,2 + ,1 + ,4 + ,0 + ,2 + ,7 + ,52 + ,51 + ,1 + ,4 + ,1 + ,2 + ,0 + ,2 + ,7 + ,60 + ,41 + ,1 + ,4 + ,1 + ,1 + ,0 + ,2 + ,7 + ,47 + ,59 + ,1 + ,1 + ,1 + ,1 + ,0 + ,2 + ,7 + ,52 + ,44 + ,0 + ,1 + ,1 + ,5 + ,0 + ,1 + ,7 + ,47 + ,48 + ,0 + ,1 + ,1 + ,1 + ,0 + ,1 + ,7 + ,59 + ,60 + ,1 + ,2 + ,1 + ,2 + ,0 + ,2 + ,8 + ,48 + ,84 + ,1 + ,2 + ,1 + ,2 + ,0 + ,1 + ,8 + ,61 + ,67 + ,0 + ,2 + ,2 + ,1 + ,0 + ,1 + ,8 + ,60 + ,38 + ,1 + ,2 + ,1 + ,7 + ,0 + ,1 + ,8 + ,45 + ,46 + ,0 + ,4 + ,1 + ,2 + ,0 + ,1 + ,8 + ,63 + ,36 + ,0 + ,2 + ,1 + ,1 + ,0 + ,1 + ,8 + ,41 + ,79 + ,0 + ,4 + ,1 + ,2 + ,0 + ,1 + ,8 + ,49 + ,32 + ,1 + ,1 + ,1 + ,1 + ,0 + ,2 + ,8 + ,63 + ,65 + ,0 + ,4 + ,1 + ,3 + ,1 + ,1 + ,7 + ,54 + ,79 + ,1 + ,4 + ,1 + ,4 + ,1 + ,1 + ,7 + ,55 + ,67 + ,1 + ,4 + ,1 + ,4 + ,1 + ,2 + ,7 + ,70 + ,73 + ,1 + ,2 + ,2 + ,1 + ,1 + ,1 + ,7 + ,43 + ,74 + ,1 + ,4 + ,1 + ,3 + ,1 + ,2 + ,7 + ,58 + ,61 + ,0 + ,4 + ,1 + ,4 + ,1 + ,2 + ,7 + ,56 + ,69 + ,1 + ,4 + ,1 + ,2 + ,1 + ,2 + ,7 + ,50 + ,55 + ,0 + ,4 + ,1 + ,4 + ,1 + ,2 + ,7 + ,32 + ,75 + ,1 + ,4 + ,1 + ,2 + ,1 + ,2 + ,7 + ,59 + ,29 + ,0 + ,2 + ,1 + ,5 + ,1 + ,1 + ,7 + ,58 + ,66 + ,0 + ,1 + ,1 + ,3 + ,1 + ,1 + ,7 + ,56 + ,48 + ,0 + ,2 + ,1 + ,3 + ,1 + ,1 + ,7 + ,50 + ,64 + ,1 + ,4 + ,1 + ,1 + ,1 + ,1 + ,7 + ,32 + ,52 + ,1 + ,4 + ,1 + ,1 + ,1 + ,1 + ,7 + ,36 + ,31 + ,0 + ,2 + ,1 + ,1 + ,1 + ,1 + ,10 + ,46 + ,85 + ,1 + ,4 + ,1 + ,5 + ,1 + ,1 + ,10 + ,47 + ,58 + ,1 + ,2 + ,3 + ,3 + ,1 + ,1 + ,10 + ,67 + ,75 + ,0 + ,4 + ,2 + ,6 + ,1 + ,1 + ,10 + ,61 + ,46 + ,0 + ,1 + ,3 + ,5 + ,1 + ,1 + ,10 + ,49 + ,53 + ,1 + ,1 + ,1 + ,4 + ,1 + ,1 + ,10 + ,49 + ,80 + ,1 + ,4 + ,1 + ,3 + ,1 + ,2 + ,10 + ,56 + ,67 + ,1 + ,4 + ,1 + ,1 + ,1 + ,2 + ,10 + ,56 + ,58 + ,1 + ,4 + ,1 + ,5 + ,1 + ,2 + ,10 + ,52 + ,70 + ,1 + ,4 + ,1 + ,4 + ,1 + ,2 + ,10 + ,49 + ,77 + ,1 + ,4 + ,1 + ,1 + ,1 + ,2 + ,10 + ,55 + ,58 + ,0 + ,4 + ,1 + ,9 + ,1 + ,1 + ,10 + ,56 + ,65 + ,0 + ,4 + ,1 + ,4 + ,1 + ,2 + ,10) + ,dim=c(9 + ,56) + ,dimnames=list(c('Sat' + ,'Age' + ,'MF' + ,'Rm' + ,'PubPr' + ,'LOS' + ,'OorG' + ,'type' + ,'wr ') + ,1:56)) > y <- array(NA,dim=c(9,56),dimnames=list(c('Sat','Age','MF','Rm','PubPr','LOS','OorG','type','wr '),1:56)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > par3 <- 'No 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 > 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 Sat Age MF Rm PubPr LOS OorG type wr\r 1 48 81 0 4 1 6 0 1 6 2 56 38 1 4 1 3 0 1 6 3 47 89 0 1 1 2 0 1 6 4 48 80 1 2 1 2 0 2 6 5 45 79 1 2 1 2 0 1 6 6 56 61 1 2 1 1 0 1 6 7 48 42 0 2 1 2 0 1 6 8 45 67 0 2 2 2 0 1 6 9 52 47 1 2 1 2 0 1 6 10 47 55 1 2 2 3 0 1 7 11 52 85 1 4 1 2 0 1 7 12 60 75 0 4 1 3 0 1 7 13 45 66 0 4 1 2 0 1 7 14 48 53 1 4 1 2 0 2 7 15 56 67 0 1 1 1 0 1 7 16 60 63 1 2 1 4 0 2 7 17 52 51 1 4 1 2 0 2 7 18 60 41 1 4 1 1 0 2 7 19 47 59 1 1 1 1 0 2 7 20 52 44 0 1 1 5 0 1 7 21 47 48 0 1 1 1 0 1 7 22 59 60 1 2 1 2 0 2 8 23 48 84 1 2 1 2 0 1 8 24 61 67 0 2 2 1 0 1 8 25 60 38 1 2 1 7 0 1 8 26 45 46 0 4 1 2 0 1 8 27 63 36 0 2 1 1 0 1 8 28 41 79 0 4 1 2 0 1 8 29 49 32 1 1 1 1 0 2 8 30 63 65 0 4 1 3 1 1 7 31 54 79 1 4 1 4 1 1 7 32 55 67 1 4 1 4 1 2 7 33 70 73 1 2 2 1 1 1 7 34 43 74 1 4 1 3 1 2 7 35 58 61 0 4 1 4 1 2 7 36 56 69 1 4 1 2 1 2 7 37 50 55 0 4 1 4 1 2 7 38 32 75 1 4 1 2 1 2 7 39 59 29 0 2 1 5 1 1 7 40 58 66 0 1 1 3 1 1 7 41 56 48 0 2 1 3 1 1 7 42 50 64 1 4 1 1 1 1 7 43 32 52 1 4 1 1 1 1 7 44 36 31 0 2 1 1 1 1 10 45 46 85 1 4 1 5 1 1 10 46 47 58 1 2 3 3 1 1 10 47 67 75 0 4 2 6 1 1 10 48 61 46 0 1 3 5 1 1 10 49 49 53 1 1 1 4 1 1 10 50 49 80 1 4 1 3 1 2 10 51 56 67 1 4 1 1 1 2 10 52 56 58 1 4 1 5 1 2 10 53 52 70 1 4 1 4 1 2 10 54 49 77 1 4 1 1 1 2 10 55 55 58 0 4 1 9 1 1 10 56 56 65 0 4 1 4 1 2 10 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Age MF Rm PubPr LOS 48.77164 -0.03293 -1.54457 -0.46201 3.31334 1.18533 OorG type `wr\r` -0.18841 2.14874 -0.33310 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -18.3709 -4.3366 0.3717 4.9809 18.6599 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 48.77164 8.49514 5.741 6.62e-07 *** Age -0.03293 0.07281 -0.452 0.6532 MF -1.54457 2.37937 -0.649 0.5194 Rm -0.46201 1.04295 -0.443 0.6598 PubPr 3.31334 2.59325 1.278 0.2076 LOS 1.18533 0.66997 1.769 0.0833 . OorG -0.18841 2.63124 -0.072 0.9432 type 2.14874 2.62247 0.819 0.4167 `wr\r` -0.33310 0.93670 -0.356 0.7237 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.798 on 47 degrees of freedom Multiple R-squared: 0.1254, Adjusted R-squared: -0.02351 F-statistic: 0.8421 on 8 and 47 DF, p-value: 0.5709 > 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.26657147 0.53314295 0.7334285 [2,] 0.39962240 0.79924480 0.6003776 [3,] 0.27914593 0.55829185 0.7208541 [4,] 0.21762081 0.43524162 0.7823792 [5,] 0.18342542 0.36685085 0.8165746 [6,] 0.10996520 0.21993040 0.8900348 [7,] 0.11508691 0.23017383 0.8849131 [8,] 0.11129323 0.22258647 0.8887068 [9,] 0.08191926 0.16383851 0.9180807 [10,] 0.06705190 0.13410380 0.9329481 [11,] 0.04588257 0.09176515 0.9541174 [12,] 0.03862329 0.07724658 0.9613767 [13,] 0.05319505 0.10639010 0.9468050 [14,] 0.03414065 0.06828130 0.9658593 [15,] 0.04605998 0.09211996 0.9539400 [16,] 0.07809380 0.15618761 0.9219062 [17,] 0.11895905 0.23791810 0.8810409 [18,] 0.10717568 0.21435136 0.8928243 [19,] 0.08674545 0.17349091 0.9132545 [20,] 0.06797954 0.13595908 0.9320205 [21,] 0.04754603 0.09509206 0.9524540 [22,] 0.14880367 0.29760734 0.8511963 [23,] 0.20921947 0.41843894 0.7907805 [24,] 0.14957006 0.29914012 0.8504299 [25,] 0.13660403 0.27320806 0.8633960 [26,] 0.10781404 0.21562809 0.8921860 [27,] 0.68619966 0.62760068 0.3138003 [28,] 0.62019436 0.75961127 0.3798056 [29,] 0.52814744 0.94370511 0.4718526 [30,] 0.40337445 0.80674890 0.5966256 [31,] 0.49862067 0.99724135 0.5013793 [32,] 0.46335818 0.92671635 0.5366418 [33,] 0.53106436 0.93787127 0.4689356 > postscript(file="/var/wessaorg/rcomp/tmp/17yiy1345792332.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2ijib1345792332.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3f4pl1345792332.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4rq8v1345792332.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/5x8u81345792332.ps",horizontal=F,onefile=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 = 56 Frequency = 1 1 2 3 4 5 6 -6.83204824 4.85269255 -4.21335449 -3.65184763 -4.53603506 7.05662726 7 8 9 10 11 12 -4.29886377 -9.78905504 1.41033432 -7.49182656 3.91864326 8.85948584 13 14 15 16 17 18 -5.25151823 -3.28372588 5.58070521 5.75085322 0.65042220 9.50649218 19 20 21 22 23 24 -4.28687267 -3.91790996 -4.04488797 7.35583564 -0.70520287 8.06247690 25 26 27 28 29 30 3.85355541 -5.57693616 12.35511244 -8.49037959 -2.84277230 11.71864037 31 32 33 34 35 36 3.53884252 1.99499252 18.65991384 -8.58919624 3.25286847 5.43150351 37 38 39 40 41 42 -4.94468727 -18.37094075 3.23862546 5.36553426 3.23487772 2.60094180 43 44 45 46 47 48 -15.79416968 -13.95490086 -4.44962767 -9.51867119 10.17787472 -0.29102074 49 50 51 52 53 54 -2.70396081 -1.39233690 7.55028474 2.51263297 0.09307399 0.87954431 55 56 -2.62451498 2.38387590 > postscript(file="/var/wessaorg/rcomp/tmp/64yu11345792332.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -6.83204824 NA 1 4.85269255 -6.83204824 2 -4.21335449 4.85269255 3 -3.65184763 -4.21335449 4 -4.53603506 -3.65184763 5 7.05662726 -4.53603506 6 -4.29886377 7.05662726 7 -9.78905504 -4.29886377 8 1.41033432 -9.78905504 9 -7.49182656 1.41033432 10 3.91864326 -7.49182656 11 8.85948584 3.91864326 12 -5.25151823 8.85948584 13 -3.28372588 -5.25151823 14 5.58070521 -3.28372588 15 5.75085322 5.58070521 16 0.65042220 5.75085322 17 9.50649218 0.65042220 18 -4.28687267 9.50649218 19 -3.91790996 -4.28687267 20 -4.04488797 -3.91790996 21 7.35583564 -4.04488797 22 -0.70520287 7.35583564 23 8.06247690 -0.70520287 24 3.85355541 8.06247690 25 -5.57693616 3.85355541 26 12.35511244 -5.57693616 27 -8.49037959 12.35511244 28 -2.84277230 -8.49037959 29 11.71864037 -2.84277230 30 3.53884252 11.71864037 31 1.99499252 3.53884252 32 18.65991384 1.99499252 33 -8.58919624 18.65991384 34 3.25286847 -8.58919624 35 5.43150351 3.25286847 36 -4.94468727 5.43150351 37 -18.37094075 -4.94468727 38 3.23862546 -18.37094075 39 5.36553426 3.23862546 40 3.23487772 5.36553426 41 2.60094180 3.23487772 42 -15.79416968 2.60094180 43 -13.95490086 -15.79416968 44 -4.44962767 -13.95490086 45 -9.51867119 -4.44962767 46 10.17787472 -9.51867119 47 -0.29102074 10.17787472 48 -2.70396081 -0.29102074 49 -1.39233690 -2.70396081 50 7.55028474 -1.39233690 51 2.51263297 7.55028474 52 0.09307399 2.51263297 53 0.87954431 0.09307399 54 -2.62451498 0.87954431 55 2.38387590 -2.62451498 56 NA 2.38387590 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.85269255 -6.83204824 [2,] -4.21335449 4.85269255 [3,] -3.65184763 -4.21335449 [4,] -4.53603506 -3.65184763 [5,] 7.05662726 -4.53603506 [6,] -4.29886377 7.05662726 [7,] -9.78905504 -4.29886377 [8,] 1.41033432 -9.78905504 [9,] -7.49182656 1.41033432 [10,] 3.91864326 -7.49182656 [11,] 8.85948584 3.91864326 [12,] -5.25151823 8.85948584 [13,] -3.28372588 -5.25151823 [14,] 5.58070521 -3.28372588 [15,] 5.75085322 5.58070521 [16,] 0.65042220 5.75085322 [17,] 9.50649218 0.65042220 [18,] -4.28687267 9.50649218 [19,] -3.91790996 -4.28687267 [20,] -4.04488797 -3.91790996 [21,] 7.35583564 -4.04488797 [22,] -0.70520287 7.35583564 [23,] 8.06247690 -0.70520287 [24,] 3.85355541 8.06247690 [25,] -5.57693616 3.85355541 [26,] 12.35511244 -5.57693616 [27,] -8.49037959 12.35511244 [28,] -2.84277230 -8.49037959 [29,] 11.71864037 -2.84277230 [30,] 3.53884252 11.71864037 [31,] 1.99499252 3.53884252 [32,] 18.65991384 1.99499252 [33,] -8.58919624 18.65991384 [34,] 3.25286847 -8.58919624 [35,] 5.43150351 3.25286847 [36,] -4.94468727 5.43150351 [37,] -18.37094075 -4.94468727 [38,] 3.23862546 -18.37094075 [39,] 5.36553426 3.23862546 [40,] 3.23487772 5.36553426 [41,] 2.60094180 3.23487772 [42,] -15.79416968 2.60094180 [43,] -13.95490086 -15.79416968 [44,] -4.44962767 -13.95490086 [45,] -9.51867119 -4.44962767 [46,] 10.17787472 -9.51867119 [47,] -0.29102074 10.17787472 [48,] -2.70396081 -0.29102074 [49,] -1.39233690 -2.70396081 [50,] 7.55028474 -1.39233690 [51,] 2.51263297 7.55028474 [52,] 0.09307399 2.51263297 [53,] 0.87954431 0.09307399 [54,] -2.62451498 0.87954431 [55,] 2.38387590 -2.62451498 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.85269255 -6.83204824 2 -4.21335449 4.85269255 3 -3.65184763 -4.21335449 4 -4.53603506 -3.65184763 5 7.05662726 -4.53603506 6 -4.29886377 7.05662726 7 -9.78905504 -4.29886377 8 1.41033432 -9.78905504 9 -7.49182656 1.41033432 10 3.91864326 -7.49182656 11 8.85948584 3.91864326 12 -5.25151823 8.85948584 13 -3.28372588 -5.25151823 14 5.58070521 -3.28372588 15 5.75085322 5.58070521 16 0.65042220 5.75085322 17 9.50649218 0.65042220 18 -4.28687267 9.50649218 19 -3.91790996 -4.28687267 20 -4.04488797 -3.91790996 21 7.35583564 -4.04488797 22 -0.70520287 7.35583564 23 8.06247690 -0.70520287 24 3.85355541 8.06247690 25 -5.57693616 3.85355541 26 12.35511244 -5.57693616 27 -8.49037959 12.35511244 28 -2.84277230 -8.49037959 29 11.71864037 -2.84277230 30 3.53884252 11.71864037 31 1.99499252 3.53884252 32 18.65991384 1.99499252 33 -8.58919624 18.65991384 34 3.25286847 -8.58919624 35 5.43150351 3.25286847 36 -4.94468727 5.43150351 37 -18.37094075 -4.94468727 38 3.23862546 -18.37094075 39 5.36553426 3.23862546 40 3.23487772 5.36553426 41 2.60094180 3.23487772 42 -15.79416968 2.60094180 43 -13.95490086 -15.79416968 44 -4.44962767 -13.95490086 45 -9.51867119 -4.44962767 46 10.17787472 -9.51867119 47 -0.29102074 10.17787472 48 -2.70396081 -0.29102074 49 -1.39233690 -2.70396081 50 7.55028474 -1.39233690 51 2.51263297 7.55028474 52 0.09307399 2.51263297 53 0.87954431 0.09307399 54 -2.62451498 0.87954431 55 2.38387590 -2.62451498 > 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/wessaorg/rcomp/tmp/7p0o51345792333.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/8errm1345792333.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/9qak81345792333.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/10t2j91345792333.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/1178vy1345792333.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/wessaorg/rcomp/tmp/12z3uw1345792333.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/wessaorg/rcomp/tmp/13bo5g1345792333.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/wessaorg/rcomp/tmp/14m0ib1345792333.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/wessaorg/rcomp/tmp/1506hf1345792333.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/wessaorg/rcomp/tmp/16y91o1345792333.tab") + } > > try(system("convert tmp/17yiy1345792332.ps tmp/17yiy1345792332.png",intern=TRUE)) character(0) > try(system("convert tmp/2ijib1345792332.ps tmp/2ijib1345792332.png",intern=TRUE)) character(0) > try(system("convert tmp/3f4pl1345792332.ps tmp/3f4pl1345792332.png",intern=TRUE)) character(0) > try(system("convert tmp/4rq8v1345792332.ps tmp/4rq8v1345792332.png",intern=TRUE)) character(0) > try(system("convert tmp/5x8u81345792332.ps tmp/5x8u81345792332.png",intern=TRUE)) character(0) > try(system("convert tmp/64yu11345792332.ps tmp/64yu11345792332.png",intern=TRUE)) character(0) > try(system("convert tmp/7p0o51345792333.ps tmp/7p0o51345792333.png",intern=TRUE)) character(0) > try(system("convert tmp/8errm1345792333.ps tmp/8errm1345792333.png",intern=TRUE)) character(0) > try(system("convert tmp/9qak81345792333.ps tmp/9qak81345792333.png",intern=TRUE)) character(0) > try(system("convert tmp/10t2j91345792333.ps tmp/10t2j91345792333.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.535 0.739 5.286