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(1 + ,162556 + ,1081 + ,213118 + ,6282929 + ,1 + ,29790 + ,309 + ,81767 + ,4324047 + ,1 + ,87550 + ,458 + ,153198 + ,4108272 + ,0 + ,84738 + ,588 + ,-26007 + ,-1212617 + ,1 + ,54660 + ,299 + ,126942 + ,1485329 + ,1 + ,42634 + ,156 + ,157214 + ,1779876 + ,0 + ,40949 + ,481 + ,129352 + ,1367203 + ,1 + ,42312 + ,323 + ,234817 + ,2519076 + ,1 + ,37704 + ,452 + ,60448 + ,912684 + ,1 + ,16275 + ,109 + ,47818 + ,1443586 + ,0 + ,25830 + ,115 + ,245546 + ,1220017 + ,0 + ,12679 + ,110 + ,48020 + ,984885 + ,1 + ,18014 + ,239 + ,-1710 + ,1457425 + ,0 + ,43556 + ,247 + ,32648 + ,-572920 + ,1 + ,24524 + ,497 + ,95350 + ,929144 + ,0 + ,6532 + ,103 + ,151352 + ,1151176 + ,0 + ,7123 + ,109 + ,288170 + ,790090 + ,1 + ,20813 + ,502 + ,114337 + ,774497 + ,1 + ,37597 + ,248 + ,37884 + ,990576 + ,0 + ,17821 + ,373 + ,122844 + ,454195 + ,1 + ,12988 + ,119 + ,82340 + ,876607 + ,1 + ,22330 + ,84 + ,79801 + ,711969 + ,0 + ,13326 + ,102 + ,165548 + ,702380 + ,0 + ,16189 + ,295 + ,116384 + ,264449 + ,0 + ,7146 + ,105 + ,134028 + ,450033 + ,0 + ,15824 + ,64 + ,63838 + ,541063 + ,1 + ,26088 + ,267 + ,74996 + ,588864 + ,0 + ,11326 + ,129 + ,31080 + ,-37216 + ,0 + ,8568 + ,37 + ,32168 + ,783310 + ,0 + ,14416 + ,361 + ,49857 + ,467359 + ,1 + ,3369 + ,28 + ,87161 + ,688779 + ,1 + ,11819 + ,85 + ,106113 + ,608419 + ,1 + ,6620 + ,44 + ,80570 + ,696348 + ,1 + ,4519 + ,49 + ,102129 + ,597793 + ,0 + ,2220 + ,22 + ,301670 + ,821730 + ,0 + ,18562 + ,155 + ,102313 + ,377934 + ,0 + ,10327 + ,91 + ,88577 + ,651939 + ,1 + ,5336 + ,81 + ,112477 + ,697458 + ,1 + ,2365 + ,79 + ,191778 + ,700368 + ,0 + ,4069 + ,145 + ,79804 + ,225986 + ,0 + ,7710 + ,816 + ,128294 + ,348695 + ,0 + ,13718 + ,61 + ,96448 + ,373683 + ,0 + ,4525 + ,226 + ,93811 + ,501709 + ,0 + ,6869 + ,105 + ,117520 + ,413743 + ,0 + ,4628 + ,62 + ,69159 + ,379825 + ,1 + ,3653 + ,24 + ,101792 + ,336260 + ,1 + ,1265 + ,26 + ,210568 + ,636765 + ,1 + ,7489 + ,322 + ,136996 + ,481231 + ,0 + ,4901 + ,84 + ,121920 + ,469107 + ,0 + ,2284 + ,33 + ,76403 + ,211928 + ,1 + ,3160 + ,108 + ,108094 + ,563925 + ,1 + ,4150 + ,150 + ,134759 + ,511939 + ,1 + ,7285 + ,115 + ,188873 + ,521016 + ,1 + ,1134 + ,162 + ,146216 + ,543856 + ,1 + ,4658 + ,158 + ,156608 + ,329304 + ,0 + ,2384 + ,97 + ,61348 + ,423262 + ,0 + ,3748 + ,9 + ,50350 + ,509665 + ,0 + ,5371 + ,66 + ,87720 + ,455881 + ,0 + ,1285 + ,107 + ,99489 + ,367772 + ,1 + ,9327 + ,101 + ,87419 + ,406339 + ,1 + ,5565 + ,47 + ,94355 + ,493408 + ,0 + ,1528 + ,38 + ,60326 + ,232942 + ,1 + ,3122 + ,34 + ,94670 + ,416002 + ,1 + ,7317 + ,84 + ,82425 + ,337430 + ,0 + ,2675 + ,79 + ,59017 + ,361517 + ,0 + ,13253 + ,947 + ,90829 + ,360962 + ,0 + ,880 + ,74 + ,80791 + ,235561 + ,1 + ,2053 + ,53 + ,100423 + ,408247 + ,0 + ,1424 + ,94 + ,131116 + ,450296 + ,1 + ,4036 + ,63 + ,100269 + ,418799 + ,1 + ,3045 + ,58 + ,27330 + ,247405 + ,0 + ,5119 + ,49 + ,39039 + ,378519 + ,0 + ,1431 + ,34 + ,106885 + ,326638 + ,0 + ,554 + ,11 + ,79285 + ,328233 + ,0 + ,1975 + ,35 + ,118881 + ,386225 + ,1 + ,1286 + ,17 + ,77623 + ,283662 + ,0 + ,1012 + ,47 + ,114768 + ,370225 + ,0 + ,810 + ,43 + ,74015 + ,269236 + ,0 + ,1280 + ,117 + ,69465 + ,365732 + ,1 + ,666 + ,171 + ,117869 + ,420383 + ,0 + ,1380 + ,26 + ,60982 + ,345811 + ,1 + ,4608 + ,73 + ,90131 + ,431809 + ,0 + ,876 + ,59 + ,138971 + ,418876 + ,0 + ,814 + ,18 + ,39625 + ,297476 + ,0 + ,514 + ,15 + ,102725 + ,416776 + ,1 + ,5692 + ,72 + ,64239 + ,357257 + ,0 + ,3642 + ,86 + ,90262 + ,458343 + ,0 + ,540 + ,14 + ,103960 + ,388386 + ,0 + ,2099 + ,64 + ,106611 + ,358934 + ,0 + ,567 + ,11 + ,103345 + ,407560 + ,0 + ,2001 + ,52 + ,95551 + ,392558 + ,1 + ,2949 + ,41 + ,82903 + ,373177 + ,0 + ,2253 + ,99 + ,63593 + ,428370 + ,1 + ,6533 + ,75 + ,126910 + ,369419 + ,0 + ,1889 + ,45 + ,37527 + ,358649 + ,1 + ,3055 + ,43 + ,60247 + ,376641 + ,0 + ,272 + ,8 + ,112995 + ,467427 + ,1 + ,1414 + ,198 + ,70184 + ,364885 + ,0 + ,2564 + ,22 + ,130140 + ,436230 + ,1 + ,1383 + ,11 + ,73221 + ,329118) + ,dim=c(5 + ,100) + ,dimnames=list(c('Group' + ,'Costs' + ,'Trades' + ,'Dividends' + ,'Wealth') + ,1:100)) > y <- array(NA,dim=c(5,100),dimnames=list(c('Group','Costs','Trades','Dividends','Wealth'),1:100)) > 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 = '5' > #'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 Wealth Group Costs Trades Dividends 1 6282929 1 162556 1081 213118 2 4324047 1 29790 309 81767 3 4108272 1 87550 458 153198 4 -1212617 0 84738 588 -26007 5 1485329 1 54660 299 126942 6 1779876 1 42634 156 157214 7 1367203 0 40949 481 129352 8 2519076 1 42312 323 234817 9 912684 1 37704 452 60448 10 1443586 1 16275 109 47818 11 1220017 0 25830 115 245546 12 984885 0 12679 110 48020 13 1457425 1 18014 239 -1710 14 -572920 0 43556 247 32648 15 929144 1 24524 497 95350 16 1151176 0 6532 103 151352 17 790090 0 7123 109 288170 18 774497 1 20813 502 114337 19 990576 1 37597 248 37884 20 454195 0 17821 373 122844 21 876607 1 12988 119 82340 22 711969 1 22330 84 79801 23 702380 0 13326 102 165548 24 264449 0 16189 295 116384 25 450033 0 7146 105 134028 26 541063 0 15824 64 63838 27 588864 1 26088 267 74996 28 -37216 0 11326 129 31080 29 783310 0 8568 37 32168 30 467359 0 14416 361 49857 31 688779 1 3369 28 87161 32 608419 1 11819 85 106113 33 696348 1 6620 44 80570 34 597793 1 4519 49 102129 35 821730 0 2220 22 301670 36 377934 0 18562 155 102313 37 651939 0 10327 91 88577 38 697458 1 5336 81 112477 39 700368 1 2365 79 191778 40 225986 0 4069 145 79804 41 348695 0 7710 816 128294 42 373683 0 13718 61 96448 43 501709 0 4525 226 93811 44 413743 0 6869 105 117520 45 379825 0 4628 62 69159 46 336260 1 3653 24 101792 47 636765 1 1265 26 210568 48 481231 1 7489 322 136996 49 469107 0 4901 84 121920 50 211928 0 2284 33 76403 51 563925 1 3160 108 108094 52 511939 1 4150 150 134759 53 521016 1 7285 115 188873 54 543856 1 1134 162 146216 55 329304 1 4658 158 156608 56 423262 0 2384 97 61348 57 509665 0 3748 9 50350 58 455881 0 5371 66 87720 59 367772 0 1285 107 99489 60 406339 1 9327 101 87419 61 493408 1 5565 47 94355 62 232942 0 1528 38 60326 63 416002 1 3122 34 94670 64 337430 1 7317 84 82425 65 361517 0 2675 79 59017 66 360962 0 13253 947 90829 67 235561 0 880 74 80791 68 408247 1 2053 53 100423 69 450296 0 1424 94 131116 70 418799 1 4036 63 100269 71 247405 1 3045 58 27330 72 378519 0 5119 49 39039 73 326638 0 1431 34 106885 74 328233 0 554 11 79285 75 386225 0 1975 35 118881 76 283662 1 1286 17 77623 77 370225 0 1012 47 114768 78 269236 0 810 43 74015 79 365732 0 1280 117 69465 80 420383 1 666 171 117869 81 345811 0 1380 26 60982 82 431809 1 4608 73 90131 83 418876 0 876 59 138971 84 297476 0 814 18 39625 85 416776 0 514 15 102725 86 357257 1 5692 72 64239 87 458343 0 3642 86 90262 88 388386 0 540 14 103960 89 358934 0 2099 64 106611 90 407560 0 567 11 103345 91 392558 0 2001 52 95551 92 373177 1 2949 41 82903 93 428370 0 2253 99 63593 94 369419 1 6533 75 126910 95 358649 0 1889 45 37527 96 376641 1 3055 43 60247 97 467427 0 272 8 112995 98 364885 1 1414 198 70184 99 436230 0 2564 22 130140 100 329118 1 1383 11 73221 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Group Costs Trades Dividends -1.913e+05 2.851e+05 2.684e+01 -2.658e+02 4.282e+00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3028137 -214095 2702 155211 3162664 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.913e+05 1.368e+05 -1.398 0.165407 Group 2.851e+05 1.190e+05 2.395 0.018579 * Costs 2.684e+01 3.834e+00 7.001 3.59e-10 *** Trades -2.658e+02 4.337e+02 -0.613 0.541459 Dividends 4.282e+00 1.099e+00 3.895 0.000183 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 579100 on 95 degrees of freedom Multiple R-squared: 0.5799, Adjusted R-squared: 0.5622 F-statistic: 32.78 on 4 and 95 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 1.0000000 3.164570e-12 1.582285e-12 [2,] 1.0000000 2.364351e-19 1.182175e-19 [3,] 1.0000000 1.051133e-20 5.255663e-21 [4,] 1.0000000 1.048183e-20 5.240916e-21 [5,] 1.0000000 3.323243e-24 1.661621e-24 [6,] 1.0000000 1.317159e-27 6.585797e-28 [7,] 1.0000000 9.085710e-36 4.542855e-36 [8,] 1.0000000 2.118988e-37 1.059494e-37 [9,] 1.0000000 5.214214e-41 2.607107e-41 [10,] 1.0000000 1.410454e-40 7.052269e-41 [11,] 1.0000000 8.718609e-41 4.359304e-41 [12,] 1.0000000 7.899861e-41 3.949931e-41 [13,] 1.0000000 5.791592e-40 2.895796e-40 [14,] 1.0000000 6.976624e-41 3.488312e-41 [15,] 1.0000000 1.619499e-40 8.097496e-41 [16,] 1.0000000 8.917351e-40 4.458675e-40 [17,] 1.0000000 1.345051e-39 6.725257e-40 [18,] 1.0000000 1.012936e-38 5.064680e-39 [19,] 1.0000000 3.392844e-38 1.696422e-38 [20,] 1.0000000 1.043643e-37 5.218214e-38 [21,] 1.0000000 1.582697e-39 7.913483e-40 [22,] 1.0000000 1.112115e-42 5.560574e-43 [23,] 1.0000000 4.249026e-42 2.124513e-42 [24,] 1.0000000 1.078682e-42 5.393410e-43 [25,] 1.0000000 3.424021e-42 1.712010e-42 [26,] 1.0000000 3.598034e-43 1.799017e-43 [27,] 1.0000000 5.616123e-43 2.808061e-43 [28,] 1.0000000 2.794489e-42 1.397244e-42 [29,] 1.0000000 1.250188e-41 6.250938e-42 [30,] 1.0000000 2.380352e-42 1.190176e-42 [31,] 1.0000000 1.078540e-43 5.392699e-44 [32,] 1.0000000 6.480481e-44 3.240240e-44 [33,] 1.0000000 1.041254e-43 5.206269e-44 [34,] 1.0000000 7.913408e-43 3.956704e-43 [35,] 1.0000000 6.640030e-42 3.320015e-42 [36,] 1.0000000 1.886089e-41 9.430443e-42 [37,] 1.0000000 2.103871e-40 1.051936e-40 [38,] 1.0000000 2.087557e-39 1.043778e-39 [39,] 1.0000000 1.011865e-38 5.059327e-39 [40,] 1.0000000 2.683087e-38 1.341543e-38 [41,] 1.0000000 2.185421e-37 1.092711e-37 [42,] 1.0000000 2.145281e-36 1.072640e-36 [43,] 1.0000000 1.734324e-36 8.671620e-37 [44,] 1.0000000 9.747034e-37 4.873517e-37 [45,] 1.0000000 4.353363e-36 2.176681e-36 [46,] 1.0000000 3.507115e-35 1.753558e-35 [47,] 1.0000000 2.192313e-35 1.096156e-35 [48,] 1.0000000 4.314225e-35 2.157112e-35 [49,] 1.0000000 2.232823e-34 1.116412e-34 [50,] 1.0000000 4.959510e-35 2.479755e-35 [51,] 1.0000000 3.650404e-34 1.825202e-34 [52,] 1.0000000 5.054141e-33 2.527070e-33 [53,] 1.0000000 6.564166e-32 3.282083e-32 [54,] 1.0000000 1.807638e-31 9.038190e-32 [55,] 1.0000000 2.779396e-31 1.389698e-31 [56,] 1.0000000 3.066572e-30 1.533286e-30 [57,] 1.0000000 2.687789e-29 1.343894e-29 [58,] 1.0000000 3.497279e-28 1.748639e-28 [59,] 1.0000000 1.553617e-27 7.768085e-28 [60,] 1.0000000 3.413088e-28 1.706544e-28 [61,] 1.0000000 3.559568e-27 1.779784e-27 [62,] 1.0000000 5.476736e-26 2.738368e-26 [63,] 1.0000000 6.117324e-25 3.058662e-25 [64,] 1.0000000 3.879072e-24 1.939536e-24 [65,] 1.0000000 5.623347e-23 2.811673e-23 [66,] 1.0000000 2.805737e-22 1.402868e-22 [67,] 1.0000000 3.391584e-21 1.695792e-21 [68,] 1.0000000 4.438249e-20 2.219125e-20 [69,] 1.0000000 2.824922e-19 1.412461e-19 [70,] 1.0000000 2.959433e-18 1.479716e-18 [71,] 1.0000000 1.436308e-18 7.181542e-19 [72,] 1.0000000 2.012527e-17 1.006263e-17 [73,] 1.0000000 3.501721e-16 1.750861e-16 [74,] 1.0000000 4.675948e-15 2.337974e-15 [75,] 1.0000000 2.841764e-14 1.420882e-14 [76,] 1.0000000 4.235281e-13 2.117640e-13 [77,] 1.0000000 1.099104e-12 5.495521e-13 [78,] 1.0000000 2.067292e-11 1.033646e-11 [79,] 1.0000000 3.766652e-10 1.883326e-10 [80,] 1.0000000 2.605812e-09 1.302906e-09 [81,] 1.0000000 3.727675e-08 1.863838e-08 [82,] 0.9999999 1.430624e-07 7.153118e-08 [83,] 0.9999988 2.462329e-06 1.231165e-06 [84,] 0.9999846 3.086108e-05 1.543054e-05 [85,] 0.9997112 5.776100e-04 2.888050e-04 > postscript(file="/var/www/html/rcomp/tmp/1ghef1291317430.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/www/html/rcomp/tmp/29qvi1291317430.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/www/html/rcomp/tmp/39qvi1291317430.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/www/html/rcomp/tmp/49qvi1291317430.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/www/html/rcomp/tmp/5jzcl1291317430.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 = 100 Frequency = 1 1 2 3 4 5 1200693.3847 3162663.9890 1130276.1738 -3028136.5026 -539693.6871 6 7 8 9 10 -89993.1298 33314.0915 369927.4372 -331820.5097 737177.3415 11 12 13 14 15 -302899.8543 659461.7758 950978.0809 -1624875.1811 -99091.6719 16 17 18 19 20 546400.4421 -414829.5333 -234108.0652 -208653.6802 -259751.6213 21 22 23 24 25 113254.0285 -300562.5645 -145808.5165 -398761.4531 -96507.3415 26 27 28 29 30 51263.7402 -455322.0550 -248733.8097 616708.6703 154158.0978 31 32 33 34 35 138779.0885 -234393.0864 91564.2043 -41587.8911 -332520.2890 36 37 38 39 40 -325925.5314 210924.6393 341.3384 -257114.6615 4862.1880 41 42 43 44 45 541.6755 -200027.4870 229893.9687 -54672.5998 167220.6314 46 47 48 49 50 -285078.0692 -385740.7061 -314614.8206 29091.5707 23511.3114 51 52 53 54 55 -48840.8443 -230420.1750 -546516.5321 -163421.9681 -518124.9061 56 57 58 59 60 313639.1192 387137.2475 144915.8555 126979.5938 -285282.2284 61 62 63 64 65 -141290.6792 134990.1956 -157928.1782 -283374.0579 249281.0006 66 67 68 69 70 59277.4332 76936.0708 -156575.5102 66885.8600 -195931.9276 71 72 73 74 75 -29719.4381 278258.9834 30853.8687 168062.8507 24736.4390 76 77 78 79 80 -172508.5480 55386.2067 133266.5484 256298.9944 -150555.1399 81 82 83 84 85 245833.1785 -152204.6812 7236.0191 302017.8680 158368.9491 86 87 88 89 90 -145244.5920 188216.3577 123726.8413 54366.8730 144012.3107 91 92 93 94 95 134792.5136 -143861.1100 313181.4210 -423225.3479 350496.8863 96 97 98 99 100 -45694.2264 169677.2778 -14759.5958 7264.1543 -112400.7820 > postscript(file="/var/www/html/rcomp/tmp/6jzcl1291317430.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 = 100 Frequency = 1 lag(myerror, k = 1) myerror 0 1200693.3847 NA 1 3162663.9890 1200693.3847 2 1130276.1738 3162663.9890 3 -3028136.5026 1130276.1738 4 -539693.6871 -3028136.5026 5 -89993.1298 -539693.6871 6 33314.0915 -89993.1298 7 369927.4372 33314.0915 8 -331820.5097 369927.4372 9 737177.3415 -331820.5097 10 -302899.8543 737177.3415 11 659461.7758 -302899.8543 12 950978.0809 659461.7758 13 -1624875.1811 950978.0809 14 -99091.6719 -1624875.1811 15 546400.4421 -99091.6719 16 -414829.5333 546400.4421 17 -234108.0652 -414829.5333 18 -208653.6802 -234108.0652 19 -259751.6213 -208653.6802 20 113254.0285 -259751.6213 21 -300562.5645 113254.0285 22 -145808.5165 -300562.5645 23 -398761.4531 -145808.5165 24 -96507.3415 -398761.4531 25 51263.7402 -96507.3415 26 -455322.0550 51263.7402 27 -248733.8097 -455322.0550 28 616708.6703 -248733.8097 29 154158.0978 616708.6703 30 138779.0885 154158.0978 31 -234393.0864 138779.0885 32 91564.2043 -234393.0864 33 -41587.8911 91564.2043 34 -332520.2890 -41587.8911 35 -325925.5314 -332520.2890 36 210924.6393 -325925.5314 37 341.3384 210924.6393 38 -257114.6615 341.3384 39 4862.1880 -257114.6615 40 541.6755 4862.1880 41 -200027.4870 541.6755 42 229893.9687 -200027.4870 43 -54672.5998 229893.9687 44 167220.6314 -54672.5998 45 -285078.0692 167220.6314 46 -385740.7061 -285078.0692 47 -314614.8206 -385740.7061 48 29091.5707 -314614.8206 49 23511.3114 29091.5707 50 -48840.8443 23511.3114 51 -230420.1750 -48840.8443 52 -546516.5321 -230420.1750 53 -163421.9681 -546516.5321 54 -518124.9061 -163421.9681 55 313639.1192 -518124.9061 56 387137.2475 313639.1192 57 144915.8555 387137.2475 58 126979.5938 144915.8555 59 -285282.2284 126979.5938 60 -141290.6792 -285282.2284 61 134990.1956 -141290.6792 62 -157928.1782 134990.1956 63 -283374.0579 -157928.1782 64 249281.0006 -283374.0579 65 59277.4332 249281.0006 66 76936.0708 59277.4332 67 -156575.5102 76936.0708 68 66885.8600 -156575.5102 69 -195931.9276 66885.8600 70 -29719.4381 -195931.9276 71 278258.9834 -29719.4381 72 30853.8687 278258.9834 73 168062.8507 30853.8687 74 24736.4390 168062.8507 75 -172508.5480 24736.4390 76 55386.2067 -172508.5480 77 133266.5484 55386.2067 78 256298.9944 133266.5484 79 -150555.1399 256298.9944 80 245833.1785 -150555.1399 81 -152204.6812 245833.1785 82 7236.0191 -152204.6812 83 302017.8680 7236.0191 84 158368.9491 302017.8680 85 -145244.5920 158368.9491 86 188216.3577 -145244.5920 87 123726.8413 188216.3577 88 54366.8730 123726.8413 89 144012.3107 54366.8730 90 134792.5136 144012.3107 91 -143861.1100 134792.5136 92 313181.4210 -143861.1100 93 -423225.3479 313181.4210 94 350496.8863 -423225.3479 95 -45694.2264 350496.8863 96 169677.2778 -45694.2264 97 -14759.5958 169677.2778 98 7264.1543 -14759.5958 99 -112400.7820 7264.1543 100 NA -112400.7820 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3162663.9890 1200693.3847 [2,] 1130276.1738 3162663.9890 [3,] -3028136.5026 1130276.1738 [4,] -539693.6871 -3028136.5026 [5,] -89993.1298 -539693.6871 [6,] 33314.0915 -89993.1298 [7,] 369927.4372 33314.0915 [8,] -331820.5097 369927.4372 [9,] 737177.3415 -331820.5097 [10,] -302899.8543 737177.3415 [11,] 659461.7758 -302899.8543 [12,] 950978.0809 659461.7758 [13,] -1624875.1811 950978.0809 [14,] -99091.6719 -1624875.1811 [15,] 546400.4421 -99091.6719 [16,] -414829.5333 546400.4421 [17,] -234108.0652 -414829.5333 [18,] -208653.6802 -234108.0652 [19,] -259751.6213 -208653.6802 [20,] 113254.0285 -259751.6213 [21,] -300562.5645 113254.0285 [22,] -145808.5165 -300562.5645 [23,] -398761.4531 -145808.5165 [24,] -96507.3415 -398761.4531 [25,] 51263.7402 -96507.3415 [26,] -455322.0550 51263.7402 [27,] -248733.8097 -455322.0550 [28,] 616708.6703 -248733.8097 [29,] 154158.0978 616708.6703 [30,] 138779.0885 154158.0978 [31,] -234393.0864 138779.0885 [32,] 91564.2043 -234393.0864 [33,] -41587.8911 91564.2043 [34,] -332520.2890 -41587.8911 [35,] -325925.5314 -332520.2890 [36,] 210924.6393 -325925.5314 [37,] 341.3384 210924.6393 [38,] -257114.6615 341.3384 [39,] 4862.1880 -257114.6615 [40,] 541.6755 4862.1880 [41,] -200027.4870 541.6755 [42,] 229893.9687 -200027.4870 [43,] -54672.5998 229893.9687 [44,] 167220.6314 -54672.5998 [45,] -285078.0692 167220.6314 [46,] -385740.7061 -285078.0692 [47,] -314614.8206 -385740.7061 [48,] 29091.5707 -314614.8206 [49,] 23511.3114 29091.5707 [50,] -48840.8443 23511.3114 [51,] -230420.1750 -48840.8443 [52,] -546516.5321 -230420.1750 [53,] -163421.9681 -546516.5321 [54,] -518124.9061 -163421.9681 [55,] 313639.1192 -518124.9061 [56,] 387137.2475 313639.1192 [57,] 144915.8555 387137.2475 [58,] 126979.5938 144915.8555 [59,] -285282.2284 126979.5938 [60,] -141290.6792 -285282.2284 [61,] 134990.1956 -141290.6792 [62,] -157928.1782 134990.1956 [63,] -283374.0579 -157928.1782 [64,] 249281.0006 -283374.0579 [65,] 59277.4332 249281.0006 [66,] 76936.0708 59277.4332 [67,] -156575.5102 76936.0708 [68,] 66885.8600 -156575.5102 [69,] -195931.9276 66885.8600 [70,] -29719.4381 -195931.9276 [71,] 278258.9834 -29719.4381 [72,] 30853.8687 278258.9834 [73,] 168062.8507 30853.8687 [74,] 24736.4390 168062.8507 [75,] -172508.5480 24736.4390 [76,] 55386.2067 -172508.5480 [77,] 133266.5484 55386.2067 [78,] 256298.9944 133266.5484 [79,] -150555.1399 256298.9944 [80,] 245833.1785 -150555.1399 [81,] -152204.6812 245833.1785 [82,] 7236.0191 -152204.6812 [83,] 302017.8680 7236.0191 [84,] 158368.9491 302017.8680 [85,] -145244.5920 158368.9491 [86,] 188216.3577 -145244.5920 [87,] 123726.8413 188216.3577 [88,] 54366.8730 123726.8413 [89,] 144012.3107 54366.8730 [90,] 134792.5136 144012.3107 [91,] -143861.1100 134792.5136 [92,] 313181.4210 -143861.1100 [93,] -423225.3479 313181.4210 [94,] 350496.8863 -423225.3479 [95,] -45694.2264 350496.8863 [96,] 169677.2778 -45694.2264 [97,] -14759.5958 169677.2778 [98,] 7264.1543 -14759.5958 [99,] -112400.7820 7264.1543 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3162663.9890 1200693.3847 2 1130276.1738 3162663.9890 3 -3028136.5026 1130276.1738 4 -539693.6871 -3028136.5026 5 -89993.1298 -539693.6871 6 33314.0915 -89993.1298 7 369927.4372 33314.0915 8 -331820.5097 369927.4372 9 737177.3415 -331820.5097 10 -302899.8543 737177.3415 11 659461.7758 -302899.8543 12 950978.0809 659461.7758 13 -1624875.1811 950978.0809 14 -99091.6719 -1624875.1811 15 546400.4421 -99091.6719 16 -414829.5333 546400.4421 17 -234108.0652 -414829.5333 18 -208653.6802 -234108.0652 19 -259751.6213 -208653.6802 20 113254.0285 -259751.6213 21 -300562.5645 113254.0285 22 -145808.5165 -300562.5645 23 -398761.4531 -145808.5165 24 -96507.3415 -398761.4531 25 51263.7402 -96507.3415 26 -455322.0550 51263.7402 27 -248733.8097 -455322.0550 28 616708.6703 -248733.8097 29 154158.0978 616708.6703 30 138779.0885 154158.0978 31 -234393.0864 138779.0885 32 91564.2043 -234393.0864 33 -41587.8911 91564.2043 34 -332520.2890 -41587.8911 35 -325925.5314 -332520.2890 36 210924.6393 -325925.5314 37 341.3384 210924.6393 38 -257114.6615 341.3384 39 4862.1880 -257114.6615 40 541.6755 4862.1880 41 -200027.4870 541.6755 42 229893.9687 -200027.4870 43 -54672.5998 229893.9687 44 167220.6314 -54672.5998 45 -285078.0692 167220.6314 46 -385740.7061 -285078.0692 47 -314614.8206 -385740.7061 48 29091.5707 -314614.8206 49 23511.3114 29091.5707 50 -48840.8443 23511.3114 51 -230420.1750 -48840.8443 52 -546516.5321 -230420.1750 53 -163421.9681 -546516.5321 54 -518124.9061 -163421.9681 55 313639.1192 -518124.9061 56 387137.2475 313639.1192 57 144915.8555 387137.2475 58 126979.5938 144915.8555 59 -285282.2284 126979.5938 60 -141290.6792 -285282.2284 61 134990.1956 -141290.6792 62 -157928.1782 134990.1956 63 -283374.0579 -157928.1782 64 249281.0006 -283374.0579 65 59277.4332 249281.0006 66 76936.0708 59277.4332 67 -156575.5102 76936.0708 68 66885.8600 -156575.5102 69 -195931.9276 66885.8600 70 -29719.4381 -195931.9276 71 278258.9834 -29719.4381 72 30853.8687 278258.9834 73 168062.8507 30853.8687 74 24736.4390 168062.8507 75 -172508.5480 24736.4390 76 55386.2067 -172508.5480 77 133266.5484 55386.2067 78 256298.9944 133266.5484 79 -150555.1399 256298.9944 80 245833.1785 -150555.1399 81 -152204.6812 245833.1785 82 7236.0191 -152204.6812 83 302017.8680 7236.0191 84 158368.9491 302017.8680 85 -145244.5920 158368.9491 86 188216.3577 -145244.5920 87 123726.8413 188216.3577 88 54366.8730 123726.8413 89 144012.3107 54366.8730 90 134792.5136 144012.3107 91 -143861.1100 134792.5136 92 313181.4210 -143861.1100 93 -423225.3479 313181.4210 94 350496.8863 -423225.3479 95 -45694.2264 350496.8863 96 169677.2778 -45694.2264 97 -14759.5958 169677.2778 98 7264.1543 -14759.5958 99 -112400.7820 7264.1543 > 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/7cquo1291317430.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/www/html/rcomp/tmp/8cquo1291317430.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/www/html/rcomp/tmp/9nibq1291317430.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/www/html/rcomp/tmp/10nibq1291317430.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/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/11q09w1291317430.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/12cj821291317430.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/13i25w1291317430.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/14tbmz1291317430.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/15fcl51291317430.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/16b3iv1291317430.tab") + } > > try(system("convert tmp/1ghef1291317430.ps tmp/1ghef1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/29qvi1291317430.ps tmp/29qvi1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/39qvi1291317430.ps tmp/39qvi1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/49qvi1291317430.ps tmp/49qvi1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/5jzcl1291317430.ps tmp/5jzcl1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/6jzcl1291317430.ps tmp/6jzcl1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/7cquo1291317430.ps tmp/7cquo1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/8cquo1291317430.ps tmp/8cquo1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/9nibq1291317430.ps tmp/9nibq1291317430.png",intern=TRUE)) character(0) > try(system("convert tmp/10nibq1291317430.ps tmp/10nibq1291317430.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.971 1.667 8.131