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(12.1,0,0,12,0,0,11.8,0,0,12.7,0,0,12.3,0,0,11.9,0,0,12,0,0,12.3,0,0,12.8,0,0,12.4,0,0,12.3,0,0,12.7,0,0,12.7,0,0,12.9,0,0,13,0,0,12.2,0,0,12.3,0,0,12.8,0,0,12.8,0,0,12.8,0,0,12.2,0,0,12.6,0,0,12.8,0,0,12.5,0,0,12.4,0,0,12.3,1,0,11.9,1,0,11.7,1,0,12,1,0,12.1,1,0,11.7,1,0,11.8,1,0,11.8,1,0,11.8,1,0,11.3,1,0,11.3,1,0,11.3,1,0,11.2,0,1,11.4,0,1,12.2,0,1,12.9,0,1,13.1,0,1,13.5,0,1,13.6,0,1,14.4,0,1,14.1,0,1,15.1,0,1,15.8,0,1,15.9,0,1,15.4,0,1,15.5,0,1,14.8,0,1,13.2,0,1,12.7,0,1,12.1,0,1,11.9,0,1,10.6,0,1,10.7,0,1,9.8,0,1,9,0,1,8.3,0,1,9.3,0,1,9,0,1,9.1,0,1,10,0,1),dim=c(3,65),dimnames=list(c('Gzhdsidx','Vr_crisis','NA_crisis'),1:65)) > y <- array(NA,dim=c(3,65),dimnames=list(c('Gzhdsidx','Vr_crisis','NA_crisis'),1:65)) > 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 Gzhdsidx Vr_crisis NA_crisis M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 12.1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 2 12.0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 3 11.8 0 0 0 0 1 0 0 0 0 0 0 0 0 3 4 12.7 0 0 0 0 0 1 0 0 0 0 0 0 0 4 5 12.3 0 0 0 0 0 0 1 0 0 0 0 0 0 5 6 11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) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Vr_crisis NA_crisis M1 M2 M3 14.12357 1.14362 3.74369 -0.35421 -0.81178 -0.79540 M4 M5 M6 M7 M8 M9 -0.67901 -0.57930 -0.33830 -0.33858 -0.17886 -0.19915 M10 M11 t -0.13943 -0.09972 -0.09972 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.13038 -0.84698 0.02258 0.80961 3.51365 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 14.12357 0.87812 16.084 < 2e-16 *** Vr_crisis 1.14362 0.76273 1.499 0.14006 NA_crisis 3.74369 1.19191 3.141 0.00283 ** M1 -0.35421 0.94480 -0.375 0.70931 M2 -0.81178 0.96600 -0.840 0.40471 M3 -0.79540 0.96025 -0.828 0.41143 M4 -0.67901 0.95533 -0.711 0.48053 M5 -0.57930 0.95124 -0.609 0.54529 M6 -0.33830 0.99932 -0.339 0.73638 M7 -0.33858 0.99481 -0.340 0.73502 M8 -0.17886 0.99110 -0.180 0.85751 M9 -0.19915 0.98821 -0.202 0.84111 M10 -0.13943 0.98614 -0.141 0.88813 M11 -0.09972 0.98489 -0.101 0.91976 t -0.09972 0.02860 -3.487 0.00103 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.557 on 50 degrees of freedom Multiple R-squared: 0.2243, Adjusted R-squared: 0.007071 F-statistic: 1.033 on 14 and 50 DF, p-value: 0.4384 > 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,] 5.251141e-02 1.050228e-01 0.9474886 [2,] 1.518618e-02 3.037235e-02 0.9848138 [3,] 3.764222e-03 7.528444e-03 0.9962358 [4,] 2.911138e-03 5.822276e-03 0.9970889 [5,] 7.764767e-04 1.552953e-03 0.9992235 [6,] 1.863908e-04 3.727816e-04 0.9998136 [7,] 6.186287e-05 1.237257e-04 0.9999381 [8,] 1.946937e-05 3.893874e-05 0.9999805 [9,] 4.114680e-06 8.229361e-06 0.9999959 [10,] 9.141671e-07 1.828334e-06 0.9999991 [11,] 2.202297e-07 4.404594e-07 0.9999998 [12,] 4.170679e-08 8.341357e-08 1.0000000 [13,] 7.552834e-09 1.510567e-08 1.0000000 [14,] 1.482430e-09 2.964859e-09 1.0000000 [15,] 2.806906e-10 5.613811e-10 1.0000000 [16,] 4.626434e-11 9.252867e-11 1.0000000 [17,] 7.154412e-12 1.430882e-11 1.0000000 [18,] 3.177196e-12 6.354392e-12 1.0000000 [19,] 1.236740e-12 2.473481e-12 1.0000000 [20,] 3.532467e-13 7.064935e-13 1.0000000 [21,] 2.976329e-13 5.952657e-13 1.0000000 [22,] 7.769447e-13 1.553889e-12 1.0000000 [23,] 1.704438e-11 3.408875e-11 1.0000000 [24,] 3.876118e-09 7.752236e-09 1.0000000 [25,] 1.431171e-07 2.862342e-07 0.9999999 [26,] 6.052895e-06 1.210579e-05 0.9999939 [27,] 2.686345e-04 5.372690e-04 0.9997314 [28,] 1.500380e-03 3.000761e-03 0.9984996 [29,] 8.505902e-03 1.701180e-02 0.9914941 [30,] 1.347298e-02 2.694596e-02 0.9865270 > postscript(file="/var/www/html/rcomp/tmp/1kf771261149177.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/2pglf1261149177.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/3tg4z1261149177.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/4nz4h1261149177.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/5pbj81261149177.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 = 65 Frequency = 1 1 2 3 4 5 6 -1.56964577 -1.11236428 -1.22903094 -0.34569761 -0.74569761 -1.28698324 7 8 9 10 11 12 -1.08698324 -0.84698324 -0.22698324 -0.58698324 -0.62698324 -0.22698324 13 14 15 16 17 18 0.22694591 0.98422740 1.16756074 0.35089407 0.45089407 0.80960844 19 20 21 22 23 24 0.90960844 0.84960844 0.36960844 0.80960844 1.06960844 0.76960844 25 26 27 28 29 30 1.12353760 0.43719632 0.12052966 -0.09613701 0.20386299 0.16257736 31 32 33 34 35 36 -0.13742264 -0.09742264 0.02257736 0.06257736 -0.37742264 -0.37742264 37 38 39 40 41 42 0.07650651 -2.06627816 -1.78294483 -0.99961150 -0.29961150 -0.24089712 43 44 45 46 47 48 0.25910288 0.29910288 1.21910288 0.95910288 2.01910288 2.71910288 49 50 51 52 53 54 3.27303203 3.33031352 3.51364685 2.79698018 1.19698018 0.55569456 55 56 57 58 59 60 0.05569456 -0.20430544 -1.38430544 -1.24430544 -2.08430544 -2.88430544 61 62 63 64 65 -3.13037629 -1.57309480 -1.78976147 -1.70642814 -0.80642814 > postscript(file="/var/www/html/rcomp/tmp/6lty51261149177.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 = 65 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.56964577 NA 1 -1.11236428 -1.56964577 2 -1.22903094 -1.11236428 3 -0.34569761 -1.22903094 4 -0.74569761 -0.34569761 5 -1.28698324 -0.74569761 6 -1.08698324 -1.28698324 7 -0.84698324 -1.08698324 8 -0.22698324 -0.84698324 9 -0.58698324 -0.22698324 10 -0.62698324 -0.58698324 11 -0.22698324 -0.62698324 12 0.22694591 -0.22698324 13 0.98422740 0.22694591 14 1.16756074 0.98422740 15 0.35089407 1.16756074 16 0.45089407 0.35089407 17 0.80960844 0.45089407 18 0.90960844 0.80960844 19 0.84960844 0.90960844 20 0.36960844 0.84960844 21 0.80960844 0.36960844 22 1.06960844 0.80960844 23 0.76960844 1.06960844 24 1.12353760 0.76960844 25 0.43719632 1.12353760 26 0.12052966 0.43719632 27 -0.09613701 0.12052966 28 0.20386299 -0.09613701 29 0.16257736 0.20386299 30 -0.13742264 0.16257736 31 -0.09742264 -0.13742264 32 0.02257736 -0.09742264 33 0.06257736 0.02257736 34 -0.37742264 0.06257736 35 -0.37742264 -0.37742264 36 0.07650651 -0.37742264 37 -2.06627816 0.07650651 38 -1.78294483 -2.06627816 39 -0.99961150 -1.78294483 40 -0.29961150 -0.99961150 41 -0.24089712 -0.29961150 42 0.25910288 -0.24089712 43 0.29910288 0.25910288 44 1.21910288 0.29910288 45 0.95910288 1.21910288 46 2.01910288 0.95910288 47 2.71910288 2.01910288 48 3.27303203 2.71910288 49 3.33031352 3.27303203 50 3.51364685 3.33031352 51 2.79698018 3.51364685 52 1.19698018 2.79698018 53 0.55569456 1.19698018 54 0.05569456 0.55569456 55 -0.20430544 0.05569456 56 -1.38430544 -0.20430544 57 -1.24430544 -1.38430544 58 -2.08430544 -1.24430544 59 -2.88430544 -2.08430544 60 -3.13037629 -2.88430544 61 -1.57309480 -3.13037629 62 -1.78976147 -1.57309480 63 -1.70642814 -1.78976147 64 -0.80642814 -1.70642814 65 NA -0.80642814 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.11236428 -1.56964577 [2,] -1.22903094 -1.11236428 [3,] -0.34569761 -1.22903094 [4,] -0.74569761 -0.34569761 [5,] -1.28698324 -0.74569761 [6,] -1.08698324 -1.28698324 [7,] -0.84698324 -1.08698324 [8,] -0.22698324 -0.84698324 [9,] -0.58698324 -0.22698324 [10,] -0.62698324 -0.58698324 [11,] -0.22698324 -0.62698324 [12,] 0.22694591 -0.22698324 [13,] 0.98422740 0.22694591 [14,] 1.16756074 0.98422740 [15,] 0.35089407 1.16756074 [16,] 0.45089407 0.35089407 [17,] 0.80960844 0.45089407 [18,] 0.90960844 0.80960844 [19,] 0.84960844 0.90960844 [20,] 0.36960844 0.84960844 [21,] 0.80960844 0.36960844 [22,] 1.06960844 0.80960844 [23,] 0.76960844 1.06960844 [24,] 1.12353760 0.76960844 [25,] 0.43719632 1.12353760 [26,] 0.12052966 0.43719632 [27,] -0.09613701 0.12052966 [28,] 0.20386299 -0.09613701 [29,] 0.16257736 0.20386299 [30,] -0.13742264 0.16257736 [31,] -0.09742264 -0.13742264 [32,] 0.02257736 -0.09742264 [33,] 0.06257736 0.02257736 [34,] -0.37742264 0.06257736 [35,] -0.37742264 -0.37742264 [36,] 0.07650651 -0.37742264 [37,] -2.06627816 0.07650651 [38,] -1.78294483 -2.06627816 [39,] -0.99961150 -1.78294483 [40,] -0.29961150 -0.99961150 [41,] -0.24089712 -0.29961150 [42,] 0.25910288 -0.24089712 [43,] 0.29910288 0.25910288 [44,] 1.21910288 0.29910288 [45,] 0.95910288 1.21910288 [46,] 2.01910288 0.95910288 [47,] 2.71910288 2.01910288 [48,] 3.27303203 2.71910288 [49,] 3.33031352 3.27303203 [50,] 3.51364685 3.33031352 [51,] 2.79698018 3.51364685 [52,] 1.19698018 2.79698018 [53,] 0.55569456 1.19698018 [54,] 0.05569456 0.55569456 [55,] -0.20430544 0.05569456 [56,] -1.38430544 -0.20430544 [57,] -1.24430544 -1.38430544 [58,] -2.08430544 -1.24430544 [59,] -2.88430544 -2.08430544 [60,] -3.13037629 -2.88430544 [61,] -1.57309480 -3.13037629 [62,] -1.78976147 -1.57309480 [63,] -1.70642814 -1.78976147 [64,] -0.80642814 -1.70642814 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.11236428 -1.56964577 2 -1.22903094 -1.11236428 3 -0.34569761 -1.22903094 4 -0.74569761 -0.34569761 5 -1.28698324 -0.74569761 6 -1.08698324 -1.28698324 7 -0.84698324 -1.08698324 8 -0.22698324 -0.84698324 9 -0.58698324 -0.22698324 10 -0.62698324 -0.58698324 11 -0.22698324 -0.62698324 12 0.22694591 -0.22698324 13 0.98422740 0.22694591 14 1.16756074 0.98422740 15 0.35089407 1.16756074 16 0.45089407 0.35089407 17 0.80960844 0.45089407 18 0.90960844 0.80960844 19 0.84960844 0.90960844 20 0.36960844 0.84960844 21 0.80960844 0.36960844 22 1.06960844 0.80960844 23 0.76960844 1.06960844 24 1.12353760 0.76960844 25 0.43719632 1.12353760 26 0.12052966 0.43719632 27 -0.09613701 0.12052966 28 0.20386299 -0.09613701 29 0.16257736 0.20386299 30 -0.13742264 0.16257736 31 -0.09742264 -0.13742264 32 0.02257736 -0.09742264 33 0.06257736 0.02257736 34 -0.37742264 0.06257736 35 -0.37742264 -0.37742264 36 0.07650651 -0.37742264 37 -2.06627816 0.07650651 38 -1.78294483 -2.06627816 39 -0.99961150 -1.78294483 40 -0.29961150 -0.99961150 41 -0.24089712 -0.29961150 42 0.25910288 -0.24089712 43 0.29910288 0.25910288 44 1.21910288 0.29910288 45 0.95910288 1.21910288 46 2.01910288 0.95910288 47 2.71910288 2.01910288 48 3.27303203 2.71910288 49 3.33031352 3.27303203 50 3.51364685 3.33031352 51 2.79698018 3.51364685 52 1.19698018 2.79698018 53 0.55569456 1.19698018 54 0.05569456 0.55569456 55 -0.20430544 0.05569456 56 -1.38430544 -0.20430544 57 -1.24430544 -1.38430544 58 -2.08430544 -1.24430544 59 -2.88430544 -2.08430544 60 -3.13037629 -2.88430544 61 -1.57309480 -3.13037629 62 -1.78976147 -1.57309480 63 -1.70642814 -1.78976147 64 -0.80642814 -1.70642814 > 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/79cmj1261149177.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/88cco1261149177.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/98jhs1261149177.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/10n4aw1261149177.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/11nmvx1261149177.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/125rqp1261149177.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/138dmd1261149177.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/14fdy41261149177.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/15gts01261149177.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/16oz8a1261149177.tab") + } > > try(system("convert tmp/1kf771261149177.ps tmp/1kf771261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/2pglf1261149177.ps tmp/2pglf1261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/3tg4z1261149177.ps tmp/3tg4z1261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/4nz4h1261149177.ps tmp/4nz4h1261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/5pbj81261149177.ps tmp/5pbj81261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/6lty51261149177.ps tmp/6lty51261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/79cmj1261149177.ps tmp/79cmj1261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/88cco1261149177.ps tmp/88cco1261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/98jhs1261149177.ps tmp/98jhs1261149177.png",intern=TRUE)) character(0) > try(system("convert tmp/10n4aw1261149177.ps tmp/10n4aw1261149177.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.454 1.582 3.064