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.579 + ,9.769 + ,2.146 + ,9.321 + ,2.462 + ,9.939 + ,3.695 + ,9.336 + ,4.831 + ,10.195 + ,5.134 + ,9.464 + ,6.250 + ,10.010 + ,5.760 + ,10.213 + ,6.249 + ,9.563 + ,2.917 + ,9.890 + ,1.741 + ,9.305 + ,2.359 + ,9.391 + ,1.511 + ,9.928 + ,2.059 + ,8.686 + ,2.635 + ,9.843 + ,2.867 + ,9.627 + ,4.403 + ,10.074 + ,5.720 + ,9.503 + ,4.502 + ,10.119 + ,5.749 + ,10.000 + ,5.627 + ,9.313 + ,2.846 + ,9.866 + ,1.762 + ,9.172 + ,2.429 + ,9.241 + ,1.169 + ,9.659 + ,2.154 + ,8.904 + ,2.249 + ,9.755 + ,2.687 + ,9.080 + ,4.359 + ,9.435 + ,5.382 + ,8.971 + ,4.459 + ,10.063 + ,6.398 + ,9.793 + ,4.596 + ,9.454 + ,3.024 + ,9.759 + ,1.887 + ,8.820 + ,2.070 + ,9.403 + ,1.351 + ,9.676 + ,2.218 + ,8.642 + ,2.461 + ,9.402 + ,3.028 + ,9.610 + ,4.784 + ,9.294 + ,4.975 + ,9.448 + ,4.607 + ,10.319 + ,6.249 + ,9.548 + ,4.809 + ,9.801 + ,3.157 + ,9.596 + ,1.910 + ,8.923 + ,2.228 + ,9.746 + ,1.594 + ,9.829 + ,2.467 + ,9.125 + ,2.222 + ,9.782 + ,3.607 + ,9.441 + ,4.685 + ,9.162 + ,4.962 + ,9.915 + ,5.770 + ,10.444 + ,5.480 + ,10.209 + ,5.000 + ,9.985 + ,3.228 + ,9.842 + ,1.993 + ,9.429 + ,2.288 + ,10.132 + ,1.580 + ,9.849 + ,2.111 + ,9.172 + ,2.192 + ,10.313 + ,3.601 + ,9.819 + ,4.665 + ,9.955 + ,4.876 + ,10.048 + ,5.813 + ,10.082 + ,5.589 + ,10.541 + ,5.331 + ,10.208 + ,3.075 + ,10.233 + ,2.002 + ,9.439 + ,2.306 + ,9.963 + ,1.507 + ,10.158 + ,1.992 + ,9.225 + ,2.487 + ,10.474 + ,3.490 + ,9.757 + ,4.647 + ,10.490 + ,5.594 + ,10.281 + ,5.611 + ,10.444 + ,5.788 + ,10.640 + ,6.204 + ,10.695 + ,3.013 + ,10.786 + ,1.931 + ,9.832 + ,2.549 + ,9.747 + ,1.504 + ,10.411 + ,2.090 + ,9.511 + ,2.702 + ,10.402 + ,2.939 + ,9.701 + ,4.500 + ,10.540 + ,6.208 + ,10.112 + ,6.415 + ,10.915 + ,5.657 + ,11.183 + ,5.964 + ,10.384 + ,3.163 + ,10.834 + ,1.997 + ,9.886 + ,2.422 + ,10.216) + ,dim=c(2 + ,96) + ,dimnames=list(c('huwelijken' + ,'geboortes') + ,1:96)) > y <- array(NA,dim=c(2,96),dimnames=list(c('huwelijken','geboortes'),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 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x huwelijken geboortes M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 1.579 9.769 1 0 0 0 0 0 0 0 0 0 0 1 2 2.146 9.321 0 1 0 0 0 0 0 0 0 0 0 2 3 2.462 9.939 0 0 1 0 0 0 0 0 0 0 0 3 4 3.695 9.336 0 0 0 1 0 0 0 0 0 0 0 4 5 4.831 10.195 0 0 0 0 1 0 0 0 0 0 0 5 6 5.134 9.464 0 0 0 0 0 1 0 0 0 0 0 6 7 6.250 10.010 0 0 0 0 0 0 1 0 0 0 0 7 8 5.760 10.213 0 0 0 0 0 0 0 1 0 0 0 8 9 6.249 9.563 0 0 0 0 0 0 0 0 1 0 0 9 10 2.917 9.890 0 0 0 0 0 0 0 0 0 1 0 10 11 1.741 9.305 0 0 0 0 0 0 0 0 0 0 1 11 12 2.359 9.391 0 0 0 0 0 0 0 0 0 0 0 12 13 1.511 9.928 1 0 0 0 0 0 0 0 0 0 0 13 14 2.059 8.686 0 1 0 0 0 0 0 0 0 0 0 14 15 2.635 9.843 0 0 1 0 0 0 0 0 0 0 0 15 16 2.867 9.627 0 0 0 1 0 0 0 0 0 0 0 16 17 4.403 10.074 0 0 0 0 1 0 0 0 0 0 0 17 18 5.720 9.503 0 0 0 0 0 1 0 0 0 0 0 18 19 4.502 10.119 0 0 0 0 0 0 1 0 0 0 0 19 20 5.749 10.000 0 0 0 0 0 0 0 1 0 0 0 20 21 5.627 9.313 0 0 0 0 0 0 0 0 1 0 0 21 22 2.846 9.866 0 0 0 0 0 0 0 0 0 1 0 22 23 1.762 9.172 0 0 0 0 0 0 0 0 0 0 1 23 24 2.429 9.241 0 0 0 0 0 0 0 0 0 0 0 24 25 1.169 9.659 1 0 0 0 0 0 0 0 0 0 0 25 26 2.154 8.904 0 1 0 0 0 0 0 0 0 0 0 26 27 2.249 9.755 0 0 1 0 0 0 0 0 0 0 0 27 28 2.687 9.080 0 0 0 1 0 0 0 0 0 0 0 28 29 4.359 9.435 0 0 0 0 1 0 0 0 0 0 0 29 30 5.382 8.971 0 0 0 0 0 1 0 0 0 0 0 30 31 4.459 10.063 0 0 0 0 0 0 1 0 0 0 0 31 32 6.398 9.793 0 0 0 0 0 0 0 1 0 0 0 32 33 4.596 9.454 0 0 0 0 0 0 0 0 1 0 0 33 34 3.024 9.759 0 0 0 0 0 0 0 0 0 1 0 34 35 1.887 8.820 0 0 0 0 0 0 0 0 0 0 1 35 36 2.070 9.403 0 0 0 0 0 0 0 0 0 0 0 36 37 1.351 9.676 1 0 0 0 0 0 0 0 0 0 0 37 38 2.218 8.642 0 1 0 0 0 0 0 0 0 0 0 38 39 2.461 9.402 0 0 1 0 0 0 0 0 0 0 0 39 40 3.028 9.610 0 0 0 1 0 0 0 0 0 0 0 40 41 4.784 9.294 0 0 0 0 1 0 0 0 0 0 0 41 42 4.975 9.448 0 0 0 0 0 1 0 0 0 0 0 42 43 4.607 10.319 0 0 0 0 0 0 1 0 0 0 0 43 44 6.249 9.548 0 0 0 0 0 0 0 1 0 0 0 44 45 4.809 9.801 0 0 0 0 0 0 0 0 1 0 0 45 46 3.157 9.596 0 0 0 0 0 0 0 0 0 1 0 46 47 1.910 8.923 0 0 0 0 0 0 0 0 0 0 1 47 48 2.228 9.746 0 0 0 0 0 0 0 0 0 0 0 48 49 1.594 9.829 1 0 0 0 0 0 0 0 0 0 0 49 50 2.467 9.125 0 1 0 0 0 0 0 0 0 0 0 50 51 2.222 9.782 0 0 1 0 0 0 0 0 0 0 0 51 52 3.607 9.441 0 0 0 1 0 0 0 0 0 0 0 52 53 4.685 9.162 0 0 0 0 1 0 0 0 0 0 0 53 54 4.962 9.915 0 0 0 0 0 1 0 0 0 0 0 54 55 5.770 10.444 0 0 0 0 0 0 1 0 0 0 0 55 56 5.480 10.209 0 0 0 0 0 0 0 1 0 0 0 56 57 5.000 9.985 0 0 0 0 0 0 0 0 1 0 0 57 58 3.228 9.842 0 0 0 0 0 0 0 0 0 1 0 58 59 1.993 9.429 0 0 0 0 0 0 0 0 0 0 1 59 60 2.288 10.132 0 0 0 0 0 0 0 0 0 0 0 60 61 1.580 9.849 1 0 0 0 0 0 0 0 0 0 0 61 62 2.111 9.172 0 1 0 0 0 0 0 0 0 0 0 62 63 2.192 10.313 0 0 1 0 0 0 0 0 0 0 0 63 64 3.601 9.819 0 0 0 1 0 0 0 0 0 0 0 64 65 4.665 9.955 0 0 0 0 1 0 0 0 0 0 0 65 66 4.876 10.048 0 0 0 0 0 1 0 0 0 0 0 66 67 5.813 10.082 0 0 0 0 0 0 1 0 0 0 0 67 68 5.589 10.541 0 0 0 0 0 0 0 1 0 0 0 68 69 5.331 10.208 0 0 0 0 0 0 0 0 1 0 0 69 70 3.075 10.233 0 0 0 0 0 0 0 0 0 1 0 70 71 2.002 9.439 0 0 0 0 0 0 0 0 0 0 1 71 72 2.306 9.963 0 0 0 0 0 0 0 0 0 0 0 72 73 1.507 10.158 1 0 0 0 0 0 0 0 0 0 0 73 74 1.992 9.225 0 1 0 0 0 0 0 0 0 0 0 74 75 2.487 10.474 0 0 1 0 0 0 0 0 0 0 0 75 76 3.490 9.757 0 0 0 1 0 0 0 0 0 0 0 76 77 4.647 10.490 0 0 0 0 1 0 0 0 0 0 0 77 78 5.594 10.281 0 0 0 0 0 1 0 0 0 0 0 78 79 5.611 10.444 0 0 0 0 0 0 1 0 0 0 0 79 80 5.788 10.640 0 0 0 0 0 0 0 1 0 0 0 80 81 6.204 10.695 0 0 0 0 0 0 0 0 1 0 0 81 82 3.013 10.786 0 0 0 0 0 0 0 0 0 1 0 82 83 1.931 9.832 0 0 0 0 0 0 0 0 0 0 1 83 84 2.549 9.747 0 0 0 0 0 0 0 0 0 0 0 84 85 1.504 10.411 1 0 0 0 0 0 0 0 0 0 0 85 86 2.090 9.511 0 1 0 0 0 0 0 0 0 0 0 86 87 2.702 10.402 0 0 1 0 0 0 0 0 0 0 0 87 88 2.939 9.701 0 0 0 1 0 0 0 0 0 0 0 88 89 4.500 10.540 0 0 0 0 1 0 0 0 0 0 0 89 90 6.208 10.112 0 0 0 0 0 1 0 0 0 0 0 90 91 6.415 10.915 0 0 0 0 0 0 1 0 0 0 0 91 92 5.657 11.183 0 0 0 0 0 0 0 1 0 0 0 92 93 5.964 10.384 0 0 0 0 0 0 0 0 1 0 0 93 94 3.163 10.834 0 0 0 0 0 0 0 0 0 1 0 94 95 1.997 9.886 0 0 0 0 0 0 0 0 0 0 1 95 96 2.422 10.216 0 0 0 0 0 0 0 0 0 0 0 96 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) geboortes M1 M2 M3 M4 2.023395 0.020691 -0.838997 -0.143412 0.107296 0.927474 M5 M6 M7 M8 M9 M10 2.288324 3.037102 3.095090 3.499186 3.143006 0.717777 M11 t -0.418680 0.001975 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.928928 -0.163207 -0.001151 0.166785 0.910574 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.023395 1.284063 1.576 0.118928 geboortes 0.020691 0.138189 0.150 0.881347 M1 -0.838997 0.190709 -4.399 3.24e-05 *** M2 -0.143412 0.202170 -0.709 0.480113 M3 0.107296 0.192387 0.558 0.578564 M4 0.927474 0.186992 4.960 3.75e-06 *** M5 2.288324 0.188961 12.110 < 2e-16 *** M6 3.037102 0.186338 16.299 < 2e-16 *** M7 3.095090 0.204729 15.118 < 2e-16 *** M8 3.499186 0.202291 17.298 < 2e-16 *** M9 3.143006 0.188645 16.661 < 2e-16 *** M10 0.717777 0.193704 3.706 0.000382 *** M11 -0.418680 0.192952 -2.170 0.032910 * t 0.001975 0.001887 1.047 0.298308 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.3721 on 82 degrees of freedom Multiple R-squared: 0.9532, Adjusted R-squared: 0.9457 F-statistic: 128.4 on 13 and 82 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.4099811 0.81996217 0.59001891 [2,] 0.6842690 0.63146200 0.31573100 [3,] 0.9755853 0.04882945 0.02441472 [4,] 0.9567090 0.08658202 0.04329101 [5,] 0.9486381 0.10272387 0.05136193 [6,] 0.9232996 0.15340079 0.07670040 [7,] 0.8928486 0.21430287 0.10715144 [8,] 0.8650598 0.26988048 0.13494024 [9,] 0.8082823 0.38343531 0.19171765 [10,] 0.7965522 0.40689556 0.20344778 [11,] 0.7334368 0.53312638 0.26656319 [12,] 0.7228673 0.55426535 0.27713267 [13,] 0.6534589 0.69308215 0.34654108 [14,] 0.5859186 0.82816277 0.41408138 [15,] 0.6716588 0.65668247 0.32834123 [16,] 0.8740972 0.25180570 0.12590285 [17,] 0.9455207 0.10895861 0.05447930 [18,] 0.9456900 0.10862004 0.05431002 [19,] 0.9292300 0.14154002 0.07077001 [20,] 0.9053940 0.18921207 0.09460603 [21,] 0.8920526 0.21589476 0.10794738 [22,] 0.8776679 0.24466417 0.12233208 [23,] 0.8446873 0.31062534 0.15531267 [24,] 0.8421724 0.31565524 0.15782762 [25,] 0.8204679 0.35906411 0.17953206 [26,] 0.7808999 0.43820020 0.21910010 [27,] 0.8809371 0.23812582 0.11906291 [28,] 0.9215934 0.15681318 0.07840659 [29,] 0.9394643 0.12107146 0.06053573 [30,] 0.9322842 0.13543170 0.06771585 [31,] 0.9161953 0.16760940 0.08380470 [32,] 0.9063711 0.18725779 0.09362890 [33,] 0.9072712 0.18545750 0.09272875 [34,] 0.9474819 0.10503617 0.05251809 [35,] 0.9263841 0.14723174 0.07361587 [36,] 0.9531112 0.09377756 0.04688878 [37,] 0.9395473 0.12090550 0.06045275 [38,] 0.9331531 0.13369370 0.06684685 [39,] 0.9551107 0.08977852 0.04488926 [40,] 0.9403664 0.11926718 0.05963359 [41,] 0.9618104 0.07637930 0.03818965 [42,] 0.9577176 0.08456480 0.04228240 [43,] 0.9464867 0.10702667 0.05351334 [44,] 0.9246233 0.15075338 0.07537669 [45,] 0.9055785 0.18884292 0.09442146 [46,] 0.8786842 0.24263158 0.12131579 [47,] 0.8467962 0.30640761 0.15320380 [48,] 0.8885565 0.22288705 0.11144353 [49,] 0.8665330 0.26693410 0.13346705 [50,] 0.9578053 0.08438949 0.04219475 [51,] 0.9473672 0.10526554 0.05263277 [52,] 0.9193131 0.16137376 0.08068688 [53,] 0.9600460 0.07990803 0.03995402 [54,] 0.9361044 0.12779125 0.06389562 [55,] 0.9071277 0.18574460 0.09287230 [56,] 0.8599191 0.28016174 0.14008087 [57,] 0.7939077 0.41218451 0.20609226 [58,] 0.7056003 0.58879940 0.29439970 [59,] 0.6183980 0.76320407 0.38160204 [60,] 0.6763720 0.64725602 0.32362801 [61,] 0.5889379 0.82212416 0.41106208 [62,] 0.6529760 0.69404796 0.34702398 [63,] 0.9404178 0.11916439 0.05958219 > postscript(file="/var/www/html/rcomp/tmp/1jhmx1290938866.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/2jhmx1290938866.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/3jhmx1290938866.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/4brmi1290938866.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/5brmi1290938866.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 0.1904993418 0.0692084342 0.1197389055 0.5430623427 0.2984635522 6 7 8 9 10 -0.1341651999 0.9105744912 0.0103035638 0.8669573230 -0.0485548983 11 12 13 14 15 -0.0779688572 0.1175960925 0.0955067997 -0.0283557240 0.2710224816 16 17 18 19 20 -0.3146613665 -0.1507356051 0.4273251372 -0.8633835179 -0.0199920529 21 22 23 24 25 0.2264272608 -0.1427610497 -0.0779197266 0.1669969643 -0.2646301399 26 27 28 29 30 0.0384309849 -0.1368594675 -0.5070463028 -0.2052170007 0.0766298410 31 32 33 34 35 -0.9289275682 0.6095881865 -0.8311928495 0.0137501238 0.0306606585 36 37 38 39 40 -0.2190576498 -0.1066846083 0.0841492106 0.0587416082 -0.2007150796 41 42 43 44 45 0.1989976552 -0.3639423309 -0.8099271043 0.4419546710 -0.6490752356 46 47 48 49 50 0.1264199741 0.0278267933 -0.0918572733 0.1094469935 0.2994528948 51 52 53 54 55 -0.2118235697 0.3580789147 0.0790260951 -0.4103075962 0.3267838361 56 57 58 59 60 -0.3644245823 -0.4855850442 0.1686273446 0.0766545923 -0.0635465952 61 62 63 64 65 0.0713304531 -0.0812222934 -0.2765130372 0.3205551181 0.0189156747 66 67 68 69 70 -0.5227621812 0.3535711277 -0.2859966086 -0.1829017885 -0.0161654305 71 72 73 74 75 0.0617449585 -0.0657526008 -0.0317656879 -0.2250216256 -0.0085469606 76 77 78 79 80 0.1871352118 -0.0338565555 0.1667141679 0.1203783817 -0.1127477111 81 82 83 84 85 0.6563191330 -0.1133100926 -0.0410891980 0.1580138545 -0.0637031520 86 87 88 89 90 -0.1566418815 0.1842400397 -0.3864088384 -0.2055938157 0.7605081622 91 92 93 94 95 0.8909303537 -0.2786854665 0.3990512010 0.0119940285 0.0000907792 96 -0.0023927921 > postscript(file="/var/www/html/rcomp/tmp/6brmi1290938866.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 0.1904993418 NA 1 0.0692084342 0.1904993418 2 0.1197389055 0.0692084342 3 0.5430623427 0.1197389055 4 0.2984635522 0.5430623427 5 -0.1341651999 0.2984635522 6 0.9105744912 -0.1341651999 7 0.0103035638 0.9105744912 8 0.8669573230 0.0103035638 9 -0.0485548983 0.8669573230 10 -0.0779688572 -0.0485548983 11 0.1175960925 -0.0779688572 12 0.0955067997 0.1175960925 13 -0.0283557240 0.0955067997 14 0.2710224816 -0.0283557240 15 -0.3146613665 0.2710224816 16 -0.1507356051 -0.3146613665 17 0.4273251372 -0.1507356051 18 -0.8633835179 0.4273251372 19 -0.0199920529 -0.8633835179 20 0.2264272608 -0.0199920529 21 -0.1427610497 0.2264272608 22 -0.0779197266 -0.1427610497 23 0.1669969643 -0.0779197266 24 -0.2646301399 0.1669969643 25 0.0384309849 -0.2646301399 26 -0.1368594675 0.0384309849 27 -0.5070463028 -0.1368594675 28 -0.2052170007 -0.5070463028 29 0.0766298410 -0.2052170007 30 -0.9289275682 0.0766298410 31 0.6095881865 -0.9289275682 32 -0.8311928495 0.6095881865 33 0.0137501238 -0.8311928495 34 0.0306606585 0.0137501238 35 -0.2190576498 0.0306606585 36 -0.1066846083 -0.2190576498 37 0.0841492106 -0.1066846083 38 0.0587416082 0.0841492106 39 -0.2007150796 0.0587416082 40 0.1989976552 -0.2007150796 41 -0.3639423309 0.1989976552 42 -0.8099271043 -0.3639423309 43 0.4419546710 -0.8099271043 44 -0.6490752356 0.4419546710 45 0.1264199741 -0.6490752356 46 0.0278267933 0.1264199741 47 -0.0918572733 0.0278267933 48 0.1094469935 -0.0918572733 49 0.2994528948 0.1094469935 50 -0.2118235697 0.2994528948 51 0.3580789147 -0.2118235697 52 0.0790260951 0.3580789147 53 -0.4103075962 0.0790260951 54 0.3267838361 -0.4103075962 55 -0.3644245823 0.3267838361 56 -0.4855850442 -0.3644245823 57 0.1686273446 -0.4855850442 58 0.0766545923 0.1686273446 59 -0.0635465952 0.0766545923 60 0.0713304531 -0.0635465952 61 -0.0812222934 0.0713304531 62 -0.2765130372 -0.0812222934 63 0.3205551181 -0.2765130372 64 0.0189156747 0.3205551181 65 -0.5227621812 0.0189156747 66 0.3535711277 -0.5227621812 67 -0.2859966086 0.3535711277 68 -0.1829017885 -0.2859966086 69 -0.0161654305 -0.1829017885 70 0.0617449585 -0.0161654305 71 -0.0657526008 0.0617449585 72 -0.0317656879 -0.0657526008 73 -0.2250216256 -0.0317656879 74 -0.0085469606 -0.2250216256 75 0.1871352118 -0.0085469606 76 -0.0338565555 0.1871352118 77 0.1667141679 -0.0338565555 78 0.1203783817 0.1667141679 79 -0.1127477111 0.1203783817 80 0.6563191330 -0.1127477111 81 -0.1133100926 0.6563191330 82 -0.0410891980 -0.1133100926 83 0.1580138545 -0.0410891980 84 -0.0637031520 0.1580138545 85 -0.1566418815 -0.0637031520 86 0.1842400397 -0.1566418815 87 -0.3864088384 0.1842400397 88 -0.2055938157 -0.3864088384 89 0.7605081622 -0.2055938157 90 0.8909303537 0.7605081622 91 -0.2786854665 0.8909303537 92 0.3990512010 -0.2786854665 93 0.0119940285 0.3990512010 94 0.0000907792 0.0119940285 95 -0.0023927921 0.0000907792 96 NA -0.0023927921 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0692084342 0.1904993418 [2,] 0.1197389055 0.0692084342 [3,] 0.5430623427 0.1197389055 [4,] 0.2984635522 0.5430623427 [5,] -0.1341651999 0.2984635522 [6,] 0.9105744912 -0.1341651999 [7,] 0.0103035638 0.9105744912 [8,] 0.8669573230 0.0103035638 [9,] -0.0485548983 0.8669573230 [10,] -0.0779688572 -0.0485548983 [11,] 0.1175960925 -0.0779688572 [12,] 0.0955067997 0.1175960925 [13,] -0.0283557240 0.0955067997 [14,] 0.2710224816 -0.0283557240 [15,] -0.3146613665 0.2710224816 [16,] -0.1507356051 -0.3146613665 [17,] 0.4273251372 -0.1507356051 [18,] -0.8633835179 0.4273251372 [19,] -0.0199920529 -0.8633835179 [20,] 0.2264272608 -0.0199920529 [21,] -0.1427610497 0.2264272608 [22,] -0.0779197266 -0.1427610497 [23,] 0.1669969643 -0.0779197266 [24,] -0.2646301399 0.1669969643 [25,] 0.0384309849 -0.2646301399 [26,] -0.1368594675 0.0384309849 [27,] -0.5070463028 -0.1368594675 [28,] -0.2052170007 -0.5070463028 [29,] 0.0766298410 -0.2052170007 [30,] -0.9289275682 0.0766298410 [31,] 0.6095881865 -0.9289275682 [32,] -0.8311928495 0.6095881865 [33,] 0.0137501238 -0.8311928495 [34,] 0.0306606585 0.0137501238 [35,] -0.2190576498 0.0306606585 [36,] -0.1066846083 -0.2190576498 [37,] 0.0841492106 -0.1066846083 [38,] 0.0587416082 0.0841492106 [39,] -0.2007150796 0.0587416082 [40,] 0.1989976552 -0.2007150796 [41,] -0.3639423309 0.1989976552 [42,] -0.8099271043 -0.3639423309 [43,] 0.4419546710 -0.8099271043 [44,] -0.6490752356 0.4419546710 [45,] 0.1264199741 -0.6490752356 [46,] 0.0278267933 0.1264199741 [47,] -0.0918572733 0.0278267933 [48,] 0.1094469935 -0.0918572733 [49,] 0.2994528948 0.1094469935 [50,] -0.2118235697 0.2994528948 [51,] 0.3580789147 -0.2118235697 [52,] 0.0790260951 0.3580789147 [53,] -0.4103075962 0.0790260951 [54,] 0.3267838361 -0.4103075962 [55,] -0.3644245823 0.3267838361 [56,] -0.4855850442 -0.3644245823 [57,] 0.1686273446 -0.4855850442 [58,] 0.0766545923 0.1686273446 [59,] -0.0635465952 0.0766545923 [60,] 0.0713304531 -0.0635465952 [61,] -0.0812222934 0.0713304531 [62,] -0.2765130372 -0.0812222934 [63,] 0.3205551181 -0.2765130372 [64,] 0.0189156747 0.3205551181 [65,] -0.5227621812 0.0189156747 [66,] 0.3535711277 -0.5227621812 [67,] -0.2859966086 0.3535711277 [68,] -0.1829017885 -0.2859966086 [69,] -0.0161654305 -0.1829017885 [70,] 0.0617449585 -0.0161654305 [71,] -0.0657526008 0.0617449585 [72,] -0.0317656879 -0.0657526008 [73,] -0.2250216256 -0.0317656879 [74,] -0.0085469606 -0.2250216256 [75,] 0.1871352118 -0.0085469606 [76,] -0.0338565555 0.1871352118 [77,] 0.1667141679 -0.0338565555 [78,] 0.1203783817 0.1667141679 [79,] -0.1127477111 0.1203783817 [80,] 0.6563191330 -0.1127477111 [81,] -0.1133100926 0.6563191330 [82,] -0.0410891980 -0.1133100926 [83,] 0.1580138545 -0.0410891980 [84,] -0.0637031520 0.1580138545 [85,] -0.1566418815 -0.0637031520 [86,] 0.1842400397 -0.1566418815 [87,] -0.3864088384 0.1842400397 [88,] -0.2055938157 -0.3864088384 [89,] 0.7605081622 -0.2055938157 [90,] 0.8909303537 0.7605081622 [91,] -0.2786854665 0.8909303537 [92,] 0.3990512010 -0.2786854665 [93,] 0.0119940285 0.3990512010 [94,] 0.0000907792 0.0119940285 [95,] -0.0023927921 0.0000907792 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0692084342 0.1904993418 2 0.1197389055 0.0692084342 3 0.5430623427 0.1197389055 4 0.2984635522 0.5430623427 5 -0.1341651999 0.2984635522 6 0.9105744912 -0.1341651999 7 0.0103035638 0.9105744912 8 0.8669573230 0.0103035638 9 -0.0485548983 0.8669573230 10 -0.0779688572 -0.0485548983 11 0.1175960925 -0.0779688572 12 0.0955067997 0.1175960925 13 -0.0283557240 0.0955067997 14 0.2710224816 -0.0283557240 15 -0.3146613665 0.2710224816 16 -0.1507356051 -0.3146613665 17 0.4273251372 -0.1507356051 18 -0.8633835179 0.4273251372 19 -0.0199920529 -0.8633835179 20 0.2264272608 -0.0199920529 21 -0.1427610497 0.2264272608 22 -0.0779197266 -0.1427610497 23 0.1669969643 -0.0779197266 24 -0.2646301399 0.1669969643 25 0.0384309849 -0.2646301399 26 -0.1368594675 0.0384309849 27 -0.5070463028 -0.1368594675 28 -0.2052170007 -0.5070463028 29 0.0766298410 -0.2052170007 30 -0.9289275682 0.0766298410 31 0.6095881865 -0.9289275682 32 -0.8311928495 0.6095881865 33 0.0137501238 -0.8311928495 34 0.0306606585 0.0137501238 35 -0.2190576498 0.0306606585 36 -0.1066846083 -0.2190576498 37 0.0841492106 -0.1066846083 38 0.0587416082 0.0841492106 39 -0.2007150796 0.0587416082 40 0.1989976552 -0.2007150796 41 -0.3639423309 0.1989976552 42 -0.8099271043 -0.3639423309 43 0.4419546710 -0.8099271043 44 -0.6490752356 0.4419546710 45 0.1264199741 -0.6490752356 46 0.0278267933 0.1264199741 47 -0.0918572733 0.0278267933 48 0.1094469935 -0.0918572733 49 0.2994528948 0.1094469935 50 -0.2118235697 0.2994528948 51 0.3580789147 -0.2118235697 52 0.0790260951 0.3580789147 53 -0.4103075962 0.0790260951 54 0.3267838361 -0.4103075962 55 -0.3644245823 0.3267838361 56 -0.4855850442 -0.3644245823 57 0.1686273446 -0.4855850442 58 0.0766545923 0.1686273446 59 -0.0635465952 0.0766545923 60 0.0713304531 -0.0635465952 61 -0.0812222934 0.0713304531 62 -0.2765130372 -0.0812222934 63 0.3205551181 -0.2765130372 64 0.0189156747 0.3205551181 65 -0.5227621812 0.0189156747 66 0.3535711277 -0.5227621812 67 -0.2859966086 0.3535711277 68 -0.1829017885 -0.2859966086 69 -0.0161654305 -0.1829017885 70 0.0617449585 -0.0161654305 71 -0.0657526008 0.0617449585 72 -0.0317656879 -0.0657526008 73 -0.2250216256 -0.0317656879 74 -0.0085469606 -0.2250216256 75 0.1871352118 -0.0085469606 76 -0.0338565555 0.1871352118 77 0.1667141679 -0.0338565555 78 0.1203783817 0.1667141679 79 -0.1127477111 0.1203783817 80 0.6563191330 -0.1127477111 81 -0.1133100926 0.6563191330 82 -0.0410891980 -0.1133100926 83 0.1580138545 -0.0410891980 84 -0.0637031520 0.1580138545 85 -0.1566418815 -0.0637031520 86 0.1842400397 -0.1566418815 87 -0.3864088384 0.1842400397 88 -0.2055938157 -0.3864088384 89 0.7605081622 -0.2055938157 90 0.8909303537 0.7605081622 91 -0.2786854665 0.8909303537 92 0.3990512010 -0.2786854665 93 0.0119940285 0.3990512010 94 0.0000907792 0.0119940285 95 -0.0023927921 0.0000907792 > 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/740ll1290938866.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/8x9k61290938866.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/9x9k61290938866.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10x9k61290938866.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/11t1ix1290938866.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/123az01290938866.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/13atwc1290938866.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/1432dw1290938866.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/1573uk1290938866.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/163dst1290938866.tab") + } > > try(system("convert tmp/1jhmx1290938866.ps tmp/1jhmx1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/2jhmx1290938866.ps tmp/2jhmx1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/3jhmx1290938866.ps tmp/3jhmx1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/4brmi1290938866.ps tmp/4brmi1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/5brmi1290938866.ps tmp/5brmi1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/6brmi1290938866.ps tmp/6brmi1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/740ll1290938866.ps tmp/740ll1290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/8x9k61290938866.ps tmp/8x9k61290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/9x9k61290938866.ps tmp/9x9k61290938866.png",intern=TRUE)) character(0) > try(system("convert tmp/10x9k61290938866.ps tmp/10x9k61290938866.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.948 1.631 6.555