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(524,0,552,0,532,0,511,0,492,0,492,0,493,0,481,0,462,0,457,0,442,0,439,0,488,0,521,0,501,0,485,0,464,0,460,0,467,0,460,0,448,0,443,0,436,0,431,0,484,0,510,0,513,0,503,0,471,0,471,0,476,0,475,0,470,0,461,0,455,0,456,0,517,0,525,0,523,0,519,0,509,0,512,0,519,0,517,0,510,0,509,0,501,0,507,0,569,1,580,1,578,1,565,1,547,1,555,1,562,1,561,1,555,1,544,1,537,1,543,1,594,1,611,1,613,1,611,1,594,1,595,1,591,1,589,1,584,1,573,1,567,1,569,1,621,1,629,1,628,1,612,1,595,1,597,1,593,1,590,1,580,1,574,1,573,1,573,1,620,1,626,1,620,1,588,1,566,1,557,1,561,1,549,1,532,1,526,1,511,1,499,1),dim=c(2,96),dimnames=list(c('Aantal_werklozen_(*1000)','dummyvariabele'),1:96)) > y <- array(NA,dim=c(2,96),dimnames=list(c('Aantal_werklozen_(*1000)','dummyvariabele'),1:96)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Aantal_werklozen_(*1000) dummyvariabele 1 524 0 2 552 0 3 532 0 4 511 0 5 492 0 6 492 0 7 493 0 8 481 0 9 462 0 10 457 0 11 442 0 12 439 0 13 488 0 14 521 0 15 501 0 16 485 0 17 464 0 18 460 0 19 467 0 20 460 0 21 448 0 22 443 0 23 436 0 24 431 0 25 484 0 26 510 0 27 513 0 28 503 0 29 471 0 30 471 0 31 476 0 32 475 0 33 470 0 34 461 0 35 455 0 36 456 0 37 517 0 38 525 0 39 523 0 40 519 0 41 509 0 42 512 0 43 519 0 44 517 0 45 510 0 46 509 0 47 501 0 48 507 0 49 569 1 50 580 1 51 578 1 52 565 1 53 547 1 54 555 1 55 562 1 56 561 1 57 555 1 58 544 1 59 537 1 60 543 1 61 594 1 62 611 1 63 613 1 64 611 1 65 594 1 66 595 1 67 591 1 68 589 1 69 584 1 70 573 1 71 567 1 72 569 1 73 621 1 74 629 1 75 628 1 76 612 1 77 595 1 78 597 1 79 593 1 80 590 1 81 580 1 82 574 1 83 573 1 84 573 1 85 620 1 86 626 1 87 620 1 88 588 1 89 566 1 90 557 1 91 561 1 92 549 1 93 532 1 94 526 1 95 511 1 96 499 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dummyvariabele 487.37 89.85 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -78.2292 -22.2292 0.6979 22.6250 64.6250 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 487.375 4.356 111.89 <2e-16 *** dummyvariabele 89.854 6.160 14.59 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 30.18 on 94 degrees of freedom Multiple R-squared: 0.6936, Adjusted R-squared: 0.6903 F-statistic: 212.8 on 1 and 94 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,] 0.49293887 0.98587775 0.5070611 [2,] 0.47060268 0.94120536 0.5293973 [3,] 0.40877587 0.81755173 0.5912241 [4,] 0.41955475 0.83910949 0.5804453 [5,] 0.55889146 0.88221709 0.4411085 [6,] 0.65982900 0.68034200 0.3401710 [7,] 0.80347836 0.39304327 0.1965216 [8,] 0.88359449 0.23281103 0.1164055 [9,] 0.83351765 0.33296470 0.1664823 [10,] 0.82754779 0.34490441 0.1724522 [11,] 0.77460623 0.45078753 0.2253938 [12,] 0.71074475 0.57851050 0.2892552 [13,] 0.68838920 0.62322161 0.3116108 [14,] 0.67677935 0.64644131 0.3232207 [15,] 0.63703851 0.72592298 0.3629615 [16,] 0.61884092 0.76231817 0.3811591 [17,] 0.65246415 0.69507170 0.3475359 [18,] 0.70529657 0.58940687 0.2947034 [19,] 0.78447430 0.43105140 0.2155257 [20,] 0.86794017 0.26411966 0.1320598 [21,] 0.83141758 0.33716484 0.1685824 [22,] 0.81989264 0.36021471 0.1801074 [23,] 0.81281801 0.37436397 0.1871820 [24,] 0.78247119 0.43505762 0.2175288 [25,] 0.74723490 0.50553020 0.2527651 [26,] 0.71091417 0.57817165 0.2890858 [27,] 0.66591448 0.66817104 0.3340855 [28,] 0.62192681 0.75614637 0.3780732 [29,] 0.58950867 0.82098266 0.4104913 [30,] 0.59014611 0.81970778 0.4098539 [31,] 0.62663764 0.74672472 0.3733624 [32,] 0.67274140 0.65451721 0.3272586 [33,] 0.67419398 0.65161205 0.3258060 [34,] 0.69751166 0.60497668 0.3024883 [35,] 0.70719621 0.58560757 0.2928038 [36,] 0.70050681 0.59898638 0.2994932 [37,] 0.66903436 0.66193129 0.3309656 [38,] 0.64029405 0.71941190 0.3597060 [39,] 0.62578299 0.74843401 0.3742170 [40,] 0.60404161 0.79191679 0.3959584 [41,] 0.56531960 0.86936079 0.4346804 [42,] 0.52351611 0.95296778 0.4764839 [43,] 0.47130396 0.94260791 0.5286960 [44,] 0.42513394 0.85026789 0.5748661 [45,] 0.36984406 0.73968813 0.6301559 [46,] 0.31716059 0.63432118 0.6828394 [47,] 0.26636818 0.53273636 0.7336318 [48,] 0.22544033 0.45088066 0.7745597 [49,] 0.21621718 0.43243436 0.7837828 [50,] 0.18959318 0.37918637 0.8104068 [51,] 0.15751404 0.31502808 0.8424860 [52,] 0.13012643 0.26025287 0.8698736 [53,] 0.11154266 0.22308531 0.8884573 [54,] 0.10956479 0.21912959 0.8904352 [55,] 0.12254517 0.24509034 0.8774548 [56,] 0.12510580 0.25021160 0.8748942 [57,] 0.11459594 0.22919188 0.8854041 [58,] 0.13262912 0.26525825 0.8673709 [59,] 0.15210511 0.30421021 0.8478949 [60,] 0.16298438 0.32596875 0.8370156 [61,] 0.13830147 0.27660294 0.8616985 [62,] 0.11662242 0.23324483 0.8833776 [63,] 0.09351272 0.18702544 0.9064873 [64,] 0.07254122 0.14508244 0.9274588 [65,] 0.05358300 0.10716600 0.9464170 [66,] 0.03836275 0.07672550 0.9616372 [67,] 0.02771464 0.05542928 0.9722854 [68,] 0.01932906 0.03865812 0.9806709 [69,] 0.02623593 0.05247186 0.9737641 [70,] 0.04653677 0.09307355 0.9534632 [71,] 0.07937114 0.15874228 0.9206289 [72,] 0.08831088 0.17662177 0.9116891 [73,] 0.07323260 0.14646520 0.9267674 [74,] 0.06287137 0.12574275 0.9371286 [75,] 0.05107321 0.10214642 0.9489268 [76,] 0.03976812 0.07953624 0.9602319 [77,] 0.02729983 0.05459966 0.9727002 [78,] 0.01749404 0.03498809 0.9825060 [79,] 0.01072330 0.02144661 0.9892767 [80,] 0.00628918 0.01257836 0.9937108 [81,] 0.01523962 0.03047923 0.9847604 [82,] 0.07028316 0.14056631 0.9297168 [83,] 0.31927358 0.63854716 0.6807264 [84,] 0.48977446 0.97954892 0.5102255 [85,] 0.51002168 0.97995665 0.4899783 [86,] 0.48593689 0.97187378 0.5140631 [87,] 0.58597757 0.82804486 0.4140224 > postscript(file="/var/www/html/rcomp/tmp/13vjy1229456281.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/21w071229456281.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/3yj041229456281.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/4erpz1229456281.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/5d34v1229456281.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 = 96 Frequency = 1 1 2 3 4 5 6 36.6250000 64.6250000 44.6250000 23.6250000 4.6250000 4.6250000 7 8 9 10 11 12 5.6250000 -6.3750000 -25.3750000 -30.3750000 -45.3750000 -48.3750000 13 14 15 16 17 18 0.6250000 33.6250000 13.6250000 -2.3750000 -23.3750000 -27.3750000 19 20 21 22 23 24 -20.3750000 -27.3750000 -39.3750000 -44.3750000 -51.3750000 -56.3750000 25 26 27 28 29 30 -3.3750000 22.6250000 25.6250000 15.6250000 -16.3750000 -16.3750000 31 32 33 34 35 36 -11.3750000 -12.3750000 -17.3750000 -26.3750000 -32.3750000 -31.3750000 37 38 39 40 41 42 29.6250000 37.6250000 35.6250000 31.6250000 21.6250000 24.6250000 43 44 45 46 47 48 31.6250000 29.6250000 22.6250000 21.6250000 13.6250000 19.6250000 49 50 51 52 53 54 -8.2291667 2.7708333 0.7708333 -12.2291667 -30.2291667 -22.2291667 55 56 57 58 59 60 -15.2291667 -16.2291667 -22.2291667 -33.2291667 -40.2291667 -34.2291667 61 62 63 64 65 66 16.7708333 33.7708333 35.7708333 33.7708333 16.7708333 17.7708333 67 68 69 70 71 72 13.7708333 11.7708333 6.7708333 -4.2291667 -10.2291667 -8.2291667 73 74 75 76 77 78 43.7708333 51.7708333 50.7708333 34.7708333 17.7708333 19.7708333 79 80 81 82 83 84 15.7708333 12.7708333 2.7708333 -3.2291667 -4.2291667 -4.2291667 85 86 87 88 89 90 42.7708333 48.7708333 42.7708333 10.7708333 -11.2291667 -20.2291667 91 92 93 94 95 96 -16.2291667 -28.2291667 -45.2291667 -51.2291667 -66.2291667 -78.2291667 > postscript(file="/var/www/html/rcomp/tmp/6ia861229456281.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 = 96 Frequency = 1 lag(myerror, k = 1) myerror 0 36.6250000 NA 1 64.6250000 36.6250000 2 44.6250000 64.6250000 3 23.6250000 44.6250000 4 4.6250000 23.6250000 5 4.6250000 4.6250000 6 5.6250000 4.6250000 7 -6.3750000 5.6250000 8 -25.3750000 -6.3750000 9 -30.3750000 -25.3750000 10 -45.3750000 -30.3750000 11 -48.3750000 -45.3750000 12 0.6250000 -48.3750000 13 33.6250000 0.6250000 14 13.6250000 33.6250000 15 -2.3750000 13.6250000 16 -23.3750000 -2.3750000 17 -27.3750000 -23.3750000 18 -20.3750000 -27.3750000 19 -27.3750000 -20.3750000 20 -39.3750000 -27.3750000 21 -44.3750000 -39.3750000 22 -51.3750000 -44.3750000 23 -56.3750000 -51.3750000 24 -3.3750000 -56.3750000 25 22.6250000 -3.3750000 26 25.6250000 22.6250000 27 15.6250000 25.6250000 28 -16.3750000 15.6250000 29 -16.3750000 -16.3750000 30 -11.3750000 -16.3750000 31 -12.3750000 -11.3750000 32 -17.3750000 -12.3750000 33 -26.3750000 -17.3750000 34 -32.3750000 -26.3750000 35 -31.3750000 -32.3750000 36 29.6250000 -31.3750000 37 37.6250000 29.6250000 38 35.6250000 37.6250000 39 31.6250000 35.6250000 40 21.6250000 31.6250000 41 24.6250000 21.6250000 42 31.6250000 24.6250000 43 29.6250000 31.6250000 44 22.6250000 29.6250000 45 21.6250000 22.6250000 46 13.6250000 21.6250000 47 19.6250000 13.6250000 48 -8.2291667 19.6250000 49 2.7708333 -8.2291667 50 0.7708333 2.7708333 51 -12.2291667 0.7708333 52 -30.2291667 -12.2291667 53 -22.2291667 -30.2291667 54 -15.2291667 -22.2291667 55 -16.2291667 -15.2291667 56 -22.2291667 -16.2291667 57 -33.2291667 -22.2291667 58 -40.2291667 -33.2291667 59 -34.2291667 -40.2291667 60 16.7708333 -34.2291667 61 33.7708333 16.7708333 62 35.7708333 33.7708333 63 33.7708333 35.7708333 64 16.7708333 33.7708333 65 17.7708333 16.7708333 66 13.7708333 17.7708333 67 11.7708333 13.7708333 68 6.7708333 11.7708333 69 -4.2291667 6.7708333 70 -10.2291667 -4.2291667 71 -8.2291667 -10.2291667 72 43.7708333 -8.2291667 73 51.7708333 43.7708333 74 50.7708333 51.7708333 75 34.7708333 50.7708333 76 17.7708333 34.7708333 77 19.7708333 17.7708333 78 15.7708333 19.7708333 79 12.7708333 15.7708333 80 2.7708333 12.7708333 81 -3.2291667 2.7708333 82 -4.2291667 -3.2291667 83 -4.2291667 -4.2291667 84 42.7708333 -4.2291667 85 48.7708333 42.7708333 86 42.7708333 48.7708333 87 10.7708333 42.7708333 88 -11.2291667 10.7708333 89 -20.2291667 -11.2291667 90 -16.2291667 -20.2291667 91 -28.2291667 -16.2291667 92 -45.2291667 -28.2291667 93 -51.2291667 -45.2291667 94 -66.2291667 -51.2291667 95 -78.2291667 -66.2291667 96 NA -78.2291667 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 64.6250000 36.6250000 [2,] 44.6250000 64.6250000 [3,] 23.6250000 44.6250000 [4,] 4.6250000 23.6250000 [5,] 4.6250000 4.6250000 [6,] 5.6250000 4.6250000 [7,] -6.3750000 5.6250000 [8,] -25.3750000 -6.3750000 [9,] -30.3750000 -25.3750000 [10,] -45.3750000 -30.3750000 [11,] -48.3750000 -45.3750000 [12,] 0.6250000 -48.3750000 [13,] 33.6250000 0.6250000 [14,] 13.6250000 33.6250000 [15,] -2.3750000 13.6250000 [16,] -23.3750000 -2.3750000 [17,] -27.3750000 -23.3750000 [18,] -20.3750000 -27.3750000 [19,] -27.3750000 -20.3750000 [20,] -39.3750000 -27.3750000 [21,] -44.3750000 -39.3750000 [22,] -51.3750000 -44.3750000 [23,] -56.3750000 -51.3750000 [24,] -3.3750000 -56.3750000 [25,] 22.6250000 -3.3750000 [26,] 25.6250000 22.6250000 [27,] 15.6250000 25.6250000 [28,] -16.3750000 15.6250000 [29,] -16.3750000 -16.3750000 [30,] -11.3750000 -16.3750000 [31,] -12.3750000 -11.3750000 [32,] -17.3750000 -12.3750000 [33,] -26.3750000 -17.3750000 [34,] -32.3750000 -26.3750000 [35,] -31.3750000 -32.3750000 [36,] 29.6250000 -31.3750000 [37,] 37.6250000 29.6250000 [38,] 35.6250000 37.6250000 [39,] 31.6250000 35.6250000 [40,] 21.6250000 31.6250000 [41,] 24.6250000 21.6250000 [42,] 31.6250000 24.6250000 [43,] 29.6250000 31.6250000 [44,] 22.6250000 29.6250000 [45,] 21.6250000 22.6250000 [46,] 13.6250000 21.6250000 [47,] 19.6250000 13.6250000 [48,] -8.2291667 19.6250000 [49,] 2.7708333 -8.2291667 [50,] 0.7708333 2.7708333 [51,] -12.2291667 0.7708333 [52,] -30.2291667 -12.2291667 [53,] -22.2291667 -30.2291667 [54,] -15.2291667 -22.2291667 [55,] -16.2291667 -15.2291667 [56,] -22.2291667 -16.2291667 [57,] -33.2291667 -22.2291667 [58,] -40.2291667 -33.2291667 [59,] -34.2291667 -40.2291667 [60,] 16.7708333 -34.2291667 [61,] 33.7708333 16.7708333 [62,] 35.7708333 33.7708333 [63,] 33.7708333 35.7708333 [64,] 16.7708333 33.7708333 [65,] 17.7708333 16.7708333 [66,] 13.7708333 17.7708333 [67,] 11.7708333 13.7708333 [68,] 6.7708333 11.7708333 [69,] -4.2291667 6.7708333 [70,] -10.2291667 -4.2291667 [71,] -8.2291667 -10.2291667 [72,] 43.7708333 -8.2291667 [73,] 51.7708333 43.7708333 [74,] 50.7708333 51.7708333 [75,] 34.7708333 50.7708333 [76,] 17.7708333 34.7708333 [77,] 19.7708333 17.7708333 [78,] 15.7708333 19.7708333 [79,] 12.7708333 15.7708333 [80,] 2.7708333 12.7708333 [81,] -3.2291667 2.7708333 [82,] -4.2291667 -3.2291667 [83,] -4.2291667 -4.2291667 [84,] 42.7708333 -4.2291667 [85,] 48.7708333 42.7708333 [86,] 42.7708333 48.7708333 [87,] 10.7708333 42.7708333 [88,] -11.2291667 10.7708333 [89,] -20.2291667 -11.2291667 [90,] -16.2291667 -20.2291667 [91,] -28.2291667 -16.2291667 [92,] -45.2291667 -28.2291667 [93,] -51.2291667 -45.2291667 [94,] -66.2291667 -51.2291667 [95,] -78.2291667 -66.2291667 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 64.6250000 36.6250000 2 44.6250000 64.6250000 3 23.6250000 44.6250000 4 4.6250000 23.6250000 5 4.6250000 4.6250000 6 5.6250000 4.6250000 7 -6.3750000 5.6250000 8 -25.3750000 -6.3750000 9 -30.3750000 -25.3750000 10 -45.3750000 -30.3750000 11 -48.3750000 -45.3750000 12 0.6250000 -48.3750000 13 33.6250000 0.6250000 14 13.6250000 33.6250000 15 -2.3750000 13.6250000 16 -23.3750000 -2.3750000 17 -27.3750000 -23.3750000 18 -20.3750000 -27.3750000 19 -27.3750000 -20.3750000 20 -39.3750000 -27.3750000 21 -44.3750000 -39.3750000 22 -51.3750000 -44.3750000 23 -56.3750000 -51.3750000 24 -3.3750000 -56.3750000 25 22.6250000 -3.3750000 26 25.6250000 22.6250000 27 15.6250000 25.6250000 28 -16.3750000 15.6250000 29 -16.3750000 -16.3750000 30 -11.3750000 -16.3750000 31 -12.3750000 -11.3750000 32 -17.3750000 -12.3750000 33 -26.3750000 -17.3750000 34 -32.3750000 -26.3750000 35 -31.3750000 -32.3750000 36 29.6250000 -31.3750000 37 37.6250000 29.6250000 38 35.6250000 37.6250000 39 31.6250000 35.6250000 40 21.6250000 31.6250000 41 24.6250000 21.6250000 42 31.6250000 24.6250000 43 29.6250000 31.6250000 44 22.6250000 29.6250000 45 21.6250000 22.6250000 46 13.6250000 21.6250000 47 19.6250000 13.6250000 48 -8.2291667 19.6250000 49 2.7708333 -8.2291667 50 0.7708333 2.7708333 51 -12.2291667 0.7708333 52 -30.2291667 -12.2291667 53 -22.2291667 -30.2291667 54 -15.2291667 -22.2291667 55 -16.2291667 -15.2291667 56 -22.2291667 -16.2291667 57 -33.2291667 -22.2291667 58 -40.2291667 -33.2291667 59 -34.2291667 -40.2291667 60 16.7708333 -34.2291667 61 33.7708333 16.7708333 62 35.7708333 33.7708333 63 33.7708333 35.7708333 64 16.7708333 33.7708333 65 17.7708333 16.7708333 66 13.7708333 17.7708333 67 11.7708333 13.7708333 68 6.7708333 11.7708333 69 -4.2291667 6.7708333 70 -10.2291667 -4.2291667 71 -8.2291667 -10.2291667 72 43.7708333 -8.2291667 73 51.7708333 43.7708333 74 50.7708333 51.7708333 75 34.7708333 50.7708333 76 17.7708333 34.7708333 77 19.7708333 17.7708333 78 15.7708333 19.7708333 79 12.7708333 15.7708333 80 2.7708333 12.7708333 81 -3.2291667 2.7708333 82 -4.2291667 -3.2291667 83 -4.2291667 -4.2291667 84 42.7708333 -4.2291667 85 48.7708333 42.7708333 86 42.7708333 48.7708333 87 10.7708333 42.7708333 88 -11.2291667 10.7708333 89 -20.2291667 -11.2291667 90 -16.2291667 -20.2291667 91 -28.2291667 -16.2291667 92 -45.2291667 -28.2291667 93 -51.2291667 -45.2291667 94 -66.2291667 -51.2291667 95 -78.2291667 -66.2291667 > 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/7t6x01229456281.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/8xnhq1229456282.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/9zr1s1229456282.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') hat values (leverages) are all = 0.02083333 and there are no factor predictors; no plot no. 5 > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10jddn1229456282.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/11iisl1229456282.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/12rns71229456282.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/13tvhs1229456282.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/1489v71229456282.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/15ibaq1229456282.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/16j4ts1229456282.tab") + } > > system("convert tmp/13vjy1229456281.ps tmp/13vjy1229456281.png") > system("convert tmp/21w071229456281.ps tmp/21w071229456281.png") > system("convert tmp/3yj041229456281.ps tmp/3yj041229456281.png") > system("convert tmp/4erpz1229456281.ps tmp/4erpz1229456281.png") > system("convert tmp/5d34v1229456281.ps tmp/5d34v1229456281.png") > system("convert tmp/6ia861229456281.ps tmp/6ia861229456281.png") > system("convert tmp/7t6x01229456281.ps tmp/7t6x01229456281.png") > system("convert tmp/8xnhq1229456282.ps tmp/8xnhq1229456282.png") > system("convert tmp/9zr1s1229456282.ps tmp/9zr1s1229456282.png") > system("convert tmp/10jddn1229456282.ps tmp/10jddn1229456282.png") > > > proc.time() user system elapsed 2.881 1.610 3.314