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(22 + ,591 + ,19 + ,19 + ,18 + ,19 + ,23 + ,589 + ,22 + ,19 + ,19 + ,18 + ,20 + ,584 + ,23 + ,22 + ,19 + ,19 + ,14 + ,573 + ,20 + ,23 + ,22 + ,19 + ,14 + ,567 + ,14 + ,20 + ,23 + ,22 + ,14 + ,569 + ,14 + ,14 + ,20 + ,23 + ,15 + ,621 + ,14 + ,14 + ,14 + ,20 + ,11 + ,629 + ,15 + ,14 + ,14 + ,14 + ,17 + ,628 + ,11 + ,15 + ,14 + ,14 + ,16 + ,612 + ,17 + ,11 + ,15 + ,14 + ,20 + ,595 + ,16 + ,17 + ,11 + ,15 + ,24 + ,597 + ,20 + ,16 + ,17 + ,11 + ,23 + ,593 + ,24 + ,20 + ,16 + ,17 + ,20 + ,590 + ,23 + ,24 + ,20 + ,16 + ,21 + ,580 + ,20 + ,23 + ,24 + ,20 + ,19 + ,574 + ,21 + ,20 + ,23 + ,24 + ,23 + ,573 + ,19 + ,21 + ,20 + ,23 + ,23 + ,573 + ,23 + ,19 + ,21 + ,20 + ,23 + ,620 + ,23 + ,23 + ,19 + ,21 + ,23 + ,626 + ,23 + ,23 + ,23 + ,19 + ,27 + ,620 + ,23 + ,23 + ,23 + ,23 + ,26 + ,588 + ,27 + ,23 + ,23 + ,23 + ,17 + ,566 + ,26 + ,27 + ,23 + ,23 + ,24 + ,557 + ,17 + ,26 + ,27 + ,23 + ,26 + ,561 + ,24 + ,17 + ,26 + ,27 + ,24 + ,549 + ,26 + ,24 + ,17 + ,26 + ,27 + ,532 + ,24 + ,26 + ,24 + ,17 + ,27 + ,526 + ,27 + ,24 + ,26 + ,24 + ,26 + ,511 + ,27 + ,27 + ,24 + ,26 + ,24 + ,499 + ,26 + ,27 + ,27 + ,24 + ,23 + ,555 + ,24 + ,26 + ,27 + ,27 + ,23 + ,565 + ,23 + ,24 + ,26 + ,27 + ,24 + ,542 + ,23 + ,23 + ,24 + ,26 + ,17 + ,527 + ,24 + ,23 + ,23 + ,24 + ,21 + ,510 + ,17 + ,24 + ,23 + ,23 + ,19 + ,514 + ,21 + ,17 + ,24 + ,23 + ,22 + ,517 + ,19 + ,21 + ,17 + ,24 + ,22 + ,508 + ,22 + ,19 + ,21 + ,17 + ,18 + ,493 + ,22 + ,22 + ,19 + ,21 + ,16 + ,490 + ,18 + ,22 + ,22 + ,19 + ,14 + ,469 + ,16 + ,18 + ,22 + ,22 + ,12 + ,478 + ,14 + ,16 + ,18 + ,22 + ,14 + ,528 + ,12 + ,14 + ,16 + ,18 + ,16 + ,534 + ,14 + ,12 + ,14 + ,16 + ,8 + ,518 + ,16 + ,14 + ,12 + ,14 + ,3 + ,506 + ,8 + ,16 + ,14 + ,12 + ,0 + ,502 + ,3 + ,8 + ,16 + ,14 + ,5 + ,516 + ,0 + ,3 + ,8 + ,16 + ,1 + ,528 + ,5 + ,0 + ,3 + ,8 + ,1 + ,533 + ,1 + ,5 + ,0 + ,3 + ,3 + ,536 + ,1 + ,1 + ,5 + ,0 + ,6 + ,537 + ,3 + ,1 + ,1 + ,5 + ,7 + ,524 + ,6 + ,3 + ,1 + ,1 + ,8 + ,536 + ,7 + ,6 + ,3 + ,1 + ,14 + ,587 + ,8 + ,7 + ,6 + ,3 + ,14 + ,597 + ,14 + ,8 + ,7 + ,6 + ,13 + ,581 + ,14 + ,14 + ,8 + ,7) + ,dim=c(6 + ,57) + ,dimnames=list(c('y' + ,'x' + ,'y1' + ,'y2' + ,'y3' + ,'y4') + ,1:57)) > y <- array(NA,dim=c(6,57),dimnames=list(c('y','x','y1','y2','y3','y4'),1:57)) > 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 y x y1 y2 y3 y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 22 591 19 19 18 19 1 0 0 0 0 0 0 0 0 0 0 1 2 23 589 22 19 19 18 0 1 0 0 0 0 0 0 0 0 0 2 3 20 584 23 22 19 19 0 0 1 0 0 0 0 0 0 0 0 3 4 14 573 20 23 22 19 0 0 0 1 0 0 0 0 0 0 0 4 5 14 567 14 20 23 22 0 0 0 0 1 0 0 0 0 0 0 5 6 14 569 14 14 20 23 0 0 0 0 0 1 0 0 0 0 0 6 7 15 621 14 14 14 20 0 0 0 0 0 0 1 0 0 0 0 7 8 11 629 15 14 14 14 0 0 0 0 0 0 0 1 0 0 0 8 9 17 628 11 15 14 14 0 0 0 0 0 0 0 0 1 0 0 9 10 16 612 17 11 15 14 0 0 0 0 0 0 0 0 0 1 0 10 11 20 595 16 17 11 15 0 0 0 0 0 0 0 0 0 0 1 11 12 24 597 20 16 17 11 0 0 0 0 0 0 0 0 0 0 0 12 13 23 593 24 20 16 17 1 0 0 0 0 0 0 0 0 0 0 13 14 20 590 23 24 20 16 0 1 0 0 0 0 0 0 0 0 0 14 15 21 580 20 23 24 20 0 0 1 0 0 0 0 0 0 0 0 15 16 19 574 21 20 23 24 0 0 0 1 0 0 0 0 0 0 0 16 17 23 573 19 21 20 23 0 0 0 0 1 0 0 0 0 0 0 17 18 23 573 23 19 21 20 0 0 0 0 0 1 0 0 0 0 0 18 19 23 620 23 23 19 21 0 0 0 0 0 0 1 0 0 0 0 19 20 23 626 23 23 23 19 0 0 0 0 0 0 0 1 0 0 0 20 21 27 620 23 23 23 23 0 0 0 0 0 0 0 0 1 0 0 21 22 26 588 27 23 23 23 0 0 0 0 0 0 0 0 0 1 0 22 23 17 566 26 27 23 23 0 0 0 0 0 0 0 0 0 0 1 23 24 24 557 17 26 27 23 0 0 0 0 0 0 0 0 0 0 0 24 25 26 561 24 17 26 27 1 0 0 0 0 0 0 0 0 0 0 25 26 24 549 26 24 17 26 0 1 0 0 0 0 0 0 0 0 0 26 27 27 532 24 26 24 17 0 0 1 0 0 0 0 0 0 0 0 27 28 27 526 27 24 26 24 0 0 0 1 0 0 0 0 0 0 0 28 29 26 511 27 27 24 26 0 0 0 0 1 0 0 0 0 0 0 29 30 24 499 26 27 27 24 0 0 0 0 0 1 0 0 0 0 0 30 31 23 555 24 26 27 27 0 0 0 0 0 0 1 0 0 0 0 31 32 23 565 23 24 26 27 0 0 0 0 0 0 0 1 0 0 0 32 33 24 542 23 23 24 26 0 0 0 0 0 0 0 0 1 0 0 33 34 17 527 24 23 23 24 0 0 0 0 0 0 0 0 0 1 0 34 35 21 510 17 24 23 23 0 0 0 0 0 0 0 0 0 0 1 35 36 19 514 21 17 24 23 0 0 0 0 0 0 0 0 0 0 0 36 37 22 517 19 21 17 24 1 0 0 0 0 0 0 0 0 0 0 37 38 22 508 22 19 21 17 0 1 0 0 0 0 0 0 0 0 0 38 39 18 493 22 22 19 21 0 0 1 0 0 0 0 0 0 0 0 39 40 16 490 18 22 22 19 0 0 0 1 0 0 0 0 0 0 0 40 41 14 469 16 18 22 22 0 0 0 0 1 0 0 0 0 0 0 41 42 12 478 14 16 18 22 0 0 0 0 0 1 0 0 0 0 0 42 43 14 528 12 14 16 18 0 0 0 0 0 0 1 0 0 0 0 43 44 16 534 14 12 14 16 0 0 0 0 0 0 0 1 0 0 0 44 45 8 518 16 14 12 14 0 0 0 0 0 0 0 0 1 0 0 45 46 3 506 8 16 14 12 0 0 0 0 0 0 0 0 0 1 0 46 47 0 502 3 8 16 14 0 0 0 0 0 0 0 0 0 0 1 47 48 5 516 0 3 8 16 0 0 0 0 0 0 0 0 0 0 0 48 49 1 528 5 0 3 8 1 0 0 0 0 0 0 0 0 0 0 49 50 1 533 1 5 0 3 0 1 0 0 0 0 0 0 0 0 0 50 51 3 536 1 1 5 0 0 0 1 0 0 0 0 0 0 0 0 51 52 6 537 3 1 1 5 0 0 0 1 0 0 0 0 0 0 0 52 53 7 524 6 3 1 1 0 0 0 0 1 0 0 0 0 0 0 53 54 8 536 7 6 3 1 0 0 0 0 0 1 0 0 0 0 0 54 55 14 587 8 7 6 3 0 0 0 0 0 0 1 0 0 0 0 55 56 14 597 14 8 7 6 0 0 0 0 0 0 0 1 0 0 0 56 57 13 581 14 14 8 7 0 0 0 0 0 0 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x y1 y2 y3 y4 -37.98113 0.06702 0.68292 0.11918 0.15051 0.08148 M1 M2 M3 M4 M5 M6 -1.58003 -2.61700 -2.23469 -3.49583 -1.40349 -2.27170 M7 M8 M9 M10 M11 t -3.62375 -5.63694 -4.37543 -6.46479 -4.23387 0.10973 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.5516 -1.8903 0.1422 2.0135 5.3885 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -37.98113 17.51813 -2.168 0.03631 * x 0.06702 0.02616 2.562 0.01438 * y1 0.68292 0.15477 4.413 7.83e-05 *** y2 0.11918 0.18824 0.633 0.53034 y3 0.15051 0.19169 0.785 0.43707 y4 0.08148 0.16312 0.499 0.62025 M1 -1.58003 2.33808 -0.676 0.50317 M2 -2.61700 2.40766 -1.087 0.28373 M3 -2.23469 2.33362 -0.958 0.34416 M4 -3.49583 2.23898 -1.561 0.12652 M5 -1.40349 2.28555 -0.614 0.54273 M6 -2.27170 2.26303 -1.004 0.32165 M7 -3.62375 2.39263 -1.515 0.13795 M8 -5.63694 2.42232 -2.327 0.02525 * M9 -4.37543 2.39563 -1.826 0.07545 . M10 -6.46479 2.33944 -2.763 0.00869 ** M11 -4.23387 2.37534 -1.782 0.08247 . t 0.10973 0.06531 1.680 0.10090 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.219 on 39 degrees of freedom Multiple R-squared: 0.869, Adjusted R-squared: 0.8119 F-statistic: 15.22 on 17 and 39 DF, p-value: 3.252e-12 > 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.1526818 0.3053637 0.8473182 [2,] 0.3890235 0.7780471 0.6109765 [3,] 0.5754356 0.8491289 0.4245644 [4,] 0.4700331 0.9400663 0.5299669 [5,] 0.5409254 0.9181491 0.4590746 [6,] 0.4392568 0.8785135 0.5607432 [7,] 0.6565211 0.6869577 0.3434789 [8,] 0.5939398 0.8121203 0.4060602 [9,] 0.4869008 0.9738016 0.5130992 [10,] 0.3639621 0.7279242 0.6360379 [11,] 0.4059547 0.8119094 0.5940453 [12,] 0.5883530 0.8232941 0.4116470 [13,] 0.4742351 0.9484703 0.5257649 [14,] 0.5339884 0.9320232 0.4660116 [15,] 0.4082206 0.8164413 0.5917794 [16,] 0.7199303 0.5601395 0.2800697 > postscript(file="/var/www/html/rcomp/tmp/1iu711258659112.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/2ejq11258659112.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/35j2k1258659112.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/4zylj1258659112.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/5hadr1258659112.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 = 57 Frequency = 1 1 2 3 4 5 6 7 2.3455001 2.2889736 -1.9899127 -4.6232395 -2.3630677 -0.6534843 -0.7486830 8 9 10 11 12 13 14 -3.5754439 3.7328374 2.0134574 5.3005620 1.6332341 -1.1751303 -3.3612128 15 16 17 18 19 20 21 -0.9430796 -1.8903180 1.7543100 0.1133730 -2.0514059 -0.9891661 1.7158050 22 23 24 25 26 27 28 2.1083804 -7.5516383 1.3713580 0.6903584 -0.3421627 4.1122895 2.9840578 29 30 31 32 33 34 35 0.5678191 0.5248637 -1.7453320 0.5597303 2.2316250 -2.1529057 5.3885208 36 37 38 39 40 41 42 -3.2710992 2.8593920 2.5476747 -1.3214903 0.4740771 -0.7224460 -0.3608870 43 44 45 46 47 48 49 1.7615746 4.5994172 -4.8397333 -1.9689321 -3.1374445 0.2665070 -4.7201203 50 51 52 53 54 55 56 -1.1332728 0.1421930 3.0554226 0.7633847 0.3761346 2.7838463 -0.5945375 57 -2.8405340 > postscript(file="/var/www/html/rcomp/tmp/63ti71258659112.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 2.3455001 NA 1 2.2889736 2.3455001 2 -1.9899127 2.2889736 3 -4.6232395 -1.9899127 4 -2.3630677 -4.6232395 5 -0.6534843 -2.3630677 6 -0.7486830 -0.6534843 7 -3.5754439 -0.7486830 8 3.7328374 -3.5754439 9 2.0134574 3.7328374 10 5.3005620 2.0134574 11 1.6332341 5.3005620 12 -1.1751303 1.6332341 13 -3.3612128 -1.1751303 14 -0.9430796 -3.3612128 15 -1.8903180 -0.9430796 16 1.7543100 -1.8903180 17 0.1133730 1.7543100 18 -2.0514059 0.1133730 19 -0.9891661 -2.0514059 20 1.7158050 -0.9891661 21 2.1083804 1.7158050 22 -7.5516383 2.1083804 23 1.3713580 -7.5516383 24 0.6903584 1.3713580 25 -0.3421627 0.6903584 26 4.1122895 -0.3421627 27 2.9840578 4.1122895 28 0.5678191 2.9840578 29 0.5248637 0.5678191 30 -1.7453320 0.5248637 31 0.5597303 -1.7453320 32 2.2316250 0.5597303 33 -2.1529057 2.2316250 34 5.3885208 -2.1529057 35 -3.2710992 5.3885208 36 2.8593920 -3.2710992 37 2.5476747 2.8593920 38 -1.3214903 2.5476747 39 0.4740771 -1.3214903 40 -0.7224460 0.4740771 41 -0.3608870 -0.7224460 42 1.7615746 -0.3608870 43 4.5994172 1.7615746 44 -4.8397333 4.5994172 45 -1.9689321 -4.8397333 46 -3.1374445 -1.9689321 47 0.2665070 -3.1374445 48 -4.7201203 0.2665070 49 -1.1332728 -4.7201203 50 0.1421930 -1.1332728 51 3.0554226 0.1421930 52 0.7633847 3.0554226 53 0.3761346 0.7633847 54 2.7838463 0.3761346 55 -0.5945375 2.7838463 56 -2.8405340 -0.5945375 57 NA -2.8405340 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.2889736 2.3455001 [2,] -1.9899127 2.2889736 [3,] -4.6232395 -1.9899127 [4,] -2.3630677 -4.6232395 [5,] -0.6534843 -2.3630677 [6,] -0.7486830 -0.6534843 [7,] -3.5754439 -0.7486830 [8,] 3.7328374 -3.5754439 [9,] 2.0134574 3.7328374 [10,] 5.3005620 2.0134574 [11,] 1.6332341 5.3005620 [12,] -1.1751303 1.6332341 [13,] -3.3612128 -1.1751303 [14,] -0.9430796 -3.3612128 [15,] -1.8903180 -0.9430796 [16,] 1.7543100 -1.8903180 [17,] 0.1133730 1.7543100 [18,] -2.0514059 0.1133730 [19,] -0.9891661 -2.0514059 [20,] 1.7158050 -0.9891661 [21,] 2.1083804 1.7158050 [22,] -7.5516383 2.1083804 [23,] 1.3713580 -7.5516383 [24,] 0.6903584 1.3713580 [25,] -0.3421627 0.6903584 [26,] 4.1122895 -0.3421627 [27,] 2.9840578 4.1122895 [28,] 0.5678191 2.9840578 [29,] 0.5248637 0.5678191 [30,] -1.7453320 0.5248637 [31,] 0.5597303 -1.7453320 [32,] 2.2316250 0.5597303 [33,] -2.1529057 2.2316250 [34,] 5.3885208 -2.1529057 [35,] -3.2710992 5.3885208 [36,] 2.8593920 -3.2710992 [37,] 2.5476747 2.8593920 [38,] -1.3214903 2.5476747 [39,] 0.4740771 -1.3214903 [40,] -0.7224460 0.4740771 [41,] -0.3608870 -0.7224460 [42,] 1.7615746 -0.3608870 [43,] 4.5994172 1.7615746 [44,] -4.8397333 4.5994172 [45,] -1.9689321 -4.8397333 [46,] -3.1374445 -1.9689321 [47,] 0.2665070 -3.1374445 [48,] -4.7201203 0.2665070 [49,] -1.1332728 -4.7201203 [50,] 0.1421930 -1.1332728 [51,] 3.0554226 0.1421930 [52,] 0.7633847 3.0554226 [53,] 0.3761346 0.7633847 [54,] 2.7838463 0.3761346 [55,] -0.5945375 2.7838463 [56,] -2.8405340 -0.5945375 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.2889736 2.3455001 2 -1.9899127 2.2889736 3 -4.6232395 -1.9899127 4 -2.3630677 -4.6232395 5 -0.6534843 -2.3630677 6 -0.7486830 -0.6534843 7 -3.5754439 -0.7486830 8 3.7328374 -3.5754439 9 2.0134574 3.7328374 10 5.3005620 2.0134574 11 1.6332341 5.3005620 12 -1.1751303 1.6332341 13 -3.3612128 -1.1751303 14 -0.9430796 -3.3612128 15 -1.8903180 -0.9430796 16 1.7543100 -1.8903180 17 0.1133730 1.7543100 18 -2.0514059 0.1133730 19 -0.9891661 -2.0514059 20 1.7158050 -0.9891661 21 2.1083804 1.7158050 22 -7.5516383 2.1083804 23 1.3713580 -7.5516383 24 0.6903584 1.3713580 25 -0.3421627 0.6903584 26 4.1122895 -0.3421627 27 2.9840578 4.1122895 28 0.5678191 2.9840578 29 0.5248637 0.5678191 30 -1.7453320 0.5248637 31 0.5597303 -1.7453320 32 2.2316250 0.5597303 33 -2.1529057 2.2316250 34 5.3885208 -2.1529057 35 -3.2710992 5.3885208 36 2.8593920 -3.2710992 37 2.5476747 2.8593920 38 -1.3214903 2.5476747 39 0.4740771 -1.3214903 40 -0.7224460 0.4740771 41 -0.3608870 -0.7224460 42 1.7615746 -0.3608870 43 4.5994172 1.7615746 44 -4.8397333 4.5994172 45 -1.9689321 -4.8397333 46 -3.1374445 -1.9689321 47 0.2665070 -3.1374445 48 -4.7201203 0.2665070 49 -1.1332728 -4.7201203 50 0.1421930 -1.1332728 51 3.0554226 0.1421930 52 0.7633847 3.0554226 53 0.3761346 0.7633847 54 2.7838463 0.3761346 55 -0.5945375 2.7838463 56 -2.8405340 -0.5945375 > 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/7nh8t1258659112.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/87mf11258659112.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/9ulnb1258659112.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/10q0371258659112.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/11mmzw1258659112.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/12rsl21258659112.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/13o3031258659112.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/14v3im1258659112.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/15j9j11258659112.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/16qz1n1258659112.tab") + } > > system("convert tmp/1iu711258659112.ps tmp/1iu711258659112.png") > system("convert tmp/2ejq11258659112.ps tmp/2ejq11258659112.png") > system("convert tmp/35j2k1258659112.ps tmp/35j2k1258659112.png") > system("convert tmp/4zylj1258659112.ps tmp/4zylj1258659112.png") > system("convert tmp/5hadr1258659112.ps tmp/5hadr1258659112.png") > system("convert tmp/63ti71258659112.ps tmp/63ti71258659112.png") > system("convert tmp/7nh8t1258659112.ps tmp/7nh8t1258659112.png") > system("convert tmp/87mf11258659112.ps tmp/87mf11258659112.png") > system("convert tmp/9ulnb1258659112.ps tmp/9ulnb1258659112.png") > system("convert tmp/10q0371258659112.ps tmp/10q0371258659112.png") > > > proc.time() user system elapsed 2.335 1.525 2.748