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.8,9.3,114.1,9.3,110.3,8.7,103.9,8.2,101.6,8.3,94.6,8.5,95.9,8.6,104.7,8.5,102.8,8.2,98.1,8.1,113.9,7.9,80.9,8.6,95.7,8.7,113.2,8.7,105.9,8.5,108.8,8.4,102.3,8.5,99,8.7,100.7,8.7,115.5,8.6,100.7,8.5,109.9,8.3,114.6,8,85.4,8.2,100.5,8.1,114.8,8.1,116.5,8,112.9,7.9,102,7.9,106,8,105.3,8,118.8,7.9,106.1,8,109.3,7.7,117.2,7.2,92.5,7.5,104.2,7.3,112.5,7,122.4,7,113.3,7,100,7.2,110.7,7.3,112.8,7.1,109.8,6.8,117.3,6.4,109.1,6.1,115.9,6.5,96,7.7,99.8,7.9,116.8,7.5,115.7,6.9,99.4,6.6,94.3,6.9,91,7.7,93.2,8,103.1,8,94.1,7.7,91.8,7.3,102.7,7.4,82.6,8.1,89.1,8.3),dim=c(2,61),dimnames=list(c('tip','wrk'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('tip','wrk'),1:61)) > 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 = '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 tip wrk M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 96.8 9.3 1 0 0 0 0 0 0 0 0 0 0 2 114.1 9.3 0 1 0 0 0 0 0 0 0 0 0 3 110.3 8.7 0 0 1 0 0 0 0 0 0 0 0 4 103.9 8.2 0 0 0 1 0 0 0 0 0 0 0 5 101.6 8.3 0 0 0 0 1 0 0 0 0 0 0 6 94.6 8.5 0 0 0 0 0 1 0 0 0 0 0 7 95.9 8.6 0 0 0 0 0 0 1 0 0 0 0 8 104.7 8.5 0 0 0 0 0 0 0 1 0 0 0 9 102.8 8.2 0 0 0 0 0 0 0 0 1 0 0 10 98.1 8.1 0 0 0 0 0 0 0 0 0 1 0 11 113.9 7.9 0 0 0 0 0 0 0 0 0 0 1 12 80.9 8.6 0 0 0 0 0 0 0 0 0 0 0 13 95.7 8.7 1 0 0 0 0 0 0 0 0 0 0 14 113.2 8.7 0 1 0 0 0 0 0 0 0 0 0 15 105.9 8.5 0 0 1 0 0 0 0 0 0 0 0 16 108.8 8.4 0 0 0 1 0 0 0 0 0 0 0 17 102.3 8.5 0 0 0 0 1 0 0 0 0 0 0 18 99.0 8.7 0 0 0 0 0 1 0 0 0 0 0 19 100.7 8.7 0 0 0 0 0 0 1 0 0 0 0 20 115.5 8.6 0 0 0 0 0 0 0 1 0 0 0 21 100.7 8.5 0 0 0 0 0 0 0 0 1 0 0 22 109.9 8.3 0 0 0 0 0 0 0 0 0 1 0 23 114.6 8.0 0 0 0 0 0 0 0 0 0 0 1 24 85.4 8.2 0 0 0 0 0 0 0 0 0 0 0 25 100.5 8.1 1 0 0 0 0 0 0 0 0 0 0 26 114.8 8.1 0 1 0 0 0 0 0 0 0 0 0 27 116.5 8.0 0 0 1 0 0 0 0 0 0 0 0 28 112.9 7.9 0 0 0 1 0 0 0 0 0 0 0 29 102.0 7.9 0 0 0 0 1 0 0 0 0 0 0 30 106.0 8.0 0 0 0 0 0 1 0 0 0 0 0 31 105.3 8.0 0 0 0 0 0 0 1 0 0 0 0 32 118.8 7.9 0 0 0 0 0 0 0 1 0 0 0 33 106.1 8.0 0 0 0 0 0 0 0 0 1 0 0 34 109.3 7.7 0 0 0 0 0 0 0 0 0 1 0 35 117.2 7.2 0 0 0 0 0 0 0 0 0 0 1 36 92.5 7.5 0 0 0 0 0 0 0 0 0 0 0 37 104.2 7.3 1 0 0 0 0 0 0 0 0 0 0 38 112.5 7.0 0 1 0 0 0 0 0 0 0 0 0 39 122.4 7.0 0 0 1 0 0 0 0 0 0 0 0 40 113.3 7.0 0 0 0 1 0 0 0 0 0 0 0 41 100.0 7.2 0 0 0 0 1 0 0 0 0 0 0 42 110.7 7.3 0 0 0 0 0 1 0 0 0 0 0 43 112.8 7.1 0 0 0 0 0 0 1 0 0 0 0 44 109.8 6.8 0 0 0 0 0 0 0 1 0 0 0 45 117.3 6.4 0 0 0 0 0 0 0 0 1 0 0 46 109.1 6.1 0 0 0 0 0 0 0 0 0 1 0 47 115.9 6.5 0 0 0 0 0 0 0 0 0 0 1 48 96.0 7.7 0 0 0 0 0 0 0 0 0 0 0 49 99.8 7.9 1 0 0 0 0 0 0 0 0 0 0 50 116.8 7.5 0 1 0 0 0 0 0 0 0 0 0 51 115.7 6.9 0 0 1 0 0 0 0 0 0 0 0 52 99.4 6.6 0 0 0 1 0 0 0 0 0 0 0 53 94.3 6.9 0 0 0 0 1 0 0 0 0 0 0 54 91.0 7.7 0 0 0 0 0 1 0 0 0 0 0 55 93.2 8.0 0 0 0 0 0 0 1 0 0 0 0 56 103.1 8.0 0 0 0 0 0 0 0 1 0 0 0 57 94.1 7.7 0 0 0 0 0 0 0 0 1 0 0 58 91.8 7.3 0 0 0 0 0 0 0 0 0 1 0 59 102.7 7.4 0 0 0 0 0 0 0 0 0 0 1 60 82.6 8.1 0 0 0 0 0 0 0 0 0 0 0 61 89.1 8.3 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) wrk M1 M2 M3 M4 109.46 -2.74 10.88 27.07 26.13 19.08 M5 M6 M7 M8 M9 M10 11.85 12.83 14.26 22.74 16.01 14.74 M11 23.68 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -12.388 -4.200 0.819 3.595 9.373 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 109.456 10.200 10.731 2.39e-14 *** wrk -2.740 1.224 -2.239 0.029820 * M1 10.879 3.773 2.883 0.005875 ** M2 27.074 3.930 6.888 1.09e-08 *** M3 26.132 3.936 6.639 2.63e-08 *** M4 19.084 3.959 4.821 1.48e-05 *** M5 11.848 3.941 3.006 0.004202 ** M6 12.835 3.929 3.267 0.002011 ** M7 14.264 3.929 3.630 0.000686 *** M8 22.736 3.929 5.786 5.31e-07 *** M9 16.008 3.941 4.061 0.000179 *** M10 14.735 3.980 3.703 0.000550 *** M11 23.681 4.001 5.919 3.34e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.211 on 48 degrees of freedom Multiple R-squared: 0.6648, Adjusted R-squared: 0.581 F-statistic: 7.934 on 12 and 48 DF, p-value: 6.916e-08 > 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.047385412 0.094770824 0.9526146 [2,] 0.012849517 0.025699035 0.9871505 [3,] 0.006426104 0.012852208 0.9935739 [4,] 0.004119542 0.008239084 0.9958805 [5,] 0.022710884 0.045421768 0.9772891 [6,] 0.012082773 0.024165546 0.9879172 [7,] 0.029979890 0.059959779 0.9700201 [8,] 0.015327253 0.030654505 0.9846727 [9,] 0.012775500 0.025551001 0.9872245 [10,] 0.010883008 0.021766016 0.9891170 [11,] 0.005268607 0.010537214 0.9947314 [12,] 0.005802512 0.011605023 0.9941975 [13,] 0.005944237 0.011888474 0.9940558 [14,] 0.003779479 0.007558959 0.9962205 [15,] 0.004418851 0.008837703 0.9955811 [16,] 0.002877123 0.005754246 0.9971229 [17,] 0.005110496 0.010220992 0.9948895 [18,] 0.003678270 0.007356541 0.9963217 [19,] 0.013184570 0.026369140 0.9868154 [20,] 0.014402997 0.028805993 0.9855970 [21,] 0.009126132 0.018252263 0.9908739 [22,] 0.004741723 0.009483446 0.9952583 [23,] 0.012718609 0.025437219 0.9872814 [24,] 0.012172707 0.024345414 0.9878273 [25,] 0.073938168 0.147876337 0.9260618 [26,] 0.116927702 0.233855403 0.8830723 [27,] 0.318728945 0.637457891 0.6812711 [28,] 0.323988678 0.647977357 0.6760113 [29,] 0.754643167 0.490713667 0.2453568 [30,] 0.614914766 0.770170468 0.3850852 > postscript(file="/var/www/html/rcomp/tmp/1rpb71258649067.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/2rha21258649067.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/3qjc41258649067.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/48usq1258649067.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/5nd601258649067.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 = 61 Frequency = 1 1 2 3 4 5 6 1.9482118 3.0534419 -1.4486196 -2.1706811 3.0397107 -4.3995057 7 8 9 10 11 12 -4.2550934 -4.2002893 -0.1943098 -3.8958770 2.4101025 -4.9906811 13 14 15 16 17 18 -0.7959112 0.5093189 -6.3966606 3.2773599 4.2877517 0.5485353 19 20 21 22 23 24 0.8189271 6.8737312 -1.4722483 8.4521640 3.3841230 -1.5867631 25 26 27 28 29 30 2.3599658 0.4651959 2.8332369 6.0072574 2.3436287 5.6303918 31 32 33 34 35 36 3.5007836 8.2555877 2.5576492 6.2080410 3.7919590 3.5950934 37 38 39 40 41 42 3.8678019 -4.8490296 5.9930319 3.9410729 -1.5745148 8.4122483 43 44 45 46 47 48 8.5345991 -3.7586378 9.3733213 1.6237131 0.5738155 7.6431344 49 50 51 52 53 54 1.1119248 0.8210729 -0.9809886 -11.0550091 -8.0965763 -10.1916697 55 56 57 58 59 60 -8.5992164 -7.1703918 -10.2644123 -12.3880410 -10.1600000 -4.6607836 61 -8.4919932 > postscript(file="/var/www/html/rcomp/tmp/6uih81258649067.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 1.9482118 NA 1 3.0534419 1.9482118 2 -1.4486196 3.0534419 3 -2.1706811 -1.4486196 4 3.0397107 -2.1706811 5 -4.3995057 3.0397107 6 -4.2550934 -4.3995057 7 -4.2002893 -4.2550934 8 -0.1943098 -4.2002893 9 -3.8958770 -0.1943098 10 2.4101025 -3.8958770 11 -4.9906811 2.4101025 12 -0.7959112 -4.9906811 13 0.5093189 -0.7959112 14 -6.3966606 0.5093189 15 3.2773599 -6.3966606 16 4.2877517 3.2773599 17 0.5485353 4.2877517 18 0.8189271 0.5485353 19 6.8737312 0.8189271 20 -1.4722483 6.8737312 21 8.4521640 -1.4722483 22 3.3841230 8.4521640 23 -1.5867631 3.3841230 24 2.3599658 -1.5867631 25 0.4651959 2.3599658 26 2.8332369 0.4651959 27 6.0072574 2.8332369 28 2.3436287 6.0072574 29 5.6303918 2.3436287 30 3.5007836 5.6303918 31 8.2555877 3.5007836 32 2.5576492 8.2555877 33 6.2080410 2.5576492 34 3.7919590 6.2080410 35 3.5950934 3.7919590 36 3.8678019 3.5950934 37 -4.8490296 3.8678019 38 5.9930319 -4.8490296 39 3.9410729 5.9930319 40 -1.5745148 3.9410729 41 8.4122483 -1.5745148 42 8.5345991 8.4122483 43 -3.7586378 8.5345991 44 9.3733213 -3.7586378 45 1.6237131 9.3733213 46 0.5738155 1.6237131 47 7.6431344 0.5738155 48 1.1119248 7.6431344 49 0.8210729 1.1119248 50 -0.9809886 0.8210729 51 -11.0550091 -0.9809886 52 -8.0965763 -11.0550091 53 -10.1916697 -8.0965763 54 -8.5992164 -10.1916697 55 -7.1703918 -8.5992164 56 -10.2644123 -7.1703918 57 -12.3880410 -10.2644123 58 -10.1600000 -12.3880410 59 -4.6607836 -10.1600000 60 -8.4919932 -4.6607836 61 NA -8.4919932 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.0534419 1.9482118 [2,] -1.4486196 3.0534419 [3,] -2.1706811 -1.4486196 [4,] 3.0397107 -2.1706811 [5,] -4.3995057 3.0397107 [6,] -4.2550934 -4.3995057 [7,] -4.2002893 -4.2550934 [8,] -0.1943098 -4.2002893 [9,] -3.8958770 -0.1943098 [10,] 2.4101025 -3.8958770 [11,] -4.9906811 2.4101025 [12,] -0.7959112 -4.9906811 [13,] 0.5093189 -0.7959112 [14,] -6.3966606 0.5093189 [15,] 3.2773599 -6.3966606 [16,] 4.2877517 3.2773599 [17,] 0.5485353 4.2877517 [18,] 0.8189271 0.5485353 [19,] 6.8737312 0.8189271 [20,] -1.4722483 6.8737312 [21,] 8.4521640 -1.4722483 [22,] 3.3841230 8.4521640 [23,] -1.5867631 3.3841230 [24,] 2.3599658 -1.5867631 [25,] 0.4651959 2.3599658 [26,] 2.8332369 0.4651959 [27,] 6.0072574 2.8332369 [28,] 2.3436287 6.0072574 [29,] 5.6303918 2.3436287 [30,] 3.5007836 5.6303918 [31,] 8.2555877 3.5007836 [32,] 2.5576492 8.2555877 [33,] 6.2080410 2.5576492 [34,] 3.7919590 6.2080410 [35,] 3.5950934 3.7919590 [36,] 3.8678019 3.5950934 [37,] -4.8490296 3.8678019 [38,] 5.9930319 -4.8490296 [39,] 3.9410729 5.9930319 [40,] -1.5745148 3.9410729 [41,] 8.4122483 -1.5745148 [42,] 8.5345991 8.4122483 [43,] -3.7586378 8.5345991 [44,] 9.3733213 -3.7586378 [45,] 1.6237131 9.3733213 [46,] 0.5738155 1.6237131 [47,] 7.6431344 0.5738155 [48,] 1.1119248 7.6431344 [49,] 0.8210729 1.1119248 [50,] -0.9809886 0.8210729 [51,] -11.0550091 -0.9809886 [52,] -8.0965763 -11.0550091 [53,] -10.1916697 -8.0965763 [54,] -8.5992164 -10.1916697 [55,] -7.1703918 -8.5992164 [56,] -10.2644123 -7.1703918 [57,] -12.3880410 -10.2644123 [58,] -10.1600000 -12.3880410 [59,] -4.6607836 -10.1600000 [60,] -8.4919932 -4.6607836 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.0534419 1.9482118 2 -1.4486196 3.0534419 3 -2.1706811 -1.4486196 4 3.0397107 -2.1706811 5 -4.3995057 3.0397107 6 -4.2550934 -4.3995057 7 -4.2002893 -4.2550934 8 -0.1943098 -4.2002893 9 -3.8958770 -0.1943098 10 2.4101025 -3.8958770 11 -4.9906811 2.4101025 12 -0.7959112 -4.9906811 13 0.5093189 -0.7959112 14 -6.3966606 0.5093189 15 3.2773599 -6.3966606 16 4.2877517 3.2773599 17 0.5485353 4.2877517 18 0.8189271 0.5485353 19 6.8737312 0.8189271 20 -1.4722483 6.8737312 21 8.4521640 -1.4722483 22 3.3841230 8.4521640 23 -1.5867631 3.3841230 24 2.3599658 -1.5867631 25 0.4651959 2.3599658 26 2.8332369 0.4651959 27 6.0072574 2.8332369 28 2.3436287 6.0072574 29 5.6303918 2.3436287 30 3.5007836 5.6303918 31 8.2555877 3.5007836 32 2.5576492 8.2555877 33 6.2080410 2.5576492 34 3.7919590 6.2080410 35 3.5950934 3.7919590 36 3.8678019 3.5950934 37 -4.8490296 3.8678019 38 5.9930319 -4.8490296 39 3.9410729 5.9930319 40 -1.5745148 3.9410729 41 8.4122483 -1.5745148 42 8.5345991 8.4122483 43 -3.7586378 8.5345991 44 9.3733213 -3.7586378 45 1.6237131 9.3733213 46 0.5738155 1.6237131 47 7.6431344 0.5738155 48 1.1119248 7.6431344 49 0.8210729 1.1119248 50 -0.9809886 0.8210729 51 -11.0550091 -0.9809886 52 -8.0965763 -11.0550091 53 -10.1916697 -8.0965763 54 -8.5992164 -10.1916697 55 -7.1703918 -8.5992164 56 -10.2644123 -7.1703918 57 -12.3880410 -10.2644123 58 -10.1600000 -12.3880410 59 -4.6607836 -10.1600000 60 -8.4919932 -4.6607836 > 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/75aiu1258649067.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/8w21a1258649067.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/984p21258649067.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/10nseu1258649067.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/11e5vr1258649067.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/12liqo1258649067.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/13ycvf1258649067.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/14q6ts1258649067.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/15k8871258649067.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/1669po1258649067.tab") + } > system("convert tmp/1rpb71258649067.ps tmp/1rpb71258649067.png") > system("convert tmp/2rha21258649067.ps tmp/2rha21258649067.png") > system("convert tmp/3qjc41258649067.ps tmp/3qjc41258649067.png") > system("convert tmp/48usq1258649067.ps tmp/48usq1258649067.png") > system("convert tmp/5nd601258649067.ps tmp/5nd601258649067.png") > system("convert tmp/6uih81258649067.ps tmp/6uih81258649067.png") > system("convert tmp/75aiu1258649067.ps tmp/75aiu1258649067.png") > system("convert tmp/8w21a1258649067.ps tmp/8w21a1258649067.png") > system("convert tmp/984p21258649067.ps tmp/984p21258649067.png") > system("convert tmp/10nseu1258649067.ps tmp/10nseu1258649067.png") > > > proc.time() user system elapsed 2.445 1.565 2.872