R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(5.81,0,5.76,0,5.99,0,6.12,0,6.03,0,6.25,0,5.80,0,5.67,0,5.89,0,5.91,0,5.86,0,6.07,0,6.27,0,6.68,0,6.77,0,6.71,0,6.62,0,6.50,0,5.89,0,6.05,0,6.43,0,6.47,0,6.62,0,6.77,0,6.70,0,6.95,0,6.73,0,7.07,0,7.28,0,7.32,0,6.76,0,6.93,0,6.99,0,7.16,0,7.28,0,7.08,0,7.34,0,7.87,0,6.28,1,6.30,1,6.36,1,6.28,1,5.89,1,6.04,1,5.96,1,6.10,1,6.26,1,6.02,1,6.25,1,6.41,1,6.22,1,6.57,1,6.18,1,6.26,1,6.10,1,6.02,1,6.06,1,6.35,1,6.21,1,6.48,1,6.74,1,6.53,1,6.80,1,6.75,1,6.56,1,6.66,1,6.18,1,6.40,1,6.43,1,6.54,1,6.44,1,6.64,1,6.82,1,6.97,1,7.00,1,6.91,1,6.74,1,6.98,1,6.37,1,6.56,1,6.63,1,6.87,1,6.68,1,6.75,1,6.84,1,7.15,1,7.09,1,6.97,1,7.15,1),dim=c(2,89),dimnames=list(c('Y','X'),1:89)) > y <- array(NA,dim=c(2,89),dimnames=list(c('Y','X'),1:89)) > 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' > #'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 1 5.81 0 2 5.76 0 3 5.99 0 4 6.12 0 5 6.03 0 6 6.25 0 7 5.80 0 8 5.67 0 9 5.89 0 10 5.91 0 11 5.86 0 12 6.07 0 13 6.27 0 14 6.68 0 15 6.77 0 16 6.71 0 17 6.62 0 18 6.50 0 19 5.89 0 20 6.05 0 21 6.43 0 22 6.47 0 23 6.62 0 24 6.77 0 25 6.70 0 26 6.95 0 27 6.73 0 28 7.07 0 29 7.28 0 30 7.32 0 31 6.76 0 32 6.93 0 33 6.99 0 34 7.16 0 35 7.28 0 36 7.08 0 37 7.34 0 38 7.87 0 39 6.28 1 40 6.30 1 41 6.36 1 42 6.28 1 43 5.89 1 44 6.04 1 45 5.96 1 46 6.10 1 47 6.26 1 48 6.02 1 49 6.25 1 50 6.41 1 51 6.22 1 52 6.57 1 53 6.18 1 54 6.26 1 55 6.10 1 56 6.02 1 57 6.06 1 58 6.35 1 59 6.21 1 60 6.48 1 61 6.74 1 62 6.53 1 63 6.80 1 64 6.75 1 65 6.56 1 66 6.66 1 67 6.18 1 68 6.40 1 69 6.43 1 70 6.54 1 71 6.44 1 72 6.64 1 73 6.82 1 74 6.97 1 75 7.00 1 76 6.91 1 77 6.74 1 78 6.98 1 79 6.37 1 80 6.56 1 81 6.63 1 82 6.87 1 83 6.68 1 84 6.75 1 85 6.84 1 86 7.15 1 87 7.09 1 88 6.97 1 89 7.15 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 6.53684 -0.03194 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.8668 -0.3249 0.0251 0.2951 1.3332 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.53684 0.07190 90.922 <2e-16 *** X -0.03194 0.09498 -0.336 0.737 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.4432 on 87 degrees of freedom Multiple R-squared: 0.001298, Adjusted R-squared: -0.01018 F-statistic: 0.1131 on 1 and 87 DF, p-value: 0.7375 > 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.082726646 0.1654532921 0.9172733540 [2,] 0.081681534 0.1633630684 0.9183184658 [3,] 0.052096501 0.1041930030 0.9479034985 [4,] 0.056193868 0.1123877362 0.9438061319 [5,] 0.030248336 0.0604966722 0.9697516639 [6,] 0.016118136 0.0322362718 0.9838818641 [7,] 0.009486311 0.0189726213 0.9905136893 [8,] 0.006621569 0.0132431372 0.9933784314 [9,] 0.011728508 0.0234570167 0.9882714916 [10,] 0.124368905 0.2487378096 0.8756310952 [11,] 0.342153515 0.6843070300 0.6578464850 [12,] 0.474885404 0.9497708087 0.5251145957 [13,] 0.522060299 0.9558794023 0.4779397012 [14,] 0.514904837 0.9701903251 0.4850951626 [15,] 0.580421981 0.8391560372 0.4195780186 [16,] 0.612019237 0.7759615268 0.3879807634 [17,] 0.621725078 0.7565498440 0.3782749220 [18,] 0.640532867 0.7189342669 0.3594671335 [19,] 0.684360511 0.6312789787 0.3156394893 [20,] 0.753363796 0.4932724086 0.2466362043 [21,] 0.790932150 0.4181357001 0.2090678501 [22,] 0.862575256 0.2748494873 0.1374247436 [23,] 0.882517834 0.2349643312 0.1174821656 [24,] 0.930318872 0.1393622569 0.0696811284 [25,] 0.971327877 0.0573442453 0.0286721226 [26,] 0.987840582 0.0243188363 0.0121594181 [27,] 0.988267062 0.0234658764 0.0117329382 [28,] 0.989378455 0.0212430895 0.0106215448 [29,] 0.990796280 0.0184074402 0.0092037201 [30,] 0.992961220 0.0140775595 0.0070387798 [31,] 0.995095594 0.0098088114 0.0049044057 [32,] 0.996151972 0.0076960553 0.0038480276 [33,] 0.997744283 0.0045114338 0.0022557169 [34,] 0.999403560 0.0011928808 0.0005964404 [35,] 0.999075383 0.0018492344 0.0009246172 [36,] 0.998571451 0.0028570974 0.0014285487 [37,] 0.997753151 0.0044936982 0.0022468491 [38,] 0.996715938 0.0065681244 0.0032840622 [39,] 0.997746089 0.0045078211 0.0022539105 [40,] 0.997797999 0.0044040020 0.0022020010 [41,] 0.998330453 0.0033390950 0.0016695475 [42,] 0.998294305 0.0034113897 0.0017056949 [43,] 0.997764691 0.0044706182 0.0022353091 [44,] 0.998288451 0.0034230990 0.0017115495 [45,] 0.997899300 0.0042014000 0.0021007000 [46,] 0.996980808 0.0060383843 0.0030191922 [47,] 0.996609452 0.0067810969 0.0033905484 [48,] 0.995071233 0.0098575338 0.0049287669 [49,] 0.995078151 0.0098436976 0.0049218488 [50,] 0.994432093 0.0111358133 0.0055679066 [51,] 0.995975899 0.0080482013 0.0040241007 [52,] 0.998201440 0.0035971200 0.0017985600 [53,] 0.999297358 0.0014052843 0.0007026421 [54,] 0.999257799 0.0014844019 0.0007422009 [55,] 0.999586818 0.0008263641 0.0004131820 [56,] 0.999454037 0.0010919252 0.0005459626 [57,] 0.999146322 0.0017073562 0.0008536781 [58,] 0.998768306 0.0024633885 0.0012316942 [59,] 0.998148972 0.0037020556 0.0018510278 [60,] 0.997054648 0.0058907033 0.0029453516 [61,] 0.995586096 0.0088278071 0.0044139036 [62,] 0.992953849 0.0140923025 0.0070461512 [63,] 0.997255043 0.0054899133 0.0027449567 [64,] 0.997638526 0.0047229488 0.0023614744 [65,] 0.997971746 0.0040565084 0.0020282542 [66,] 0.997560338 0.0048793241 0.0024396620 [67,] 0.998322059 0.0033558822 0.0016779411 [68,] 0.997562780 0.0048744395 0.0024372197 [69,] 0.995433283 0.0091334341 0.0045667170 [70,] 0.992694441 0.0146111175 0.0073055587 [71,] 0.989116092 0.0217678166 0.0108839083 [72,] 0.980984389 0.0380312230 0.0190156115 [73,] 0.966581694 0.0668366121 0.0334183060 [74,] 0.948813711 0.1023725784 0.0511862892 [75,] 0.974003501 0.0519929988 0.0259964994 [76,] 0.976087845 0.0478243107 0.0239121553 [77,] 0.975561975 0.0488760506 0.0244380253 [78,] 0.945726570 0.1085468594 0.0542734297 [79,] 0.944500813 0.1109983748 0.0554991874 [80,] 0.943948147 0.1121037055 0.0560518527 > postscript(file="/var/www/html/freestat/rcomp/tmp/103r21290878356.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/freestat/rcomp/tmp/203r21290878356.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/freestat/rcomp/tmp/303r21290878356.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/freestat/rcomp/tmp/4td841290878356.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/freestat/rcomp/tmp/5td841290878356.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 = 89 Frequency = 1 1 2 3 4 5 6 -0.72684211 -0.77684211 -0.54684211 -0.41684211 -0.50684211 -0.28684211 7 8 9 10 11 12 -0.73684211 -0.86684211 -0.64684211 -0.62684211 -0.67684211 -0.46684211 13 14 15 16 17 18 -0.26684211 0.14315789 0.23315789 0.17315789 0.08315789 -0.03684211 19 20 21 22 23 24 -0.64684211 -0.48684211 -0.10684211 -0.06684211 0.08315789 0.23315789 25 26 27 28 29 30 0.16315789 0.41315789 0.19315789 0.53315789 0.74315789 0.78315789 31 32 33 34 35 36 0.22315789 0.39315789 0.45315789 0.62315789 0.74315789 0.54315789 37 38 39 40 41 42 0.80315789 1.33315789 -0.22490196 -0.20490196 -0.14490196 -0.22490196 43 44 45 46 47 48 -0.61490196 -0.46490196 -0.54490196 -0.40490196 -0.24490196 -0.48490196 49 50 51 52 53 54 -0.25490196 -0.09490196 -0.28490196 0.06509804 -0.32490196 -0.24490196 55 56 57 58 59 60 -0.40490196 -0.48490196 -0.44490196 -0.15490196 -0.29490196 -0.02490196 61 62 63 64 65 66 0.23509804 0.02509804 0.29509804 0.24509804 0.05509804 0.15509804 67 68 69 70 71 72 -0.32490196 -0.10490196 -0.07490196 0.03509804 -0.06490196 0.13509804 73 74 75 76 77 78 0.31509804 0.46509804 0.49509804 0.40509804 0.23509804 0.47509804 79 80 81 82 83 84 -0.13490196 0.05509804 0.12509804 0.36509804 0.17509804 0.24509804 85 86 87 88 89 0.33509804 0.64509804 0.58509804 0.46509804 0.64509804 > postscript(file="/var/www/html/freestat/rcomp/tmp/6td841290878356.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 = 89 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.72684211 NA 1 -0.77684211 -0.72684211 2 -0.54684211 -0.77684211 3 -0.41684211 -0.54684211 4 -0.50684211 -0.41684211 5 -0.28684211 -0.50684211 6 -0.73684211 -0.28684211 7 -0.86684211 -0.73684211 8 -0.64684211 -0.86684211 9 -0.62684211 -0.64684211 10 -0.67684211 -0.62684211 11 -0.46684211 -0.67684211 12 -0.26684211 -0.46684211 13 0.14315789 -0.26684211 14 0.23315789 0.14315789 15 0.17315789 0.23315789 16 0.08315789 0.17315789 17 -0.03684211 0.08315789 18 -0.64684211 -0.03684211 19 -0.48684211 -0.64684211 20 -0.10684211 -0.48684211 21 -0.06684211 -0.10684211 22 0.08315789 -0.06684211 23 0.23315789 0.08315789 24 0.16315789 0.23315789 25 0.41315789 0.16315789 26 0.19315789 0.41315789 27 0.53315789 0.19315789 28 0.74315789 0.53315789 29 0.78315789 0.74315789 30 0.22315789 0.78315789 31 0.39315789 0.22315789 32 0.45315789 0.39315789 33 0.62315789 0.45315789 34 0.74315789 0.62315789 35 0.54315789 0.74315789 36 0.80315789 0.54315789 37 1.33315789 0.80315789 38 -0.22490196 1.33315789 39 -0.20490196 -0.22490196 40 -0.14490196 -0.20490196 41 -0.22490196 -0.14490196 42 -0.61490196 -0.22490196 43 -0.46490196 -0.61490196 44 -0.54490196 -0.46490196 45 -0.40490196 -0.54490196 46 -0.24490196 -0.40490196 47 -0.48490196 -0.24490196 48 -0.25490196 -0.48490196 49 -0.09490196 -0.25490196 50 -0.28490196 -0.09490196 51 0.06509804 -0.28490196 52 -0.32490196 0.06509804 53 -0.24490196 -0.32490196 54 -0.40490196 -0.24490196 55 -0.48490196 -0.40490196 56 -0.44490196 -0.48490196 57 -0.15490196 -0.44490196 58 -0.29490196 -0.15490196 59 -0.02490196 -0.29490196 60 0.23509804 -0.02490196 61 0.02509804 0.23509804 62 0.29509804 0.02509804 63 0.24509804 0.29509804 64 0.05509804 0.24509804 65 0.15509804 0.05509804 66 -0.32490196 0.15509804 67 -0.10490196 -0.32490196 68 -0.07490196 -0.10490196 69 0.03509804 -0.07490196 70 -0.06490196 0.03509804 71 0.13509804 -0.06490196 72 0.31509804 0.13509804 73 0.46509804 0.31509804 74 0.49509804 0.46509804 75 0.40509804 0.49509804 76 0.23509804 0.40509804 77 0.47509804 0.23509804 78 -0.13490196 0.47509804 79 0.05509804 -0.13490196 80 0.12509804 0.05509804 81 0.36509804 0.12509804 82 0.17509804 0.36509804 83 0.24509804 0.17509804 84 0.33509804 0.24509804 85 0.64509804 0.33509804 86 0.58509804 0.64509804 87 0.46509804 0.58509804 88 0.64509804 0.46509804 89 NA 0.64509804 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.77684211 -0.72684211 [2,] -0.54684211 -0.77684211 [3,] -0.41684211 -0.54684211 [4,] -0.50684211 -0.41684211 [5,] -0.28684211 -0.50684211 [6,] -0.73684211 -0.28684211 [7,] -0.86684211 -0.73684211 [8,] -0.64684211 -0.86684211 [9,] -0.62684211 -0.64684211 [10,] -0.67684211 -0.62684211 [11,] -0.46684211 -0.67684211 [12,] -0.26684211 -0.46684211 [13,] 0.14315789 -0.26684211 [14,] 0.23315789 0.14315789 [15,] 0.17315789 0.23315789 [16,] 0.08315789 0.17315789 [17,] -0.03684211 0.08315789 [18,] -0.64684211 -0.03684211 [19,] -0.48684211 -0.64684211 [20,] -0.10684211 -0.48684211 [21,] -0.06684211 -0.10684211 [22,] 0.08315789 -0.06684211 [23,] 0.23315789 0.08315789 [24,] 0.16315789 0.23315789 [25,] 0.41315789 0.16315789 [26,] 0.19315789 0.41315789 [27,] 0.53315789 0.19315789 [28,] 0.74315789 0.53315789 [29,] 0.78315789 0.74315789 [30,] 0.22315789 0.78315789 [31,] 0.39315789 0.22315789 [32,] 0.45315789 0.39315789 [33,] 0.62315789 0.45315789 [34,] 0.74315789 0.62315789 [35,] 0.54315789 0.74315789 [36,] 0.80315789 0.54315789 [37,] 1.33315789 0.80315789 [38,] -0.22490196 1.33315789 [39,] -0.20490196 -0.22490196 [40,] -0.14490196 -0.20490196 [41,] -0.22490196 -0.14490196 [42,] -0.61490196 -0.22490196 [43,] -0.46490196 -0.61490196 [44,] -0.54490196 -0.46490196 [45,] -0.40490196 -0.54490196 [46,] -0.24490196 -0.40490196 [47,] -0.48490196 -0.24490196 [48,] -0.25490196 -0.48490196 [49,] -0.09490196 -0.25490196 [50,] -0.28490196 -0.09490196 [51,] 0.06509804 -0.28490196 [52,] -0.32490196 0.06509804 [53,] -0.24490196 -0.32490196 [54,] -0.40490196 -0.24490196 [55,] -0.48490196 -0.40490196 [56,] -0.44490196 -0.48490196 [57,] -0.15490196 -0.44490196 [58,] -0.29490196 -0.15490196 [59,] -0.02490196 -0.29490196 [60,] 0.23509804 -0.02490196 [61,] 0.02509804 0.23509804 [62,] 0.29509804 0.02509804 [63,] 0.24509804 0.29509804 [64,] 0.05509804 0.24509804 [65,] 0.15509804 0.05509804 [66,] -0.32490196 0.15509804 [67,] -0.10490196 -0.32490196 [68,] -0.07490196 -0.10490196 [69,] 0.03509804 -0.07490196 [70,] -0.06490196 0.03509804 [71,] 0.13509804 -0.06490196 [72,] 0.31509804 0.13509804 [73,] 0.46509804 0.31509804 [74,] 0.49509804 0.46509804 [75,] 0.40509804 0.49509804 [76,] 0.23509804 0.40509804 [77,] 0.47509804 0.23509804 [78,] -0.13490196 0.47509804 [79,] 0.05509804 -0.13490196 [80,] 0.12509804 0.05509804 [81,] 0.36509804 0.12509804 [82,] 0.17509804 0.36509804 [83,] 0.24509804 0.17509804 [84,] 0.33509804 0.24509804 [85,] 0.64509804 0.33509804 [86,] 0.58509804 0.64509804 [87,] 0.46509804 0.58509804 [88,] 0.64509804 0.46509804 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.77684211 -0.72684211 2 -0.54684211 -0.77684211 3 -0.41684211 -0.54684211 4 -0.50684211 -0.41684211 5 -0.28684211 -0.50684211 6 -0.73684211 -0.28684211 7 -0.86684211 -0.73684211 8 -0.64684211 -0.86684211 9 -0.62684211 -0.64684211 10 -0.67684211 -0.62684211 11 -0.46684211 -0.67684211 12 -0.26684211 -0.46684211 13 0.14315789 -0.26684211 14 0.23315789 0.14315789 15 0.17315789 0.23315789 16 0.08315789 0.17315789 17 -0.03684211 0.08315789 18 -0.64684211 -0.03684211 19 -0.48684211 -0.64684211 20 -0.10684211 -0.48684211 21 -0.06684211 -0.10684211 22 0.08315789 -0.06684211 23 0.23315789 0.08315789 24 0.16315789 0.23315789 25 0.41315789 0.16315789 26 0.19315789 0.41315789 27 0.53315789 0.19315789 28 0.74315789 0.53315789 29 0.78315789 0.74315789 30 0.22315789 0.78315789 31 0.39315789 0.22315789 32 0.45315789 0.39315789 33 0.62315789 0.45315789 34 0.74315789 0.62315789 35 0.54315789 0.74315789 36 0.80315789 0.54315789 37 1.33315789 0.80315789 38 -0.22490196 1.33315789 39 -0.20490196 -0.22490196 40 -0.14490196 -0.20490196 41 -0.22490196 -0.14490196 42 -0.61490196 -0.22490196 43 -0.46490196 -0.61490196 44 -0.54490196 -0.46490196 45 -0.40490196 -0.54490196 46 -0.24490196 -0.40490196 47 -0.48490196 -0.24490196 48 -0.25490196 -0.48490196 49 -0.09490196 -0.25490196 50 -0.28490196 -0.09490196 51 0.06509804 -0.28490196 52 -0.32490196 0.06509804 53 -0.24490196 -0.32490196 54 -0.40490196 -0.24490196 55 -0.48490196 -0.40490196 56 -0.44490196 -0.48490196 57 -0.15490196 -0.44490196 58 -0.29490196 -0.15490196 59 -0.02490196 -0.29490196 60 0.23509804 -0.02490196 61 0.02509804 0.23509804 62 0.29509804 0.02509804 63 0.24509804 0.29509804 64 0.05509804 0.24509804 65 0.15509804 0.05509804 66 -0.32490196 0.15509804 67 -0.10490196 -0.32490196 68 -0.07490196 -0.10490196 69 0.03509804 -0.07490196 70 -0.06490196 0.03509804 71 0.13509804 -0.06490196 72 0.31509804 0.13509804 73 0.46509804 0.31509804 74 0.49509804 0.46509804 75 0.40509804 0.49509804 76 0.23509804 0.40509804 77 0.47509804 0.23509804 78 -0.13490196 0.47509804 79 0.05509804 -0.13490196 80 0.12509804 0.05509804 81 0.36509804 0.12509804 82 0.17509804 0.36509804 83 0.24509804 0.17509804 84 0.33509804 0.24509804 85 0.64509804 0.33509804 86 0.58509804 0.64509804 87 0.46509804 0.58509804 88 0.64509804 0.46509804 > 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/freestat/rcomp/tmp/74m7q1290878356.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/freestat/rcomp/tmp/8wdos1290878356.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/freestat/rcomp/tmp/9wdos1290878356.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/freestat/rcomp/tmp/10wdos1290878356.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/110w5y1290878356.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/freestat/rcomp/tmp/12memm1290878356.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/freestat/rcomp/tmp/13sf0g1290878356.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/freestat/rcomp/tmp/14l6011290878356.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/freestat/rcomp/tmp/1567yp1290878356.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/freestat/rcomp/tmp/16kzwx1290878356.tab") + } > > try(system("convert tmp/103r21290878356.ps tmp/103r21290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/203r21290878356.ps tmp/203r21290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/303r21290878356.ps tmp/303r21290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/4td841290878356.ps tmp/4td841290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/5td841290878356.ps tmp/5td841290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/6td841290878356.ps tmp/6td841290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/74m7q1290878356.ps tmp/74m7q1290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/8wdos1290878356.ps tmp/8wdos1290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/9wdos1290878356.ps tmp/9wdos1290878356.png",intern=TRUE)) character(0) > try(system("convert tmp/10wdos1290878356.ps tmp/10wdos1290878356.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.143 2.455 4.508