R version 2.11.1 (2010-05-31) Copyright (C) 2010 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(11993 + ,11992 + ,11771 + ,10900 + ,10057 + ,14504 + ,11993 + ,11992 + ,11771 + ,10900 + ,11727 + ,14504 + ,11993 + ,11992 + ,11771 + ,11477 + ,11727 + ,14504 + ,11993 + ,11992 + ,13578 + ,11477 + ,11727 + ,14504 + ,11993 + ,11555 + ,13578 + ,11477 + ,11727 + ,14504 + ,11846 + ,11555 + ,13578 + ,11477 + ,11727 + ,11397 + ,11846 + ,11555 + ,13578 + ,11477 + ,10066 + ,11397 + ,11846 + ,11555 + ,13578 + ,10269 + ,10066 + ,11397 + ,11846 + ,11555 + ,14279 + ,10269 + ,10066 + ,11397 + ,11846 + ,13870 + ,14279 + ,10269 + ,10066 + ,11397 + ,13695 + ,13870 + ,14279 + ,10269 + ,10066 + ,14420 + ,13695 + ,13870 + ,14279 + ,10269 + ,11424 + ,14420 + ,13695 + ,13870 + ,14279 + ,9704 + ,11424 + ,14420 + ,13695 + ,13870 + ,12464 + ,9704 + ,11424 + ,14420 + ,13695 + ,14301 + ,12464 + ,9704 + ,11424 + ,14420 + ,13464 + ,14301 + ,12464 + ,9704 + ,11424 + ,9893 + ,13464 + ,14301 + ,12464 + ,9704 + ,11572 + ,9893 + ,13464 + ,14301 + ,12464 + ,12380 + ,11572 + ,9893 + ,13464 + ,14301 + ,16692 + ,12380 + ,11572 + ,9893 + ,13464 + ,16052 + ,16692 + ,12380 + ,11572 + ,9893 + ,16459 + ,16052 + ,16692 + ,12380 + ,11572 + ,14761 + ,16459 + ,16052 + ,16692 + ,12380 + ,13654 + ,14761 + ,16459 + ,16052 + ,16692 + ,13480 + ,13654 + ,14761 + ,16459 + ,16052 + ,18068 + ,13480 + ,13654 + ,14761 + ,16459 + ,16560 + ,18068 + ,13480 + ,13654 + ,14761 + ,14530 + ,16560 + ,18068 + ,13480 + ,13654 + ,10650 + ,14530 + ,16560 + ,18068 + ,13480 + ,11651 + ,10650 + ,14530 + ,16560 + ,18068 + ,13735 + ,11651 + ,10650 + ,14530 + ,16560 + ,13360 + ,13735 + ,11651 + ,10650 + ,14530 + ,17818 + ,13360 + ,13735 + ,11651 + ,10650 + ,20613 + ,17818 + ,13360 + ,13735 + ,11651 + ,16231 + ,20613 + ,17818 + ,13360 + ,13735 + ,13862 + ,16231 + ,20613 + ,17818 + ,13360 + ,12004 + ,13862 + ,16231 + ,20613 + ,17818 + ,17734 + ,12004 + ,13862 + ,16231 + ,20613 + ,15034 + ,17734 + ,12004 + ,13862 + ,16231 + ,12609 + ,15034 + ,17734 + ,12004 + ,13862 + ,12320 + ,12609 + ,15034 + ,17734 + ,12004 + ,10833 + ,12320 + ,12609 + ,15034 + ,17734 + ,11350 + ,10833 + ,12320 + ,12609 + ,15034 + ,13648 + ,11350 + ,10833 + ,12320 + ,12609 + ,14890 + ,13648 + ,11350 + ,10833 + ,12320 + ,16325 + ,14890 + ,13648 + ,11350 + ,10833 + ,18045 + ,16325 + ,14890 + ,13648 + ,11350 + ,15616 + ,18045 + ,16325 + ,14890 + ,13648 + ,11926 + ,15616 + ,18045 + ,16325 + ,14890 + ,16855 + ,11926 + ,15616 + ,18045 + ,16325 + ,15083 + ,16855 + ,11926 + ,15616 + ,18045 + ,12520 + ,15083 + ,16855 + ,11926 + ,15616 + ,12355 + ,12520 + ,15083 + ,16855 + ,11926) + ,dim=c(5 + ,56) + ,dimnames=list(c('Y' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:56)) > y <- array(NA,dim=c(5,56),dimnames=list(c('Y','Y1','Y2','Y3','Y4'),1:56)) > 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 > 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 Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 11993 11992 11771 10900 10057 1 0 0 0 0 0 0 0 0 0 0 1 2 14504 11993 11992 11771 10900 0 1 0 0 0 0 0 0 0 0 0 2 3 11727 14504 11993 11992 11771 0 0 1 0 0 0 0 0 0 0 0 3 4 11477 11727 14504 11993 11992 0 0 0 1 0 0 0 0 0 0 0 4 5 13578 11477 11727 14504 11993 0 0 0 0 1 0 0 0 0 0 0 5 6 11555 13578 11477 11727 14504 0 0 0 0 0 1 0 0 0 0 0 6 7 11846 11555 13578 11477 11727 0 0 0 0 0 0 1 0 0 0 0 7 8 11397 11846 11555 13578 11477 0 0 0 0 0 0 0 1 0 0 0 8 9 10066 11397 11846 11555 13578 0 0 0 0 0 0 0 0 1 0 0 9 10 10269 10066 11397 11846 11555 0 0 0 0 0 0 0 0 0 1 0 10 11 14279 10269 10066 11397 11846 0 0 0 0 0 0 0 0 0 0 1 11 12 13870 14279 10269 10066 11397 0 0 0 0 0 0 0 0 0 0 0 12 13 13695 13870 14279 10269 10066 1 0 0 0 0 0 0 0 0 0 0 13 14 14420 13695 13870 14279 10269 0 1 0 0 0 0 0 0 0 0 0 14 15 11424 14420 13695 13870 14279 0 0 1 0 0 0 0 0 0 0 0 15 16 9704 11424 14420 13695 13870 0 0 0 1 0 0 0 0 0 0 0 16 17 12464 9704 11424 14420 13695 0 0 0 0 1 0 0 0 0 0 0 17 18 14301 12464 9704 11424 14420 0 0 0 0 0 1 0 0 0 0 0 18 19 13464 14301 12464 9704 11424 0 0 0 0 0 0 1 0 0 0 0 19 20 9893 13464 14301 12464 9704 0 0 0 0 0 0 0 1 0 0 0 20 21 11572 9893 13464 14301 12464 0 0 0 0 0 0 0 0 1 0 0 21 22 12380 11572 9893 13464 14301 0 0 0 0 0 0 0 0 0 1 0 22 23 16692 12380 11572 9893 13464 0 0 0 0 0 0 0 0 0 0 1 23 24 16052 16692 12380 11572 9893 0 0 0 0 0 0 0 0 0 0 0 24 25 16459 16052 16692 12380 11572 1 0 0 0 0 0 0 0 0 0 0 25 26 14761 16459 16052 16692 12380 0 1 0 0 0 0 0 0 0 0 0 26 27 13654 14761 16459 16052 16692 0 0 1 0 0 0 0 0 0 0 0 27 28 13480 13654 14761 16459 16052 0 0 0 1 0 0 0 0 0 0 0 28 29 18068 13480 13654 14761 16459 0 0 0 0 1 0 0 0 0 0 0 29 30 16560 18068 13480 13654 14761 0 0 0 0 0 1 0 0 0 0 0 30 31 14530 16560 18068 13480 13654 0 0 0 0 0 0 1 0 0 0 0 31 32 10650 14530 16560 18068 13480 0 0 0 0 0 0 0 1 0 0 0 32 33 11651 10650 14530 16560 18068 0 0 0 0 0 0 0 0 1 0 0 33 34 13735 11651 10650 14530 16560 0 0 0 0 0 0 0 0 0 1 0 34 35 13360 13735 11651 10650 14530 0 0 0 0 0 0 0 0 0 0 1 35 36 17818 13360 13735 11651 10650 0 0 0 0 0 0 0 0 0 0 0 36 37 20613 17818 13360 13735 11651 1 0 0 0 0 0 0 0 0 0 0 37 38 16231 20613 17818 13360 13735 0 1 0 0 0 0 0 0 0 0 0 38 39 13862 16231 20613 17818 13360 0 0 1 0 0 0 0 0 0 0 0 39 40 12004 13862 16231 20613 17818 0 0 0 1 0 0 0 0 0 0 0 40 41 17734 12004 13862 16231 20613 0 0 0 0 1 0 0 0 0 0 0 41 42 15034 17734 12004 13862 16231 0 0 0 0 0 1 0 0 0 0 0 42 43 12609 15034 17734 12004 13862 0 0 0 0 0 0 1 0 0 0 0 43 44 12320 12609 15034 17734 12004 0 0 0 0 0 0 0 1 0 0 0 44 45 10833 12320 12609 15034 17734 0 0 0 0 0 0 0 0 1 0 0 45 46 11350 10833 12320 12609 15034 0 0 0 0 0 0 0 0 0 1 0 46 47 13648 11350 10833 12320 12609 0 0 0 0 0 0 0 0 0 0 1 47 48 14890 13648 11350 10833 12320 0 0 0 0 0 0 0 0 0 0 0 48 49 16325 14890 13648 11350 10833 1 0 0 0 0 0 0 0 0 0 0 49 50 18045 16325 14890 13648 11350 0 1 0 0 0 0 0 0 0 0 0 50 51 15616 18045 16325 14890 13648 0 0 1 0 0 0 0 0 0 0 0 51 52 11926 15616 18045 16325 14890 0 0 0 1 0 0 0 0 0 0 0 52 53 16855 11926 15616 18045 16325 0 0 0 0 1 0 0 0 0 0 0 53 54 15083 16855 11926 15616 18045 0 0 0 0 0 1 0 0 0 0 0 54 55 12520 15083 16855 11926 15616 0 0 0 0 0 0 1 0 0 0 0 55 56 12355 12520 15083 16855 11926 0 0 0 0 0 0 0 1 0 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Y1 Y2 Y3 Y4 M1 8.912e+03 3.975e-01 -1.303e-01 1.562e-01 -7.951e-03 2.916e+02 M2 M3 M4 M5 M6 M7 -5.312e+02 -2.826e+03 -3.627e+03 7.140e+02 -1.986e+03 -2.293e+03 M8 M9 M10 M11 t -4.193e+03 -3.505e+03 -2.699e+03 -2.213e+02 3.014e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2186.0 -1086.1 -174.8 877.4 2900.0 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 8.912e+03 2.561e+03 3.480 0.00125 ** Y1 3.975e-01 1.584e-01 2.510 0.01632 * Y2 -1.303e-01 1.722e-01 -0.757 0.45367 Y3 1.562e-01 1.712e-01 0.912 0.36739 Y4 -7.951e-03 1.604e-01 -0.050 0.96073 M1 2.916e+02 1.051e+03 0.277 0.78295 M2 -5.312e+02 1.151e+03 -0.461 0.64702 M3 -2.826e+03 1.271e+03 -2.223 0.03212 * M4 -3.627e+03 1.393e+03 -2.603 0.01299 * M5 7.140e+02 1.409e+03 0.507 0.61530 M6 -1.986e+03 1.214e+03 -1.635 0.11006 M7 -2.293e+03 1.229e+03 -1.865 0.06977 . M8 -4.193e+03 1.262e+03 -3.322 0.00195 ** M9 -3.505e+03 1.432e+03 -2.448 0.01898 * M10 -2.699e+03 1.293e+03 -2.087 0.04349 * M11 -2.213e+02 1.166e+03 -0.190 0.85041 t 3.014e+01 1.904e+01 1.583 0.12151 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1476 on 39 degrees of freedom Multiple R-squared: 0.7331, Adjusted R-squared: 0.6236 F-statistic: 6.694 on 16 and 39 DF, p-value: 6.465e-07 > 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.6515083 0.6969834 0.3484917 [2,] 0.5539678 0.8920644 0.4460322 [3,] 0.4651645 0.9303291 0.5348355 [4,] 0.5885339 0.8229322 0.4114661 [5,] 0.5661289 0.8677423 0.4338711 [6,] 0.5795667 0.8408666 0.4204333 [7,] 0.7622744 0.4754512 0.2377256 [8,] 0.7184685 0.5630630 0.2815315 [9,] 0.6247125 0.7505749 0.3752875 [10,] 0.6527417 0.6945166 0.3472583 [11,] 0.5455906 0.9088189 0.4544094 [12,] 0.4226881 0.8453762 0.5773119 [13,] 0.4685272 0.9370544 0.5314728 [14,] 0.3891532 0.7783064 0.6108468 [15,] 0.2630888 0.5261776 0.7369112 [16,] 0.3496346 0.6992692 0.6503654 [17,] 0.5545166 0.8909668 0.4454834 > postscript(file="/var/www/rcomp/tmp/1b4x11290777540.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/rcomp/tmp/2b4x11290777540.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/rcomp/tmp/3mde41290777540.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/rcomp/tmp/4mde41290777540.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/rcomp/tmp/5mde41290777540.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 = 56 Frequency = 1 1 2 3 4 5 6 7 -2095.9052 1106.9145 -431.2568 1522.3365 -1402.2369 -1170.0237 492.7512 8 9 10 11 12 13 14 1204.7837 -295.4187 -519.8256 800.9051 -1222.7734 -1076.7352 -167.3241 15 16 17 18 19 20 21 -1114.1495 -753.7552 -2186.0325 1472.6743 786.7723 -786.4252 1219.8529 22 23 24 25 26 27 28 203.9822 2457.0104 -333.7438 454.9250 -1362.4620 657.1763 1404.2316 29 30 31 32 33 34 35 1814.5671 1288.8396 751.3823 -1365.6384 466.9032 1115.9792 -1874.7866 36 37 38 39 40 41 42 2565.2493 2900.0470 -1144.2064 158.1323 -959.2839 1536.1216 -679.2565 43 44 45 46 47 48 49 -736.1393 547.8042 -1391.3374 -800.1358 -1383.1289 -1008.7320 -182.3316 50 51 52 53 54 55 56 1567.0781 730.0977 -1213.5290 237.5806 -912.2336 -1294.7664 399.4758 > postscript(file="/var/www/rcomp/tmp/6x5d71290777540.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -2095.9052 NA 1 1106.9145 -2095.9052 2 -431.2568 1106.9145 3 1522.3365 -431.2568 4 -1402.2369 1522.3365 5 -1170.0237 -1402.2369 6 492.7512 -1170.0237 7 1204.7837 492.7512 8 -295.4187 1204.7837 9 -519.8256 -295.4187 10 800.9051 -519.8256 11 -1222.7734 800.9051 12 -1076.7352 -1222.7734 13 -167.3241 -1076.7352 14 -1114.1495 -167.3241 15 -753.7552 -1114.1495 16 -2186.0325 -753.7552 17 1472.6743 -2186.0325 18 786.7723 1472.6743 19 -786.4252 786.7723 20 1219.8529 -786.4252 21 203.9822 1219.8529 22 2457.0104 203.9822 23 -333.7438 2457.0104 24 454.9250 -333.7438 25 -1362.4620 454.9250 26 657.1763 -1362.4620 27 1404.2316 657.1763 28 1814.5671 1404.2316 29 1288.8396 1814.5671 30 751.3823 1288.8396 31 -1365.6384 751.3823 32 466.9032 -1365.6384 33 1115.9792 466.9032 34 -1874.7866 1115.9792 35 2565.2493 -1874.7866 36 2900.0470 2565.2493 37 -1144.2064 2900.0470 38 158.1323 -1144.2064 39 -959.2839 158.1323 40 1536.1216 -959.2839 41 -679.2565 1536.1216 42 -736.1393 -679.2565 43 547.8042 -736.1393 44 -1391.3374 547.8042 45 -800.1358 -1391.3374 46 -1383.1289 -800.1358 47 -1008.7320 -1383.1289 48 -182.3316 -1008.7320 49 1567.0781 -182.3316 50 730.0977 1567.0781 51 -1213.5290 730.0977 52 237.5806 -1213.5290 53 -912.2336 237.5806 54 -1294.7664 -912.2336 55 399.4758 -1294.7664 56 NA 399.4758 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1106.9145 -2095.9052 [2,] -431.2568 1106.9145 [3,] 1522.3365 -431.2568 [4,] -1402.2369 1522.3365 [5,] -1170.0237 -1402.2369 [6,] 492.7512 -1170.0237 [7,] 1204.7837 492.7512 [8,] -295.4187 1204.7837 [9,] -519.8256 -295.4187 [10,] 800.9051 -519.8256 [11,] -1222.7734 800.9051 [12,] -1076.7352 -1222.7734 [13,] -167.3241 -1076.7352 [14,] -1114.1495 -167.3241 [15,] -753.7552 -1114.1495 [16,] -2186.0325 -753.7552 [17,] 1472.6743 -2186.0325 [18,] 786.7723 1472.6743 [19,] -786.4252 786.7723 [20,] 1219.8529 -786.4252 [21,] 203.9822 1219.8529 [22,] 2457.0104 203.9822 [23,] -333.7438 2457.0104 [24,] 454.9250 -333.7438 [25,] -1362.4620 454.9250 [26,] 657.1763 -1362.4620 [27,] 1404.2316 657.1763 [28,] 1814.5671 1404.2316 [29,] 1288.8396 1814.5671 [30,] 751.3823 1288.8396 [31,] -1365.6384 751.3823 [32,] 466.9032 -1365.6384 [33,] 1115.9792 466.9032 [34,] -1874.7866 1115.9792 [35,] 2565.2493 -1874.7866 [36,] 2900.0470 2565.2493 [37,] -1144.2064 2900.0470 [38,] 158.1323 -1144.2064 [39,] -959.2839 158.1323 [40,] 1536.1216 -959.2839 [41,] -679.2565 1536.1216 [42,] -736.1393 -679.2565 [43,] 547.8042 -736.1393 [44,] -1391.3374 547.8042 [45,] -800.1358 -1391.3374 [46,] -1383.1289 -800.1358 [47,] -1008.7320 -1383.1289 [48,] -182.3316 -1008.7320 [49,] 1567.0781 -182.3316 [50,] 730.0977 1567.0781 [51,] -1213.5290 730.0977 [52,] 237.5806 -1213.5290 [53,] -912.2336 237.5806 [54,] -1294.7664 -912.2336 [55,] 399.4758 -1294.7664 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1106.9145 -2095.9052 2 -431.2568 1106.9145 3 1522.3365 -431.2568 4 -1402.2369 1522.3365 5 -1170.0237 -1402.2369 6 492.7512 -1170.0237 7 1204.7837 492.7512 8 -295.4187 1204.7837 9 -519.8256 -295.4187 10 800.9051 -519.8256 11 -1222.7734 800.9051 12 -1076.7352 -1222.7734 13 -167.3241 -1076.7352 14 -1114.1495 -167.3241 15 -753.7552 -1114.1495 16 -2186.0325 -753.7552 17 1472.6743 -2186.0325 18 786.7723 1472.6743 19 -786.4252 786.7723 20 1219.8529 -786.4252 21 203.9822 1219.8529 22 2457.0104 203.9822 23 -333.7438 2457.0104 24 454.9250 -333.7438 25 -1362.4620 454.9250 26 657.1763 -1362.4620 27 1404.2316 657.1763 28 1814.5671 1404.2316 29 1288.8396 1814.5671 30 751.3823 1288.8396 31 -1365.6384 751.3823 32 466.9032 -1365.6384 33 1115.9792 466.9032 34 -1874.7866 1115.9792 35 2565.2493 -1874.7866 36 2900.0470 2565.2493 37 -1144.2064 2900.0470 38 158.1323 -1144.2064 39 -959.2839 158.1323 40 1536.1216 -959.2839 41 -679.2565 1536.1216 42 -736.1393 -679.2565 43 547.8042 -736.1393 44 -1391.3374 547.8042 45 -800.1358 -1391.3374 46 -1383.1289 -800.1358 47 -1008.7320 -1383.1289 48 -182.3316 -1008.7320 49 1567.0781 -182.3316 50 730.0977 1567.0781 51 -1213.5290 730.0977 52 237.5806 -1213.5290 53 -912.2336 237.5806 54 -1294.7664 -912.2336 55 399.4758 -1294.7664 > 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/rcomp/tmp/7peda1290777540.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/rcomp/tmp/8peda1290777540.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/rcomp/tmp/9peda1290777540.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/rcomp/tmp/1005cu1290777540.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11l6s01290777540.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/rcomp/tmp/12p6961290777540.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/rcomp/tmp/13w7oi1290777540.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/rcomp/tmp/146gnl1290777540.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/rcomp/tmp/15ahm91290777540.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/rcomp/tmp/16or1i1290777540.tab") + } > > try(system("convert tmp/1b4x11290777540.ps tmp/1b4x11290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/2b4x11290777540.ps tmp/2b4x11290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/3mde41290777540.ps tmp/3mde41290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/4mde41290777540.ps tmp/4mde41290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/5mde41290777540.ps tmp/5mde41290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/6x5d71290777540.ps tmp/6x5d71290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/7peda1290777540.ps tmp/7peda1290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/8peda1290777540.ps tmp/8peda1290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/9peda1290777540.ps tmp/9peda1290777540.png",intern=TRUE)) character(0) > try(system("convert tmp/1005cu1290777540.ps tmp/1005cu1290777540.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.61 1.72 5.30