R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(103.34 + ,98.60 + ,96.33 + ,102.60 + ,96.90 + ,96.33 + ,100.69 + ,95.10 + ,95.05 + ,105.67 + ,97.00 + ,96.84 + ,123.61 + ,112.70 + ,96.92 + ,113.08 + ,102.90 + ,97.44 + ,106.46 + ,97.40 + ,97.78 + ,123.38 + ,111.40 + ,97.69 + ,109.87 + ,87.40 + ,96.67 + ,95.74 + ,96.80 + ,98.29 + ,123.06 + ,114.10 + ,98.20 + ,123.39 + ,110.30 + ,98.71 + ,120.28 + ,103.90 + ,98.54 + ,115.33 + ,101.60 + ,98.20 + ,110.40 + ,94.60 + ,100.80 + ,114.49 + ,95.90 + ,101.33 + ,132.03 + ,104.70 + ,101.88 + ,123.16 + ,102.80 + ,101.85 + ,118.82 + ,98.10 + ,102.04 + ,128.32 + ,113.90 + ,102.22 + ,112.24 + ,80.90 + ,102.63 + ,104.53 + ,95.70 + ,102.65 + ,132.57 + ,113.20 + ,102.54 + ,122.52 + ,105.90 + ,102.37 + ,131.80 + ,108.80 + ,102.68 + ,124.55 + ,102.30 + ,102.76 + ,120.96 + ,99.00 + ,102.82 + ,122.60 + ,100.70 + ,103.31 + ,145.52 + ,115.50 + ,103.23 + ,118.57 + ,100.70 + ,103.60 + ,134.25 + ,109.90 + ,103.95 + ,136.70 + ,114.60 + ,103.93 + ,121.37 + ,85.40 + ,104.25 + ,111.63 + ,100.50 + ,104.38 + ,134.42 + ,114.80 + ,104.36 + ,137.65 + ,116.50 + ,104.32 + ,137.86 + ,112.90 + ,104.58 + ,119.77 + ,102.00 + ,104.68 + ,130.69 + ,106.00 + ,104.92 + ,128.28 + ,105.30 + ,105.46 + ,147.45 + ,118.80 + ,105.23 + ,128.42 + ,106.10 + ,105.58 + ,136.90 + ,109.30 + ,105.34 + ,143.95 + ,117.20 + ,105.28 + ,135.64 + ,92.50 + ,105.70 + ,122.48 + ,104.20 + ,105.67 + ,136.83 + ,112.50 + ,105.71 + ,153.04 + ,122.40 + ,106.19 + ,142.71 + ,113.30 + ,106.93 + ,123.46 + ,100.00 + ,107.44 + ,144.37 + ,110.70 + ,107.85 + ,146.15 + ,112.80 + ,108.71 + ,147.61 + ,109.80 + ,109.32 + ,158.51 + ,117.30 + ,109.49 + ,147.40 + ,109.10 + ,110.20 + ,165.05 + ,115.90 + ,110.62 + ,154.64 + ,96.00 + ,111.22 + ,126.20 + ,99.80 + ,110.88 + ,157.36 + ,116.80 + ,111.15 + ,154.15 + ,115.70 + ,111.29 + ,123.21 + ,99.40 + ,111.09 + ,113.07 + ,94.30 + ,111.24 + ,110.45 + ,91.00 + ,111.45 + ,113.57 + ,93.20 + ,111.75 + ,122.44 + ,103.10 + ,111.07 + ,114.93 + ,94.10 + ,111.17 + ,111.85 + ,91.80 + ,110.96 + ,126.04 + ,102.70 + ,110.50 + ,121.34 + ,82.60 + ,110.48 + ,124.36 + ,89.10 + ,110.66) + ,dim=c(3 + ,70) + ,dimnames=list(c('Uitvoer' + ,'TIP' + ,'cons') + ,1:70)) > y <- array(NA,dim=c(3,70),dimnames=list(c('Uitvoer','TIP','cons'),1:70)) > 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' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 Uitvoer TIP cons 1 103.34 98.6 96.33 2 102.60 96.9 96.33 3 100.69 95.1 95.05 4 105.67 97.0 96.84 5 123.61 112.7 96.92 6 113.08 102.9 97.44 7 106.46 97.4 97.78 8 123.38 111.4 97.69 9 109.87 87.4 96.67 10 95.74 96.8 98.29 11 123.06 114.1 98.20 12 123.39 110.3 98.71 13 120.28 103.9 98.54 14 115.33 101.6 98.20 15 110.40 94.6 100.80 16 114.49 95.9 101.33 17 132.03 104.7 101.88 18 123.16 102.8 101.85 19 118.82 98.1 102.04 20 128.32 113.9 102.22 21 112.24 80.9 102.63 22 104.53 95.7 102.65 23 132.57 113.2 102.54 24 122.52 105.9 102.37 25 131.80 108.8 102.68 26 124.55 102.3 102.76 27 120.96 99.0 102.82 28 122.60 100.7 103.31 29 145.52 115.5 103.23 30 118.57 100.7 103.60 31 134.25 109.9 103.95 32 136.70 114.6 103.93 33 121.37 85.4 104.25 34 111.63 100.5 104.38 35 134.42 114.8 104.36 36 137.65 116.5 104.32 37 137.86 112.9 104.58 38 119.77 102.0 104.68 39 130.69 106.0 104.92 40 128.28 105.3 105.46 41 147.45 118.8 105.23 42 128.42 106.1 105.58 43 136.90 109.3 105.34 44 143.95 117.2 105.28 45 135.64 92.5 105.70 46 122.48 104.2 105.67 47 136.83 112.5 105.71 48 153.04 122.4 106.19 49 142.71 113.3 106.93 50 123.46 100.0 107.44 51 144.37 110.7 107.85 52 146.15 112.8 108.71 53 147.61 109.8 109.32 54 158.51 117.3 109.49 55 147.40 109.1 110.20 56 165.05 115.9 110.62 57 154.64 96.0 111.22 58 126.20 99.8 110.88 59 157.36 116.8 111.15 60 154.15 115.7 111.29 61 123.21 99.4 111.09 62 113.07 94.3 111.24 63 110.45 91.0 111.45 64 113.57 93.2 111.75 65 122.44 103.1 111.07 66 114.93 94.1 111.17 67 111.85 91.8 110.96 68 126.04 102.7 110.50 69 121.34 82.6 110.48 70 124.36 89.1 110.66 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) TIP cons -153.269 1.128 1.559 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -13.7350 -4.2722 -0.7397 2.7077 26.2410 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -153.2692 23.2305 -6.598 7.89e-09 *** TIP 1.1281 0.1018 11.081 < 2e-16 *** cons 1.5588 0.2013 7.745 6.93e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.006 on 67 degrees of freedom Multiple R-squared: 0.7383, Adjusted R-squared: 0.7305 F-statistic: 94.5 on 2 and 67 DF, p-value: < 2.2e-16 > 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,] 1.296587e-02 0.0259317399 0.98703413 [2,] 2.236846e-03 0.0044736911 0.99776315 [3,] 3.502713e-04 0.0007005427 0.99964973 [4,] 1.276691e-01 0.2553382452 0.87233088 [5,] 3.328373e-01 0.6656746732 0.66716266 [6,] 2.407609e-01 0.4815217882 0.75923911 [7,] 1.841850e-01 0.3683699553 0.81581502 [8,] 1.568179e-01 0.3136357136 0.84318214 [9,] 1.079550e-01 0.2159099740 0.89204501 [10,] 6.790344e-02 0.1358068733 0.93209656 [11,] 4.205931e-02 0.0841186216 0.95794069 [12,] 4.980739e-02 0.0996147848 0.95019261 [13,] 3.002440e-02 0.0600488089 0.96997560 [14,] 1.753969e-02 0.0350793706 0.98246031 [15,] 1.438517e-02 0.0287703397 0.98561483 [16,] 1.567388e-02 0.0313477581 0.98432612 [17,] 5.365552e-02 0.1073110461 0.94634448 [18,] 3.577530e-02 0.0715506047 0.96422470 [19,] 2.441778e-02 0.0488355679 0.97558222 [20,] 1.681766e-02 0.0336353281 0.98318234 [21,] 1.028033e-02 0.0205606559 0.98971967 [22,] 6.019115e-03 0.0120382291 0.99398089 [23,] 3.409270e-03 0.0068185408 0.99659073 [24,] 4.806465e-03 0.0096129298 0.99519354 [25,] 3.683825e-03 0.0073676504 0.99631617 [26,] 2.093925e-03 0.0041878507 0.99790607 [27,] 1.168273e-03 0.0023365467 0.99883173 [28,] 3.226723e-03 0.0064534458 0.99677328 [29,] 1.038843e-02 0.0207768587 0.98961157 [30,] 7.380074e-03 0.0147601488 0.99261993 [31,] 4.888893e-03 0.0097777863 0.99511111 [32,] 2.968999e-03 0.0059379979 0.99703100 [33,] 2.678845e-03 0.0053576906 0.99732115 [34,] 1.520936e-03 0.0030418728 0.99847906 [35,] 9.105421e-04 0.0018210842 0.99908946 [36,] 6.290382e-04 0.0012580764 0.99937096 [37,] 4.021071e-04 0.0008042142 0.99959789 [38,] 2.218759e-04 0.0004437518 0.99977812 [39,] 1.315259e-04 0.0002630518 0.99986847 [40,] 2.111631e-03 0.0042232628 0.99788837 [41,] 2.093582e-03 0.0041871643 0.99790642 [42,] 1.283560e-03 0.0025671207 0.99871644 [43,] 9.498652e-04 0.0018997304 0.99905013 [44,] 5.654427e-04 0.0011308855 0.99943456 [45,] 5.673525e-04 0.0011347050 0.99943265 [46,] 3.663412e-04 0.0007326824 0.99963366 [47,] 2.872024e-04 0.0005744047 0.99971280 [48,] 1.719885e-04 0.0003439771 0.99982801 [49,] 1.410621e-04 0.0002821241 0.99985894 [50,] 6.875104e-05 0.0001375021 0.99993125 [51,] 1.257136e-04 0.0002514271 0.99987429 [52,] 1.495690e-01 0.2991380318 0.85043098 [53,] 1.532666e-01 0.3065332232 0.84673339 [54,] 1.925281e-01 0.3850562517 0.80747187 [55,] 9.253470e-01 0.1493059814 0.07465299 [56,] 9.270684e-01 0.1458632211 0.07293161 [57,] 9.083484e-01 0.1833032809 0.09165164 [58,] 8.627449e-01 0.2745101257 0.13725506 [59,] 8.233611e-01 0.3532778952 0.17663895 > postscript(file="/var/wessaorg/rcomp/tmp/1v7dq1356023537.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/wessaorg/rcomp/tmp/2l3y31356023537.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/wessaorg/rcomp/tmp/3mb351356023537.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/wessaorg/rcomp/tmp/4ukwa1356023537.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/wessaorg/rcomp/tmp/5av8f1356023537.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 = 70 Frequency = 1 1 2 3 4 5 6 -4.7820419 -3.6042009 -1.4883178 -1.4419888 -1.3385159 -1.6232882 7 8 9 10 11 12 -2.5684911 -1.3021860 13.8531632 -13.4065797 -5.4631424 -1.6411774 13 14 15 16 17 18 2.7339210 0.9086294 -0.1771853 1.6200813 8.3751094 1.6953419 19 20 21 22 23 24 2.3614414 -6.2437771 14.2658040 -10.1718692 -1.7028848 -3.2524589 25 26 27 28 29 30 2.2727108 2.2309303 2.2702718 1.2286326 7.5768365 -3.2534113 31 32 33 34 35 36 1.5021145 -1.3189762 15.7939557 -11.1836250 -4.4948765 -3.1203666 37 38 39 40 41 42 0.7456630 -5.2034692 0.8298586 -1.6321790 2.6664250 -2.5817450 43 44 45 46 47 48 2.6623066 0.8935132 19.7939301 -6.5185652 -1.5944925 2.6986937 49 50 51 52 53 54 1.4812924 -3.5593961 4.6403907 2.7107493 6.6043236 8.7782693 55 56 57 58 59 60 5.8123036 15.1362555 26.2410131 -5.9559431 5.6047788 3.4175067 61 62 63 64 65 66 -8.8220285 -13.4423214 -12.6667957 -12.4963391 -13.7349775 -11.2475790 67 68 69 70 -11.4055109 -8.7952208 9.2116036 4.6181034 > postscript(file="/var/wessaorg/rcomp/tmp/6pudx1356023537.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 = 70 Frequency = 1 lag(myerror, k = 1) myerror 0 -4.7820419 NA 1 -3.6042009 -4.7820419 2 -1.4883178 -3.6042009 3 -1.4419888 -1.4883178 4 -1.3385159 -1.4419888 5 -1.6232882 -1.3385159 6 -2.5684911 -1.6232882 7 -1.3021860 -2.5684911 8 13.8531632 -1.3021860 9 -13.4065797 13.8531632 10 -5.4631424 -13.4065797 11 -1.6411774 -5.4631424 12 2.7339210 -1.6411774 13 0.9086294 2.7339210 14 -0.1771853 0.9086294 15 1.6200813 -0.1771853 16 8.3751094 1.6200813 17 1.6953419 8.3751094 18 2.3614414 1.6953419 19 -6.2437771 2.3614414 20 14.2658040 -6.2437771 21 -10.1718692 14.2658040 22 -1.7028848 -10.1718692 23 -3.2524589 -1.7028848 24 2.2727108 -3.2524589 25 2.2309303 2.2727108 26 2.2702718 2.2309303 27 1.2286326 2.2702718 28 7.5768365 1.2286326 29 -3.2534113 7.5768365 30 1.5021145 -3.2534113 31 -1.3189762 1.5021145 32 15.7939557 -1.3189762 33 -11.1836250 15.7939557 34 -4.4948765 -11.1836250 35 -3.1203666 -4.4948765 36 0.7456630 -3.1203666 37 -5.2034692 0.7456630 38 0.8298586 -5.2034692 39 -1.6321790 0.8298586 40 2.6664250 -1.6321790 41 -2.5817450 2.6664250 42 2.6623066 -2.5817450 43 0.8935132 2.6623066 44 19.7939301 0.8935132 45 -6.5185652 19.7939301 46 -1.5944925 -6.5185652 47 2.6986937 -1.5944925 48 1.4812924 2.6986937 49 -3.5593961 1.4812924 50 4.6403907 -3.5593961 51 2.7107493 4.6403907 52 6.6043236 2.7107493 53 8.7782693 6.6043236 54 5.8123036 8.7782693 55 15.1362555 5.8123036 56 26.2410131 15.1362555 57 -5.9559431 26.2410131 58 5.6047788 -5.9559431 59 3.4175067 5.6047788 60 -8.8220285 3.4175067 61 -13.4423214 -8.8220285 62 -12.6667957 -13.4423214 63 -12.4963391 -12.6667957 64 -13.7349775 -12.4963391 65 -11.2475790 -13.7349775 66 -11.4055109 -11.2475790 67 -8.7952208 -11.4055109 68 9.2116036 -8.7952208 69 4.6181034 9.2116036 70 NA 4.6181034 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.6042009 -4.7820419 [2,] -1.4883178 -3.6042009 [3,] -1.4419888 -1.4883178 [4,] -1.3385159 -1.4419888 [5,] -1.6232882 -1.3385159 [6,] -2.5684911 -1.6232882 [7,] -1.3021860 -2.5684911 [8,] 13.8531632 -1.3021860 [9,] -13.4065797 13.8531632 [10,] -5.4631424 -13.4065797 [11,] -1.6411774 -5.4631424 [12,] 2.7339210 -1.6411774 [13,] 0.9086294 2.7339210 [14,] -0.1771853 0.9086294 [15,] 1.6200813 -0.1771853 [16,] 8.3751094 1.6200813 [17,] 1.6953419 8.3751094 [18,] 2.3614414 1.6953419 [19,] -6.2437771 2.3614414 [20,] 14.2658040 -6.2437771 [21,] -10.1718692 14.2658040 [22,] -1.7028848 -10.1718692 [23,] -3.2524589 -1.7028848 [24,] 2.2727108 -3.2524589 [25,] 2.2309303 2.2727108 [26,] 2.2702718 2.2309303 [27,] 1.2286326 2.2702718 [28,] 7.5768365 1.2286326 [29,] -3.2534113 7.5768365 [30,] 1.5021145 -3.2534113 [31,] -1.3189762 1.5021145 [32,] 15.7939557 -1.3189762 [33,] -11.1836250 15.7939557 [34,] -4.4948765 -11.1836250 [35,] -3.1203666 -4.4948765 [36,] 0.7456630 -3.1203666 [37,] -5.2034692 0.7456630 [38,] 0.8298586 -5.2034692 [39,] -1.6321790 0.8298586 [40,] 2.6664250 -1.6321790 [41,] -2.5817450 2.6664250 [42,] 2.6623066 -2.5817450 [43,] 0.8935132 2.6623066 [44,] 19.7939301 0.8935132 [45,] -6.5185652 19.7939301 [46,] -1.5944925 -6.5185652 [47,] 2.6986937 -1.5944925 [48,] 1.4812924 2.6986937 [49,] -3.5593961 1.4812924 [50,] 4.6403907 -3.5593961 [51,] 2.7107493 4.6403907 [52,] 6.6043236 2.7107493 [53,] 8.7782693 6.6043236 [54,] 5.8123036 8.7782693 [55,] 15.1362555 5.8123036 [56,] 26.2410131 15.1362555 [57,] -5.9559431 26.2410131 [58,] 5.6047788 -5.9559431 [59,] 3.4175067 5.6047788 [60,] -8.8220285 3.4175067 [61,] -13.4423214 -8.8220285 [62,] -12.6667957 -13.4423214 [63,] -12.4963391 -12.6667957 [64,] -13.7349775 -12.4963391 [65,] -11.2475790 -13.7349775 [66,] -11.4055109 -11.2475790 [67,] -8.7952208 -11.4055109 [68,] 9.2116036 -8.7952208 [69,] 4.6181034 9.2116036 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.6042009 -4.7820419 2 -1.4883178 -3.6042009 3 -1.4419888 -1.4883178 4 -1.3385159 -1.4419888 5 -1.6232882 -1.3385159 6 -2.5684911 -1.6232882 7 -1.3021860 -2.5684911 8 13.8531632 -1.3021860 9 -13.4065797 13.8531632 10 -5.4631424 -13.4065797 11 -1.6411774 -5.4631424 12 2.7339210 -1.6411774 13 0.9086294 2.7339210 14 -0.1771853 0.9086294 15 1.6200813 -0.1771853 16 8.3751094 1.6200813 17 1.6953419 8.3751094 18 2.3614414 1.6953419 19 -6.2437771 2.3614414 20 14.2658040 -6.2437771 21 -10.1718692 14.2658040 22 -1.7028848 -10.1718692 23 -3.2524589 -1.7028848 24 2.2727108 -3.2524589 25 2.2309303 2.2727108 26 2.2702718 2.2309303 27 1.2286326 2.2702718 28 7.5768365 1.2286326 29 -3.2534113 7.5768365 30 1.5021145 -3.2534113 31 -1.3189762 1.5021145 32 15.7939557 -1.3189762 33 -11.1836250 15.7939557 34 -4.4948765 -11.1836250 35 -3.1203666 -4.4948765 36 0.7456630 -3.1203666 37 -5.2034692 0.7456630 38 0.8298586 -5.2034692 39 -1.6321790 0.8298586 40 2.6664250 -1.6321790 41 -2.5817450 2.6664250 42 2.6623066 -2.5817450 43 0.8935132 2.6623066 44 19.7939301 0.8935132 45 -6.5185652 19.7939301 46 -1.5944925 -6.5185652 47 2.6986937 -1.5944925 48 1.4812924 2.6986937 49 -3.5593961 1.4812924 50 4.6403907 -3.5593961 51 2.7107493 4.6403907 52 6.6043236 2.7107493 53 8.7782693 6.6043236 54 5.8123036 8.7782693 55 15.1362555 5.8123036 56 26.2410131 15.1362555 57 -5.9559431 26.2410131 58 5.6047788 -5.9559431 59 3.4175067 5.6047788 60 -8.8220285 3.4175067 61 -13.4423214 -8.8220285 62 -12.6667957 -13.4423214 63 -12.4963391 -12.6667957 64 -13.7349775 -12.4963391 65 -11.2475790 -13.7349775 66 -11.4055109 -11.2475790 67 -8.7952208 -11.4055109 68 9.2116036 -8.7952208 69 4.6181034 9.2116036 > 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/wessaorg/rcomp/tmp/7nssi1356023537.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/wessaorg/rcomp/tmp/84x1x1356023537.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/wessaorg/rcomp/tmp/91hvg1356023537.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/wessaorg/rcomp/tmp/104fxk1356023537.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/115s3v1356023537.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/wessaorg/rcomp/tmp/128ck91356023537.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/wessaorg/rcomp/tmp/13y8s61356023537.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/wessaorg/rcomp/tmp/14bzve1356023537.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/wessaorg/rcomp/tmp/15dvuf1356023537.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/wessaorg/rcomp/tmp/16j4hw1356023537.tab") + } > > try(system("convert tmp/1v7dq1356023537.ps tmp/1v7dq1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/2l3y31356023537.ps tmp/2l3y31356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/3mb351356023537.ps tmp/3mb351356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/4ukwa1356023537.ps tmp/4ukwa1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/5av8f1356023537.ps tmp/5av8f1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/6pudx1356023537.ps tmp/6pudx1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/7nssi1356023537.ps tmp/7nssi1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/84x1x1356023537.ps tmp/84x1x1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/91hvg1356023537.ps tmp/91hvg1356023537.png",intern=TRUE)) character(0) > try(system("convert tmp/104fxk1356023537.ps tmp/104fxk1356023537.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.285 1.168 7.512