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(1322.4 + ,0 + ,1.0622 + ,1089.2 + ,0 + ,1.0773 + ,1147.3 + ,0 + ,1.0807 + ,1196.4 + ,0 + ,1.0848 + ,1190.2 + ,0 + ,1.1582 + ,1146 + ,0 + ,1.1663 + ,1139.8 + ,0 + ,1.1372 + ,1045.6 + ,0 + ,1.1139 + ,1050.9 + ,0 + ,1.1222 + ,1117.3 + ,0 + ,1.1692 + ,1120 + ,0 + ,1.1702 + ,1052.1 + ,0 + ,1.2286 + ,1065.8 + ,0 + ,1.2613 + ,1092.5 + ,0 + ,1.2646 + ,1422 + ,0 + ,1.2262 + ,1367.5 + ,0 + ,1.1985 + ,1136.3 + ,0 + ,1.2007 + ,1293.7 + ,0 + ,1.2138 + ,1154.8 + ,0 + ,1.2266 + ,1206.7 + ,0 + ,1.2176 + ,1199 + ,0 + ,1.2218 + ,1265 + ,0 + ,1.249 + ,1247.1 + ,0 + ,1.2991 + ,1116.5 + ,0 + ,1.3408 + ,1153.9 + ,0 + ,1.3119 + ,1077.4 + ,0 + ,1.3014 + ,1132.5 + ,0 + ,1.3201 + ,1058.8 + ,0 + ,1.2938 + ,1195.1 + ,0 + ,1.2694 + ,1263.4 + ,0 + ,1.2165 + ,1023.1 + ,0 + ,1.2037 + ,1141 + ,0 + ,1.2292 + ,1116.3 + ,0 + ,1.2256 + ,1135.6 + ,0 + ,1.2015 + ,1210.5 + ,0 + ,1.1786 + ,1230 + ,0 + ,1.1856 + ,1136.5 + ,0 + ,1.2103 + ,1068.7 + ,0 + ,1.1938 + ,1372.5 + ,0 + ,1.202 + ,1049.9 + ,0 + ,1.2271 + ,1302.2 + ,0 + ,1.277 + ,1305.9 + ,0 + ,1.265 + ,1173.5 + ,0 + ,1.2684 + ,1277.4 + ,0 + ,1.2811 + ,1238.6 + ,0 + ,1.2727 + ,1508.6 + ,0 + ,1.2611 + ,1423.4 + ,0 + ,1.2881 + ,1375.1 + ,0 + ,1.3213 + ,1344.1 + ,0 + ,1.2999 + ,1287.5 + ,0 + ,1.3074 + ,1446.9 + ,0 + ,1.3242 + ,1451 + ,0 + ,1.3516 + ,1604.4 + ,0 + ,1.3511 + ,1501.5 + ,0 + ,1.3419 + ,1522.8 + ,0 + ,1.3716 + ,1328 + ,0 + ,1.3622 + ,1420.5 + ,0 + ,1.3896 + ,1648 + ,0 + ,1.4227 + ,1631.1 + ,0 + ,1.4684 + ,1396.6 + ,0 + ,1.457 + ,1663.4 + ,0 + ,1.4718 + ,1283 + ,0 + ,1.4748 + ,1582.4 + ,0 + ,1.5527 + ,1785.2 + ,0 + ,1.575 + ,1853.6 + ,0 + ,1.5557 + ,1994.1 + ,0 + ,1.5553 + ,2042.8 + ,0 + ,1.577 + ,1586.1 + ,0 + ,1.4975 + ,1942.4 + ,0 + ,1.4369 + ,1763.6 + ,1 + ,1.3322 + ,1819.9 + ,1 + ,1.2732 + ,1836 + ,1 + ,1.3449 + ,1449.9 + ,1 + ,1.3239 + ,1513.3 + ,1 + ,1.2785 + ,1677.7 + ,1 + ,1.305 + ,1494.4 + ,1 + ,1.319 + ,1375.3 + ,1 + ,1.365 + ,1577.7 + ,1 + ,1.4016 + ,1537.7 + ,1 + ,1.4088 + ,1356.6 + ,1 + ,1.4268 + ,1469.6 + ,1 + ,1.4562) + ,dim=c(3 + ,81) + ,dimnames=list(c('Import_Uit_USA' + ,'Dummy_Crisis' + ,'Wisselkoers_EUR/DOLLAR') + ,1:81)) > y <- array(NA,dim=c(3,81),dimnames=list(c('Import_Uit_USA','Dummy_Crisis','Wisselkoers_EUR/DOLLAR'),1:81)) > 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 = 'Do not include Seasonal 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 Import_Uit_USA Dummy_Crisis Wisselkoers_EUR/DOLLAR 1 1322.4 0 1.0622 2 1089.2 0 1.0773 3 1147.3 0 1.0807 4 1196.4 0 1.0848 5 1190.2 0 1.1582 6 1146.0 0 1.1663 7 1139.8 0 1.1372 8 1045.6 0 1.1139 9 1050.9 0 1.1222 10 1117.3 0 1.1692 11 1120.0 0 1.1702 12 1052.1 0 1.2286 13 1065.8 0 1.2613 14 1092.5 0 1.2646 15 1422.0 0 1.2262 16 1367.5 0 1.1985 17 1136.3 0 1.2007 18 1293.7 0 1.2138 19 1154.8 0 1.2266 20 1206.7 0 1.2176 21 1199.0 0 1.2218 22 1265.0 0 1.2490 23 1247.1 0 1.2991 24 1116.5 0 1.3408 25 1153.9 0 1.3119 26 1077.4 0 1.3014 27 1132.5 0 1.3201 28 1058.8 0 1.2938 29 1195.1 0 1.2694 30 1263.4 0 1.2165 31 1023.1 0 1.2037 32 1141.0 0 1.2292 33 1116.3 0 1.2256 34 1135.6 0 1.2015 35 1210.5 0 1.1786 36 1230.0 0 1.1856 37 1136.5 0 1.2103 38 1068.7 0 1.1938 39 1372.5 0 1.2020 40 1049.9 0 1.2271 41 1302.2 0 1.2770 42 1305.9 0 1.2650 43 1173.5 0 1.2684 44 1277.4 0 1.2811 45 1238.6 0 1.2727 46 1508.6 0 1.2611 47 1423.4 0 1.2881 48 1375.1 0 1.3213 49 1344.1 0 1.2999 50 1287.5 0 1.3074 51 1446.9 0 1.3242 52 1451.0 0 1.3516 53 1604.4 0 1.3511 54 1501.5 0 1.3419 55 1522.8 0 1.3716 56 1328.0 0 1.3622 57 1420.5 0 1.3896 58 1648.0 0 1.4227 59 1631.1 0 1.4684 60 1396.6 0 1.4570 61 1663.4 0 1.4718 62 1283.0 0 1.4748 63 1582.4 0 1.5527 64 1785.2 0 1.5750 65 1853.6 0 1.5557 66 1994.1 0 1.5553 67 2042.8 0 1.5770 68 1586.1 0 1.4975 69 1942.4 0 1.4369 70 1763.6 1 1.3322 71 1819.9 1 1.2732 72 1836.0 1 1.3449 73 1449.9 1 1.3239 74 1513.3 1 1.2785 75 1677.7 1 1.3050 76 1494.4 1 1.3190 77 1375.3 1 1.3650 78 1577.7 1 1.4016 79 1537.7 1 1.4088 80 1356.6 1 1.4268 81 1469.6 1 1.4562 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy_Crisis `Wisselkoers_EUR/DOLLAR` -490.8 165.7 1402.7 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -319.66 -94.67 -23.62 89.68 417.68 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -490.77 198.76 -2.469 0.01573 * Dummy_Crisis 165.71 51.91 3.192 0.00203 ** `Wisselkoers_EUR/DOLLAR` 1402.67 153.97 9.110 6.6e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 162.5 on 78 degrees of freedom Multiple R-squared: 0.5839, Adjusted R-squared: 0.5732 F-statistic: 54.73 on 2 and 78 DF, p-value: 1.408e-15 > 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.2268884105 0.4537768210 0.7731116 [2,] 0.1112930833 0.2225861665 0.8887069 [3,] 0.1069428751 0.2138857502 0.8930571 [4,] 0.0797472953 0.1594945906 0.9202527 [5,] 0.0391471669 0.0782943337 0.9608528 [6,] 0.0180755066 0.0361510132 0.9819245 [7,] 0.0084223645 0.0168447290 0.9915776 [8,] 0.0039007584 0.0078015168 0.9960992 [9,] 0.0018763988 0.0037527976 0.9981236 [10,] 0.0716835568 0.1433671136 0.9283164 [11,] 0.1297437195 0.2594874389 0.8702563 [12,] 0.0878139179 0.1756278358 0.9121861 [13,] 0.0816738412 0.1633476824 0.9183262 [14,] 0.0536876661 0.1073753322 0.9463123 [15,] 0.0349558106 0.0699116213 0.9650442 [16,] 0.0217785883 0.0435571765 0.9782214 [17,] 0.0154998347 0.0309996694 0.9845002 [18,] 0.0097821838 0.0195643676 0.9902178 [19,] 0.0091133063 0.0182266126 0.9908867 [20,] 0.0062956777 0.0125913554 0.9937043 [21,] 0.0063495461 0.0126990923 0.9936505 [22,] 0.0049699116 0.0099398231 0.9950301 [23,] 0.0057157474 0.0114314947 0.9942843 [24,] 0.0036419102 0.0072838203 0.9963581 [25,] 0.0027607652 0.0055215304 0.9972392 [26,] 0.0033953355 0.0067906710 0.9966047 [27,] 0.0021193307 0.0042386614 0.9978807 [28,] 0.0014224981 0.0028449963 0.9985775 [29,] 0.0008432628 0.0016865256 0.9991567 [30,] 0.0004900009 0.0009800017 0.9995100 [31,] 0.0003003242 0.0006006484 0.9996997 [32,] 0.0001729691 0.0003459381 0.9998270 [33,] 0.0001475146 0.0002950291 0.9998525 [34,] 0.0003505915 0.0007011830 0.9996494 [35,] 0.0004229860 0.0008459720 0.9995770 [36,] 0.0004060029 0.0008120058 0.9995940 [37,] 0.0003682879 0.0007365757 0.9996317 [38,] 0.0002768563 0.0005537125 0.9997231 [39,] 0.0002238644 0.0004477287 0.9997761 [40,] 0.0001690917 0.0003381834 0.9998309 [41,] 0.0011661009 0.0023322017 0.9988339 [42,] 0.0016806169 0.0033612338 0.9983194 [43,] 0.0015692286 0.0031384573 0.9984308 [44,] 0.0012700450 0.0025400901 0.9987300 [45,] 0.0010466335 0.0020932671 0.9989534 [46,] 0.0012018437 0.0024036873 0.9987982 [47,] 0.0012121396 0.0024242792 0.9987879 [48,] 0.0027432506 0.0054865011 0.9972567 [49,] 0.0026036244 0.0052072489 0.9973964 [50,] 0.0022570759 0.0045141518 0.9977429 [51,] 0.0023732862 0.0047465723 0.9976267 [52,] 0.0024194727 0.0048389455 0.9975805 [53,] 0.0025749553 0.0051499107 0.9974250 [54,] 0.0019615586 0.0039231172 0.9980384 [55,] 0.0040694691 0.0081389382 0.9959305 [56,] 0.0034443391 0.0068886781 0.9965557 [57,] 0.0806899307 0.1613798614 0.9193101 [58,] 0.1117996046 0.2235992092 0.8882004 [59,] 0.0935843376 0.1871686753 0.9064157 [60,] 0.0825537867 0.1651075735 0.9174462 [61,] 0.1164998993 0.2329997987 0.8835001 [62,] 0.3395910709 0.6791821418 0.6604089 [63,] 0.3682367988 0.7364735976 0.6317632 [64,] 0.3649228513 0.7298457025 0.6350771 [65,] 0.3667104630 0.7334209259 0.6332895 [66,] 0.4063256409 0.8126512818 0.5936744 [67,] 0.7931435350 0.4137129300 0.2068565 [68,] 0.7416846108 0.5166307784 0.2583154 [69,] 0.6340251692 0.7319496615 0.3659748 [70,] 0.6453105039 0.7093789922 0.3546895 > postscript(file="/var/www/html/rcomp/tmp/18u4s1261046180.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/2q1v01261046180.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/3ne8h1261046180.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/4pavg1261046180.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/505uv1261046180.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 = 81 Frequency = 1 1 2 3 4 5 6 323.2612099 68.8809489 122.2118836 165.5609518 56.4052465 0.8436496 7 8 9 10 11 12 35.4612385 -26.0566371 -32.3987673 -31.9240827 -30.6267490 -180.4424600 13 14 15 16 17 18 -212.6096475 -190.5384463 192.8239391 177.1777952 -57.1080707 81.9170010 19 20 21 22 23 24 -74.9371274 -10.4131309 -24.0043293 3.8431478 -84.3304331 -273.4216172 25 26 27 28 29 30 -195.4845616 -257.2565656 -228.3864251 -265.1963018 -94.6712445 47.8298020 31 32 33 34 35 36 -174.5160695 -92.3840598 -112.0344612 -58.9302037 48.0908542 57.7721902 37 38 39 40 41 42 -70.3736670 -115.0296733 177.2684632 -180.5384606 1.7684918 22.3004872 43 44 45 46 47 48 -114.8685782 -28.7824400 -55.8000432 230.4708857 107.3988960 12.5303753 49 50 51 52 53 54 11.5474338 -55.5725633 80.2626431 45.9295869 200.0309200 110.0354499 55 56 57 58 59 60 89.6762612 -91.9386757 -37.8717320 143.2000140 62.1981648 -156.3114396 61 62 63 64 65 66 89.7290994 -294.8788995 -104.7466031 66.7739388 162.2453981 303.3064646 67 68 69 70 71 72 321.5686062 -23.6194241 417.6821528 220.0285921 359.0859029 274.6147303 73 74 75 76 77 78 -82.0292777 45.0517716 172.2811151 -30.6562129 -214.2788621 -63.2164481 79 80 81 -113.3156454 -319.6636385 -247.9020273 > postscript(file="/var/www/html/rcomp/tmp/6jb8a1261046180.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 = 81 Frequency = 1 lag(myerror, k = 1) myerror 0 323.2612099 NA 1 68.8809489 323.2612099 2 122.2118836 68.8809489 3 165.5609518 122.2118836 4 56.4052465 165.5609518 5 0.8436496 56.4052465 6 35.4612385 0.8436496 7 -26.0566371 35.4612385 8 -32.3987673 -26.0566371 9 -31.9240827 -32.3987673 10 -30.6267490 -31.9240827 11 -180.4424600 -30.6267490 12 -212.6096475 -180.4424600 13 -190.5384463 -212.6096475 14 192.8239391 -190.5384463 15 177.1777952 192.8239391 16 -57.1080707 177.1777952 17 81.9170010 -57.1080707 18 -74.9371274 81.9170010 19 -10.4131309 -74.9371274 20 -24.0043293 -10.4131309 21 3.8431478 -24.0043293 22 -84.3304331 3.8431478 23 -273.4216172 -84.3304331 24 -195.4845616 -273.4216172 25 -257.2565656 -195.4845616 26 -228.3864251 -257.2565656 27 -265.1963018 -228.3864251 28 -94.6712445 -265.1963018 29 47.8298020 -94.6712445 30 -174.5160695 47.8298020 31 -92.3840598 -174.5160695 32 -112.0344612 -92.3840598 33 -58.9302037 -112.0344612 34 48.0908542 -58.9302037 35 57.7721902 48.0908542 36 -70.3736670 57.7721902 37 -115.0296733 -70.3736670 38 177.2684632 -115.0296733 39 -180.5384606 177.2684632 40 1.7684918 -180.5384606 41 22.3004872 1.7684918 42 -114.8685782 22.3004872 43 -28.7824400 -114.8685782 44 -55.8000432 -28.7824400 45 230.4708857 -55.8000432 46 107.3988960 230.4708857 47 12.5303753 107.3988960 48 11.5474338 12.5303753 49 -55.5725633 11.5474338 50 80.2626431 -55.5725633 51 45.9295869 80.2626431 52 200.0309200 45.9295869 53 110.0354499 200.0309200 54 89.6762612 110.0354499 55 -91.9386757 89.6762612 56 -37.8717320 -91.9386757 57 143.2000140 -37.8717320 58 62.1981648 143.2000140 59 -156.3114396 62.1981648 60 89.7290994 -156.3114396 61 -294.8788995 89.7290994 62 -104.7466031 -294.8788995 63 66.7739388 -104.7466031 64 162.2453981 66.7739388 65 303.3064646 162.2453981 66 321.5686062 303.3064646 67 -23.6194241 321.5686062 68 417.6821528 -23.6194241 69 220.0285921 417.6821528 70 359.0859029 220.0285921 71 274.6147303 359.0859029 72 -82.0292777 274.6147303 73 45.0517716 -82.0292777 74 172.2811151 45.0517716 75 -30.6562129 172.2811151 76 -214.2788621 -30.6562129 77 -63.2164481 -214.2788621 78 -113.3156454 -63.2164481 79 -319.6636385 -113.3156454 80 -247.9020273 -319.6636385 81 NA -247.9020273 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 68.8809489 323.2612099 [2,] 122.2118836 68.8809489 [3,] 165.5609518 122.2118836 [4,] 56.4052465 165.5609518 [5,] 0.8436496 56.4052465 [6,] 35.4612385 0.8436496 [7,] -26.0566371 35.4612385 [8,] -32.3987673 -26.0566371 [9,] -31.9240827 -32.3987673 [10,] -30.6267490 -31.9240827 [11,] -180.4424600 -30.6267490 [12,] -212.6096475 -180.4424600 [13,] -190.5384463 -212.6096475 [14,] 192.8239391 -190.5384463 [15,] 177.1777952 192.8239391 [16,] -57.1080707 177.1777952 [17,] 81.9170010 -57.1080707 [18,] -74.9371274 81.9170010 [19,] -10.4131309 -74.9371274 [20,] -24.0043293 -10.4131309 [21,] 3.8431478 -24.0043293 [22,] -84.3304331 3.8431478 [23,] -273.4216172 -84.3304331 [24,] -195.4845616 -273.4216172 [25,] -257.2565656 -195.4845616 [26,] -228.3864251 -257.2565656 [27,] -265.1963018 -228.3864251 [28,] -94.6712445 -265.1963018 [29,] 47.8298020 -94.6712445 [30,] -174.5160695 47.8298020 [31,] -92.3840598 -174.5160695 [32,] -112.0344612 -92.3840598 [33,] -58.9302037 -112.0344612 [34,] 48.0908542 -58.9302037 [35,] 57.7721902 48.0908542 [36,] -70.3736670 57.7721902 [37,] -115.0296733 -70.3736670 [38,] 177.2684632 -115.0296733 [39,] -180.5384606 177.2684632 [40,] 1.7684918 -180.5384606 [41,] 22.3004872 1.7684918 [42,] -114.8685782 22.3004872 [43,] -28.7824400 -114.8685782 [44,] -55.8000432 -28.7824400 [45,] 230.4708857 -55.8000432 [46,] 107.3988960 230.4708857 [47,] 12.5303753 107.3988960 [48,] 11.5474338 12.5303753 [49,] -55.5725633 11.5474338 [50,] 80.2626431 -55.5725633 [51,] 45.9295869 80.2626431 [52,] 200.0309200 45.9295869 [53,] 110.0354499 200.0309200 [54,] 89.6762612 110.0354499 [55,] -91.9386757 89.6762612 [56,] -37.8717320 -91.9386757 [57,] 143.2000140 -37.8717320 [58,] 62.1981648 143.2000140 [59,] -156.3114396 62.1981648 [60,] 89.7290994 -156.3114396 [61,] -294.8788995 89.7290994 [62,] -104.7466031 -294.8788995 [63,] 66.7739388 -104.7466031 [64,] 162.2453981 66.7739388 [65,] 303.3064646 162.2453981 [66,] 321.5686062 303.3064646 [67,] -23.6194241 321.5686062 [68,] 417.6821528 -23.6194241 [69,] 220.0285921 417.6821528 [70,] 359.0859029 220.0285921 [71,] 274.6147303 359.0859029 [72,] -82.0292777 274.6147303 [73,] 45.0517716 -82.0292777 [74,] 172.2811151 45.0517716 [75,] -30.6562129 172.2811151 [76,] -214.2788621 -30.6562129 [77,] -63.2164481 -214.2788621 [78,] -113.3156454 -63.2164481 [79,] -319.6636385 -113.3156454 [80,] -247.9020273 -319.6636385 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 68.8809489 323.2612099 2 122.2118836 68.8809489 3 165.5609518 122.2118836 4 56.4052465 165.5609518 5 0.8436496 56.4052465 6 35.4612385 0.8436496 7 -26.0566371 35.4612385 8 -32.3987673 -26.0566371 9 -31.9240827 -32.3987673 10 -30.6267490 -31.9240827 11 -180.4424600 -30.6267490 12 -212.6096475 -180.4424600 13 -190.5384463 -212.6096475 14 192.8239391 -190.5384463 15 177.1777952 192.8239391 16 -57.1080707 177.1777952 17 81.9170010 -57.1080707 18 -74.9371274 81.9170010 19 -10.4131309 -74.9371274 20 -24.0043293 -10.4131309 21 3.8431478 -24.0043293 22 -84.3304331 3.8431478 23 -273.4216172 -84.3304331 24 -195.4845616 -273.4216172 25 -257.2565656 -195.4845616 26 -228.3864251 -257.2565656 27 -265.1963018 -228.3864251 28 -94.6712445 -265.1963018 29 47.8298020 -94.6712445 30 -174.5160695 47.8298020 31 -92.3840598 -174.5160695 32 -112.0344612 -92.3840598 33 -58.9302037 -112.0344612 34 48.0908542 -58.9302037 35 57.7721902 48.0908542 36 -70.3736670 57.7721902 37 -115.0296733 -70.3736670 38 177.2684632 -115.0296733 39 -180.5384606 177.2684632 40 1.7684918 -180.5384606 41 22.3004872 1.7684918 42 -114.8685782 22.3004872 43 -28.7824400 -114.8685782 44 -55.8000432 -28.7824400 45 230.4708857 -55.8000432 46 107.3988960 230.4708857 47 12.5303753 107.3988960 48 11.5474338 12.5303753 49 -55.5725633 11.5474338 50 80.2626431 -55.5725633 51 45.9295869 80.2626431 52 200.0309200 45.9295869 53 110.0354499 200.0309200 54 89.6762612 110.0354499 55 -91.9386757 89.6762612 56 -37.8717320 -91.9386757 57 143.2000140 -37.8717320 58 62.1981648 143.2000140 59 -156.3114396 62.1981648 60 89.7290994 -156.3114396 61 -294.8788995 89.7290994 62 -104.7466031 -294.8788995 63 66.7739388 -104.7466031 64 162.2453981 66.7739388 65 303.3064646 162.2453981 66 321.5686062 303.3064646 67 -23.6194241 321.5686062 68 417.6821528 -23.6194241 69 220.0285921 417.6821528 70 359.0859029 220.0285921 71 274.6147303 359.0859029 72 -82.0292777 274.6147303 73 45.0517716 -82.0292777 74 172.2811151 45.0517716 75 -30.6562129 172.2811151 76 -214.2788621 -30.6562129 77 -63.2164481 -214.2788621 78 -113.3156454 -63.2164481 79 -319.6636385 -113.3156454 80 -247.9020273 -319.6636385 > 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/717061261046180.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/88ror1261046180.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/9nqxi1261046180.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/10xmqf1261046180.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/1117o81261046180.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/12rl261261046180.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/13p2791261046180.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/14xr6g1261046180.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/15la3m1261046180.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/16dygg1261046180.tab") + } > > try(system("convert tmp/18u4s1261046180.ps tmp/18u4s1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/2q1v01261046180.ps tmp/2q1v01261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/3ne8h1261046180.ps tmp/3ne8h1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/4pavg1261046180.ps tmp/4pavg1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/505uv1261046180.ps tmp/505uv1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/6jb8a1261046180.ps tmp/6jb8a1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/717061261046180.ps tmp/717061261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/88ror1261046180.ps tmp/88ror1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/9nqxi1261046180.ps tmp/9nqxi1261046180.png",intern=TRUE)) character(0) > try(system("convert tmp/10xmqf1261046180.ps tmp/10xmqf1261046180.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.687 1.598 4.331