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. 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(7.5,0,7.2,0,6.9,0,6.7,0,6.4,0,6.3,0,6.8,0,7.3,0,7.1,0,7.1,0,6.8,0,6.5,0,6.3,0,6.1,0,6.1,0,6.3,0,6.3,0,6,0,6.2,0,6.4,0,6.8,0,7.5,0,7.5,0,7.6,0,7.6,0,7.4,0,7.3,0,7.1,0,6.9,0,6.8,0,7.5,0,7.6,0,7.8,0,8.0,0,8.1,0,8.2,0,8.3,0,8.2,0,8.0,0,7.9,0,7.6,0,7.6,0,8.2,0,8.3,0,8.4,0,8.4,0,8.4,0,8.6,0,8.9,0,8.8,0,8.3,0,7.5,0,7.2,0,7.5,0,8.8,0,9.3,0,9.3,0,8.7,1,8.2,1,8.3,1,8.5,1,8.6,1,8.6,1,8.2,1,8.1,1,8.0,1,8.6,1,8.7,1,8.8,1,8.5,1,8.4,1,8.5,1,8.7,1,8.7,1,8.6,1,8.5,1,8.3,1,8.1,1,8.2,1,8.1,1,8.1,1,7.9,1,7.9,1,7.9,1,8.0,1,8.0,1,7.9,1,8.0,1,7.7,1,7.2,1,7.5,1,7.3,1,7.0,1,7.0,1,7.0,1,7.2,1,7.3,1,7.1,1,6.8,1,6.6,1,6.2,1,6.2,1,6.8,1,6.9,1,6.8,1),dim=c(2,105),dimnames=list(c('w','d'),1:105)) > y <- array(NA,dim=c(2,105),dimnames=list(c('w','d'),1:105)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x w d M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 7.5 0 1 0 0 0 0 0 0 0 0 0 0 1 2 7.2 0 0 1 0 0 0 0 0 0 0 0 0 2 3 6.9 0 0 0 1 0 0 0 0 0 0 0 0 3 4 6.7 0 0 0 0 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1 0 0 0 0 0 0 0 100 101 6.2 1 0 0 0 0 1 0 0 0 0 0 0 101 102 6.2 1 0 0 0 0 0 1 0 0 0 0 0 102 103 6.8 1 0 0 0 0 0 0 1 0 0 0 0 103 104 6.9 1 0 0 0 0 0 0 0 1 0 0 0 104 105 6.8 1 0 0 0 0 0 0 0 0 1 0 0 105 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) d M1 M2 M3 M4 7.415278 -0.118472 0.089155 -0.031103 -0.218029 -0.416065 M5 M6 M7 M8 M9 M10 -0.658546 -0.778804 -0.243507 -0.108210 -0.095135 0.055795 M11 t -0.053353 0.009147 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.4122377 -0.4358025 0.0002160 0.5793364 1.4806790 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.415278 0.322124 23.020 <2e-16 *** d -0.118472 0.309809 -0.382 0.7031 M1 0.089155 0.383647 0.232 0.8168 M2 -0.031103 0.383540 -0.081 0.9355 M3 -0.218029 0.383501 -0.569 0.5711 M4 -0.416065 0.383530 -1.085 0.2809 M5 -0.658546 0.383626 -1.717 0.0894 . M6 -0.778804 0.383790 -2.029 0.0454 * M7 -0.243507 0.384023 -0.634 0.5276 M8 -0.108210 0.384322 -0.282 0.7789 M9 -0.095135 0.384689 -0.247 0.8052 M10 0.055795 0.394652 0.141 0.8879 M11 -0.053353 0.394553 -0.135 0.8927 t 0.009147 0.005101 1.793 0.0763 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.789 on 91 degrees of freedom Multiple R-squared: 0.1832, Adjusted R-squared: 0.06648 F-statistic: 1.57 on 13 and 91 DF, p-value: 0.1087 > 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.15158514 0.3031702896 0.8484148552 [2,] 0.08814373 0.1762874690 0.9118562655 [3,] 0.04479730 0.0895945917 0.9552027041 [4,] 0.02709102 0.0541820301 0.9729089850 [5,] 0.01941560 0.0388312084 0.9805843958 [6,] 0.05518194 0.1103638794 0.9448180603 [7,] 0.13673521 0.2734704241 0.8632647880 [8,] 0.31861273 0.6372254570 0.6813872715 [9,] 0.42535667 0.8507133319 0.5746433340 [10,] 0.50627750 0.9874449986 0.4937224993 [11,] 0.56646419 0.8670716152 0.4335358076 [12,] 0.58323158 0.8335368442 0.4167684221 [13,] 0.59615597 0.8076880619 0.4038440310 [14,] 0.63586361 0.7282727809 0.3641363904 [15,] 0.72145612 0.5570877697 0.2785438848 [16,] 0.77872058 0.4425588480 0.2212794240 [17,] 0.82535588 0.3492882478 0.1746441239 [18,] 0.81247964 0.3750407189 0.1875203594 [19,] 0.80428653 0.3914269461 0.1957134731 [20,] 0.81637735 0.3672452941 0.1836226471 [21,] 0.81921572 0.3615685590 0.1807842795 [22,] 0.83809962 0.3238007531 0.1619003766 [23,] 0.85137476 0.2972504722 0.1486252361 [24,] 0.84919156 0.3016168753 0.1508084376 [25,] 0.84787711 0.3042457862 0.1521228931 [26,] 0.84941298 0.3011740485 0.1505870242 [27,] 0.86080811 0.2783837801 0.1391918900 [28,] 0.86565462 0.2686907581 0.1343453791 [29,] 0.85936395 0.2812721044 0.1406360522 [30,] 0.82376252 0.3524749549 0.1762374774 [31,] 0.77865477 0.4426904537 0.2213452269 [32,] 0.73229019 0.5354196166 0.2677098083 [33,] 0.68901543 0.6219691324 0.3109845662 [34,] 0.64679999 0.7064000139 0.3532000069 [35,] 0.59328554 0.8134289267 0.4067144634 [36,] 0.72830085 0.5433983036 0.2716991518 [37,] 0.90968629 0.1806274176 0.0903137088 [38,] 0.96663108 0.0667378416 0.0333689208 [39,] 0.96837954 0.0632409241 0.0316204620 [40,] 0.96694645 0.0661070936 0.0330535468 [41,] 0.96044390 0.0791121991 0.0395560996 [42,] 0.94672439 0.1065512284 0.0532756142 [43,] 0.96053838 0.0789232435 0.0394616218 [44,] 0.97390590 0.0521881929 0.0260940965 [45,] 0.98379849 0.0324030138 0.0162015069 [46,] 0.98766670 0.0246665907 0.0123332953 [47,] 0.98855260 0.0228947980 0.0114473990 [48,] 0.99719028 0.0056194346 0.0028097173 [49,] 0.99921659 0.0015668184 0.0007834092 [50,] 0.99977925 0.0004415030 0.0002207515 [51,] 0.99982853 0.0003429417 0.0001714709 [52,] 0.99977752 0.0004449596 0.0002224798 [53,] 0.99954853 0.0009029469 0.0004514734 [54,] 0.99929714 0.0014057287 0.0007028643 [55,] 0.99907106 0.0018578760 0.0009289380 [56,] 0.99877056 0.0024588866 0.0012294433 [57,] 0.99805545 0.0038891055 0.0019445527 [58,] 0.99640356 0.0071928708 0.0035964354 [59,] 0.99317398 0.0136520452 0.0068260226 [60,] 0.98741972 0.0251605515 0.0125802757 [61,] 0.97844794 0.0431041246 0.0215520623 [62,] 0.96667744 0.0666451191 0.0333225596 [63,] 0.95528268 0.0894346408 0.0447173204 [64,] 0.95286647 0.0942670675 0.0471335337 [65,] 0.93934114 0.1213177229 0.0606588614 [66,] 0.92624190 0.1475162082 0.0737581041 [67,] 0.89803752 0.2039249590 0.1019624795 [68,] 0.86235525 0.2752894945 0.1376447473 [69,] 0.81485713 0.3702857372 0.1851428686 [70,] 0.72787575 0.5442484980 0.2721242490 [71,] 0.61997976 0.7600404824 0.3800202412 [72,] 0.57572910 0.8485418059 0.4242709029 > postscript(file="/var/www/html/rcomp/tmp/1b5zg1227789279.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/27l221227789279.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/38h2b1227789279.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/4icuf1227789279.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/54o0l1227789279.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 = 105 Frequency = 1 1 2 3 4 5 -0.0135802469 -0.2024691358 -0.3246913580 -0.3358024691 -0.4024691358 6 7 8 9 10 -0.3913580247 -0.4358024691 -0.0802469136 -0.3024691358 -0.4625462963 11 12 13 14 15 -0.6625462963 -1.0250462963 -1.3233487654 -1.4122376543 -1.2344598765 16 17 18 19 20 -0.8455709877 -0.6122376543 -0.8011265432 -1.1455709877 -1.0900154321 21 22 23 24 25 -0.7122376543 -0.1723148148 -0.0723148148 -0.0348148148 -0.1331172840 26 27 28 29 30 -0.2220061728 -0.1442283951 -0.1553395062 -0.1220061728 -0.1108950617 31 32 33 34 35 0.0446604938 0.0002160494 0.1779938272 0.2179166667 0.4179166667 36 37 38 39 40 0.4554166667 0.4571141975 0.4682253086 0.4460030864 0.5348919753 41 42 43 44 45 0.4682253086 0.5793364198 0.6348919753 0.5904475309 0.6682253086 46 47 48 49 50 0.5081481481 0.6081481481 0.7456481481 0.9473456790 0.9584567901 51 52 53 54 55 0.6362345679 0.0251234568 -0.0415432099 0.3695679012 1.1251234568 56 57 58 59 60 1.4806790123 1.4584567901 0.8168518519 0.4168518519 0.4543518519 61 62 63 64 65 0.5560493827 0.7671604938 0.9449382716 0.7338271605 0.8671604938 66 67 68 69 70 0.8782716049 0.9338271605 0.8893827160 0.9671604938 0.5070833333 71 72 73 74 75 0.5070833333 0.5445833333 0.6462808642 0.7573919753 0.8351697531 76 77 78 79 80 0.9240586420 0.9573919753 0.8685030864 0.4240586420 0.1796141975 81 82 83 84 85 0.1573919753 -0.2026851852 -0.1026851852 -0.1651851852 -0.1634876543 86 87 88 89 90 -0.0523765432 0.0254012346 0.3142901235 0.2476234568 -0.1412654321 91 92 93 94 95 -0.3857098765 -0.7301543210 -1.0523765432 -1.2124537037 -1.1124537037 96 97 98 99 100 -0.9749537037 -0.9732561728 -1.0621450617 -1.1843672840 -1.1954783951 101 102 103 104 105 -1.3621450617 -1.2510339506 -1.1954783951 -1.2399228395 -1.3621450617 > postscript(file="/var/www/html/rcomp/tmp/6euvj1227789279.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 = 105 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.0135802469 NA 1 -0.2024691358 -0.0135802469 2 -0.3246913580 -0.2024691358 3 -0.3358024691 -0.3246913580 4 -0.4024691358 -0.3358024691 5 -0.3913580247 -0.4024691358 6 -0.4358024691 -0.3913580247 7 -0.0802469136 -0.4358024691 8 -0.3024691358 -0.0802469136 9 -0.4625462963 -0.3024691358 10 -0.6625462963 -0.4625462963 11 -1.0250462963 -0.6625462963 12 -1.3233487654 -1.0250462963 13 -1.4122376543 -1.3233487654 14 -1.2344598765 -1.4122376543 15 -0.8455709877 -1.2344598765 16 -0.6122376543 -0.8455709877 17 -0.8011265432 -0.6122376543 18 -1.1455709877 -0.8011265432 19 -1.0900154321 -1.1455709877 20 -0.7122376543 -1.0900154321 21 -0.1723148148 -0.7122376543 22 -0.0723148148 -0.1723148148 23 -0.0348148148 -0.0723148148 24 -0.1331172840 -0.0348148148 25 -0.2220061728 -0.1331172840 26 -0.1442283951 -0.2220061728 27 -0.1553395062 -0.1442283951 28 -0.1220061728 -0.1553395062 29 -0.1108950617 -0.1220061728 30 0.0446604938 -0.1108950617 31 0.0002160494 0.0446604938 32 0.1779938272 0.0002160494 33 0.2179166667 0.1779938272 34 0.4179166667 0.2179166667 35 0.4554166667 0.4179166667 36 0.4571141975 0.4554166667 37 0.4682253086 0.4571141975 38 0.4460030864 0.4682253086 39 0.5348919753 0.4460030864 40 0.4682253086 0.5348919753 41 0.5793364198 0.4682253086 42 0.6348919753 0.5793364198 43 0.5904475309 0.6348919753 44 0.6682253086 0.5904475309 45 0.5081481481 0.6682253086 46 0.6081481481 0.5081481481 47 0.7456481481 0.6081481481 48 0.9473456790 0.7456481481 49 0.9584567901 0.9473456790 50 0.6362345679 0.9584567901 51 0.0251234568 0.6362345679 52 -0.0415432099 0.0251234568 53 0.3695679012 -0.0415432099 54 1.1251234568 0.3695679012 55 1.4806790123 1.1251234568 56 1.4584567901 1.4806790123 57 0.8168518519 1.4584567901 58 0.4168518519 0.8168518519 59 0.4543518519 0.4168518519 60 0.5560493827 0.4543518519 61 0.7671604938 0.5560493827 62 0.9449382716 0.7671604938 63 0.7338271605 0.9449382716 64 0.8671604938 0.7338271605 65 0.8782716049 0.8671604938 66 0.9338271605 0.8782716049 67 0.8893827160 0.9338271605 68 0.9671604938 0.8893827160 69 0.5070833333 0.9671604938 70 0.5070833333 0.5070833333 71 0.5445833333 0.5070833333 72 0.6462808642 0.5445833333 73 0.7573919753 0.6462808642 74 0.8351697531 0.7573919753 75 0.9240586420 0.8351697531 76 0.9573919753 0.9240586420 77 0.8685030864 0.9573919753 78 0.4240586420 0.8685030864 79 0.1796141975 0.4240586420 80 0.1573919753 0.1796141975 81 -0.2026851852 0.1573919753 82 -0.1026851852 -0.2026851852 83 -0.1651851852 -0.1026851852 84 -0.1634876543 -0.1651851852 85 -0.0523765432 -0.1634876543 86 0.0254012346 -0.0523765432 87 0.3142901235 0.0254012346 88 0.2476234568 0.3142901235 89 -0.1412654321 0.2476234568 90 -0.3857098765 -0.1412654321 91 -0.7301543210 -0.3857098765 92 -1.0523765432 -0.7301543210 93 -1.2124537037 -1.0523765432 94 -1.1124537037 -1.2124537037 95 -0.9749537037 -1.1124537037 96 -0.9732561728 -0.9749537037 97 -1.0621450617 -0.9732561728 98 -1.1843672840 -1.0621450617 99 -1.1954783951 -1.1843672840 100 -1.3621450617 -1.1954783951 101 -1.2510339506 -1.3621450617 102 -1.1954783951 -1.2510339506 103 -1.2399228395 -1.1954783951 104 -1.3621450617 -1.2399228395 105 NA -1.3621450617 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.2024691358 -0.0135802469 [2,] -0.3246913580 -0.2024691358 [3,] -0.3358024691 -0.3246913580 [4,] -0.4024691358 -0.3358024691 [5,] -0.3913580247 -0.4024691358 [6,] -0.4358024691 -0.3913580247 [7,] -0.0802469136 -0.4358024691 [8,] -0.3024691358 -0.0802469136 [9,] -0.4625462963 -0.3024691358 [10,] -0.6625462963 -0.4625462963 [11,] -1.0250462963 -0.6625462963 [12,] -1.3233487654 -1.0250462963 [13,] -1.4122376543 -1.3233487654 [14,] -1.2344598765 -1.4122376543 [15,] -0.8455709877 -1.2344598765 [16,] -0.6122376543 -0.8455709877 [17,] -0.8011265432 -0.6122376543 [18,] -1.1455709877 -0.8011265432 [19,] -1.0900154321 -1.1455709877 [20,] -0.7122376543 -1.0900154321 [21,] -0.1723148148 -0.7122376543 [22,] -0.0723148148 -0.1723148148 [23,] -0.0348148148 -0.0723148148 [24,] -0.1331172840 -0.0348148148 [25,] -0.2220061728 -0.1331172840 [26,] -0.1442283951 -0.2220061728 [27,] -0.1553395062 -0.1442283951 [28,] -0.1220061728 -0.1553395062 [29,] -0.1108950617 -0.1220061728 [30,] 0.0446604938 -0.1108950617 [31,] 0.0002160494 0.0446604938 [32,] 0.1779938272 0.0002160494 [33,] 0.2179166667 0.1779938272 [34,] 0.4179166667 0.2179166667 [35,] 0.4554166667 0.4179166667 [36,] 0.4571141975 0.4554166667 [37,] 0.4682253086 0.4571141975 [38,] 0.4460030864 0.4682253086 [39,] 0.5348919753 0.4460030864 [40,] 0.4682253086 0.5348919753 [41,] 0.5793364198 0.4682253086 [42,] 0.6348919753 0.5793364198 [43,] 0.5904475309 0.6348919753 [44,] 0.6682253086 0.5904475309 [45,] 0.5081481481 0.6682253086 [46,] 0.6081481481 0.5081481481 [47,] 0.7456481481 0.6081481481 [48,] 0.9473456790 0.7456481481 [49,] 0.9584567901 0.9473456790 [50,] 0.6362345679 0.9584567901 [51,] 0.0251234568 0.6362345679 [52,] -0.0415432099 0.0251234568 [53,] 0.3695679012 -0.0415432099 [54,] 1.1251234568 0.3695679012 [55,] 1.4806790123 1.1251234568 [56,] 1.4584567901 1.4806790123 [57,] 0.8168518519 1.4584567901 [58,] 0.4168518519 0.8168518519 [59,] 0.4543518519 0.4168518519 [60,] 0.5560493827 0.4543518519 [61,] 0.7671604938 0.5560493827 [62,] 0.9449382716 0.7671604938 [63,] 0.7338271605 0.9449382716 [64,] 0.8671604938 0.7338271605 [65,] 0.8782716049 0.8671604938 [66,] 0.9338271605 0.8782716049 [67,] 0.8893827160 0.9338271605 [68,] 0.9671604938 0.8893827160 [69,] 0.5070833333 0.9671604938 [70,] 0.5070833333 0.5070833333 [71,] 0.5445833333 0.5070833333 [72,] 0.6462808642 0.5445833333 [73,] 0.7573919753 0.6462808642 [74,] 0.8351697531 0.7573919753 [75,] 0.9240586420 0.8351697531 [76,] 0.9573919753 0.9240586420 [77,] 0.8685030864 0.9573919753 [78,] 0.4240586420 0.8685030864 [79,] 0.1796141975 0.4240586420 [80,] 0.1573919753 0.1796141975 [81,] -0.2026851852 0.1573919753 [82,] -0.1026851852 -0.2026851852 [83,] -0.1651851852 -0.1026851852 [84,] -0.1634876543 -0.1651851852 [85,] -0.0523765432 -0.1634876543 [86,] 0.0254012346 -0.0523765432 [87,] 0.3142901235 0.0254012346 [88,] 0.2476234568 0.3142901235 [89,] -0.1412654321 0.2476234568 [90,] -0.3857098765 -0.1412654321 [91,] -0.7301543210 -0.3857098765 [92,] -1.0523765432 -0.7301543210 [93,] -1.2124537037 -1.0523765432 [94,] -1.1124537037 -1.2124537037 [95,] -0.9749537037 -1.1124537037 [96,] -0.9732561728 -0.9749537037 [97,] -1.0621450617 -0.9732561728 [98,] -1.1843672840 -1.0621450617 [99,] -1.1954783951 -1.1843672840 [100,] -1.3621450617 -1.1954783951 [101,] -1.2510339506 -1.3621450617 [102,] -1.1954783951 -1.2510339506 [103,] -1.2399228395 -1.1954783951 [104,] -1.3621450617 -1.2399228395 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.2024691358 -0.0135802469 2 -0.3246913580 -0.2024691358 3 -0.3358024691 -0.3246913580 4 -0.4024691358 -0.3358024691 5 -0.3913580247 -0.4024691358 6 -0.4358024691 -0.3913580247 7 -0.0802469136 -0.4358024691 8 -0.3024691358 -0.0802469136 9 -0.4625462963 -0.3024691358 10 -0.6625462963 -0.4625462963 11 -1.0250462963 -0.6625462963 12 -1.3233487654 -1.0250462963 13 -1.4122376543 -1.3233487654 14 -1.2344598765 -1.4122376543 15 -0.8455709877 -1.2344598765 16 -0.6122376543 -0.8455709877 17 -0.8011265432 -0.6122376543 18 -1.1455709877 -0.8011265432 19 -1.0900154321 -1.1455709877 20 -0.7122376543 -1.0900154321 21 -0.1723148148 -0.7122376543 22 -0.0723148148 -0.1723148148 23 -0.0348148148 -0.0723148148 24 -0.1331172840 -0.0348148148 25 -0.2220061728 -0.1331172840 26 -0.1442283951 -0.2220061728 27 -0.1553395062 -0.1442283951 28 -0.1220061728 -0.1553395062 29 -0.1108950617 -0.1220061728 30 0.0446604938 -0.1108950617 31 0.0002160494 0.0446604938 32 0.1779938272 0.0002160494 33 0.2179166667 0.1779938272 34 0.4179166667 0.2179166667 35 0.4554166667 0.4179166667 36 0.4571141975 0.4554166667 37 0.4682253086 0.4571141975 38 0.4460030864 0.4682253086 39 0.5348919753 0.4460030864 40 0.4682253086 0.5348919753 41 0.5793364198 0.4682253086 42 0.6348919753 0.5793364198 43 0.5904475309 0.6348919753 44 0.6682253086 0.5904475309 45 0.5081481481 0.6682253086 46 0.6081481481 0.5081481481 47 0.7456481481 0.6081481481 48 0.9473456790 0.7456481481 49 0.9584567901 0.9473456790 50 0.6362345679 0.9584567901 51 0.0251234568 0.6362345679 52 -0.0415432099 0.0251234568 53 0.3695679012 -0.0415432099 54 1.1251234568 0.3695679012 55 1.4806790123 1.1251234568 56 1.4584567901 1.4806790123 57 0.8168518519 1.4584567901 58 0.4168518519 0.8168518519 59 0.4543518519 0.4168518519 60 0.5560493827 0.4543518519 61 0.7671604938 0.5560493827 62 0.9449382716 0.7671604938 63 0.7338271605 0.9449382716 64 0.8671604938 0.7338271605 65 0.8782716049 0.8671604938 66 0.9338271605 0.8782716049 67 0.8893827160 0.9338271605 68 0.9671604938 0.8893827160 69 0.5070833333 0.9671604938 70 0.5070833333 0.5070833333 71 0.5445833333 0.5070833333 72 0.6462808642 0.5445833333 73 0.7573919753 0.6462808642 74 0.8351697531 0.7573919753 75 0.9240586420 0.8351697531 76 0.9573919753 0.9240586420 77 0.8685030864 0.9573919753 78 0.4240586420 0.8685030864 79 0.1796141975 0.4240586420 80 0.1573919753 0.1796141975 81 -0.2026851852 0.1573919753 82 -0.1026851852 -0.2026851852 83 -0.1651851852 -0.1026851852 84 -0.1634876543 -0.1651851852 85 -0.0523765432 -0.1634876543 86 0.0254012346 -0.0523765432 87 0.3142901235 0.0254012346 88 0.2476234568 0.3142901235 89 -0.1412654321 0.2476234568 90 -0.3857098765 -0.1412654321 91 -0.7301543210 -0.3857098765 92 -1.0523765432 -0.7301543210 93 -1.2124537037 -1.0523765432 94 -1.1124537037 -1.2124537037 95 -0.9749537037 -1.1124537037 96 -0.9732561728 -0.9749537037 97 -1.0621450617 -0.9732561728 98 -1.1843672840 -1.0621450617 99 -1.1954783951 -1.1843672840 100 -1.3621450617 -1.1954783951 101 -1.2510339506 -1.3621450617 102 -1.1954783951 -1.2510339506 103 -1.2399228395 -1.1954783951 104 -1.3621450617 -1.2399228395 > 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/7sy5a1227789280.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/8cy8u1227789280.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/9t2q01227789280.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/102e3o1227789280.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/111o1x1227789280.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/12c5wz1227789280.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/13nfe51227789280.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/14gkld1227789280.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/15hf5u1227789280.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/169mjy1227789280.tab") + } > > system("convert tmp/1b5zg1227789279.ps tmp/1b5zg1227789279.png") > system("convert tmp/27l221227789279.ps tmp/27l221227789279.png") > system("convert tmp/38h2b1227789279.ps tmp/38h2b1227789279.png") > system("convert tmp/4icuf1227789279.ps tmp/4icuf1227789279.png") > system("convert tmp/54o0l1227789279.ps tmp/54o0l1227789279.png") > system("convert tmp/6euvj1227789279.ps tmp/6euvj1227789279.png") > system("convert tmp/7sy5a1227789280.ps tmp/7sy5a1227789280.png") > system("convert tmp/8cy8u1227789280.ps tmp/8cy8u1227789280.png") > system("convert tmp/9t2q01227789280.ps tmp/9t2q01227789280.png") > system("convert tmp/102e3o1227789280.ps tmp/102e3o1227789280.png") > > > proc.time() user system elapsed 3.050 1.593 3.559