R version 2.7.2 (2008-08-25) Copyright (C) 2008 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(69.97 + ,6911 + ,8488 + ,72.13 + ,7030.6 + ,10900 + ,78.27 + ,7115.1 + ,10456 + ,80.31 + ,7232.2 + ,18508 + ,79.06 + ,7298.3 + ,12880 + ,78.98 + ,7337.7 + ,14034 + ,87.35 + ,7432.1 + ,12419 + ,86.16 + ,7522.5 + ,17256 + ,88.71 + ,7624.1 + ,10407 + ,90.16 + ,7776.6 + ,12245 + ,94.09 + ,7866.2 + ,13394 + ,93.57 + ,8000.4 + ,18333 + ,96.73 + ,8113.8 + ,14076 + ,94.67 + ,8250.4 + ,15359 + ,101.05 + ,8381.9 + ,16592 + ,105.16 + ,8471.2 + ,19188 + ,105.27 + ,8586.7 + ,15428 + ,104.88 + ,8657.9 + ,15564 + ,107.11 + ,8789.5 + ,15451 + ,99.41 + ,8953.8 + ,19825 + ,101.37 + ,9066.6 + ,14813 + ,98.86 + ,9174.1 + ,15309 + ,100.64 + ,9313.5 + ,18573 + ,97.16 + ,9519.5 + ,20255 + ,98.1 + ,9629.4 + ,20138 + ,96.79 + ,9822.8 + ,22204 + ,102.71 + ,9862.1 + ,22981 + ,102.95 + ,9953.6 + ,21986 + ,104.07 + ,10021.5 + ,23139 + ,104.31 + ,10128.9 + ,22081 + ,105.02 + ,10135.1 + ,23989 + ,106.08 + ,10226.3 + ,24503 + ,105.28 + ,10333.3 + ,23818 + ,99.36 + ,10426.6 + ,26013 + ,101.53 + ,10527.4 + ,31911 + ,99.32 + ,10591.1 + ,31889 + ,96.91 + ,10705.6 + ,32091 + ,92.65 + ,10831.8 + ,34476 + ,95.7 + ,11086.1 + ,41941 + ,93.2 + ,11219.5 + ,48062 + ,91.93 + ,11405.5 + ,45848 + ,92.24 + ,11610.3 + ,50496 + ,95.32 + ,11779.4 + ,55803 + ,88.72 + ,11948.5 + ,63784 + ,87.99 + ,12155.4 + ,60869 + ,89.2 + ,12297.5 + ,65960 + ,93.78 + ,12538.2 + ,70186 + ,94.99 + ,12696.4 + ,75412 + ,92.9 + ,12959.6 + ,78046 + ,90.61 + ,13134.1 + ,81311 + ,94.26 + ,13249.6 + ,91629 + ,94.17 + ,13370.1 + ,94094 + ,94.81 + ,13510.9 + ,83424 + ,95.77 + ,13737.5 + ,103268 + ,99.4 + ,13950.6 + ,112481 + ,98.76 + ,14031.2 + ,114416 + ,99.37 + ,14150.8 + ,108963 + ,101.02 + ,14294.5 + ,121533) + ,dim=c(3 + ,58) + ,dimnames=list(c('reer' + ,'GDP' + ,'exp') + ,1:58)) > y <- array(NA,dim=c(3,58),dimnames=list(c('reer','GDP','exp'),1:58)) > 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 Quarterly Dummies' > par1 = '3' > #'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 exp reer GDP Q1 Q2 Q3 t 1 8488 69.97 6911.0 1 0 0 1 2 10900 72.13 7030.6 0 1 0 2 3 10456 78.27 7115.1 0 0 1 3 4 18508 80.31 7232.2 0 0 0 4 5 12880 79.06 7298.3 1 0 0 5 6 14034 78.98 7337.7 0 1 0 6 7 12419 87.35 7432.1 0 0 1 7 8 17256 86.16 7522.5 0 0 0 8 9 10407 88.71 7624.1 1 0 0 9 10 12245 90.16 7776.6 0 1 0 10 11 13394 94.09 7866.2 0 0 1 11 12 18333 93.57 8000.4 0 0 0 12 13 14076 96.73 8113.8 1 0 0 13 14 15359 94.67 8250.4 0 1 0 14 15 16592 101.05 8381.9 0 0 1 15 16 19188 105.16 8471.2 0 0 0 16 17 15428 105.27 8586.7 1 0 0 17 18 15564 104.88 8657.9 0 1 0 18 19 15451 107.11 8789.5 0 0 1 19 20 19825 99.41 8953.8 0 0 0 20 21 14813 101.37 9066.6 1 0 0 21 22 15309 98.86 9174.1 0 1 0 22 23 18573 100.64 9313.5 0 0 1 23 24 20255 97.16 9519.5 0 0 0 24 25 20138 98.10 9629.4 1 0 0 25 26 22204 96.79 9822.8 0 1 0 26 27 22981 102.71 9862.1 0 0 1 27 28 21986 102.95 9953.6 0 0 0 28 29 23139 104.07 10021.5 1 0 0 29 30 22081 104.31 10128.9 0 1 0 30 31 23989 105.02 10135.1 0 0 1 31 32 24503 106.08 10226.3 0 0 0 32 33 23818 105.28 10333.3 1 0 0 33 34 26013 99.36 10426.6 0 1 0 34 35 31911 101.53 10527.4 0 0 1 35 36 31889 99.32 10591.1 0 0 0 36 37 32091 96.91 10705.6 1 0 0 37 38 34476 92.65 10831.8 0 1 0 38 39 41941 95.70 11086.1 0 0 1 39 40 48062 93.20 11219.5 0 0 0 40 41 45848 91.93 11405.5 1 0 0 41 42 50496 92.24 11610.3 0 1 0 42 43 55803 95.32 11779.4 0 0 1 43 44 63784 88.72 11948.5 0 0 0 44 45 60869 87.99 12155.4 1 0 0 45 46 65960 89.20 12297.5 0 1 0 46 47 70186 93.78 12538.2 0 0 1 47 48 75412 94.99 12696.4 0 0 0 48 49 78046 92.90 12959.6 1 0 0 49 50 81311 90.61 13134.1 0 1 0 50 51 91629 94.26 13249.6 0 0 1 51 52 94094 94.17 13370.1 0 0 0 52 53 83424 94.81 13510.9 1 0 0 53 54 103268 95.77 13737.5 0 1 0 54 55 112481 99.40 13950.6 0 0 1 55 56 114416 98.76 14031.2 0 0 0 56 57 108963 99.37 14150.8 1 0 0 57 58 121533 101.02 14294.5 0 1 0 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) reer GDP Q1 Q2 Q3 -299135.53 -323.77 49.84 -5204.27 -3671.18 -1741.21 t -4652.51 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -12219.4 -4000.7 843.5 4165.2 14505.8 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2.991e+05 2.780e+04 -10.762 9.95e-15 *** reer -3.238e+02 1.102e+02 -2.939 0.00493 ** GDP 4.984e+01 3.418e+00 14.580 < 2e-16 *** Q1 -5.204e+03 2.138e+03 -2.435 0.01844 * Q2 -3.671e+03 2.144e+03 -1.712 0.09299 . Q3 -1.741e+03 2.175e+03 -0.800 0.42717 t -4.653e+03 4.507e+02 -10.322 4.33e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5739 on 51 degrees of freedom Multiple R-squared: 0.9718, Adjusted R-squared: 0.9684 F-statistic: 292.5 on 6 and 51 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,] 6.125692e-02 1.225138e-01 0.9387431 [2,] 1.874784e-02 3.749569e-02 0.9812522 [3,] 6.766528e-03 1.353306e-02 0.9932335 [4,] 3.030364e-03 6.060728e-03 0.9969696 [5,] 1.060274e-03 2.120548e-03 0.9989397 [6,] 4.315577e-04 8.631155e-04 0.9995684 [7,] 2.482624e-04 4.965248e-04 0.9997517 [8,] 1.302212e-04 2.604425e-04 0.9998698 [9,] 7.747027e-05 1.549405e-04 0.9999225 [10,] 5.117280e-05 1.023456e-04 0.9999488 [11,] 4.513619e-05 9.027238e-05 0.9999549 [12,] 3.007120e-05 6.014240e-05 0.9999699 [13,] 1.665287e-05 3.330574e-05 0.9999833 [14,] 3.211323e-05 6.422647e-05 0.9999679 [15,] 1.826256e-05 3.652513e-05 0.9999817 [16,] 1.873190e-04 3.746380e-04 0.9998127 [17,] 3.594577e-04 7.189154e-04 0.9996405 [18,] 6.364545e-04 1.272909e-03 0.9993635 [19,] 4.970567e-04 9.941133e-04 0.9995029 [20,] 4.561714e-03 9.123428e-03 0.9954383 [21,] 3.182905e-03 6.365810e-03 0.9968171 [22,] 3.442301e-03 6.884603e-03 0.9965577 [23,] 1.897682e-03 3.795364e-03 0.9981023 [24,] 1.438326e-03 2.876651e-03 0.9985617 [25,] 9.558025e-04 1.911605e-03 0.9990442 [26,] 3.750682e-03 7.501365e-03 0.9962493 [27,] 2.308578e-03 4.617156e-03 0.9976914 [28,] 2.466920e-03 4.933841e-03 0.9975331 [29,] 1.878566e-03 3.757133e-03 0.9981214 [30,] 1.584789e-02 3.169579e-02 0.9841521 [31,] 6.069302e-02 1.213860e-01 0.9393070 [32,] 1.393609e-01 2.787219e-01 0.8606391 [33,] 2.085349e-01 4.170698e-01 0.7914651 [34,] 2.496322e-01 4.992645e-01 0.7503678 [35,] 3.130688e-01 6.261376e-01 0.6869312 [36,] 5.814458e-01 8.371085e-01 0.4185542 [37,] 7.769414e-01 4.461171e-01 0.2230586 [38,] 6.566282e-01 6.867436e-01 0.3433718 [39,] 7.741576e-01 4.516849e-01 0.2258424 > postscript(file="/var/www/html/rcomp/tmp/1zlnr1225638108.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/20vwu1225638108.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/3v05e1225638108.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/438d51225638108.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/5wr7l1225638108.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 = 58 Frequency = 1 1 2 3 4 5 6 -4284.84358 -4014.51681 -3959.19603 1828.75230 2358.62735 4642.58414 7 8 9 10 11 12 3755.53805 6613.33225 5383.35146 3210.18093 3888.79763 4882.68420 13 14 15 16 17 18 5854.13508 2781.92057 2249.63476 4637.24586 5013.53263 4594.32139 19 20 21 22 23 24 1367.39405 -2028.48590 -2170.66075 -4725.33305 -5109.68237 -11909.41936 25 26 27 28 29 30 -7342.31701 -12219.41089 -8761.71362 -11327.74412 -3339.23266 -6552.54561 31 32 33 34 35 36 -2001.11983 -2777.70555 802.55744 -449.50346 3850.10479 2849.28318 37 38 39 40 41 42 6421.49846 4257.28223 2758.91904 4333.60423 2295.61612 -43.10079 43 44 45 46 47 48 556.31286 884.36834 -2721.36370 -1200.94090 -4765.15601 -4120.21645 49 50 51 52 53 54 -5423.07063 -8476.55355 -10.35676 -668.48875 -8291.46392 3689.83748 55 56 57 58 6180.52345 6802.78979 5443.63370 14505.77833 > postscript(file="/var/www/html/rcomp/tmp/6co581225638108.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -4284.84358 NA 1 -4014.51681 -4284.84358 2 -3959.19603 -4014.51681 3 1828.75230 -3959.19603 4 2358.62735 1828.75230 5 4642.58414 2358.62735 6 3755.53805 4642.58414 7 6613.33225 3755.53805 8 5383.35146 6613.33225 9 3210.18093 5383.35146 10 3888.79763 3210.18093 11 4882.68420 3888.79763 12 5854.13508 4882.68420 13 2781.92057 5854.13508 14 2249.63476 2781.92057 15 4637.24586 2249.63476 16 5013.53263 4637.24586 17 4594.32139 5013.53263 18 1367.39405 4594.32139 19 -2028.48590 1367.39405 20 -2170.66075 -2028.48590 21 -4725.33305 -2170.66075 22 -5109.68237 -4725.33305 23 -11909.41936 -5109.68237 24 -7342.31701 -11909.41936 25 -12219.41089 -7342.31701 26 -8761.71362 -12219.41089 27 -11327.74412 -8761.71362 28 -3339.23266 -11327.74412 29 -6552.54561 -3339.23266 30 -2001.11983 -6552.54561 31 -2777.70555 -2001.11983 32 802.55744 -2777.70555 33 -449.50346 802.55744 34 3850.10479 -449.50346 35 2849.28318 3850.10479 36 6421.49846 2849.28318 37 4257.28223 6421.49846 38 2758.91904 4257.28223 39 4333.60423 2758.91904 40 2295.61612 4333.60423 41 -43.10079 2295.61612 42 556.31286 -43.10079 43 884.36834 556.31286 44 -2721.36370 884.36834 45 -1200.94090 -2721.36370 46 -4765.15601 -1200.94090 47 -4120.21645 -4765.15601 48 -5423.07063 -4120.21645 49 -8476.55355 -5423.07063 50 -10.35676 -8476.55355 51 -668.48875 -10.35676 52 -8291.46392 -668.48875 53 3689.83748 -8291.46392 54 6180.52345 3689.83748 55 6802.78979 6180.52345 56 5443.63370 6802.78979 57 14505.77833 5443.63370 58 NA 14505.77833 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -4014.51681 -4284.84358 [2,] -3959.19603 -4014.51681 [3,] 1828.75230 -3959.19603 [4,] 2358.62735 1828.75230 [5,] 4642.58414 2358.62735 [6,] 3755.53805 4642.58414 [7,] 6613.33225 3755.53805 [8,] 5383.35146 6613.33225 [9,] 3210.18093 5383.35146 [10,] 3888.79763 3210.18093 [11,] 4882.68420 3888.79763 [12,] 5854.13508 4882.68420 [13,] 2781.92057 5854.13508 [14,] 2249.63476 2781.92057 [15,] 4637.24586 2249.63476 [16,] 5013.53263 4637.24586 [17,] 4594.32139 5013.53263 [18,] 1367.39405 4594.32139 [19,] -2028.48590 1367.39405 [20,] -2170.66075 -2028.48590 [21,] -4725.33305 -2170.66075 [22,] -5109.68237 -4725.33305 [23,] -11909.41936 -5109.68237 [24,] -7342.31701 -11909.41936 [25,] -12219.41089 -7342.31701 [26,] -8761.71362 -12219.41089 [27,] -11327.74412 -8761.71362 [28,] -3339.23266 -11327.74412 [29,] -6552.54561 -3339.23266 [30,] -2001.11983 -6552.54561 [31,] -2777.70555 -2001.11983 [32,] 802.55744 -2777.70555 [33,] -449.50346 802.55744 [34,] 3850.10479 -449.50346 [35,] 2849.28318 3850.10479 [36,] 6421.49846 2849.28318 [37,] 4257.28223 6421.49846 [38,] 2758.91904 4257.28223 [39,] 4333.60423 2758.91904 [40,] 2295.61612 4333.60423 [41,] -43.10079 2295.61612 [42,] 556.31286 -43.10079 [43,] 884.36834 556.31286 [44,] -2721.36370 884.36834 [45,] -1200.94090 -2721.36370 [46,] -4765.15601 -1200.94090 [47,] -4120.21645 -4765.15601 [48,] -5423.07063 -4120.21645 [49,] -8476.55355 -5423.07063 [50,] -10.35676 -8476.55355 [51,] -668.48875 -10.35676 [52,] -8291.46392 -668.48875 [53,] 3689.83748 -8291.46392 [54,] 6180.52345 3689.83748 [55,] 6802.78979 6180.52345 [56,] 5443.63370 6802.78979 [57,] 14505.77833 5443.63370 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -4014.51681 -4284.84358 2 -3959.19603 -4014.51681 3 1828.75230 -3959.19603 4 2358.62735 1828.75230 5 4642.58414 2358.62735 6 3755.53805 4642.58414 7 6613.33225 3755.53805 8 5383.35146 6613.33225 9 3210.18093 5383.35146 10 3888.79763 3210.18093 11 4882.68420 3888.79763 12 5854.13508 4882.68420 13 2781.92057 5854.13508 14 2249.63476 2781.92057 15 4637.24586 2249.63476 16 5013.53263 4637.24586 17 4594.32139 5013.53263 18 1367.39405 4594.32139 19 -2028.48590 1367.39405 20 -2170.66075 -2028.48590 21 -4725.33305 -2170.66075 22 -5109.68237 -4725.33305 23 -11909.41936 -5109.68237 24 -7342.31701 -11909.41936 25 -12219.41089 -7342.31701 26 -8761.71362 -12219.41089 27 -11327.74412 -8761.71362 28 -3339.23266 -11327.74412 29 -6552.54561 -3339.23266 30 -2001.11983 -6552.54561 31 -2777.70555 -2001.11983 32 802.55744 -2777.70555 33 -449.50346 802.55744 34 3850.10479 -449.50346 35 2849.28318 3850.10479 36 6421.49846 2849.28318 37 4257.28223 6421.49846 38 2758.91904 4257.28223 39 4333.60423 2758.91904 40 2295.61612 4333.60423 41 -43.10079 2295.61612 42 556.31286 -43.10079 43 884.36834 556.31286 44 -2721.36370 884.36834 45 -1200.94090 -2721.36370 46 -4765.15601 -1200.94090 47 -4120.21645 -4765.15601 48 -5423.07063 -4120.21645 49 -8476.55355 -5423.07063 50 -10.35676 -8476.55355 51 -668.48875 -10.35676 52 -8291.46392 -668.48875 53 3689.83748 -8291.46392 54 6180.52345 3689.83748 55 6802.78979 6180.52345 56 5443.63370 6802.78979 57 14505.77833 5443.63370 > 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/7qh261225638108.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/8grti1225638108.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/9si6y1225638108.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/10ie6w1225638108.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/11rs2m1225638108.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/1202291225638108.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/13p2in1225638108.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/140ww91225638108.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/1526e51225638108.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/16jmzs1225638108.tab") + } > > system("convert tmp/1zlnr1225638108.ps tmp/1zlnr1225638108.png") > system("convert tmp/20vwu1225638108.ps tmp/20vwu1225638108.png") > system("convert tmp/3v05e1225638108.ps tmp/3v05e1225638108.png") > system("convert tmp/438d51225638108.ps tmp/438d51225638108.png") > system("convert tmp/5wr7l1225638108.ps tmp/5wr7l1225638108.png") > system("convert tmp/6co581225638108.ps tmp/6co581225638108.png") > system("convert tmp/7qh261225638108.ps tmp/7qh261225638108.png") > system("convert tmp/8grti1225638108.ps tmp/8grti1225638108.png") > system("convert tmp/9si6y1225638108.ps tmp/9si6y1225638108.png") > system("convert tmp/10ie6w1225638108.ps tmp/10ie6w1225638108.png") > > > proc.time() user system elapsed 2.847 1.641 5.663