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(1 + ,162556 + ,807 + ,213118 + ,6282154 + ,1 + ,29790 + ,444 + ,81767 + ,4321023 + ,1 + ,87550 + ,412 + ,153198 + ,4111912 + ,0 + ,84738 + ,428 + ,-26007 + ,223193 + ,1 + ,54660 + ,315 + ,126942 + ,1491348 + ,1 + ,42634 + ,168 + ,157214 + ,1629616 + ,0 + ,40949 + ,263 + ,129352 + ,1398893 + ,1 + ,45187 + ,267 + ,234817 + ,1926517 + ,1 + ,37704 + ,228 + ,60448 + ,983660 + ,1 + ,16275 + ,129 + ,47818 + ,1443586 + ,0 + ,25830 + ,104 + ,245546 + ,1073089 + ,0 + ,12679 + ,122 + ,48020 + ,984885 + ,1 + ,18014 + ,393 + ,-1710 + ,1405225 + ,0 + ,43556 + ,190 + ,32648 + ,227132 + ,1 + ,24811 + ,280 + ,95350 + ,929118 + ,0 + ,6575 + ,63 + ,151352 + ,1071292 + ,0 + ,7123 + ,102 + ,288170 + ,638830 + ,1 + ,21950 + ,265 + ,114337 + ,856956 + ,1 + ,37597 + ,234 + ,37884 + ,992426 + ,0 + ,17821 + ,277 + ,122844 + ,444477 + ,1 + ,12988 + ,73 + ,82340 + ,857217 + ,1 + ,22330 + ,67 + ,79801 + ,711969 + ,0 + ,13326 + ,103 + ,165548 + ,702380 + ,0 + ,16189 + ,290 + ,116384 + ,358589 + ,0 + ,7146 + ,83 + ,134028 + ,297978 + ,0 + ,15824 + ,56 + ,63838 + ,585715 + ,1 + ,27664 + ,236 + ,74996 + ,657954 + ,0 + ,11920 + ,73 + ,31080 + ,209458 + ,0 + ,8568 + ,34 + ,32168 + ,786690 + ,0 + ,14416 + ,139 + ,49857 + ,439798 + ,1 + ,3369 + ,26 + ,87161 + ,688779 + ,1 + ,11819 + ,70 + ,106113 + ,574339 + ,1 + ,6984 + ,40 + ,80570 + ,741409 + ,1 + ,4519 + ,42 + ,102129 + ,597793 + ,0 + ,2220 + ,12 + ,301670 + ,644190 + ,0 + ,18562 + ,211 + ,102313 + ,377934 + ,0 + ,10327 + ,74 + ,88577 + ,640273 + ,1 + ,5336 + ,80 + ,112477 + ,697458 + ,1 + ,2365 + ,83 + ,191778 + ,550608 + ,0 + ,4069 + ,131 + ,79804 + ,207393 + ,0 + ,8636 + ,203 + ,128294 + ,301607 + ,0 + ,13718 + ,56 + ,96448 + ,345783 + ,0 + ,4525 + ,89 + ,93811 + ,501749 + ,0 + ,6869 + ,88 + ,117520 + ,379983 + ,0 + ,4628 + ,39 + ,69159 + ,387475 + ,1 + ,3689 + ,25 + ,101792 + ,377305 + ,1 + ,4891 + ,49 + ,210568 + ,370837 + ,1 + ,7489 + ,149 + ,136996 + ,430866 + ,0 + ,4901 + ,58 + ,121920 + ,469107 + ,0 + ,2284 + ,41 + ,76403 + ,194493 + ,1 + ,3160 + ,90 + ,108094 + ,530670 + ,1 + ,4150 + ,136 + ,134759 + ,518365 + ,1 + ,7285 + ,97 + ,188873 + ,491303 + ,1 + ,1134 + ,63 + ,146216 + ,527021 + ,1 + ,4658 + ,114 + ,156608 + ,233773 + ,0 + ,2384 + ,77 + ,61348 + ,405972 + ,0 + ,3748 + ,6 + ,50350 + ,652925 + ,0 + ,5371 + ,47 + ,87720 + ,446211 + ,0 + ,1285 + ,51 + ,99489 + ,341340 + ,1 + ,9327 + ,85 + ,87419 + ,387699 + ,1 + ,5565 + ,43 + ,94355 + ,493408 + ,0 + ,1528 + ,32 + ,60326 + ,146494 + ,1 + ,3122 + ,25 + ,94670 + ,414462 + ,1 + ,7561 + ,77 + ,82425 + ,364304 + ,0 + ,2675 + ,54 + ,59017 + ,355178 + ,0 + ,13253 + ,251 + ,90829 + ,357760 + ,0 + ,880 + ,15 + ,80791 + ,261216 + ,1 + ,2053 + ,44 + ,100423 + ,397144 + ,0 + ,1424 + ,73 + ,131116 + ,374943 + ,1 + ,4036 + ,85 + ,100269 + ,424898 + ,1 + ,3045 + ,49 + ,27330 + ,202055 + ,0 + ,5119 + ,38 + ,39039 + ,378525 + ,0 + ,1431 + ,35 + ,106885 + ,310768 + ,0 + ,554 + ,9 + ,79285 + ,325738 + ,0 + ,1975 + ,34 + ,118881 + ,394510 + ,1 + ,1765 + ,20 + ,77623 + ,247060 + ,0 + ,1012 + ,29 + ,114768 + ,368078 + ,0 + ,810 + ,11 + ,74015 + ,236761 + ,0 + ,1280 + ,52 + ,69465 + ,312378 + ,1 + ,666 + ,13 + ,117869 + ,339836 + ,0 + ,1380 + ,29 + ,60982 + ,347385 + ,1 + ,4677 + ,66 + ,90131 + ,426280 + ,0 + ,876 + ,33 + ,138971 + ,352850 + ,0 + ,814 + ,15 + ,39625 + ,301881 + ,0 + ,514 + ,15 + ,102725 + ,377516 + ,1 + ,5692 + ,68 + ,64239 + ,357312 + ,0 + ,3642 + ,100 + ,90262 + ,458343 + ,0 + ,540 + ,13 + ,103960 + ,354228 + ,0 + ,2099 + ,45 + ,106611 + ,308636 + ,0 + ,567 + ,14 + ,103345 + ,386212 + ,0 + ,2001 + ,36 + ,95551 + ,393343 + ,1 + ,2949 + ,40 + ,82903 + ,378509 + ,0 + ,2253 + ,68 + ,63593 + ,452469 + ,1 + ,6533 + ,29 + ,126910 + ,364839 + ,0 + ,1889 + ,43 + ,37527 + ,358649 + ,1 + ,3055 + ,30 + ,60247 + ,376641 + ,0 + ,272 + ,9 + ,112995 + ,429112 + ,1 + ,1414 + ,22 + ,70184 + ,330546 + ,0 + ,2564 + ,19 + ,130140 + ,403560 + ,1 + ,1383 + ,9 + ,73221 + ,317892) + ,dim=c(5 + ,100) + ,dimnames=list(c('Group' + ,'Costs' + ,'Orders' + ,'Dividends' + ,'Wealth') + ,1:100)) > y <- array(NA,dim=c(5,100),dimnames=list(c('Group','Costs','Orders','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 Orders Dividends 1 6282154 1 162556 807 213118 2 4321023 1 29790 444 81767 3 4111912 1 87550 412 153198 4 223193 0 84738 428 -26007 5 1491348 1 54660 315 126942 6 1629616 1 42634 168 157214 7 1398893 0 40949 263 129352 8 1926517 1 45187 267 234817 9 983660 1 37704 228 60448 10 1443586 1 16275 129 47818 11 1073089 0 25830 104 245546 12 984885 0 12679 122 48020 13 1405225 1 18014 393 -1710 14 227132 0 43556 190 32648 15 929118 1 24811 280 95350 16 1071292 0 6575 63 151352 17 638830 0 7123 102 288170 18 856956 1 21950 265 114337 19 992426 1 37597 234 37884 20 444477 0 17821 277 122844 21 857217 1 12988 73 82340 22 711969 1 22330 67 79801 23 702380 0 13326 103 165548 24 358589 0 16189 290 116384 25 297978 0 7146 83 134028 26 585715 0 15824 56 63838 27 657954 1 27664 236 74996 28 209458 0 11920 73 31080 29 786690 0 8568 34 32168 30 439798 0 14416 139 49857 31 688779 1 3369 26 87161 32 574339 1 11819 70 106113 33 741409 1 6984 40 80570 34 597793 1 4519 42 102129 35 644190 0 2220 12 301670 36 377934 0 18562 211 102313 37 640273 0 10327 74 88577 38 697458 1 5336 80 112477 39 550608 1 2365 83 191778 40 207393 0 4069 131 79804 41 301607 0 8636 203 128294 42 345783 0 13718 56 96448 43 501749 0 4525 89 93811 44 379983 0 6869 88 117520 45 387475 0 4628 39 69159 46 377305 1 3689 25 101792 47 370837 1 4891 49 210568 48 430866 1 7489 149 136996 49 469107 0 4901 58 121920 50 194493 0 2284 41 76403 51 530670 1 3160 90 108094 52 518365 1 4150 136 134759 53 491303 1 7285 97 188873 54 527021 1 1134 63 146216 55 233773 1 4658 114 156608 56 405972 0 2384 77 61348 57 652925 0 3748 6 50350 58 446211 0 5371 47 87720 59 341340 0 1285 51 99489 60 387699 1 9327 85 87419 61 493408 1 5565 43 94355 62 146494 0 1528 32 60326 63 414462 1 3122 25 94670 64 364304 1 7561 77 82425 65 355178 0 2675 54 59017 66 357760 0 13253 251 90829 67 261216 0 880 15 80791 68 397144 1 2053 44 100423 69 374943 0 1424 73 131116 70 424898 1 4036 85 100269 71 202055 1 3045 49 27330 72 378525 0 5119 38 39039 73 310768 0 1431 35 106885 74 325738 0 554 9 79285 75 394510 0 1975 34 118881 76 247060 1 1765 20 77623 77 368078 0 1012 29 114768 78 236761 0 810 11 74015 79 312378 0 1280 52 69465 80 339836 1 666 13 117869 81 347385 0 1380 29 60982 82 426280 1 4677 66 90131 83 352850 0 876 33 138971 84 301881 0 814 15 39625 85 377516 0 514 15 102725 86 357312 1 5692 68 64239 87 458343 0 3642 100 90262 88 354228 0 540 13 103960 89 308636 0 2099 45 106611 90 386212 0 567 14 103345 91 393343 0 2001 36 95551 92 378509 1 2949 40 82903 93 452469 0 2253 68 63593 94 364839 1 6533 29 126910 95 358649 0 1889 43 37527 96 376641 1 3055 30 60247 97 429112 0 272 9 112995 98 330546 1 1414 22 70184 99 403560 0 2564 19 130140 100 317892 1 1383 9 73221 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Group Costs Orders Dividends -1.192e+05 1.948e+05 1.905e+01 1.974e+03 2.423e+00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2053625 -155094 4637 173837 2603268 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.192e+05 1.147e+05 -1.039 0.30146 Group 1.948e+05 9.782e+04 1.991 0.04930 * Costs 1.905e+01 4.504e+00 4.229 5.4e-05 *** Orders 1.974e+03 8.010e+02 2.465 0.01550 * Dividends 2.423e+00 9.023e-01 2.686 0.00855 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 474700 on 95 degrees of freedom Multiple R-squared: 0.691, Adjusted R-squared: 0.678 F-statistic: 53.11 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.188291e-12 1.594146e-12 [2,] 1.0000000 1.445316e-11 7.226581e-12 [3,] 1.0000000 1.422800e-14 7.114001e-15 [4,] 1.0000000 4.736008e-15 2.368004e-15 [5,] 1.0000000 4.465912e-18 2.232956e-18 [6,] 1.0000000 4.752790e-24 2.376395e-24 [7,] 1.0000000 1.070465e-26 5.352324e-27 [8,] 1.0000000 1.135616e-28 5.678079e-29 [9,] 1.0000000 4.888335e-32 2.444167e-32 [10,] 1.0000000 1.159319e-32 5.796595e-33 [11,] 1.0000000 4.431863e-34 2.215931e-34 [12,] 1.0000000 1.777156e-33 8.885778e-34 [13,] 1.0000000 1.908190e-33 9.540950e-34 [14,] 1.0000000 7.049539e-34 3.524769e-34 [15,] 1.0000000 5.057740e-33 2.528870e-33 [16,] 1.0000000 1.506711e-32 7.533556e-33 [17,] 1.0000000 2.865691e-32 1.432846e-32 [18,] 1.0000000 9.711276e-32 4.855638e-32 [19,] 1.0000000 1.107949e-31 5.539746e-32 [20,] 1.0000000 1.865000e-31 9.325000e-32 [21,] 1.0000000 1.102194e-31 5.510969e-32 [22,] 1.0000000 5.240546e-34 2.620273e-34 [23,] 1.0000000 3.523963e-33 1.761982e-33 [24,] 1.0000000 1.607923e-33 8.039617e-34 [25,] 1.0000000 8.842436e-33 4.421218e-33 [26,] 1.0000000 1.016900e-33 5.084500e-34 [27,] 1.0000000 1.572701e-33 7.863507e-34 [28,] 1.0000000 7.866485e-33 3.933243e-33 [29,] 1.0000000 3.238139e-32 1.619070e-32 [30,] 1.0000000 1.228866e-32 6.144328e-33 [31,] 1.0000000 8.360904e-34 4.180452e-34 [32,] 1.0000000 1.842082e-33 9.210411e-34 [33,] 1.0000000 3.688351e-33 1.844176e-33 [34,] 1.0000000 9.325898e-33 4.662949e-33 [35,] 1.0000000 4.388534e-32 2.194267e-32 [36,] 1.0000000 1.182747e-31 5.913737e-32 [37,] 1.0000000 8.481695e-31 4.240847e-31 [38,] 1.0000000 4.831213e-30 2.415606e-30 [39,] 1.0000000 3.512854e-29 1.756427e-29 [40,] 1.0000000 8.410415e-29 4.205208e-29 [41,] 1.0000000 3.988873e-28 1.994436e-28 [42,] 1.0000000 2.184765e-27 1.092382e-27 [43,] 1.0000000 2.997141e-27 1.498570e-27 [44,] 1.0000000 4.400488e-27 2.200244e-27 [45,] 1.0000000 5.566117e-27 2.783059e-27 [46,] 1.0000000 2.928824e-26 1.464412e-26 [47,] 1.0000000 1.166038e-26 5.830189e-27 [48,] 1.0000000 2.094244e-26 1.047122e-26 [49,] 1.0000000 8.770881e-26 4.385440e-26 [50,] 1.0000000 1.234581e-28 6.172903e-29 [51,] 1.0000000 5.906857e-28 2.953429e-28 [52,] 1.0000000 5.424628e-27 2.712314e-27 [53,] 1.0000000 4.849997e-26 2.424998e-26 [54,] 1.0000000 8.773622e-26 4.386811e-26 [55,] 1.0000000 8.071086e-27 4.035543e-27 [56,] 1.0000000 4.904336e-26 2.452168e-26 [57,] 1.0000000 5.171989e-25 2.585995e-25 [58,] 1.0000000 4.951253e-24 2.475627e-24 [59,] 1.0000000 1.394709e-24 6.973547e-25 [60,] 1.0000000 5.915708e-24 2.957854e-24 [61,] 1.0000000 4.657761e-23 2.328881e-23 [62,] 1.0000000 3.142255e-22 1.571128e-22 [63,] 1.0000000 3.308446e-21 1.654223e-21 [64,] 1.0000000 2.156317e-21 1.078158e-21 [65,] 1.0000000 2.194576e-20 1.097288e-20 [66,] 1.0000000 9.681695e-20 4.840847e-20 [67,] 1.0000000 1.121448e-18 5.607242e-19 [68,] 1.0000000 1.289507e-17 6.447536e-18 [69,] 1.0000000 2.910542e-17 1.455271e-17 [70,] 1.0000000 3.433684e-16 1.716842e-16 [71,] 1.0000000 3.282798e-16 1.641399e-16 [72,] 1.0000000 8.653895e-16 4.326947e-16 [73,] 1.0000000 1.097634e-14 5.488168e-15 [74,] 1.0000000 1.395901e-13 6.979505e-14 [75,] 1.0000000 1.371864e-12 6.859322e-13 [76,] 1.0000000 6.605460e-12 3.302730e-12 [77,] 1.0000000 5.747628e-11 2.873814e-11 [78,] 1.0000000 7.583006e-10 3.791503e-10 [79,] 1.0000000 8.534733e-09 4.267367e-09 [80,] 1.0000000 9.675454e-08 4.837727e-08 [81,] 0.9999995 9.709159e-07 4.854580e-07 [82,] 0.9999999 1.509184e-07 7.545918e-08 [83,] 0.9999985 2.980863e-06 1.490432e-06 [84,] 0.9999797 4.052477e-05 2.026239e-05 [85,] 0.9996236 7.527618e-04 3.763809e-04 > postscript(file="/var/www/html/freestat/rcomp/tmp/1zlj71291209825.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/freestat/rcomp/tmp/2au0a1291209825.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/freestat/rcomp/tmp/3au0a1291209825.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/freestat/rcomp/tmp/4au0a1291209825.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/freestat/rcomp/tmp/5au0a1291209825.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 1000593.8580 2603268.0642 1184070.5633 -2053625.2042 -554894.3964 6 7 8 9 10 29306.2774 -94568.6500 -105927.6053 -406720.7226 687433.1069 11 12 13 14 15 -100042.6567 505355.3482 214744.6226 -937525.3218 -402925.9541 16 17 18 19 20 574116.0414 -277322.5262 -436988.4486 -353085.0820 -620328.9841 21 22 23 24 25 190580.3178 -114609.0351 -36757.2287 -685144.0058 -207580.5859 26 27 28 29 30 138256.4761 -592239.4450 -117823.5585 597617.1407 -110831.7627 31 32 33 34 35 286469.1387 -121715.6149 258574.0677 105718.8214 -33597.9619 36 37 38 39 40 -520929.5537 202031.6183 89722.4071 -198624.7630 -202927.9415 41 42 43 44 45 -455356.1565 -140583.0998 131722.0507 -90168.5977 173939.5653 46 47 48 49 50 -64579.7952 -404914.5230 -413521.6707 85008.0271 4101.9811 51 52 53 54 55 -44740.9406 -231336.7968 -372243.5432 -48871.3469 -535114.6232 56 57 58 59 60 179082.1676 566882.2001 157751.4598 94291.5522 -245204.9428 61 62 63 64 65 -1725.8676 27229.7482 635.1905 -207066.2696 173803.3724 66 67 68 69 70 -491126.1486 138266.7145 -47774.1793 5172.6989 -138365.0631 71 72 73 74 75 -94509.3434 230599.0333 74605.6948 224493.4435 120891.3494 76 77 78 79 80 -89739.3887 132640.2159 139462.0542 136205.2031 -59735.0302 81 82 83 84 85 235273.0872 -87113.6332 53456.1755 279943.0843 208387.1317 86 87 88 89 90 -116621.2913 92017.2594 185559.8734 40670.8260 216545.5526 91 92 93 94 95 171814.1801 -33123.4596 240403.1488 -199980.0264 266038.0921 96 97 98 99 100 37633.2213 251552.0566 14509.8941 121054.3194 20753.2505 > postscript(file="/var/www/html/freestat/rcomp/tmp/6llzd1291209825.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 1000593.8580 NA 1 2603268.0642 1000593.8580 2 1184070.5633 2603268.0642 3 -2053625.2042 1184070.5633 4 -554894.3964 -2053625.2042 5 29306.2774 -554894.3964 6 -94568.6500 29306.2774 7 -105927.6053 -94568.6500 8 -406720.7226 -105927.6053 9 687433.1069 -406720.7226 10 -100042.6567 687433.1069 11 505355.3482 -100042.6567 12 214744.6226 505355.3482 13 -937525.3218 214744.6226 14 -402925.9541 -937525.3218 15 574116.0414 -402925.9541 16 -277322.5262 574116.0414 17 -436988.4486 -277322.5262 18 -353085.0820 -436988.4486 19 -620328.9841 -353085.0820 20 190580.3178 -620328.9841 21 -114609.0351 190580.3178 22 -36757.2287 -114609.0351 23 -685144.0058 -36757.2287 24 -207580.5859 -685144.0058 25 138256.4761 -207580.5859 26 -592239.4450 138256.4761 27 -117823.5585 -592239.4450 28 597617.1407 -117823.5585 29 -110831.7627 597617.1407 30 286469.1387 -110831.7627 31 -121715.6149 286469.1387 32 258574.0677 -121715.6149 33 105718.8214 258574.0677 34 -33597.9619 105718.8214 35 -520929.5537 -33597.9619 36 202031.6183 -520929.5537 37 89722.4071 202031.6183 38 -198624.7630 89722.4071 39 -202927.9415 -198624.7630 40 -455356.1565 -202927.9415 41 -140583.0998 -455356.1565 42 131722.0507 -140583.0998 43 -90168.5977 131722.0507 44 173939.5653 -90168.5977 45 -64579.7952 173939.5653 46 -404914.5230 -64579.7952 47 -413521.6707 -404914.5230 48 85008.0271 -413521.6707 49 4101.9811 85008.0271 50 -44740.9406 4101.9811 51 -231336.7968 -44740.9406 52 -372243.5432 -231336.7968 53 -48871.3469 -372243.5432 54 -535114.6232 -48871.3469 55 179082.1676 -535114.6232 56 566882.2001 179082.1676 57 157751.4598 566882.2001 58 94291.5522 157751.4598 59 -245204.9428 94291.5522 60 -1725.8676 -245204.9428 61 27229.7482 -1725.8676 62 635.1905 27229.7482 63 -207066.2696 635.1905 64 173803.3724 -207066.2696 65 -491126.1486 173803.3724 66 138266.7145 -491126.1486 67 -47774.1793 138266.7145 68 5172.6989 -47774.1793 69 -138365.0631 5172.6989 70 -94509.3434 -138365.0631 71 230599.0333 -94509.3434 72 74605.6948 230599.0333 73 224493.4435 74605.6948 74 120891.3494 224493.4435 75 -89739.3887 120891.3494 76 132640.2159 -89739.3887 77 139462.0542 132640.2159 78 136205.2031 139462.0542 79 -59735.0302 136205.2031 80 235273.0872 -59735.0302 81 -87113.6332 235273.0872 82 53456.1755 -87113.6332 83 279943.0843 53456.1755 84 208387.1317 279943.0843 85 -116621.2913 208387.1317 86 92017.2594 -116621.2913 87 185559.8734 92017.2594 88 40670.8260 185559.8734 89 216545.5526 40670.8260 90 171814.1801 216545.5526 91 -33123.4596 171814.1801 92 240403.1488 -33123.4596 93 -199980.0264 240403.1488 94 266038.0921 -199980.0264 95 37633.2213 266038.0921 96 251552.0566 37633.2213 97 14509.8941 251552.0566 98 121054.3194 14509.8941 99 20753.2505 121054.3194 100 NA 20753.2505 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2603268.0642 1000593.8580 [2,] 1184070.5633 2603268.0642 [3,] -2053625.2042 1184070.5633 [4,] -554894.3964 -2053625.2042 [5,] 29306.2774 -554894.3964 [6,] -94568.6500 29306.2774 [7,] -105927.6053 -94568.6500 [8,] -406720.7226 -105927.6053 [9,] 687433.1069 -406720.7226 [10,] -100042.6567 687433.1069 [11,] 505355.3482 -100042.6567 [12,] 214744.6226 505355.3482 [13,] -937525.3218 214744.6226 [14,] -402925.9541 -937525.3218 [15,] 574116.0414 -402925.9541 [16,] -277322.5262 574116.0414 [17,] -436988.4486 -277322.5262 [18,] -353085.0820 -436988.4486 [19,] -620328.9841 -353085.0820 [20,] 190580.3178 -620328.9841 [21,] -114609.0351 190580.3178 [22,] -36757.2287 -114609.0351 [23,] -685144.0058 -36757.2287 [24,] -207580.5859 -685144.0058 [25,] 138256.4761 -207580.5859 [26,] -592239.4450 138256.4761 [27,] -117823.5585 -592239.4450 [28,] 597617.1407 -117823.5585 [29,] -110831.7627 597617.1407 [30,] 286469.1387 -110831.7627 [31,] -121715.6149 286469.1387 [32,] 258574.0677 -121715.6149 [33,] 105718.8214 258574.0677 [34,] -33597.9619 105718.8214 [35,] -520929.5537 -33597.9619 [36,] 202031.6183 -520929.5537 [37,] 89722.4071 202031.6183 [38,] -198624.7630 89722.4071 [39,] -202927.9415 -198624.7630 [40,] -455356.1565 -202927.9415 [41,] -140583.0998 -455356.1565 [42,] 131722.0507 -140583.0998 [43,] -90168.5977 131722.0507 [44,] 173939.5653 -90168.5977 [45,] -64579.7952 173939.5653 [46,] -404914.5230 -64579.7952 [47,] -413521.6707 -404914.5230 [48,] 85008.0271 -413521.6707 [49,] 4101.9811 85008.0271 [50,] -44740.9406 4101.9811 [51,] -231336.7968 -44740.9406 [52,] -372243.5432 -231336.7968 [53,] -48871.3469 -372243.5432 [54,] -535114.6232 -48871.3469 [55,] 179082.1676 -535114.6232 [56,] 566882.2001 179082.1676 [57,] 157751.4598 566882.2001 [58,] 94291.5522 157751.4598 [59,] -245204.9428 94291.5522 [60,] -1725.8676 -245204.9428 [61,] 27229.7482 -1725.8676 [62,] 635.1905 27229.7482 [63,] -207066.2696 635.1905 [64,] 173803.3724 -207066.2696 [65,] -491126.1486 173803.3724 [66,] 138266.7145 -491126.1486 [67,] -47774.1793 138266.7145 [68,] 5172.6989 -47774.1793 [69,] -138365.0631 5172.6989 [70,] -94509.3434 -138365.0631 [71,] 230599.0333 -94509.3434 [72,] 74605.6948 230599.0333 [73,] 224493.4435 74605.6948 [74,] 120891.3494 224493.4435 [75,] -89739.3887 120891.3494 [76,] 132640.2159 -89739.3887 [77,] 139462.0542 132640.2159 [78,] 136205.2031 139462.0542 [79,] -59735.0302 136205.2031 [80,] 235273.0872 -59735.0302 [81,] -87113.6332 235273.0872 [82,] 53456.1755 -87113.6332 [83,] 279943.0843 53456.1755 [84,] 208387.1317 279943.0843 [85,] -116621.2913 208387.1317 [86,] 92017.2594 -116621.2913 [87,] 185559.8734 92017.2594 [88,] 40670.8260 185559.8734 [89,] 216545.5526 40670.8260 [90,] 171814.1801 216545.5526 [91,] -33123.4596 171814.1801 [92,] 240403.1488 -33123.4596 [93,] -199980.0264 240403.1488 [94,] 266038.0921 -199980.0264 [95,] 37633.2213 266038.0921 [96,] 251552.0566 37633.2213 [97,] 14509.8941 251552.0566 [98,] 121054.3194 14509.8941 [99,] 20753.2505 121054.3194 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2603268.0642 1000593.8580 2 1184070.5633 2603268.0642 3 -2053625.2042 1184070.5633 4 -554894.3964 -2053625.2042 5 29306.2774 -554894.3964 6 -94568.6500 29306.2774 7 -105927.6053 -94568.6500 8 -406720.7226 -105927.6053 9 687433.1069 -406720.7226 10 -100042.6567 687433.1069 11 505355.3482 -100042.6567 12 214744.6226 505355.3482 13 -937525.3218 214744.6226 14 -402925.9541 -937525.3218 15 574116.0414 -402925.9541 16 -277322.5262 574116.0414 17 -436988.4486 -277322.5262 18 -353085.0820 -436988.4486 19 -620328.9841 -353085.0820 20 190580.3178 -620328.9841 21 -114609.0351 190580.3178 22 -36757.2287 -114609.0351 23 -685144.0058 -36757.2287 24 -207580.5859 -685144.0058 25 138256.4761 -207580.5859 26 -592239.4450 138256.4761 27 -117823.5585 -592239.4450 28 597617.1407 -117823.5585 29 -110831.7627 597617.1407 30 286469.1387 -110831.7627 31 -121715.6149 286469.1387 32 258574.0677 -121715.6149 33 105718.8214 258574.0677 34 -33597.9619 105718.8214 35 -520929.5537 -33597.9619 36 202031.6183 -520929.5537 37 89722.4071 202031.6183 38 -198624.7630 89722.4071 39 -202927.9415 -198624.7630 40 -455356.1565 -202927.9415 41 -140583.0998 -455356.1565 42 131722.0507 -140583.0998 43 -90168.5977 131722.0507 44 173939.5653 -90168.5977 45 -64579.7952 173939.5653 46 -404914.5230 -64579.7952 47 -413521.6707 -404914.5230 48 85008.0271 -413521.6707 49 4101.9811 85008.0271 50 -44740.9406 4101.9811 51 -231336.7968 -44740.9406 52 -372243.5432 -231336.7968 53 -48871.3469 -372243.5432 54 -535114.6232 -48871.3469 55 179082.1676 -535114.6232 56 566882.2001 179082.1676 57 157751.4598 566882.2001 58 94291.5522 157751.4598 59 -245204.9428 94291.5522 60 -1725.8676 -245204.9428 61 27229.7482 -1725.8676 62 635.1905 27229.7482 63 -207066.2696 635.1905 64 173803.3724 -207066.2696 65 -491126.1486 173803.3724 66 138266.7145 -491126.1486 67 -47774.1793 138266.7145 68 5172.6989 -47774.1793 69 -138365.0631 5172.6989 70 -94509.3434 -138365.0631 71 230599.0333 -94509.3434 72 74605.6948 230599.0333 73 224493.4435 74605.6948 74 120891.3494 224493.4435 75 -89739.3887 120891.3494 76 132640.2159 -89739.3887 77 139462.0542 132640.2159 78 136205.2031 139462.0542 79 -59735.0302 136205.2031 80 235273.0872 -59735.0302 81 -87113.6332 235273.0872 82 53456.1755 -87113.6332 83 279943.0843 53456.1755 84 208387.1317 279943.0843 85 -116621.2913 208387.1317 86 92017.2594 -116621.2913 87 185559.8734 92017.2594 88 40670.8260 185559.8734 89 216545.5526 40670.8260 90 171814.1801 216545.5526 91 -33123.4596 171814.1801 92 240403.1488 -33123.4596 93 -199980.0264 240403.1488 94 266038.0921 -199980.0264 95 37633.2213 266038.0921 96 251552.0566 37633.2213 97 14509.8941 251552.0566 98 121054.3194 14509.8941 99 20753.2505 121054.3194 > 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/7ddhy1291209825.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/freestat/rcomp/tmp/8ddhy1291209825.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/freestat/rcomp/tmp/9ddhy1291209825.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/freestat/rcomp/tmp/10o4yj1291209825.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/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/11r4e71291209825.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/12d5vv1291209825.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/13rftm1291209825.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/14cx9a1291209825.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/15ggqx1291209825.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/16jg6l1291209825.tab") + } > > try(system("convert tmp/1zlj71291209825.ps tmp/1zlj71291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/2au0a1291209825.ps tmp/2au0a1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/3au0a1291209825.ps tmp/3au0a1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/4au0a1291209825.ps tmp/4au0a1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/5au0a1291209825.ps tmp/5au0a1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/6llzd1291209825.ps tmp/6llzd1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/7ddhy1291209825.ps tmp/7ddhy1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/8ddhy1291209825.ps tmp/8ddhy1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/9ddhy1291209825.ps tmp/9ddhy1291209825.png",intern=TRUE)) character(0) > try(system("convert tmp/10o4yj1291209825.ps tmp/10o4yj1291209825.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.445 2.532 4.760