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(24,24,22,23,25,24,24,24,29,27,26,28,26,25,21,19,23,19,22,19,21,20,16,16,19,22,16,21,25,25,27,29,23,28,22,25,23,26,20,24,24,28,23,28,20,28,21,28,22,32,17,31,21,22,19,29,23,31,22,29,15,32,23,32,21,31,18,29,18,28,18,28,18,29,10,22,13,26,10,24,9,27,9,27,6,23,11,21,9,19,10,17,9,19,16,21,10,13,7,8,7,5,14,10,11,6,10,6,6,8,8,11,13,12,12,13,15,19,16,19,16,18),dim=c(2,61),dimnames=list(c('s','consv'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('s','consv'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x s consv M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 24 24 1 0 0 0 0 0 0 0 0 0 0 1 2 22 23 0 1 0 0 0 0 0 0 0 0 0 2 3 25 24 0 0 1 0 0 0 0 0 0 0 0 3 4 24 24 0 0 0 1 0 0 0 0 0 0 0 4 5 29 27 0 0 0 0 1 0 0 0 0 0 0 5 6 26 28 0 0 0 0 0 1 0 0 0 0 0 6 7 26 25 0 0 0 0 0 0 1 0 0 0 0 7 8 21 19 0 0 0 0 0 0 0 1 0 0 0 8 9 23 19 0 0 0 0 0 0 0 0 1 0 0 9 10 22 19 0 0 0 0 0 0 0 0 0 1 0 10 11 21 20 0 0 0 0 0 0 0 0 0 0 1 11 12 16 16 0 0 0 0 0 0 0 0 0 0 0 12 13 19 22 1 0 0 0 0 0 0 0 0 0 0 13 14 16 21 0 1 0 0 0 0 0 0 0 0 0 14 15 25 25 0 0 1 0 0 0 0 0 0 0 0 15 16 27 29 0 0 0 1 0 0 0 0 0 0 0 16 17 23 28 0 0 0 0 1 0 0 0 0 0 0 17 18 22 25 0 0 0 0 0 1 0 0 0 0 0 18 19 23 26 0 0 0 0 0 0 1 0 0 0 0 19 20 20 24 0 0 0 0 0 0 0 1 0 0 0 20 21 24 28 0 0 0 0 0 0 0 0 1 0 0 21 22 23 28 0 0 0 0 0 0 0 0 0 1 0 22 23 20 28 0 0 0 0 0 0 0 0 0 0 1 23 24 21 28 0 0 0 0 0 0 0 0 0 0 0 24 25 22 32 1 0 0 0 0 0 0 0 0 0 0 25 26 17 31 0 1 0 0 0 0 0 0 0 0 0 26 27 21 22 0 0 1 0 0 0 0 0 0 0 0 27 28 19 29 0 0 0 1 0 0 0 0 0 0 0 28 29 23 31 0 0 0 0 1 0 0 0 0 0 0 29 30 22 29 0 0 0 0 0 1 0 0 0 0 0 30 31 15 32 0 0 0 0 0 0 1 0 0 0 0 31 32 23 32 0 0 0 0 0 0 0 1 0 0 0 32 33 21 31 0 0 0 0 0 0 0 0 1 0 0 33 34 18 29 0 0 0 0 0 0 0 0 0 1 0 34 35 18 28 0 0 0 0 0 0 0 0 0 0 1 35 36 18 28 0 0 0 0 0 0 0 0 0 0 0 36 37 18 29 1 0 0 0 0 0 0 0 0 0 0 37 38 10 22 0 1 0 0 0 0 0 0 0 0 0 38 39 13 26 0 0 1 0 0 0 0 0 0 0 0 39 40 10 24 0 0 0 1 0 0 0 0 0 0 0 40 41 9 27 0 0 0 0 1 0 0 0 0 0 0 41 42 9 27 0 0 0 0 0 1 0 0 0 0 0 42 43 6 23 0 0 0 0 0 0 1 0 0 0 0 43 44 11 21 0 0 0 0 0 0 0 1 0 0 0 44 45 9 19 0 0 0 0 0 0 0 0 1 0 0 45 46 10 17 0 0 0 0 0 0 0 0 0 1 0 46 47 9 19 0 0 0 0 0 0 0 0 0 0 1 47 48 16 21 0 0 0 0 0 0 0 0 0 0 0 48 49 10 13 1 0 0 0 0 0 0 0 0 0 0 49 50 7 8 0 1 0 0 0 0 0 0 0 0 0 50 51 7 5 0 0 1 0 0 0 0 0 0 0 0 51 52 14 10 0 0 0 1 0 0 0 0 0 0 0 52 53 11 6 0 0 0 0 1 0 0 0 0 0 0 53 54 10 6 0 0 0 0 0 1 0 0 0 0 0 54 55 6 8 0 0 0 0 0 0 1 0 0 0 0 55 56 8 11 0 0 0 0 0 0 0 1 0 0 0 56 57 13 12 0 0 0 0 0 0 0 0 1 0 0 57 58 12 13 0 0 0 0 0 0 0 0 0 1 0 58 59 15 19 0 0 0 0 0 0 0 0 0 0 1 59 60 16 19 0 0 0 0 0 0 0 0 0 0 0 60 61 16 18 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) consv M1 M2 M3 M4 21.348582 0.212254 -0.569446 -5.120365 -0.951260 -0.703820 M5 M6 M7 M8 M9 M10 -0.389420 -1.177865 -3.493662 -1.554754 0.002096 -0.628799 M11 t -1.126654 -0.241752 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.77819 -1.63148 0.01032 1.79818 6.14717 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 21.348582 2.909627 7.337 2.52e-09 *** consv 0.212254 0.075131 2.825 0.00692 ** M1 -0.569446 2.133534 -0.267 0.79071 M2 -5.120365 2.254835 -2.271 0.02778 * M3 -0.951260 2.255604 -0.422 0.67514 M4 -0.703820 2.234698 -0.315 0.75419 M5 -0.389420 2.231390 -0.175 0.86221 M6 -1.177865 2.230011 -0.528 0.59985 M7 -3.493662 2.228325 -1.568 0.12363 M8 -1.554754 2.230761 -0.697 0.48926 M9 0.002096 2.227292 0.001 0.99925 M10 -0.628799 2.227939 -0.282 0.77900 M11 -1.126654 2.224166 -0.507 0.61484 t -0.241752 0.030543 -7.915 3.41e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.516 on 47 degrees of freedom Multiple R-squared: 0.7476, Adjusted R-squared: 0.6777 F-statistic: 10.71 on 13 and 47 DF, p-value: 4.743e-10 > 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.1313210117 0.2626420233 0.8686790 [2,] 0.0775578710 0.1551157420 0.9224421 [3,] 0.0385097278 0.0770194557 0.9614903 [4,] 0.0207005926 0.0414011851 0.9792994 [5,] 0.0108430990 0.0216861981 0.9891569 [6,] 0.0045805828 0.0091611656 0.9954194 [7,] 0.0023330140 0.0046660280 0.9976670 [8,] 0.0011018633 0.0022037266 0.9988981 [9,] 0.0003660874 0.0007321748 0.9996339 [10,] 0.0002074330 0.0004148660 0.9997926 [11,] 0.0002066985 0.0004133971 0.9997933 [12,] 0.0002050684 0.0004101367 0.9997949 [13,] 0.0001472362 0.0002944725 0.9998528 [14,] 0.0002026918 0.0004053836 0.9997973 [15,] 0.0079641114 0.0159282228 0.9920359 [16,] 0.0269567420 0.0539134839 0.9730433 [17,] 0.0464365043 0.0928730086 0.9535635 [18,] 0.0612827374 0.1225654748 0.9387173 [19,] 0.1043910440 0.2087820881 0.8956090 [20,] 0.1023179751 0.2046359502 0.8976820 [21,] 0.2542314266 0.5084628532 0.7457686 [22,] 0.2370962501 0.4741925003 0.7629037 [23,] 0.5314296450 0.9371407099 0.4685704 [24,] 0.5563222366 0.8873555267 0.4436778 [25,] 0.6471303506 0.7057392989 0.3528696 [26,] 0.6981320845 0.6037358311 0.3018679 [27,] 0.6348042893 0.7303914214 0.3651957 [28,] 0.6113662379 0.7772675242 0.3886338 > postscript(file="/var/www/html/rcomp/tmp/1uowm1258565654.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/2ysw01258565654.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/3mygc1258565654.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/4tpy71258565654.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/5t2as1258565654.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 = 61 Frequency = 1 1 2 3 4 5 6 -1.63148253 1.37344237 0.23383578 -0.77185269 3.51873742 1.33668001 7 8 9 10 11 12 4.53099154 -0.89263951 -0.20773786 -0.33509033 -0.80773786 -5.84362303 13 14 15 16 17 18 -3.30594959 -1.30102470 2.92260635 4.06790141 0.20750800 0.87446706 19 20 21 22 23 24 4.21976212 -0.05288541 1.78299976 1.65564729 -0.60474612 -0.48964776 25 26 27 28 29 30 0.47253391 0.47745881 2.46039341 -1.03107389 2.47177034 2.92647528 31 32 33 34 35 36 -2.15273790 4.15010634 1.04726210 -0.65558213 0.29627858 -0.58862307 37 38 39 40 41 42 0.01032097 -1.71122942 -3.48759837 -6.06877860 -7.77818848 -6.74799178 43 44 45 46 47 48 -6.34142613 -2.61407366 -5.50466377 -3.20750800 -3.89240965 1.79818046 49 50 51 52 53 54 -1.69258843 1.16135294 -2.12923717 3.80380377 1.58017272 1.61036942 55 56 57 58 59 60 -0.25658964 -0.59050777 2.88213976 2.54253317 5.00861505 5.12371340 61 6.14716567 > postscript(file="/var/www/html/rcomp/tmp/68lsg1258565654.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.63148253 NA 1 1.37344237 -1.63148253 2 0.23383578 1.37344237 3 -0.77185269 0.23383578 4 3.51873742 -0.77185269 5 1.33668001 3.51873742 6 4.53099154 1.33668001 7 -0.89263951 4.53099154 8 -0.20773786 -0.89263951 9 -0.33509033 -0.20773786 10 -0.80773786 -0.33509033 11 -5.84362303 -0.80773786 12 -3.30594959 -5.84362303 13 -1.30102470 -3.30594959 14 2.92260635 -1.30102470 15 4.06790141 2.92260635 16 0.20750800 4.06790141 17 0.87446706 0.20750800 18 4.21976212 0.87446706 19 -0.05288541 4.21976212 20 1.78299976 -0.05288541 21 1.65564729 1.78299976 22 -0.60474612 1.65564729 23 -0.48964776 -0.60474612 24 0.47253391 -0.48964776 25 0.47745881 0.47253391 26 2.46039341 0.47745881 27 -1.03107389 2.46039341 28 2.47177034 -1.03107389 29 2.92647528 2.47177034 30 -2.15273790 2.92647528 31 4.15010634 -2.15273790 32 1.04726210 4.15010634 33 -0.65558213 1.04726210 34 0.29627858 -0.65558213 35 -0.58862307 0.29627858 36 0.01032097 -0.58862307 37 -1.71122942 0.01032097 38 -3.48759837 -1.71122942 39 -6.06877860 -3.48759837 40 -7.77818848 -6.06877860 41 -6.74799178 -7.77818848 42 -6.34142613 -6.74799178 43 -2.61407366 -6.34142613 44 -5.50466377 -2.61407366 45 -3.20750800 -5.50466377 46 -3.89240965 -3.20750800 47 1.79818046 -3.89240965 48 -1.69258843 1.79818046 49 1.16135294 -1.69258843 50 -2.12923717 1.16135294 51 3.80380377 -2.12923717 52 1.58017272 3.80380377 53 1.61036942 1.58017272 54 -0.25658964 1.61036942 55 -0.59050777 -0.25658964 56 2.88213976 -0.59050777 57 2.54253317 2.88213976 58 5.00861505 2.54253317 59 5.12371340 5.00861505 60 6.14716567 5.12371340 61 NA 6.14716567 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.37344237 -1.63148253 [2,] 0.23383578 1.37344237 [3,] -0.77185269 0.23383578 [4,] 3.51873742 -0.77185269 [5,] 1.33668001 3.51873742 [6,] 4.53099154 1.33668001 [7,] -0.89263951 4.53099154 [8,] -0.20773786 -0.89263951 [9,] -0.33509033 -0.20773786 [10,] -0.80773786 -0.33509033 [11,] -5.84362303 -0.80773786 [12,] -3.30594959 -5.84362303 [13,] -1.30102470 -3.30594959 [14,] 2.92260635 -1.30102470 [15,] 4.06790141 2.92260635 [16,] 0.20750800 4.06790141 [17,] 0.87446706 0.20750800 [18,] 4.21976212 0.87446706 [19,] -0.05288541 4.21976212 [20,] 1.78299976 -0.05288541 [21,] 1.65564729 1.78299976 [22,] -0.60474612 1.65564729 [23,] -0.48964776 -0.60474612 [24,] 0.47253391 -0.48964776 [25,] 0.47745881 0.47253391 [26,] 2.46039341 0.47745881 [27,] -1.03107389 2.46039341 [28,] 2.47177034 -1.03107389 [29,] 2.92647528 2.47177034 [30,] -2.15273790 2.92647528 [31,] 4.15010634 -2.15273790 [32,] 1.04726210 4.15010634 [33,] -0.65558213 1.04726210 [34,] 0.29627858 -0.65558213 [35,] -0.58862307 0.29627858 [36,] 0.01032097 -0.58862307 [37,] -1.71122942 0.01032097 [38,] -3.48759837 -1.71122942 [39,] -6.06877860 -3.48759837 [40,] -7.77818848 -6.06877860 [41,] -6.74799178 -7.77818848 [42,] -6.34142613 -6.74799178 [43,] -2.61407366 -6.34142613 [44,] -5.50466377 -2.61407366 [45,] -3.20750800 -5.50466377 [46,] -3.89240965 -3.20750800 [47,] 1.79818046 -3.89240965 [48,] -1.69258843 1.79818046 [49,] 1.16135294 -1.69258843 [50,] -2.12923717 1.16135294 [51,] 3.80380377 -2.12923717 [52,] 1.58017272 3.80380377 [53,] 1.61036942 1.58017272 [54,] -0.25658964 1.61036942 [55,] -0.59050777 -0.25658964 [56,] 2.88213976 -0.59050777 [57,] 2.54253317 2.88213976 [58,] 5.00861505 2.54253317 [59,] 5.12371340 5.00861505 [60,] 6.14716567 5.12371340 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.37344237 -1.63148253 2 0.23383578 1.37344237 3 -0.77185269 0.23383578 4 3.51873742 -0.77185269 5 1.33668001 3.51873742 6 4.53099154 1.33668001 7 -0.89263951 4.53099154 8 -0.20773786 -0.89263951 9 -0.33509033 -0.20773786 10 -0.80773786 -0.33509033 11 -5.84362303 -0.80773786 12 -3.30594959 -5.84362303 13 -1.30102470 -3.30594959 14 2.92260635 -1.30102470 15 4.06790141 2.92260635 16 0.20750800 4.06790141 17 0.87446706 0.20750800 18 4.21976212 0.87446706 19 -0.05288541 4.21976212 20 1.78299976 -0.05288541 21 1.65564729 1.78299976 22 -0.60474612 1.65564729 23 -0.48964776 -0.60474612 24 0.47253391 -0.48964776 25 0.47745881 0.47253391 26 2.46039341 0.47745881 27 -1.03107389 2.46039341 28 2.47177034 -1.03107389 29 2.92647528 2.47177034 30 -2.15273790 2.92647528 31 4.15010634 -2.15273790 32 1.04726210 4.15010634 33 -0.65558213 1.04726210 34 0.29627858 -0.65558213 35 -0.58862307 0.29627858 36 0.01032097 -0.58862307 37 -1.71122942 0.01032097 38 -3.48759837 -1.71122942 39 -6.06877860 -3.48759837 40 -7.77818848 -6.06877860 41 -6.74799178 -7.77818848 42 -6.34142613 -6.74799178 43 -2.61407366 -6.34142613 44 -5.50466377 -2.61407366 45 -3.20750800 -5.50466377 46 -3.89240965 -3.20750800 47 1.79818046 -3.89240965 48 -1.69258843 1.79818046 49 1.16135294 -1.69258843 50 -2.12923717 1.16135294 51 3.80380377 -2.12923717 52 1.58017272 3.80380377 53 1.61036942 1.58017272 54 -0.25658964 1.61036942 55 -0.59050777 -0.25658964 56 2.88213976 -0.59050777 57 2.54253317 2.88213976 58 5.00861505 2.54253317 59 5.12371340 5.00861505 60 6.14716567 5.12371340 > 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/7ijv21258565654.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/8gc8h1258565654.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/9eq3z1258565654.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/10n9u01258565654.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/11l1p91258565654.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/12vq8s1258565654.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/1328z21258565654.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/14bzbc1258565654.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/15u89m1258565654.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/1697bc1258565654.tab") + } > > system("convert tmp/1uowm1258565654.ps tmp/1uowm1258565654.png") > system("convert tmp/2ysw01258565654.ps tmp/2ysw01258565654.png") > system("convert tmp/3mygc1258565654.ps tmp/3mygc1258565654.png") > system("convert tmp/4tpy71258565654.ps tmp/4tpy71258565654.png") > system("convert tmp/5t2as1258565654.ps tmp/5t2as1258565654.png") > system("convert tmp/68lsg1258565654.ps tmp/68lsg1258565654.png") > system("convert tmp/7ijv21258565654.ps tmp/7ijv21258565654.png") > system("convert tmp/8gc8h1258565654.ps tmp/8gc8h1258565654.png") > system("convert tmp/9eq3z1258565654.ps tmp/9eq3z1258565654.png") > system("convert tmp/10n9u01258565654.ps tmp/10n9u01258565654.png") > > > proc.time() user system elapsed 2.405 1.583 2.851