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(8.4,420,8.4,418,8.4,410,8.6,418,8.9,426,8.8,428,8.3,430,7.5,424,7.2,423,7.4,427,8.8,441,9.3,449,9.3,452,8.7,462,8.2,455,8.3,461,8.5,461,8.6,463,8.5,462,8.2,456,8.1,455,7.9,456,8.6,472,8.7,472,8.7,471,8.5,465,8.4,459,8.5,465,8.7,468,8.7,467,8.6,463,8.5,460,8.3,462,8.00,461,8.2,476,8.1,476,8.1,471,8.00,453,7.9,443,7.9,442,8.00,444,8.00,438,7.9,427,8.00,424,7.7,416,7.2,406,7.5,431,7.3,434,7.00,418,7.00,412,7.00,404,7.2,409,7.3,412,7.1,406,6.8,398,6.4,397,6.1,385,6.5,390,7.7,413,7.9,413,7.5,401,6.9,397,6.6,397,6.9,409,7.7,419,8.00,424,8.00,428,7.7,430,7.3,424,7.4,433,8.1,456,8.3,459,8.2,446),dim=c(2,73),dimnames=list(c('wgb','nwwz'),1:73)) > y <- array(NA,dim=c(2,73),dimnames=list(c('wgb','nwwz'),1:73)) > 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 = '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 wgb nwwz M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 8.4 420 1 0 0 0 0 0 0 0 0 0 0 2 8.4 418 0 1 0 0 0 0 0 0 0 0 0 3 8.4 410 0 0 1 0 0 0 0 0 0 0 0 4 8.6 418 0 0 0 1 0 0 0 0 0 0 0 5 8.9 426 0 0 0 0 1 0 0 0 0 0 0 6 8.8 428 0 0 0 0 0 1 0 0 0 0 0 7 8.3 430 0 0 0 0 0 0 1 0 0 0 0 8 7.5 424 0 0 0 0 0 0 0 1 0 0 0 9 7.2 423 0 0 0 0 0 0 0 0 1 0 0 10 7.4 427 0 0 0 0 0 0 0 0 0 1 0 11 8.8 441 0 0 0 0 0 0 0 0 0 0 1 12 9.3 449 0 0 0 0 0 0 0 0 0 0 0 13 9.3 452 1 0 0 0 0 0 0 0 0 0 0 14 8.7 462 0 1 0 0 0 0 0 0 0 0 0 15 8.2 455 0 0 1 0 0 0 0 0 0 0 0 16 8.3 461 0 0 0 1 0 0 0 0 0 0 0 17 8.5 461 0 0 0 0 1 0 0 0 0 0 0 18 8.6 463 0 0 0 0 0 1 0 0 0 0 0 19 8.5 462 0 0 0 0 0 0 1 0 0 0 0 20 8.2 456 0 0 0 0 0 0 0 1 0 0 0 21 8.1 455 0 0 0 0 0 0 0 0 1 0 0 22 7.9 456 0 0 0 0 0 0 0 0 0 1 0 23 8.6 472 0 0 0 0 0 0 0 0 0 0 1 24 8.7 472 0 0 0 0 0 0 0 0 0 0 0 25 8.7 471 1 0 0 0 0 0 0 0 0 0 0 26 8.5 465 0 1 0 0 0 0 0 0 0 0 0 27 8.4 459 0 0 1 0 0 0 0 0 0 0 0 28 8.5 465 0 0 0 1 0 0 0 0 0 0 0 29 8.7 468 0 0 0 0 1 0 0 0 0 0 0 30 8.7 467 0 0 0 0 0 1 0 0 0 0 0 31 8.6 463 0 0 0 0 0 0 1 0 0 0 0 32 8.5 460 0 0 0 0 0 0 0 1 0 0 0 33 8.3 462 0 0 0 0 0 0 0 0 1 0 0 34 8.0 461 0 0 0 0 0 0 0 0 0 1 0 35 8.2 476 0 0 0 0 0 0 0 0 0 0 1 36 8.1 476 0 0 0 0 0 0 0 0 0 0 0 37 8.1 471 1 0 0 0 0 0 0 0 0 0 0 38 8.0 453 0 1 0 0 0 0 0 0 0 0 0 39 7.9 443 0 0 1 0 0 0 0 0 0 0 0 40 7.9 442 0 0 0 1 0 0 0 0 0 0 0 41 8.0 444 0 0 0 0 1 0 0 0 0 0 0 42 8.0 438 0 0 0 0 0 1 0 0 0 0 0 43 7.9 427 0 0 0 0 0 0 1 0 0 0 0 44 8.0 424 0 0 0 0 0 0 0 1 0 0 0 45 7.7 416 0 0 0 0 0 0 0 0 1 0 0 46 7.2 406 0 0 0 0 0 0 0 0 0 1 0 47 7.5 431 0 0 0 0 0 0 0 0 0 0 1 48 7.3 434 0 0 0 0 0 0 0 0 0 0 0 49 7.0 418 1 0 0 0 0 0 0 0 0 0 0 50 7.0 412 0 1 0 0 0 0 0 0 0 0 0 51 7.0 404 0 0 1 0 0 0 0 0 0 0 0 52 7.2 409 0 0 0 1 0 0 0 0 0 0 0 53 7.3 412 0 0 0 0 1 0 0 0 0 0 0 54 7.1 406 0 0 0 0 0 1 0 0 0 0 0 55 6.8 398 0 0 0 0 0 0 1 0 0 0 0 56 6.4 397 0 0 0 0 0 0 0 1 0 0 0 57 6.1 385 0 0 0 0 0 0 0 0 1 0 0 58 6.5 390 0 0 0 0 0 0 0 0 0 1 0 59 7.7 413 0 0 0 0 0 0 0 0 0 0 1 60 7.9 413 0 0 0 0 0 0 0 0 0 0 0 61 7.5 401 1 0 0 0 0 0 0 0 0 0 0 62 6.9 397 0 1 0 0 0 0 0 0 0 0 0 63 6.6 397 0 0 1 0 0 0 0 0 0 0 0 64 6.9 409 0 0 0 1 0 0 0 0 0 0 0 65 7.7 419 0 0 0 0 1 0 0 0 0 0 0 66 8.0 424 0 0 0 0 0 1 0 0 0 0 0 67 8.0 428 0 0 0 0 0 0 1 0 0 0 0 68 7.7 430 0 0 0 0 0 0 0 1 0 0 0 69 7.3 424 0 0 0 0 0 0 0 0 1 0 0 70 7.4 433 0 0 0 0 0 0 0 0 0 1 0 71 8.1 456 0 0 0 0 0 0 0 0 0 0 1 72 8.3 459 0 0 0 0 0 0 0 0 0 0 0 73 8.2 446 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) nwwz M1 M2 M3 M4 -0.65424 0.01980 0.11551 -0.03316 -0.07112 -0.03993 M5 M6 M7 M8 M9 M10 0.15759 0.18746 0.06354 -0.18036 -0.36122 -0.43762 M11 -0.07046 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.7386 -0.2066 -0.0708 0.1153 1.0630 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.654243 1.062980 -0.615 0.541 nwwz 0.019802 0.002321 8.531 6.12e-12 *** M1 0.115514 0.261117 0.442 0.660 M2 -0.033164 0.272303 -0.122 0.903 M3 -0.071116 0.274768 -0.259 0.797 M4 -0.039930 0.272464 -0.147 0.884 M5 0.157594 0.271233 0.581 0.563 M6 0.187462 0.271398 0.691 0.492 M7 0.063535 0.272251 0.233 0.816 M8 -0.180358 0.273216 -0.660 0.512 M9 -0.361215 0.274991 -1.314 0.194 M10 -0.437618 0.274407 -1.595 0.116 M11 -0.070461 0.269813 -0.261 0.795 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4672 on 60 degrees of freedom Multiple R-squared: 0.6233, Adjusted R-squared: 0.548 F-statistic: 8.274 on 12 and 60 DF, p-value: 6.42e-09 > 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.8634651 0.2730697 0.13653486 [2,] 0.8410576 0.3178848 0.15894240 [3,] 0.7596057 0.4807886 0.24039429 [4,] 0.6653176 0.6693648 0.33468240 [5,] 0.7342508 0.5314985 0.26574924 [6,] 0.8245773 0.3508453 0.17542265 [7,] 0.7815998 0.4368003 0.21840017 [8,] 0.7349756 0.5300488 0.26502438 [9,] 0.7770297 0.4459406 0.22297030 [10,] 0.7264104 0.5471791 0.27358955 [11,] 0.6579109 0.6841782 0.34208912 [12,] 0.5860933 0.8278133 0.41390666 [13,] 0.5060760 0.9878480 0.49392401 [14,] 0.4225449 0.8450899 0.57745505 [15,] 0.3406375 0.6812749 0.65936254 [16,] 0.2741937 0.5483874 0.72580632 [17,] 0.3209854 0.6419707 0.67901464 [18,] 0.3457627 0.6915254 0.65423728 [19,] 0.2893871 0.5787742 0.71061291 [20,] 0.3319861 0.6639722 0.66801389 [21,] 0.5432299 0.9135402 0.45677012 [22,] 0.6687863 0.6624274 0.33121368 [23,] 0.6489981 0.7020037 0.35100187 [24,] 0.6066794 0.7866412 0.39332062 [25,] 0.5817830 0.8364340 0.41821700 [26,] 0.5830078 0.8339843 0.41699217 [27,] 0.5682723 0.8634554 0.43172770 [28,] 0.5235858 0.9528284 0.47641421 [29,] 0.5593329 0.8813342 0.44066708 [30,] 0.6248949 0.7502102 0.37510509 [31,] 0.5979464 0.8041073 0.40205363 [32,] 0.6279062 0.7441877 0.37209384 [33,] 0.8229454 0.3541093 0.17705464 [34,] 0.9407805 0.1184390 0.05921952 [35,] 0.9313404 0.1373192 0.06865962 [36,] 0.9087524 0.1824951 0.09124756 [37,] 0.8765331 0.2469338 0.12346690 [38,] 0.8290003 0.3419994 0.17099971 [39,] 0.8195529 0.3608942 0.18044712 [40,] 0.8319535 0.3360929 0.16804647 [41,] 0.8979652 0.2040697 0.10203484 [42,] 0.9492483 0.1015035 0.05075174 > postscript(file="/var/www/html/rcomp/tmp/10uz11258623759.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/28vr41258623759.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/3i8pc1258623759.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/4idft1258623759.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/5u6cw1258623759.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 = 73 Frequency = 1 1 2 3 4 5 6 0.621787354 0.810070308 1.006440336 1.016835854 0.960894304 0.791421662 7 8 9 10 11 12 0.375743791 -0.061549113 -0.160889916 0.036304108 0.791916060 1.063036695 13 14 15 16 17 18 0.888115647 0.238771710 -0.084660503 -0.134660503 -0.132184126 -0.101656769 19 20 21 22 23 24 -0.057927917 0.004779179 0.105438376 -0.037960877 -0.021953407 0.007585155 25 26 27 28 29 30 -0.088126930 -0.020635013 0.036130533 -0.013869467 -0.070799812 -0.080865732 31 32 33 34 35 36 0.022269842 0.225570216 0.166822690 -0.036972081 -0.501162371 -0.671623809 37 38 39 40 41 42 -0.688126930 -0.283008123 -0.147033613 -0.158417927 -0.295546032 -0.206600747 43 44 45 46 47 48 0.035150513 0.438450887 0.477725770 0.252151166 -0.310061532 -0.639929692 49 50 51 52 53 54 -0.738608164 -0.471116247 -0.274746219 -0.204943978 -0.361874324 -0.472929039 55 56 57 58 59 60 -0.490584502 -0.626888610 -0.508404763 -0.131012980 0.246378804 0.375917366 61 62 63 64 65 66 0.098029931 -0.274082634 -0.536130533 -0.504943978 -0.100490010 0.070630625 67 68 69 70 71 72 0.115348272 0.019637442 -0.080692157 -0.082509337 -0.205117553 -0.134985714 73 -0.093070908 > postscript(file="/var/www/html/rcomp/tmp/6aq8p1258623759.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 = 73 Frequency = 1 lag(myerror, k = 1) myerror 0 0.621787354 NA 1 0.810070308 0.621787354 2 1.006440336 0.810070308 3 1.016835854 1.006440336 4 0.960894304 1.016835854 5 0.791421662 0.960894304 6 0.375743791 0.791421662 7 -0.061549113 0.375743791 8 -0.160889916 -0.061549113 9 0.036304108 -0.160889916 10 0.791916060 0.036304108 11 1.063036695 0.791916060 12 0.888115647 1.063036695 13 0.238771710 0.888115647 14 -0.084660503 0.238771710 15 -0.134660503 -0.084660503 16 -0.132184126 -0.134660503 17 -0.101656769 -0.132184126 18 -0.057927917 -0.101656769 19 0.004779179 -0.057927917 20 0.105438376 0.004779179 21 -0.037960877 0.105438376 22 -0.021953407 -0.037960877 23 0.007585155 -0.021953407 24 -0.088126930 0.007585155 25 -0.020635013 -0.088126930 26 0.036130533 -0.020635013 27 -0.013869467 0.036130533 28 -0.070799812 -0.013869467 29 -0.080865732 -0.070799812 30 0.022269842 -0.080865732 31 0.225570216 0.022269842 32 0.166822690 0.225570216 33 -0.036972081 0.166822690 34 -0.501162371 -0.036972081 35 -0.671623809 -0.501162371 36 -0.688126930 -0.671623809 37 -0.283008123 -0.688126930 38 -0.147033613 -0.283008123 39 -0.158417927 -0.147033613 40 -0.295546032 -0.158417927 41 -0.206600747 -0.295546032 42 0.035150513 -0.206600747 43 0.438450887 0.035150513 44 0.477725770 0.438450887 45 0.252151166 0.477725770 46 -0.310061532 0.252151166 47 -0.639929692 -0.310061532 48 -0.738608164 -0.639929692 49 -0.471116247 -0.738608164 50 -0.274746219 -0.471116247 51 -0.204943978 -0.274746219 52 -0.361874324 -0.204943978 53 -0.472929039 -0.361874324 54 -0.490584502 -0.472929039 55 -0.626888610 -0.490584502 56 -0.508404763 -0.626888610 57 -0.131012980 -0.508404763 58 0.246378804 -0.131012980 59 0.375917366 0.246378804 60 0.098029931 0.375917366 61 -0.274082634 0.098029931 62 -0.536130533 -0.274082634 63 -0.504943978 -0.536130533 64 -0.100490010 -0.504943978 65 0.070630625 -0.100490010 66 0.115348272 0.070630625 67 0.019637442 0.115348272 68 -0.080692157 0.019637442 69 -0.082509337 -0.080692157 70 -0.205117553 -0.082509337 71 -0.134985714 -0.205117553 72 -0.093070908 -0.134985714 73 NA -0.093070908 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.810070308 0.621787354 [2,] 1.006440336 0.810070308 [3,] 1.016835854 1.006440336 [4,] 0.960894304 1.016835854 [5,] 0.791421662 0.960894304 [6,] 0.375743791 0.791421662 [7,] -0.061549113 0.375743791 [8,] -0.160889916 -0.061549113 [9,] 0.036304108 -0.160889916 [10,] 0.791916060 0.036304108 [11,] 1.063036695 0.791916060 [12,] 0.888115647 1.063036695 [13,] 0.238771710 0.888115647 [14,] -0.084660503 0.238771710 [15,] -0.134660503 -0.084660503 [16,] -0.132184126 -0.134660503 [17,] -0.101656769 -0.132184126 [18,] -0.057927917 -0.101656769 [19,] 0.004779179 -0.057927917 [20,] 0.105438376 0.004779179 [21,] -0.037960877 0.105438376 [22,] -0.021953407 -0.037960877 [23,] 0.007585155 -0.021953407 [24,] -0.088126930 0.007585155 [25,] -0.020635013 -0.088126930 [26,] 0.036130533 -0.020635013 [27,] -0.013869467 0.036130533 [28,] -0.070799812 -0.013869467 [29,] -0.080865732 -0.070799812 [30,] 0.022269842 -0.080865732 [31,] 0.225570216 0.022269842 [32,] 0.166822690 0.225570216 [33,] -0.036972081 0.166822690 [34,] -0.501162371 -0.036972081 [35,] -0.671623809 -0.501162371 [36,] -0.688126930 -0.671623809 [37,] -0.283008123 -0.688126930 [38,] -0.147033613 -0.283008123 [39,] -0.158417927 -0.147033613 [40,] -0.295546032 -0.158417927 [41,] -0.206600747 -0.295546032 [42,] 0.035150513 -0.206600747 [43,] 0.438450887 0.035150513 [44,] 0.477725770 0.438450887 [45,] 0.252151166 0.477725770 [46,] -0.310061532 0.252151166 [47,] -0.639929692 -0.310061532 [48,] -0.738608164 -0.639929692 [49,] -0.471116247 -0.738608164 [50,] -0.274746219 -0.471116247 [51,] -0.204943978 -0.274746219 [52,] -0.361874324 -0.204943978 [53,] -0.472929039 -0.361874324 [54,] -0.490584502 -0.472929039 [55,] -0.626888610 -0.490584502 [56,] -0.508404763 -0.626888610 [57,] -0.131012980 -0.508404763 [58,] 0.246378804 -0.131012980 [59,] 0.375917366 0.246378804 [60,] 0.098029931 0.375917366 [61,] -0.274082634 0.098029931 [62,] -0.536130533 -0.274082634 [63,] -0.504943978 -0.536130533 [64,] -0.100490010 -0.504943978 [65,] 0.070630625 -0.100490010 [66,] 0.115348272 0.070630625 [67,] 0.019637442 0.115348272 [68,] -0.080692157 0.019637442 [69,] -0.082509337 -0.080692157 [70,] -0.205117553 -0.082509337 [71,] -0.134985714 -0.205117553 [72,] -0.093070908 -0.134985714 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.810070308 0.621787354 2 1.006440336 0.810070308 3 1.016835854 1.006440336 4 0.960894304 1.016835854 5 0.791421662 0.960894304 6 0.375743791 0.791421662 7 -0.061549113 0.375743791 8 -0.160889916 -0.061549113 9 0.036304108 -0.160889916 10 0.791916060 0.036304108 11 1.063036695 0.791916060 12 0.888115647 1.063036695 13 0.238771710 0.888115647 14 -0.084660503 0.238771710 15 -0.134660503 -0.084660503 16 -0.132184126 -0.134660503 17 -0.101656769 -0.132184126 18 -0.057927917 -0.101656769 19 0.004779179 -0.057927917 20 0.105438376 0.004779179 21 -0.037960877 0.105438376 22 -0.021953407 -0.037960877 23 0.007585155 -0.021953407 24 -0.088126930 0.007585155 25 -0.020635013 -0.088126930 26 0.036130533 -0.020635013 27 -0.013869467 0.036130533 28 -0.070799812 -0.013869467 29 -0.080865732 -0.070799812 30 0.022269842 -0.080865732 31 0.225570216 0.022269842 32 0.166822690 0.225570216 33 -0.036972081 0.166822690 34 -0.501162371 -0.036972081 35 -0.671623809 -0.501162371 36 -0.688126930 -0.671623809 37 -0.283008123 -0.688126930 38 -0.147033613 -0.283008123 39 -0.158417927 -0.147033613 40 -0.295546032 -0.158417927 41 -0.206600747 -0.295546032 42 0.035150513 -0.206600747 43 0.438450887 0.035150513 44 0.477725770 0.438450887 45 0.252151166 0.477725770 46 -0.310061532 0.252151166 47 -0.639929692 -0.310061532 48 -0.738608164 -0.639929692 49 -0.471116247 -0.738608164 50 -0.274746219 -0.471116247 51 -0.204943978 -0.274746219 52 -0.361874324 -0.204943978 53 -0.472929039 -0.361874324 54 -0.490584502 -0.472929039 55 -0.626888610 -0.490584502 56 -0.508404763 -0.626888610 57 -0.131012980 -0.508404763 58 0.246378804 -0.131012980 59 0.375917366 0.246378804 60 0.098029931 0.375917366 61 -0.274082634 0.098029931 62 -0.536130533 -0.274082634 63 -0.504943978 -0.536130533 64 -0.100490010 -0.504943978 65 0.070630625 -0.100490010 66 0.115348272 0.070630625 67 0.019637442 0.115348272 68 -0.080692157 0.019637442 69 -0.082509337 -0.080692157 70 -0.205117553 -0.082509337 71 -0.134985714 -0.205117553 72 -0.093070908 -0.134985714 > 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/7hks61258623759.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/8z6jm1258623759.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/9rqum1258623759.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/10uspz1258623759.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/11tag61258623759.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/12jhrd1258623759.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/13cme71258623760.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/14xn911258623760.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/15ro9q1258623760.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/16itdz1258623760.tab") + } > > system("convert tmp/10uz11258623759.ps tmp/10uz11258623759.png") > system("convert tmp/28vr41258623759.ps tmp/28vr41258623759.png") > system("convert tmp/3i8pc1258623759.ps tmp/3i8pc1258623759.png") > system("convert tmp/4idft1258623759.ps tmp/4idft1258623759.png") > system("convert tmp/5u6cw1258623759.ps tmp/5u6cw1258623759.png") > system("convert tmp/6aq8p1258623759.ps tmp/6aq8p1258623759.png") > system("convert tmp/7hks61258623759.ps tmp/7hks61258623759.png") > system("convert tmp/8z6jm1258623759.ps tmp/8z6jm1258623759.png") > system("convert tmp/9rqum1258623759.ps tmp/9rqum1258623759.png") > system("convert tmp/10uspz1258623759.ps tmp/10uspz1258623759.png") > > > proc.time() user system elapsed 2.526 1.604 3.314