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(100 + ,100 + ,96.21064363 + ,97.82226485 + ,96.31280765 + ,94.04971502 + ,107.1793443 + ,91.12460521 + ,114.9066592 + ,93.13202153 + ,92.56060184 + ,93.88342812 + ,114.9995356 + ,92.55349954 + ,107.1236185 + ,94.43494835 + ,117.7765394 + ,96.25017563 + ,107.3650971 + ,100.4355715 + ,106.2970187 + ,101.5036685 + ,114.5072908 + ,99.39789728 + ,98.0031578 + ,99.68990733 + ,103.0649206 + ,101.6895041 + ,100.2879168 + ,103.6652759 + ,104.6066685 + ,103.0532766 + ,111.1544534 + ,100.9500712 + ,104.9874617 + ,102.345366 + ,109.9284852 + ,101.6472299 + ,111.5352466 + ,99.56809393 + ,132.4974459 + ,95.67727392 + ,100.3436426 + ,96.58494865 + ,123.0983561 + ,96.32604937 + ,114.2379493 + ,95.37109101 + ,104.569518 + ,96.00056203 + ,109.0833101 + ,96.88367859 + ,106.9843039 + ,94.85280372 + ,133.6769759 + ,92.46943974 + ,124.8537197 + ,93.99180173 + ,122.5132349 + ,93.45262168 + ,116.8013374 + ,92.26698759 + ,116.0118882 + ,90.39653498 + ,129.7575926 + ,90.43001228 + ,125.1973623 + ,91.04995327 + ,143.7912139 + ,89.07845784 + ,127.9465032 + ,89.69314509 + ,130.2962757 + ,87.92459054 + ,108.4424631 + ,85.8789319 + ,129.3675118 + ,83.20612366 + ,143.6797622 + ,83.85722053 + ,131.8844618 + ,83.01393462 + ,117.6186496 + ,82.84508195 + ,118.9560695 + ,78.68864276 + ,104.8202842 + ,77.56959675 + ,134.624315 + ,78.53689529 + ,140.401226 + ,78.55717715 + ,143.8005015 + ,77.4761291 + ,153.4317823 + ,81.58931659 + ,153.2924677 + ,85.02428326 + ,127.3149438 + ,91.71290159 + ,153.5525216 + ,95.96293061 + ,136.9276493 + ,90.84689022 + ,131.7730101 + ,92.28788036 + ,144.3391845 + ,95.56511274 + ,107.4208229 + ,93.62452884 + ,113.6249652 + ,92.63071726 + ,124.2221603 + ,89.50914211 + ,102.0618557 + ,87.17171779 + ,96.36853348 + ,86.72624975 + ,111.6838488 + ,85.63212844) + ,dim=c(2 + ,60) + ,dimnames=list(c('Import' + ,'Wisselkoers') + ,1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Import','Wisselkoers'),1:60)) > 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 Import Wisselkoers M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 100.00000 100.00000 1 0 0 0 0 0 0 0 0 0 0 2 96.21064 97.82226 0 1 0 0 0 0 0 0 0 0 0 3 96.31281 94.04972 0 0 1 0 0 0 0 0 0 0 0 4 107.17934 91.12461 0 0 0 1 0 0 0 0 0 0 0 5 114.90666 93.13202 0 0 0 0 1 0 0 0 0 0 0 6 92.56060 93.88343 0 0 0 0 0 1 0 0 0 0 0 7 114.99954 92.55350 0 0 0 0 0 0 1 0 0 0 0 8 107.12362 94.43495 0 0 0 0 0 0 0 1 0 0 0 9 117.77654 96.25018 0 0 0 0 0 0 0 0 1 0 0 10 107.36510 100.43557 0 0 0 0 0 0 0 0 0 1 0 11 106.29702 101.50367 0 0 0 0 0 0 0 0 0 0 1 12 114.50729 99.39790 0 0 0 0 0 0 0 0 0 0 0 13 98.00316 99.68991 1 0 0 0 0 0 0 0 0 0 0 14 103.06492 101.68950 0 1 0 0 0 0 0 0 0 0 0 15 100.28792 103.66528 0 0 1 0 0 0 0 0 0 0 0 16 104.60667 103.05328 0 0 0 1 0 0 0 0 0 0 0 17 111.15445 100.95007 0 0 0 0 1 0 0 0 0 0 0 18 104.98746 102.34537 0 0 0 0 0 1 0 0 0 0 0 19 109.92849 101.64723 0 0 0 0 0 0 1 0 0 0 0 20 111.53525 99.56809 0 0 0 0 0 0 0 1 0 0 0 21 132.49745 95.67727 0 0 0 0 0 0 0 0 1 0 0 22 100.34364 96.58495 0 0 0 0 0 0 0 0 0 1 0 23 123.09836 96.32605 0 0 0 0 0 0 0 0 0 0 1 24 114.23795 95.37109 0 0 0 0 0 0 0 0 0 0 0 25 104.56952 96.00056 1 0 0 0 0 0 0 0 0 0 0 26 109.08331 96.88368 0 1 0 0 0 0 0 0 0 0 0 27 106.98430 94.85280 0 0 1 0 0 0 0 0 0 0 0 28 133.67698 92.46944 0 0 0 1 0 0 0 0 0 0 0 29 124.85372 93.99180 0 0 0 0 1 0 0 0 0 0 0 30 122.51323 93.45262 0 0 0 0 0 1 0 0 0 0 0 31 116.80134 92.26699 0 0 0 0 0 0 1 0 0 0 0 32 116.01189 90.39653 0 0 0 0 0 0 0 1 0 0 0 33 129.75759 90.43001 0 0 0 0 0 0 0 0 1 0 0 34 125.19736 91.04995 0 0 0 0 0 0 0 0 0 1 0 35 143.79121 89.07846 0 0 0 0 0 0 0 0 0 0 1 36 127.94650 89.69315 0 0 0 0 0 0 0 0 0 0 0 37 130.29628 87.92459 1 0 0 0 0 0 0 0 0 0 0 38 108.44246 85.87893 0 1 0 0 0 0 0 0 0 0 0 39 129.36751 83.20612 0 0 1 0 0 0 0 0 0 0 0 40 143.67976 83.85722 0 0 0 1 0 0 0 0 0 0 0 41 131.88446 83.01393 0 0 0 0 1 0 0 0 0 0 0 42 117.61865 82.84508 0 0 0 0 0 1 0 0 0 0 0 43 118.95607 78.68864 0 0 0 0 0 0 1 0 0 0 0 44 104.82028 77.56960 0 0 0 0 0 0 0 1 0 0 0 45 134.62431 78.53690 0 0 0 0 0 0 0 0 1 0 0 46 140.40123 78.55718 0 0 0 0 0 0 0 0 0 1 0 47 143.80050 77.47613 0 0 0 0 0 0 0 0 0 0 1 48 153.43178 81.58932 0 0 0 0 0 0 0 0 0 0 0 49 153.29247 85.02428 1 0 0 0 0 0 0 0 0 0 0 50 127.31494 91.71290 0 1 0 0 0 0 0 0 0 0 0 51 153.55252 95.96293 0 0 1 0 0 0 0 0 0 0 0 52 136.92765 90.84689 0 0 0 1 0 0 0 0 0 0 0 53 131.77301 92.28788 0 0 0 0 1 0 0 0 0 0 0 54 144.33918 95.56511 0 0 0 0 0 1 0 0 0 0 0 55 107.42082 93.62453 0 0 0 0 0 0 1 0 0 0 0 56 113.62497 92.63072 0 0 0 0 0 0 0 1 0 0 0 57 124.22216 89.50914 0 0 0 0 0 0 0 0 1 0 0 58 102.06186 87.17172 0 0 0 0 0 0 0 0 0 1 0 59 96.36853 86.72625 0 0 0 0 0 0 0 0 0 0 1 60 111.68385 85.63213 0 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) Wisselkoers M1 M2 M3 M4 222.724 -1.089 -3.437 -10.681 -2.693 2.958 M5 M6 M7 M8 M9 M10 1.099 -4.384 -9.195 -13.103 3.135 -8.827 M11 -1.815 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -30.1090 -8.8732 0.1699 7.1205 38.0106 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 222.724 25.925 8.591 3.39e-11 *** Wisselkoers -1.089 0.278 -3.917 0.000289 *** M1 -3.437 9.159 -0.375 0.709169 M2 -10.681 9.194 -1.162 0.251208 M3 -2.693 9.178 -0.293 0.770456 M4 2.958 9.126 0.324 0.747281 M5 1.099 9.133 0.120 0.904721 M6 -4.385 9.156 -0.479 0.634243 M7 -9.195 9.119 -1.008 0.318458 M8 -13.103 9.112 -1.438 0.157036 M9 3.135 9.110 0.344 0.732266 M10 -8.827 9.111 -0.969 0.337590 M11 -1.815 9.110 -0.199 0.842932 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 14.4 on 47 degrees of freedom Multiple R-squared: 0.3473, Adjusted R-squared: 0.1806 F-statistic: 2.084 on 12 and 47 DF, p-value: 0.03686 > 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.0164602011 0.0329204022 0.9835398 [2,] 0.0049042353 0.0098084707 0.9950958 [3,] 0.0077307882 0.0154615763 0.9922692 [4,] 0.0036076785 0.0072153570 0.9963923 [5,] 0.0011472030 0.0022944060 0.9988528 [6,] 0.0025546376 0.0051092752 0.9974454 [7,] 0.0012118698 0.0024237397 0.9987881 [8,] 0.0025889710 0.0051779420 0.9974110 [9,] 0.0009971958 0.0019943916 0.9990028 [10,] 0.0008201781 0.0016403562 0.9991798 [11,] 0.0005685728 0.0011371455 0.9994314 [12,] 0.0007524917 0.0015049834 0.9992475 [13,] 0.0083232682 0.0166465364 0.9916767 [14,] 0.0058385260 0.0116770521 0.9941615 [15,] 0.0102390448 0.0204780897 0.9897610 [16,] 0.0051434543 0.0102869086 0.9948565 [17,] 0.0025568856 0.0051137713 0.9974431 [18,] 0.0011369326 0.0022738651 0.9988631 [19,] 0.0009980551 0.0019961102 0.9990019 [20,] 0.0021604753 0.0043209506 0.9978395 [21,] 0.0009972154 0.0019944307 0.9990028 [22,] 0.0012174885 0.0024349770 0.9987825 [23,] 0.0010771370 0.0021542739 0.9989229 [24,] 0.0015324660 0.0030649320 0.9984675 [25,] 0.0008504710 0.0017009420 0.9991495 [26,] 0.0003502077 0.0007004154 0.9996498 [27,] 0.0014380514 0.0028761027 0.9985619 [28,] 0.0011013167 0.0022026334 0.9988987 [29,] 0.0386942440 0.0773884880 0.9613058 > postscript(file="/var/www/html/rcomp/tmp/1bcq01258731778.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/2iine1258731778.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/3qojl1258731778.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/4lqux1258731778.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/5bc8b1258731778.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 = 60 Frequency = 1 1 2 3 4 5 6 -10.40290298 -9.31906389 -21.31230469 -19.28220540 -7.51033038 -23.55456522 7 8 9 10 11 12 2.24644560 0.32767668 -3.28146643 2.82659862 -4.09023490 0.01204106 13 14 15 16 17 18 -12.73738813 1.74603842 -6.86733712 -8.86640323 -2.74988942 -1.91396393 19 20 21 22 23 24 7.07706091 10.32850631 10.81563873 -8.38758854 7.07347616 -4.64186959 25 26 27 28 29 30 -10.18815428 2.53162732 -9.76636907 8.67974298 3.37289776 5.92898627 31 32 33 34 35 36 3.73628021 4.81873890 2.36232917 10.43937737 19.87482787 2.88427950 37 38 39 40 41 42 6.74511969 -10.09168656 -0.06459420 9.30515473 -1.54955932 -10.51556898 43 44 45 46 47 48 -8.89370486 -20.33941671 -5.72071316 12.04054031 7.25097417 19.54574289 49 50 51 52 53 54 26.58332570 15.13308471 38.01060509 10.16371093 8.43688136 30.05511186 55 56 57 58 59 60 -4.16608186 4.86449481 -4.17578830 -16.91892776 -30.10904331 -17.80019386 > postscript(file="/var/www/html/rcomp/tmp/664o61258731778.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -10.40290298 NA 1 -9.31906389 -10.40290298 2 -21.31230469 -9.31906389 3 -19.28220540 -21.31230469 4 -7.51033038 -19.28220540 5 -23.55456522 -7.51033038 6 2.24644560 -23.55456522 7 0.32767668 2.24644560 8 -3.28146643 0.32767668 9 2.82659862 -3.28146643 10 -4.09023490 2.82659862 11 0.01204106 -4.09023490 12 -12.73738813 0.01204106 13 1.74603842 -12.73738813 14 -6.86733712 1.74603842 15 -8.86640323 -6.86733712 16 -2.74988942 -8.86640323 17 -1.91396393 -2.74988942 18 7.07706091 -1.91396393 19 10.32850631 7.07706091 20 10.81563873 10.32850631 21 -8.38758854 10.81563873 22 7.07347616 -8.38758854 23 -4.64186959 7.07347616 24 -10.18815428 -4.64186959 25 2.53162732 -10.18815428 26 -9.76636907 2.53162732 27 8.67974298 -9.76636907 28 3.37289776 8.67974298 29 5.92898627 3.37289776 30 3.73628021 5.92898627 31 4.81873890 3.73628021 32 2.36232917 4.81873890 33 10.43937737 2.36232917 34 19.87482787 10.43937737 35 2.88427950 19.87482787 36 6.74511969 2.88427950 37 -10.09168656 6.74511969 38 -0.06459420 -10.09168656 39 9.30515473 -0.06459420 40 -1.54955932 9.30515473 41 -10.51556898 -1.54955932 42 -8.89370486 -10.51556898 43 -20.33941671 -8.89370486 44 -5.72071316 -20.33941671 45 12.04054031 -5.72071316 46 7.25097417 12.04054031 47 19.54574289 7.25097417 48 26.58332570 19.54574289 49 15.13308471 26.58332570 50 38.01060509 15.13308471 51 10.16371093 38.01060509 52 8.43688136 10.16371093 53 30.05511186 8.43688136 54 -4.16608186 30.05511186 55 4.86449481 -4.16608186 56 -4.17578830 4.86449481 57 -16.91892776 -4.17578830 58 -30.10904331 -16.91892776 59 -17.80019386 -30.10904331 60 NA -17.80019386 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -9.31906389 -10.40290298 [2,] -21.31230469 -9.31906389 [3,] -19.28220540 -21.31230469 [4,] -7.51033038 -19.28220540 [5,] -23.55456522 -7.51033038 [6,] 2.24644560 -23.55456522 [7,] 0.32767668 2.24644560 [8,] -3.28146643 0.32767668 [9,] 2.82659862 -3.28146643 [10,] -4.09023490 2.82659862 [11,] 0.01204106 -4.09023490 [12,] -12.73738813 0.01204106 [13,] 1.74603842 -12.73738813 [14,] -6.86733712 1.74603842 [15,] -8.86640323 -6.86733712 [16,] -2.74988942 -8.86640323 [17,] -1.91396393 -2.74988942 [18,] 7.07706091 -1.91396393 [19,] 10.32850631 7.07706091 [20,] 10.81563873 10.32850631 [21,] -8.38758854 10.81563873 [22,] 7.07347616 -8.38758854 [23,] -4.64186959 7.07347616 [24,] -10.18815428 -4.64186959 [25,] 2.53162732 -10.18815428 [26,] -9.76636907 2.53162732 [27,] 8.67974298 -9.76636907 [28,] 3.37289776 8.67974298 [29,] 5.92898627 3.37289776 [30,] 3.73628021 5.92898627 [31,] 4.81873890 3.73628021 [32,] 2.36232917 4.81873890 [33,] 10.43937737 2.36232917 [34,] 19.87482787 10.43937737 [35,] 2.88427950 19.87482787 [36,] 6.74511969 2.88427950 [37,] -10.09168656 6.74511969 [38,] -0.06459420 -10.09168656 [39,] 9.30515473 -0.06459420 [40,] -1.54955932 9.30515473 [41,] -10.51556898 -1.54955932 [42,] -8.89370486 -10.51556898 [43,] -20.33941671 -8.89370486 [44,] -5.72071316 -20.33941671 [45,] 12.04054031 -5.72071316 [46,] 7.25097417 12.04054031 [47,] 19.54574289 7.25097417 [48,] 26.58332570 19.54574289 [49,] 15.13308471 26.58332570 [50,] 38.01060509 15.13308471 [51,] 10.16371093 38.01060509 [52,] 8.43688136 10.16371093 [53,] 30.05511186 8.43688136 [54,] -4.16608186 30.05511186 [55,] 4.86449481 -4.16608186 [56,] -4.17578830 4.86449481 [57,] -16.91892776 -4.17578830 [58,] -30.10904331 -16.91892776 [59,] -17.80019386 -30.10904331 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -9.31906389 -10.40290298 2 -21.31230469 -9.31906389 3 -19.28220540 -21.31230469 4 -7.51033038 -19.28220540 5 -23.55456522 -7.51033038 6 2.24644560 -23.55456522 7 0.32767668 2.24644560 8 -3.28146643 0.32767668 9 2.82659862 -3.28146643 10 -4.09023490 2.82659862 11 0.01204106 -4.09023490 12 -12.73738813 0.01204106 13 1.74603842 -12.73738813 14 -6.86733712 1.74603842 15 -8.86640323 -6.86733712 16 -2.74988942 -8.86640323 17 -1.91396393 -2.74988942 18 7.07706091 -1.91396393 19 10.32850631 7.07706091 20 10.81563873 10.32850631 21 -8.38758854 10.81563873 22 7.07347616 -8.38758854 23 -4.64186959 7.07347616 24 -10.18815428 -4.64186959 25 2.53162732 -10.18815428 26 -9.76636907 2.53162732 27 8.67974298 -9.76636907 28 3.37289776 8.67974298 29 5.92898627 3.37289776 30 3.73628021 5.92898627 31 4.81873890 3.73628021 32 2.36232917 4.81873890 33 10.43937737 2.36232917 34 19.87482787 10.43937737 35 2.88427950 19.87482787 36 6.74511969 2.88427950 37 -10.09168656 6.74511969 38 -0.06459420 -10.09168656 39 9.30515473 -0.06459420 40 -1.54955932 9.30515473 41 -10.51556898 -1.54955932 42 -8.89370486 -10.51556898 43 -20.33941671 -8.89370486 44 -5.72071316 -20.33941671 45 12.04054031 -5.72071316 46 7.25097417 12.04054031 47 19.54574289 7.25097417 48 26.58332570 19.54574289 49 15.13308471 26.58332570 50 38.01060509 15.13308471 51 10.16371093 38.01060509 52 8.43688136 10.16371093 53 30.05511186 8.43688136 54 -4.16608186 30.05511186 55 4.86449481 -4.16608186 56 -4.17578830 4.86449481 57 -16.91892776 -4.17578830 58 -30.10904331 -16.91892776 59 -17.80019386 -30.10904331 > 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/7nd821258731778.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/8ssr61258731778.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/90oex1258731778.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/10jp1r1258731778.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/11q7jl1258731778.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/12v4uw1258731778.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/13tqk81258731778.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/144llt1258731778.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/15vzjv1258731778.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/16abbt1258731778.tab") + } > > system("convert tmp/1bcq01258731778.ps tmp/1bcq01258731778.png") > system("convert tmp/2iine1258731778.ps tmp/2iine1258731778.png") > system("convert tmp/3qojl1258731778.ps tmp/3qojl1258731778.png") > system("convert tmp/4lqux1258731778.ps tmp/4lqux1258731778.png") > system("convert tmp/5bc8b1258731778.ps tmp/5bc8b1258731778.png") > system("convert tmp/664o61258731778.ps tmp/664o61258731778.png") > system("convert tmp/7nd821258731778.ps tmp/7nd821258731778.png") > system("convert tmp/8ssr61258731778.ps tmp/8ssr61258731778.png") > system("convert tmp/90oex1258731778.ps tmp/90oex1258731778.png") > system("convert tmp/10jp1r1258731778.ps tmp/10jp1r1258731778.png") > > > proc.time() user system elapsed 2.473 1.640 4.249