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(1038.00 + ,0 + ,934.00 + ,988.00 + ,870.00 + ,854.00 + ,934.00 + ,0 + ,988.00 + ,870.00 + ,854.00 + ,834.00 + ,988.00 + ,0 + ,870.00 + ,854.00 + ,834.00 + ,872.00 + ,870.00 + ,0 + ,854.00 + ,834.00 + ,872.00 + ,954.00 + ,854.00 + ,0 + ,834.00 + ,872.00 + ,954.00 + ,870.00 + ,834.00 + ,0 + ,872.00 + ,954.00 + ,870.00 + ,1238.00 + ,872.00 + ,0 + ,954.00 + ,870.00 + ,1238.00 + ,1082.00 + ,954.00 + ,0 + ,870.00 + ,1238.00 + ,1082.00 + ,1053.00 + ,870.00 + ,0 + ,1238.00 + ,1082.00 + ,1053.00 + ,934.00 + ,1238.00 + ,0 + ,1082.00 + ,1053.00 + ,934.00 + ,787.00 + ,1082.00 + ,0 + ,1053.00 + ,934.00 + ,787.00 + ,1081.00 + ,1053.00 + ,0 + ,934.00 + ,787.00 + ,1081.00 + ,908.00 + ,934.00 + ,0 + ,787.00 + ,1081.00 + ,908.00 + ,995.00 + ,787.00 + ,0 + ,1081.00 + ,908.00 + ,995.00 + ,825.00 + ,1081.00 + ,0 + ,908.00 + ,995.00 + ,825.00 + ,822.00 + ,908.00 + ,0 + ,995.00 + ,825.00 + ,822.00 + ,856.00 + ,995.00 + ,0 + ,825.00 + ,822.00 + ,856.00 + ,887.00 + ,825.00 + ,0 + ,822.00 + ,856.00 + ,887.00 + ,1094.00 + ,822.00 + ,0 + ,856.00 + ,887.00 + ,1094.00 + ,990.00 + ,856.00 + ,0 + ,887.00 + ,1094.00 + ,990.00 + ,936.00 + ,887.00 + ,0 + ,1094.00 + ,990.00 + ,936.00 + ,1097.00 + ,1094.00 + ,0 + ,990.00 + ,936.00 + ,1097.00 + ,918.00 + ,990.00 + ,0 + ,936.00 + ,1097.00 + ,918.00 + ,926.00 + ,936.00 + ,0 + ,1097.00 + ,918.00 + ,926.00 + ,907.00 + ,1097.00 + ,0 + ,918.00 + ,926.00 + ,907.00 + ,899.00 + ,918.00 + ,0 + ,926.00 + ,907.00 + ,899.00 + ,971.00 + ,926.00 + ,0 + ,907.00 + ,899.00 + ,971.00 + ,1087.00 + ,907.00 + ,0 + ,899.00 + ,971.00 + ,1087.00 + ,1000.00 + ,899.00 + ,0 + ,971.00 + ,1087.00 + ,1000.00 + ,1071.00 + ,971.00 + ,0 + ,1087.00 + ,1000.00 + ,1071.00 + ,1190.00 + ,1087.00 + ,0 + ,1000.00 + ,1071.00 + ,1190.00 + ,1116.00 + ,1000.00 + ,0 + ,1071.00 + ,1190.00 + ,1116.00 + ,1070.00 + ,1071.00 + ,0 + ,1190.00 + ,1116.00 + ,1070.00 + ,1314.00 + ,1190.00 + ,0 + ,1116.00 + ,1070.00 + ,1314.00 + ,1068.00 + ,1116.00 + ,0 + ,1070.00 + ,1314.00 + ,1068.00 + ,1185.00 + ,1070.00 + ,0 + ,1314.00 + ,1068.00 + ,1185.00 + ,1215.00 + ,1314.00 + ,0 + ,1068.00 + ,1185.00 + ,1215.00 + ,1145.00 + ,1068.00 + ,0 + ,1185.00 + ,1215.00 + ,1145.00 + ,1251.00 + ,1185.00 + ,0 + ,1215.00 + ,1145.00 + ,1251.00 + ,1363.00 + ,1215.00 + ,0 + ,1145.00 + ,1251.00 + ,1363.00 + ,1368.00 + ,1145.00 + ,0 + ,1251.00 + ,1363.00 + ,1368.00 + ,1535.00 + ,1251.00 + ,1 + ,1363.00 + ,1368.00 + ,1535.00 + ,1853.00 + ,1363.00 + ,1 + ,1368.00 + ,1535.00 + ,1853.00 + ,1866.00 + ,1368.00 + ,1 + ,1535.00 + ,1853.00 + ,1866.00 + ,2023.00 + ,1535.00 + ,1 + ,1853.00 + ,1866.00 + ,2023.00 + ,1373.00 + ,1853.00 + ,1 + ,1866.00 + ,2023.00 + ,1373.00 + ,1968.00 + ,1866.00 + ,1 + ,2023.00 + ,1373.00 + ,1968.00 + ,1424.00 + ,2023.00 + ,1 + ,1373.00 + ,1968.00 + ,1424.00 + ,1160.00 + ,1373.00 + ,1 + ,1968.00 + ,1424.00 + ,1160.00 + ,1243.00 + ,1968.00 + ,1 + ,1424.00 + ,1160.00 + ,1243.00 + ,1375.00 + ,1424.00 + ,1 + ,1160.00 + ,1243.00 + ,1375.00 + ,1539.00 + ,1160.00 + ,1 + ,1243.00 + ,1375.00 + ,1539.00 + ,1773.00 + ,1243.00 + ,1 + ,1375.00 + ,1539.00 + ,1773.00 + ,1906.00 + ,1375.00 + ,1 + ,1539.00 + ,1773.00 + ,1906.00 + ,2076.00 + ,1539.00 + ,1 + ,1773.00 + ,1906.00 + ,2076.00 + ,2004.00) + ,dim=c(6 + ,55) + ,dimnames=list(c('Maandelijksewerkloosheid' + ,'x' + ,'y-1' + ,'y-2' + ,'y-3' + ,'y-4') + ,1:55)) > y <- array(NA,dim=c(6,55),dimnames=list(c('Maandelijksewerkloosheid','x','y-1','y-2','y-3','y-4'),1:55)) > 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 Maandelijksewerkloosheid x y-1 y-2 y-3 y-4 M1 M2 M3 M4 M5 M6 M7 M8 M9 1 1038 0 934 988 870 854 1 0 0 0 0 0 0 0 0 2 934 0 988 870 854 834 0 1 0 0 0 0 0 0 0 3 988 0 870 854 834 872 0 0 1 0 0 0 0 0 0 4 870 0 854 834 872 954 0 0 0 1 0 0 0 0 0 5 854 0 834 872 954 870 0 0 0 0 1 0 0 0 0 6 834 0 872 954 870 1238 0 0 0 0 0 1 0 0 0 7 872 0 954 870 1238 1082 0 0 0 0 0 0 1 0 0 8 954 0 870 1238 1082 1053 0 0 0 0 0 0 0 1 0 9 870 0 1238 1082 1053 934 0 0 0 0 0 0 0 0 1 10 1238 0 1082 1053 934 787 0 0 0 0 0 0 0 0 0 11 1082 0 1053 934 787 1081 0 0 0 0 0 0 0 0 0 12 1053 0 934 787 1081 908 0 0 0 0 0 0 0 0 0 13 934 0 787 1081 908 995 1 0 0 0 0 0 0 0 0 14 787 0 1081 908 995 825 0 1 0 0 0 0 0 0 0 15 1081 0 908 995 825 822 0 0 1 0 0 0 0 0 0 16 908 0 995 825 822 856 0 0 0 1 0 0 0 0 0 17 995 0 825 822 856 887 0 0 0 0 1 0 0 0 0 18 825 0 822 856 887 1094 0 0 0 0 0 1 0 0 0 19 822 0 856 887 1094 990 0 0 0 0 0 0 1 0 0 20 856 0 887 1094 990 936 0 0 0 0 0 0 0 1 0 21 887 0 1094 990 936 1097 0 0 0 0 0 0 0 0 1 22 1094 0 990 936 1097 918 0 0 0 0 0 0 0 0 0 23 990 0 936 1097 918 926 0 0 0 0 0 0 0 0 0 24 936 0 1097 918 926 907 0 0 0 0 0 0 0 0 0 25 1097 0 918 926 907 899 1 0 0 0 0 0 0 0 0 26 918 0 926 907 899 971 0 1 0 0 0 0 0 0 0 27 926 0 907 899 971 1087 0 0 1 0 0 0 0 0 0 28 907 0 899 971 1087 1000 0 0 0 1 0 0 0 0 0 29 899 0 971 1087 1000 1071 0 0 0 0 1 0 0 0 0 30 971 0 1087 1000 1071 1190 0 0 0 0 0 1 0 0 0 31 1087 0 1000 1071 1190 1116 0 0 0 0 0 0 1 0 0 32 1000 0 1071 1190 1116 1070 0 0 0 0 0 0 0 1 0 33 1071 0 1190 1116 1070 1314 0 0 0 0 0 0 0 0 1 34 1190 0 1116 1070 1314 1068 0 0 0 0 0 0 0 0 0 35 1116 0 1070 1314 1068 1185 0 0 0 0 0 0 0 0 0 36 1070 0 1314 1068 1185 1215 0 0 0 0 0 0 0 0 0 37 1314 0 1068 1185 1215 1145 1 0 0 0 0 0 0 0 0 38 1068 0 1185 1215 1145 1251 0 1 0 0 0 0 0 0 0 39 1185 0 1215 1145 1251 1363 0 0 1 0 0 0 0 0 0 40 1215 0 1145 1251 1363 1368 0 0 0 1 0 0 0 0 0 41 1145 0 1251 1363 1368 1535 0 0 0 0 1 0 0 0 0 42 1251 1 1363 1368 1535 1853 0 0 0 0 0 1 0 0 0 43 1363 1 1368 1535 1853 1866 0 0 0 0 0 0 1 0 0 44 1368 1 1535 1853 1866 2023 0 0 0 0 0 0 0 1 0 45 1535 1 1853 1866 2023 1373 0 0 0 0 0 0 0 0 1 46 1853 1 1866 2023 1373 1968 0 0 0 0 0 0 0 0 0 47 1866 1 2023 1373 1968 1424 0 0 0 0 0 0 0 0 0 48 2023 1 1373 1968 1424 1160 0 0 0 0 0 0 0 0 0 49 1373 1 1968 1424 1160 1243 1 0 0 0 0 0 0 0 0 50 1968 1 1424 1160 1243 1375 0 1 0 0 0 0 0 0 0 51 1424 1 1160 1243 1375 1539 0 0 1 0 0 0 0 0 0 52 1160 1 1243 1375 1539 1773 0 0 0 1 0 0 0 0 0 53 1243 1 1375 1539 1773 1906 0 0 0 0 1 0 0 0 0 54 1375 1 1539 1773 1906 2076 0 0 0 0 0 1 0 0 0 55 1539 1 1773 1906 2076 2004 0 0 0 0 0 0 1 0 0 M10 M11 t 1 0 0 1 2 0 0 2 3 0 0 3 4 0 0 4 5 0 0 5 6 0 0 6 7 0 0 7 8 0 0 8 9 0 0 9 10 1 0 10 11 0 1 11 12 0 0 12 13 0 0 13 14 0 0 14 15 0 0 15 16 0 0 16 17 0 0 17 18 0 0 18 19 0 0 19 20 0 0 20 21 0 0 21 22 1 0 22 23 0 1 23 24 0 0 24 25 0 0 25 26 0 0 26 27 0 0 27 28 0 0 28 29 0 0 29 30 0 0 30 31 0 0 31 32 0 0 32 33 0 0 33 34 1 0 34 35 0 1 35 36 0 0 36 37 0 0 37 38 0 0 38 39 0 0 39 40 0 0 40 41 0 0 41 42 0 0 42 43 0 0 43 44 0 0 44 45 0 0 45 46 1 0 46 47 0 1 47 48 0 0 48 49 0 0 49 50 0 0 50 51 0 0 51 52 0 0 52 53 0 0 53 54 0 0 54 55 0 0 55 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x `y-1` `y-2` `y-3` `y-4` 785.5816 316.8376 0.1132 0.3314 0.0194 -0.2536 M1 M2 M3 M4 M5 M6 -59.0114 -35.8482 -25.6600 -136.2858 -141.1007 -153.2680 M7 M8 M9 M10 M11 t -123.6214 -197.6825 -180.7946 78.1080 15.0932 4.0890 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -272.746 -74.510 2.603 67.158 475.952 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 785.5816 187.2436 4.196 0.000163 *** x 316.8376 102.6771 3.086 0.003832 ** `y-1` 0.1132 0.1545 0.733 0.468255 `y-2` 0.3314 0.1522 2.177 0.035969 * `y-3` 0.0194 0.1512 0.128 0.898588 `y-4` -0.2536 0.1462 -1.734 0.091161 . M1 -59.0114 100.9725 -0.584 0.562478 M2 -35.8482 102.7440 -0.349 0.729136 M3 -25.6600 105.4646 -0.243 0.809114 M4 -136.2858 106.3422 -1.282 0.207964 M5 -141.1007 106.6551 -1.323 0.193966 M6 -153.2680 117.2422 -1.307 0.199184 M7 -123.6214 113.9452 -1.085 0.284976 M8 -197.6825 113.4235 -1.743 0.089663 . M9 -180.7946 109.8987 -1.645 0.108419 M10 78.1080 107.7282 0.725 0.472984 M11 15.0932 107.0510 0.141 0.888642 t 4.0890 2.5657 1.594 0.119502 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 148.3 on 37 degrees of freedom Multiple R-squared: 0.8241, Adjusted R-squared: 0.7433 F-statistic: 10.2 on 17 and 37 DF, p-value: 2.885e-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.1130922851 0.2261845701 0.8869077 [2,] 0.0406324151 0.0812648302 0.9593676 [3,] 0.0138374800 0.0276749600 0.9861625 [4,] 0.0153647089 0.0307294178 0.9846353 [5,] 0.0139018442 0.0278036884 0.9860982 [6,] 0.0084391090 0.0168782180 0.9915609 [7,] 0.0032548962 0.0065097923 0.9967451 [8,] 0.0017664142 0.0035328284 0.9982336 [9,] 0.0005751076 0.0011502152 0.9994249 [10,] 0.0003661145 0.0007322291 0.9996339 [11,] 0.0004499087 0.0008998174 0.9995501 [12,] 0.0001243824 0.0002487648 0.9998756 [13,] 0.0001933581 0.0003867163 0.9998066 [14,] 0.0284704132 0.0569408264 0.9715296 > postscript(file="/var/www/html/rcomp/tmp/118va1292952119.ps",horizontal=F,onefile=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/2tiud1292952119.ps",horizontal=F,onefile=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/3tiud1292952119.ps",horizontal=F,onefile=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/4tiud1292952119.ps",horizontal=F,onefile=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/5mrcg1292952119.ps",horizontal=F,onefile=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 = 55 Frequency = 1 1 2 3 4 5 6 73.898432 -29.129989 39.282472 56.317720 7.822339 59.385814 7 8 9 10 11 12 35.496202 70.710493 -53.864501 43.445940 66.502385 61.114090 13 14 15 16 17 18 -58.317118 -253.338975 19.682908 8.380402 123.554057 2.602916 19 20 21 22 23 24 -78.646667 -58.454903 4.468536 -70.372700 -157.180087 -164.067761 25 26 27 28 29 30 67.813628 -114.633095 -88.085052 -47.815207 -81.986370 42.587479 31 32 33 34 35 36 90.101144 15.370124 139.212881 -48.278805 -104.551418 -80.324083 37 38 39 40 41 42 189.351301 -78.849906 70.019770 178.454520 102.321081 -37.367716 43 44 45 46 47 48 -17.878731 -27.625715 -89.816917 75.205565 195.229121 183.277754 49 50 51 52 53 54 -272.746243 475.951965 -40.900099 -195.337434 -151.711107 -67.208493 55 -29.071949 > postscript(file="/var/www/html/rcomp/tmp/6mrcg1292952119.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 55 Frequency = 1 lag(myerror, k = 1) myerror 0 73.898432 NA 1 -29.129989 73.898432 2 39.282472 -29.129989 3 56.317720 39.282472 4 7.822339 56.317720 5 59.385814 7.822339 6 35.496202 59.385814 7 70.710493 35.496202 8 -53.864501 70.710493 9 43.445940 -53.864501 10 66.502385 43.445940 11 61.114090 66.502385 12 -58.317118 61.114090 13 -253.338975 -58.317118 14 19.682908 -253.338975 15 8.380402 19.682908 16 123.554057 8.380402 17 2.602916 123.554057 18 -78.646667 2.602916 19 -58.454903 -78.646667 20 4.468536 -58.454903 21 -70.372700 4.468536 22 -157.180087 -70.372700 23 -164.067761 -157.180087 24 67.813628 -164.067761 25 -114.633095 67.813628 26 -88.085052 -114.633095 27 -47.815207 -88.085052 28 -81.986370 -47.815207 29 42.587479 -81.986370 30 90.101144 42.587479 31 15.370124 90.101144 32 139.212881 15.370124 33 -48.278805 139.212881 34 -104.551418 -48.278805 35 -80.324083 -104.551418 36 189.351301 -80.324083 37 -78.849906 189.351301 38 70.019770 -78.849906 39 178.454520 70.019770 40 102.321081 178.454520 41 -37.367716 102.321081 42 -17.878731 -37.367716 43 -27.625715 -17.878731 44 -89.816917 -27.625715 45 75.205565 -89.816917 46 195.229121 75.205565 47 183.277754 195.229121 48 -272.746243 183.277754 49 475.951965 -272.746243 50 -40.900099 475.951965 51 -195.337434 -40.900099 52 -151.711107 -195.337434 53 -67.208493 -151.711107 54 -29.071949 -67.208493 55 NA -29.071949 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -29.129989 73.898432 [2,] 39.282472 -29.129989 [3,] 56.317720 39.282472 [4,] 7.822339 56.317720 [5,] 59.385814 7.822339 [6,] 35.496202 59.385814 [7,] 70.710493 35.496202 [8,] -53.864501 70.710493 [9,] 43.445940 -53.864501 [10,] 66.502385 43.445940 [11,] 61.114090 66.502385 [12,] -58.317118 61.114090 [13,] -253.338975 -58.317118 [14,] 19.682908 -253.338975 [15,] 8.380402 19.682908 [16,] 123.554057 8.380402 [17,] 2.602916 123.554057 [18,] -78.646667 2.602916 [19,] -58.454903 -78.646667 [20,] 4.468536 -58.454903 [21,] -70.372700 4.468536 [22,] -157.180087 -70.372700 [23,] -164.067761 -157.180087 [24,] 67.813628 -164.067761 [25,] -114.633095 67.813628 [26,] -88.085052 -114.633095 [27,] -47.815207 -88.085052 [28,] -81.986370 -47.815207 [29,] 42.587479 -81.986370 [30,] 90.101144 42.587479 [31,] 15.370124 90.101144 [32,] 139.212881 15.370124 [33,] -48.278805 139.212881 [34,] -104.551418 -48.278805 [35,] -80.324083 -104.551418 [36,] 189.351301 -80.324083 [37,] -78.849906 189.351301 [38,] 70.019770 -78.849906 [39,] 178.454520 70.019770 [40,] 102.321081 178.454520 [41,] -37.367716 102.321081 [42,] -17.878731 -37.367716 [43,] -27.625715 -17.878731 [44,] -89.816917 -27.625715 [45,] 75.205565 -89.816917 [46,] 195.229121 75.205565 [47,] 183.277754 195.229121 [48,] -272.746243 183.277754 [49,] 475.951965 -272.746243 [50,] -40.900099 475.951965 [51,] -195.337434 -40.900099 [52,] -151.711107 -195.337434 [53,] -67.208493 -151.711107 [54,] -29.071949 -67.208493 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -29.129989 73.898432 2 39.282472 -29.129989 3 56.317720 39.282472 4 7.822339 56.317720 5 59.385814 7.822339 6 35.496202 59.385814 7 70.710493 35.496202 8 -53.864501 70.710493 9 43.445940 -53.864501 10 66.502385 43.445940 11 61.114090 66.502385 12 -58.317118 61.114090 13 -253.338975 -58.317118 14 19.682908 -253.338975 15 8.380402 19.682908 16 123.554057 8.380402 17 2.602916 123.554057 18 -78.646667 2.602916 19 -58.454903 -78.646667 20 4.468536 -58.454903 21 -70.372700 4.468536 22 -157.180087 -70.372700 23 -164.067761 -157.180087 24 67.813628 -164.067761 25 -114.633095 67.813628 26 -88.085052 -114.633095 27 -47.815207 -88.085052 28 -81.986370 -47.815207 29 42.587479 -81.986370 30 90.101144 42.587479 31 15.370124 90.101144 32 139.212881 15.370124 33 -48.278805 139.212881 34 -104.551418 -48.278805 35 -80.324083 -104.551418 36 189.351301 -80.324083 37 -78.849906 189.351301 38 70.019770 -78.849906 39 178.454520 70.019770 40 102.321081 178.454520 41 -37.367716 102.321081 42 -17.878731 -37.367716 43 -27.625715 -17.878731 44 -89.816917 -27.625715 45 75.205565 -89.816917 46 195.229121 75.205565 47 183.277754 195.229121 48 -272.746243 183.277754 49 475.951965 -272.746243 50 -40.900099 475.951965 51 -195.337434 -40.900099 52 -151.711107 -195.337434 53 -67.208493 -151.711107 54 -29.071949 -67.208493 > 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/7fitj1292952119.ps",horizontal=F,onefile=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/8fitj1292952119.ps",horizontal=F,onefile=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/9fitj1292952119.ps",horizontal=F,onefile=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/107ram1292952119.ps",horizontal=F,onefile=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/11ta9a1292952119.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/12eb7x1292952119.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/13a2no1292952119.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/14wl4c1292952119.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/15z3ki1292952119.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/16km1o1292952119.tab") + } > > try(system("convert tmp/118va1292952119.ps tmp/118va1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/2tiud1292952119.ps tmp/2tiud1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/3tiud1292952119.ps tmp/3tiud1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/4tiud1292952119.ps tmp/4tiud1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/5mrcg1292952119.ps tmp/5mrcg1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/6mrcg1292952119.ps tmp/6mrcg1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/7fitj1292952119.ps tmp/7fitj1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/8fitj1292952119.ps tmp/8fitj1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/9fitj1292952119.ps tmp/9fitj1292952119.png",intern=TRUE)) character(0) > try(system("convert tmp/107ram1292952119.ps tmp/107ram1292952119.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.363 1.605 5.718