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(461 + ,1870 + ,455 + ,462 + ,461 + ,2263 + ,461 + ,455 + ,463 + ,1802 + ,461 + ,461 + ,462 + ,1863 + ,463 + ,461 + ,456 + ,1989 + ,462 + ,463 + ,455 + ,2197 + ,456 + ,462 + ,456 + ,2409 + ,455 + ,456 + ,472 + ,2502 + ,456 + ,455 + ,472 + ,2593 + ,472 + ,456 + ,471 + ,2598 + ,472 + ,472 + ,465 + ,2053 + ,471 + ,472 + ,459 + ,2213 + ,465 + ,471 + ,465 + ,2238 + ,459 + ,465 + ,468 + ,2359 + ,465 + ,459 + ,467 + ,2151 + ,468 + ,465 + ,463 + ,2474 + ,467 + ,468 + ,460 + ,3079 + ,463 + ,467 + ,462 + ,2312 + ,460 + ,463 + ,461 + ,2565 + ,462 + ,460 + ,476 + ,1972 + ,461 + ,462 + ,476 + ,2484 + ,476 + ,461 + ,471 + ,2202 + ,476 + ,476 + ,453 + ,2151 + ,471 + ,476 + ,443 + ,1976 + ,453 + ,471 + ,442 + ,2012 + ,443 + ,453 + ,444 + ,2114 + ,442 + ,443 + ,438 + ,1772 + ,444 + ,442 + ,427 + ,1957 + ,438 + ,444 + ,424 + ,2070 + ,427 + ,438 + ,416 + ,1990 + ,424 + ,427 + ,406 + ,2182 + ,416 + ,424 + ,431 + ,2008 + ,406 + ,416 + ,434 + ,1916 + ,431 + ,406 + ,418 + ,2397 + ,434 + ,431 + ,412 + ,2114 + ,418 + ,434 + ,404 + ,1778 + ,412 + ,418 + ,409 + ,1641 + ,404 + ,412 + ,412 + ,2186 + ,409 + ,404 + ,406 + ,1773 + ,412 + ,409 + ,398 + ,1785 + ,406 + ,412 + ,397 + ,2217 + ,398 + ,406 + ,385 + ,2153 + ,397 + ,398 + ,390 + ,1895 + ,385 + ,397 + ,413 + ,2475 + ,390 + ,385 + ,413 + ,1793 + ,413 + ,390 + ,401 + ,2308 + ,413 + ,413 + ,397 + ,2051 + ,401 + ,413 + ,397 + ,1898 + ,397 + ,401 + ,409 + ,2142 + ,397 + ,397 + ,419 + ,1874 + ,409 + ,397 + ,424 + ,1560 + ,419 + ,409 + ,428 + ,1808 + ,424 + ,419 + ,430 + ,1575 + ,428 + ,424 + ,424 + ,1525 + ,430 + ,428 + ,433 + ,1997 + ,424 + ,430 + ,456 + ,1753 + ,433 + ,424 + ,459 + ,1623 + ,456 + ,433 + ,446 + ,2251 + ,459 + ,456 + ,441 + ,1890 + ,446 + ,459) + ,dim=c(4 + ,59) + ,dimnames=list(c('wkl' + ,'bvg' + ,'Y1' + ,'Y2') + ,1:59)) > y <- array(NA,dim=c(4,59),dimnames=list(c('wkl','bvg','Y1','Y2'),1:59)) > 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 wkl bvg Y1 Y2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 461 1870 455 462 1 0 0 0 0 0 0 0 0 0 0 1 2 461 2263 461 455 0 1 0 0 0 0 0 0 0 0 0 2 3 463 1802 461 461 0 0 1 0 0 0 0 0 0 0 0 3 4 462 1863 463 461 0 0 0 1 0 0 0 0 0 0 0 4 5 456 1989 462 463 0 0 0 0 1 0 0 0 0 0 0 5 6 455 2197 456 462 0 0 0 0 0 1 0 0 0 0 0 6 7 456 2409 455 456 0 0 0 0 0 0 1 0 0 0 0 7 8 472 2502 456 455 0 0 0 0 0 0 0 1 0 0 0 8 9 472 2593 472 456 0 0 0 0 0 0 0 0 1 0 0 9 10 471 2598 472 472 0 0 0 0 0 0 0 0 0 1 0 10 11 465 2053 471 472 0 0 0 0 0 0 0 0 0 0 1 11 12 459 2213 465 471 0 0 0 0 0 0 0 0 0 0 0 12 13 465 2238 459 465 1 0 0 0 0 0 0 0 0 0 0 13 14 468 2359 465 459 0 1 0 0 0 0 0 0 0 0 0 14 15 467 2151 468 465 0 0 1 0 0 0 0 0 0 0 0 15 16 463 2474 467 468 0 0 0 1 0 0 0 0 0 0 0 16 17 460 3079 463 467 0 0 0 0 1 0 0 0 0 0 0 17 18 462 2312 460 463 0 0 0 0 0 1 0 0 0 0 0 18 19 461 2565 462 460 0 0 0 0 0 0 1 0 0 0 0 19 20 476 1972 461 462 0 0 0 0 0 0 0 1 0 0 0 20 21 476 2484 476 461 0 0 0 0 0 0 0 0 1 0 0 21 22 471 2202 476 476 0 0 0 0 0 0 0 0 0 1 0 22 23 453 2151 471 476 0 0 0 0 0 0 0 0 0 0 1 23 24 443 1976 453 471 0 0 0 0 0 0 0 0 0 0 0 24 25 442 2012 443 453 1 0 0 0 0 0 0 0 0 0 0 25 26 444 2114 442 443 0 1 0 0 0 0 0 0 0 0 0 26 27 438 1772 444 442 0 0 1 0 0 0 0 0 0 0 0 27 28 427 1957 438 444 0 0 0 1 0 0 0 0 0 0 0 28 29 424 2070 427 438 0 0 0 0 1 0 0 0 0 0 0 29 30 416 1990 424 427 0 0 0 0 0 1 0 0 0 0 0 30 31 406 2182 416 424 0 0 0 0 0 0 1 0 0 0 0 31 32 431 2008 406 416 0 0 0 0 0 0 0 1 0 0 0 32 33 434 1916 431 406 0 0 0 0 0 0 0 0 1 0 0 33 34 418 2397 434 431 0 0 0 0 0 0 0 0 0 1 0 34 35 412 2114 418 434 0 0 0 0 0 0 0 0 0 0 1 35 36 404 1778 412 418 0 0 0 0 0 0 0 0 0 0 0 36 37 409 1641 404 412 1 0 0 0 0 0 0 0 0 0 0 37 38 412 2186 409 404 0 1 0 0 0 0 0 0 0 0 0 38 39 406 1773 412 409 0 0 1 0 0 0 0 0 0 0 0 39 40 398 1785 406 412 0 0 0 1 0 0 0 0 0 0 0 40 41 397 2217 398 406 0 0 0 0 1 0 0 0 0 0 0 41 42 385 2153 397 398 0 0 0 0 0 1 0 0 0 0 0 42 43 390 1895 385 397 0 0 0 0 0 0 1 0 0 0 0 43 44 413 2475 390 385 0 0 0 0 0 0 0 1 0 0 0 44 45 413 1793 413 390 0 0 0 0 0 0 0 0 1 0 0 45 46 401 2308 413 413 0 0 0 0 0 0 0 0 0 1 0 46 47 397 2051 401 413 0 0 0 0 0 0 0 0 0 0 1 47 48 397 1898 397 401 0 0 0 0 0 0 0 0 0 0 0 48 49 409 2142 397 397 1 0 0 0 0 0 0 0 0 0 0 49 50 419 1874 409 397 0 1 0 0 0 0 0 0 0 0 0 50 51 424 1560 419 409 0 0 1 0 0 0 0 0 0 0 0 51 52 428 1808 424 419 0 0 0 1 0 0 0 0 0 0 0 52 53 430 1575 428 424 0 0 0 0 1 0 0 0 0 0 0 53 54 424 1525 430 428 0 0 0 0 0 1 0 0 0 0 0 54 55 433 1997 424 430 0 0 0 0 0 0 1 0 0 0 0 55 56 456 1753 433 424 0 0 0 0 0 0 0 1 0 0 0 56 57 459 1623 456 433 0 0 0 0 0 0 0 0 1 0 0 57 58 446 2251 459 456 0 0 0 0 0 0 0 0 0 1 0 58 59 441 1890 446 459 0 0 0 0 0 0 0 0 0 0 1 59 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) bvg Y1 Y2 M1 M2 -4.0121588 -0.0002801 1.1548015 -0.1579077 11.4480705 7.6106411 M3 M4 M5 M6 M7 M8 2.9987317 0.9578624 3.2044692 0.0296764 6.2635413 24.8896854 M9 M10 M11 t 2.5996572 -4.9308674 -1.8116497 0.0415409 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.3725 -2.8647 0.3459 3.1596 9.7215 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -4.0121588 20.4546208 -0.196 0.84542 bvg -0.0002801 0.0030063 -0.093 0.92620 Y1 1.1548015 0.1509836 7.649 1.50e-09 *** Y2 -0.1579077 0.1569175 -1.006 0.31990 M1 11.4480705 3.4317278 3.336 0.00176 ** M2 7.6106411 4.0994681 1.856 0.07024 . M3 2.9987317 3.8983248 0.769 0.44596 M4 0.9578624 3.5679714 0.268 0.78963 M5 3.2044692 3.5201169 0.910 0.36772 M6 0.0296764 3.5321603 0.008 0.99334 M7 6.2635413 3.5229851 1.778 0.08249 . M8 24.8896854 3.7395345 6.656 4.06e-08 *** M9 2.5996572 5.5509703 0.468 0.64192 M10 -4.9308674 3.9498668 -1.248 0.21865 M11 -1.8116497 3.4815306 -0.520 0.60548 t 0.0415409 0.0673180 0.617 0.54043 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.048 on 43 degrees of freedom Multiple R-squared: 0.9728, Adjusted R-squared: 0.9634 F-statistic: 102.7 on 15 and 43 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.0117706822 0.023541364 0.988229318 [2,] 0.0022613514 0.004522703 0.997738649 [3,] 0.0005171232 0.001034246 0.999482877 [4,] 0.0190381692 0.038076338 0.980961831 [5,] 0.3100823309 0.620164662 0.689917669 [6,] 0.2294768874 0.458953775 0.770523113 [7,] 0.1750893664 0.350178733 0.824910634 [8,] 0.1920543712 0.384108742 0.807945629 [9,] 0.1542290451 0.308458090 0.845770955 [10,] 0.1128400686 0.225680137 0.887159931 [11,] 0.1524158795 0.304831759 0.847584120 [12,] 0.1736818658 0.347363732 0.826318134 [13,] 0.3561647622 0.712329524 0.643835238 [14,] 0.9564077371 0.087184526 0.043592263 [15,] 0.9562470989 0.087505802 0.043752901 [16,] 0.9583909648 0.083218070 0.041609035 [17,] 0.9838071589 0.032385682 0.016192841 [18,] 0.9650010548 0.069997890 0.034998945 [19,] 0.9704613332 0.059077334 0.029538667 [20,] 0.9862474218 0.027505156 0.013752578 [21,] 0.9927653287 0.014469343 0.007234671 [22,] 0.9696938941 0.060612212 0.030306106 > postscript(file="/var/www/html/rcomp/tmp/1hzav1258745870.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/2kwib1258745870.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/34d2h1258745870.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/4ndjy1258745870.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/5twyv1258745870.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 = 59 Frequency = 1 1 2 3 4 5 6 1.56501188 -2.56317935 4.82550471 3.53231676 -3.24992026 5.71249582 7 8 9 10 11 12 0.70382876 -3.25051523 0.70454552 9.72145257 1.56283576 0.52536408 13 14 15 16 17 18 1.02411843 -0.02235495 0.97279233 0.69112066 0.03373766 7.78491928 19 20 21 22 23 24 -2.20294478 -4.56611795 0.34585512 5.12446303 -10.27657358 -2.18189459 25 26 27 28 29 30 -5.95574510 -0.55556070 -4.54850033 -6.25272726 0.24614797 -2.91558880 31 32 33 34 35 36 -10.37252446 6.19580514 0.96940782 -6.92358839 2.78692918 -2.75809201 37 38 39 40 41 42 -0.99511240 -1.08383313 -5.30401601 -3.89879423 1.22503146 -7.76810356 43 44 45 46 47 48 4.58393282 1.40981177 -2.30363210 -3.03851540 3.58635596 4.41462252 49 50 51 52 53 54 4.36172718 4.22492814 4.05421929 5.92808407 1.74500317 -2.81372274 55 56 57 58 59 7.28770766 0.21101627 0.28382363 -4.88381181 2.34045268 > postscript(file="/var/www/html/rcomp/tmp/6tjj11258745870.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 = 59 Frequency = 1 lag(myerror, k = 1) myerror 0 1.56501188 NA 1 -2.56317935 1.56501188 2 4.82550471 -2.56317935 3 3.53231676 4.82550471 4 -3.24992026 3.53231676 5 5.71249582 -3.24992026 6 0.70382876 5.71249582 7 -3.25051523 0.70382876 8 0.70454552 -3.25051523 9 9.72145257 0.70454552 10 1.56283576 9.72145257 11 0.52536408 1.56283576 12 1.02411843 0.52536408 13 -0.02235495 1.02411843 14 0.97279233 -0.02235495 15 0.69112066 0.97279233 16 0.03373766 0.69112066 17 7.78491928 0.03373766 18 -2.20294478 7.78491928 19 -4.56611795 -2.20294478 20 0.34585512 -4.56611795 21 5.12446303 0.34585512 22 -10.27657358 5.12446303 23 -2.18189459 -10.27657358 24 -5.95574510 -2.18189459 25 -0.55556070 -5.95574510 26 -4.54850033 -0.55556070 27 -6.25272726 -4.54850033 28 0.24614797 -6.25272726 29 -2.91558880 0.24614797 30 -10.37252446 -2.91558880 31 6.19580514 -10.37252446 32 0.96940782 6.19580514 33 -6.92358839 0.96940782 34 2.78692918 -6.92358839 35 -2.75809201 2.78692918 36 -0.99511240 -2.75809201 37 -1.08383313 -0.99511240 38 -5.30401601 -1.08383313 39 -3.89879423 -5.30401601 40 1.22503146 -3.89879423 41 -7.76810356 1.22503146 42 4.58393282 -7.76810356 43 1.40981177 4.58393282 44 -2.30363210 1.40981177 45 -3.03851540 -2.30363210 46 3.58635596 -3.03851540 47 4.41462252 3.58635596 48 4.36172718 4.41462252 49 4.22492814 4.36172718 50 4.05421929 4.22492814 51 5.92808407 4.05421929 52 1.74500317 5.92808407 53 -2.81372274 1.74500317 54 7.28770766 -2.81372274 55 0.21101627 7.28770766 56 0.28382363 0.21101627 57 -4.88381181 0.28382363 58 2.34045268 -4.88381181 59 NA 2.34045268 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.56317935 1.56501188 [2,] 4.82550471 -2.56317935 [3,] 3.53231676 4.82550471 [4,] -3.24992026 3.53231676 [5,] 5.71249582 -3.24992026 [6,] 0.70382876 5.71249582 [7,] -3.25051523 0.70382876 [8,] 0.70454552 -3.25051523 [9,] 9.72145257 0.70454552 [10,] 1.56283576 9.72145257 [11,] 0.52536408 1.56283576 [12,] 1.02411843 0.52536408 [13,] -0.02235495 1.02411843 [14,] 0.97279233 -0.02235495 [15,] 0.69112066 0.97279233 [16,] 0.03373766 0.69112066 [17,] 7.78491928 0.03373766 [18,] -2.20294478 7.78491928 [19,] -4.56611795 -2.20294478 [20,] 0.34585512 -4.56611795 [21,] 5.12446303 0.34585512 [22,] -10.27657358 5.12446303 [23,] -2.18189459 -10.27657358 [24,] -5.95574510 -2.18189459 [25,] -0.55556070 -5.95574510 [26,] -4.54850033 -0.55556070 [27,] -6.25272726 -4.54850033 [28,] 0.24614797 -6.25272726 [29,] -2.91558880 0.24614797 [30,] -10.37252446 -2.91558880 [31,] 6.19580514 -10.37252446 [32,] 0.96940782 6.19580514 [33,] -6.92358839 0.96940782 [34,] 2.78692918 -6.92358839 [35,] -2.75809201 2.78692918 [36,] -0.99511240 -2.75809201 [37,] -1.08383313 -0.99511240 [38,] -5.30401601 -1.08383313 [39,] -3.89879423 -5.30401601 [40,] 1.22503146 -3.89879423 [41,] -7.76810356 1.22503146 [42,] 4.58393282 -7.76810356 [43,] 1.40981177 4.58393282 [44,] -2.30363210 1.40981177 [45,] -3.03851540 -2.30363210 [46,] 3.58635596 -3.03851540 [47,] 4.41462252 3.58635596 [48,] 4.36172718 4.41462252 [49,] 4.22492814 4.36172718 [50,] 4.05421929 4.22492814 [51,] 5.92808407 4.05421929 [52,] 1.74500317 5.92808407 [53,] -2.81372274 1.74500317 [54,] 7.28770766 -2.81372274 [55,] 0.21101627 7.28770766 [56,] 0.28382363 0.21101627 [57,] -4.88381181 0.28382363 [58,] 2.34045268 -4.88381181 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.56317935 1.56501188 2 4.82550471 -2.56317935 3 3.53231676 4.82550471 4 -3.24992026 3.53231676 5 5.71249582 -3.24992026 6 0.70382876 5.71249582 7 -3.25051523 0.70382876 8 0.70454552 -3.25051523 9 9.72145257 0.70454552 10 1.56283576 9.72145257 11 0.52536408 1.56283576 12 1.02411843 0.52536408 13 -0.02235495 1.02411843 14 0.97279233 -0.02235495 15 0.69112066 0.97279233 16 0.03373766 0.69112066 17 7.78491928 0.03373766 18 -2.20294478 7.78491928 19 -4.56611795 -2.20294478 20 0.34585512 -4.56611795 21 5.12446303 0.34585512 22 -10.27657358 5.12446303 23 -2.18189459 -10.27657358 24 -5.95574510 -2.18189459 25 -0.55556070 -5.95574510 26 -4.54850033 -0.55556070 27 -6.25272726 -4.54850033 28 0.24614797 -6.25272726 29 -2.91558880 0.24614797 30 -10.37252446 -2.91558880 31 6.19580514 -10.37252446 32 0.96940782 6.19580514 33 -6.92358839 0.96940782 34 2.78692918 -6.92358839 35 -2.75809201 2.78692918 36 -0.99511240 -2.75809201 37 -1.08383313 -0.99511240 38 -5.30401601 -1.08383313 39 -3.89879423 -5.30401601 40 1.22503146 -3.89879423 41 -7.76810356 1.22503146 42 4.58393282 -7.76810356 43 1.40981177 4.58393282 44 -2.30363210 1.40981177 45 -3.03851540 -2.30363210 46 3.58635596 -3.03851540 47 4.41462252 3.58635596 48 4.36172718 4.41462252 49 4.22492814 4.36172718 50 4.05421929 4.22492814 51 5.92808407 4.05421929 52 1.74500317 5.92808407 53 -2.81372274 1.74500317 54 7.28770766 -2.81372274 55 0.21101627 7.28770766 56 0.28382363 0.21101627 57 -4.88381181 0.28382363 58 2.34045268 -4.88381181 > 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/7w4fi1258745870.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/8kzqc1258745870.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/9bpxp1258745870.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/10wv8k1258745870.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/11w48e1258745870.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/12s0us1258745870.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/13lu011258745870.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/14t2zs1258745870.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/154k681258745870.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/16xj9y1258745870.tab") + } > > system("convert tmp/1hzav1258745870.ps tmp/1hzav1258745870.png") > system("convert tmp/2kwib1258745870.ps tmp/2kwib1258745870.png") > system("convert tmp/34d2h1258745870.ps tmp/34d2h1258745870.png") > system("convert tmp/4ndjy1258745870.ps tmp/4ndjy1258745870.png") > system("convert tmp/5twyv1258745870.ps tmp/5twyv1258745870.png") > system("convert tmp/6tjj11258745870.ps tmp/6tjj11258745870.png") > system("convert tmp/7w4fi1258745870.ps tmp/7w4fi1258745870.png") > system("convert tmp/8kzqc1258745870.ps tmp/8kzqc1258745870.png") > system("convert tmp/9bpxp1258745870.ps tmp/9bpxp1258745870.png") > system("convert tmp/10wv8k1258745870.ps tmp/10wv8k1258745870.png") > > > proc.time() user system elapsed 2.387 1.576 2.766