R version 2.8.0 (2008-10-20) 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(71.7,0,77.5,0,89.8,0,80.3,0,78.7,0,93.8,0,57.6,0,60.6,0,91,0,85.3,0,77.4,0,77.3,0,68.3,0,69.9,0,81.7,0,75.1,0,69.9,0,84,0,54.3,0,60,0,89.9,0,77,0,85.3,0,77.6,0,69.2,0,75.5,0,85.7,0,72.2,0,79.9,0,85.3,0,52.2,0,61.2,0,82.4,0,85.4,0,78.2,0,70.2,1,70.2,1,69.3,1,77.5,1,66.1,1,69,1,79.2,1,56.2,1,63.3,1,77.8,1,92,1,78.1,1,65.1,1,71.1,1,70.9,1,72,1,81.9,1,70.6,1,72.5,1,65.1,1,61.1,1),dim=c(2,56),dimnames=list(c('y','x'),1:56)) > y <- array(NA,dim=c(2,56),dimnames=list(c('y','x'),1:56)) > 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 y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 71.7 0 1 0 0 0 0 0 0 0 0 0 0 1 2 77.5 0 0 1 0 0 0 0 0 0 0 0 0 2 3 89.8 0 0 0 1 0 0 0 0 0 0 0 0 3 4 80.3 0 0 0 0 1 0 0 0 0 0 0 0 4 5 78.7 0 0 0 0 0 1 0 0 0 0 0 0 5 6 93.8 0 0 0 0 0 0 1 0 0 0 0 0 6 7 57.6 0 0 0 0 0 0 0 1 0 0 0 0 7 8 60.6 0 0 0 0 0 0 0 0 1 0 0 0 8 9 91.0 0 0 0 0 0 0 0 0 0 1 0 0 9 10 85.3 0 0 0 0 0 0 0 0 0 0 1 0 10 11 77.4 0 0 0 0 0 0 0 0 0 0 0 1 11 12 77.3 0 0 0 0 0 0 0 0 0 0 0 0 12 13 68.3 0 1 0 0 0 0 0 0 0 0 0 0 13 14 69.9 0 0 1 0 0 0 0 0 0 0 0 0 14 15 81.7 0 0 0 1 0 0 0 0 0 0 0 0 15 16 75.1 0 0 0 0 1 0 0 0 0 0 0 0 16 17 69.9 0 0 0 0 0 1 0 0 0 0 0 0 17 18 84.0 0 0 0 0 0 0 1 0 0 0 0 0 18 19 54.3 0 0 0 0 0 0 0 1 0 0 0 0 19 20 60.0 0 0 0 0 0 0 0 0 1 0 0 0 20 21 89.9 0 0 0 0 0 0 0 0 0 1 0 0 21 22 77.0 0 0 0 0 0 0 0 0 0 0 1 0 22 23 85.3 0 0 0 0 0 0 0 0 0 0 0 1 23 24 77.6 0 0 0 0 0 0 0 0 0 0 0 0 24 25 69.2 0 1 0 0 0 0 0 0 0 0 0 0 25 26 75.5 0 0 1 0 0 0 0 0 0 0 0 0 26 27 85.7 0 0 0 1 0 0 0 0 0 0 0 0 27 28 72.2 0 0 0 0 1 0 0 0 0 0 0 0 28 29 79.9 0 0 0 0 0 1 0 0 0 0 0 0 29 30 85.3 0 0 0 0 0 0 1 0 0 0 0 0 30 31 52.2 0 0 0 0 0 0 0 1 0 0 0 0 31 32 61.2 0 0 0 0 0 0 0 0 1 0 0 0 32 33 82.4 0 0 0 0 0 0 0 0 0 1 0 0 33 34 85.4 0 0 0 0 0 0 0 0 0 0 1 0 34 35 78.2 0 0 0 0 0 0 0 0 0 0 0 1 35 36 70.2 1 0 0 0 0 0 0 0 0 0 0 0 36 37 70.2 1 1 0 0 0 0 0 0 0 0 0 0 37 38 69.3 1 0 1 0 0 0 0 0 0 0 0 0 38 39 77.5 1 0 0 1 0 0 0 0 0 0 0 0 39 40 66.1 1 0 0 0 1 0 0 0 0 0 0 0 40 41 69.0 1 0 0 0 0 1 0 0 0 0 0 0 41 42 79.2 1 0 0 0 0 0 1 0 0 0 0 0 42 43 56.2 1 0 0 0 0 0 0 1 0 0 0 0 43 44 63.3 1 0 0 0 0 0 0 0 1 0 0 0 44 45 77.8 1 0 0 0 0 0 0 0 0 1 0 0 45 46 92.0 1 0 0 0 0 0 0 0 0 0 1 0 46 47 78.1 1 0 0 0 0 0 0 0 0 0 0 1 47 48 65.1 1 0 0 0 0 0 0 0 0 0 0 0 48 49 71.1 1 1 0 0 0 0 0 0 0 0 0 0 49 50 70.9 1 0 1 0 0 0 0 0 0 0 0 0 50 51 72.0 1 0 0 1 0 0 0 0 0 0 0 0 51 52 81.9 1 0 0 0 1 0 0 0 0 0 0 0 52 53 70.6 1 0 0 0 0 1 0 0 0 0 0 0 53 54 72.5 1 0 0 0 0 0 1 0 0 0 0 0 54 55 65.1 1 0 0 0 0 0 0 1 0 0 0 0 55 56 61.1 1 0 0 0 0 0 0 0 1 0 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 75.7533 -0.7304 -2.9961 -0.3814 8.4332 2.3078 M5 M6 M7 M8 M9 M10 0.9024 10.3370 -15.4484 -11.1938 12.2586 12.0032 M11 t 6.9228 -0.0946 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.675 -3.086 -0.675 2.634 10.729 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 75.75328 2.91139 26.020 < 2e-16 *** x -0.73037 2.68299 -0.272 0.78678 M1 -2.99605 3.39721 -0.882 0.38284 M2 -0.38145 3.39409 -0.112 0.91105 M3 8.43315 3.39285 2.486 0.01700 * M4 2.30776 3.39351 0.680 0.50020 M5 0.90236 3.39606 0.266 0.79176 M6 10.33696 3.40050 3.040 0.00406 ** M7 -15.44843 3.40682 -4.535 4.75e-05 *** M8 -11.19383 3.41501 -3.278 0.00210 ** M9 12.25860 3.60576 3.400 0.00149 ** M10 12.00320 3.61399 3.321 0.00186 ** M11 6.92280 3.62396 1.910 0.06294 . t -0.09460 0.08015 -1.180 0.24450 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.053 on 42 degrees of freedom Multiple R-squared: 0.801, Adjusted R-squared: 0.7394 F-statistic: 13 on 13 and 42 DF, p-value: 8.419e-11 > 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.04758368 0.09516735 0.9524163 [2,] 0.02438494 0.04876987 0.9756151 [3,] 0.01623630 0.03247260 0.9837637 [4,] 0.02218440 0.04436880 0.9778156 [5,] 0.02042441 0.04084883 0.9795756 [6,] 0.01827668 0.03655337 0.9817233 [7,] 0.16150044 0.32300089 0.8384996 [8,] 0.14427843 0.28855686 0.8557216 [9,] 0.12112212 0.24224424 0.8788779 [10,] 0.11832540 0.23665080 0.8816746 [11,] 0.12283090 0.24566180 0.8771691 [12,] 0.08199016 0.16398032 0.9180098 [13,] 0.16673080 0.33346159 0.8332692 [14,] 0.22333955 0.44667911 0.7766604 [15,] 0.19983645 0.39967289 0.8001636 [16,] 0.14388122 0.28776243 0.8561188 [17,] 0.14498104 0.28996209 0.8550190 [18,] 0.14341246 0.28682492 0.8565875 [19,] 0.08635988 0.17271976 0.9136401 [20,] 0.06736254 0.13472509 0.9326375 [21,] 0.04630477 0.09260954 0.9536952 [22,] 0.02163741 0.04327481 0.9783626 [23,] 0.02028401 0.04056801 0.9797160 > postscript(file="/var/www/html/rcomp/tmp/16dxa1227352990.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/2c18h1227352990.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/34ysx1227352990.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/4uz1l1227352990.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/5eli61227352990.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 = 56 Frequency = 1 1 2 3 4 5 6 7 -0.9626216 2.3173784 5.8973784 2.6173784 2.5173784 8.2773784 -2.0426216 8 9 10 11 12 13 14 -3.2026216 3.8395525 -1.5104475 -4.2354475 2.6819591 -3.2273855 -4.1473855 15 16 17 18 19 20 21 -1.0673855 -1.4473855 -5.1473855 -0.3873855 -4.2073855 -2.6673855 3.8747886 22 23 24 25 26 27 28 -8.6752114 4.7997886 4.1171952 -1.1921494 2.5878506 4.0678506 -3.2121494 29 30 31 32 33 34 35 5.9878506 2.0478506 -5.1721494 -0.3321494 -2.4899753 0.8600247 -1.1649753 36 37 38 39 40 41 42 -1.4171952 1.6734602 -1.7465398 -2.2665398 -7.4465398 -3.0465398 -2.1865398 43 44 45 46 47 48 49 0.6934602 3.6334602 -5.2243658 9.3256342 0.6006342 -5.3819591 3.7086963 50 51 52 53 54 55 56 0.9886963 -6.6313037 9.4886963 -0.3113037 -7.7513037 10.7286963 2.5686963 > postscript(file="/var/www/html/rcomp/tmp/655b01227352990.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.9626216 NA 1 2.3173784 -0.9626216 2 5.8973784 2.3173784 3 2.6173784 5.8973784 4 2.5173784 2.6173784 5 8.2773784 2.5173784 6 -2.0426216 8.2773784 7 -3.2026216 -2.0426216 8 3.8395525 -3.2026216 9 -1.5104475 3.8395525 10 -4.2354475 -1.5104475 11 2.6819591 -4.2354475 12 -3.2273855 2.6819591 13 -4.1473855 -3.2273855 14 -1.0673855 -4.1473855 15 -1.4473855 -1.0673855 16 -5.1473855 -1.4473855 17 -0.3873855 -5.1473855 18 -4.2073855 -0.3873855 19 -2.6673855 -4.2073855 20 3.8747886 -2.6673855 21 -8.6752114 3.8747886 22 4.7997886 -8.6752114 23 4.1171952 4.7997886 24 -1.1921494 4.1171952 25 2.5878506 -1.1921494 26 4.0678506 2.5878506 27 -3.2121494 4.0678506 28 5.9878506 -3.2121494 29 2.0478506 5.9878506 30 -5.1721494 2.0478506 31 -0.3321494 -5.1721494 32 -2.4899753 -0.3321494 33 0.8600247 -2.4899753 34 -1.1649753 0.8600247 35 -1.4171952 -1.1649753 36 1.6734602 -1.4171952 37 -1.7465398 1.6734602 38 -2.2665398 -1.7465398 39 -7.4465398 -2.2665398 40 -3.0465398 -7.4465398 41 -2.1865398 -3.0465398 42 0.6934602 -2.1865398 43 3.6334602 0.6934602 44 -5.2243658 3.6334602 45 9.3256342 -5.2243658 46 0.6006342 9.3256342 47 -5.3819591 0.6006342 48 3.7086963 -5.3819591 49 0.9886963 3.7086963 50 -6.6313037 0.9886963 51 9.4886963 -6.6313037 52 -0.3113037 9.4886963 53 -7.7513037 -0.3113037 54 10.7286963 -7.7513037 55 2.5686963 10.7286963 56 NA 2.5686963 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.3173784 -0.9626216 [2,] 5.8973784 2.3173784 [3,] 2.6173784 5.8973784 [4,] 2.5173784 2.6173784 [5,] 8.2773784 2.5173784 [6,] -2.0426216 8.2773784 [7,] -3.2026216 -2.0426216 [8,] 3.8395525 -3.2026216 [9,] -1.5104475 3.8395525 [10,] -4.2354475 -1.5104475 [11,] 2.6819591 -4.2354475 [12,] -3.2273855 2.6819591 [13,] -4.1473855 -3.2273855 [14,] -1.0673855 -4.1473855 [15,] -1.4473855 -1.0673855 [16,] -5.1473855 -1.4473855 [17,] -0.3873855 -5.1473855 [18,] -4.2073855 -0.3873855 [19,] -2.6673855 -4.2073855 [20,] 3.8747886 -2.6673855 [21,] -8.6752114 3.8747886 [22,] 4.7997886 -8.6752114 [23,] 4.1171952 4.7997886 [24,] -1.1921494 4.1171952 [25,] 2.5878506 -1.1921494 [26,] 4.0678506 2.5878506 [27,] -3.2121494 4.0678506 [28,] 5.9878506 -3.2121494 [29,] 2.0478506 5.9878506 [30,] -5.1721494 2.0478506 [31,] -0.3321494 -5.1721494 [32,] -2.4899753 -0.3321494 [33,] 0.8600247 -2.4899753 [34,] -1.1649753 0.8600247 [35,] -1.4171952 -1.1649753 [36,] 1.6734602 -1.4171952 [37,] -1.7465398 1.6734602 [38,] -2.2665398 -1.7465398 [39,] -7.4465398 -2.2665398 [40,] -3.0465398 -7.4465398 [41,] -2.1865398 -3.0465398 [42,] 0.6934602 -2.1865398 [43,] 3.6334602 0.6934602 [44,] -5.2243658 3.6334602 [45,] 9.3256342 -5.2243658 [46,] 0.6006342 9.3256342 [47,] -5.3819591 0.6006342 [48,] 3.7086963 -5.3819591 [49,] 0.9886963 3.7086963 [50,] -6.6313037 0.9886963 [51,] 9.4886963 -6.6313037 [52,] -0.3113037 9.4886963 [53,] -7.7513037 -0.3113037 [54,] 10.7286963 -7.7513037 [55,] 2.5686963 10.7286963 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.3173784 -0.9626216 2 5.8973784 2.3173784 3 2.6173784 5.8973784 4 2.5173784 2.6173784 5 8.2773784 2.5173784 6 -2.0426216 8.2773784 7 -3.2026216 -2.0426216 8 3.8395525 -3.2026216 9 -1.5104475 3.8395525 10 -4.2354475 -1.5104475 11 2.6819591 -4.2354475 12 -3.2273855 2.6819591 13 -4.1473855 -3.2273855 14 -1.0673855 -4.1473855 15 -1.4473855 -1.0673855 16 -5.1473855 -1.4473855 17 -0.3873855 -5.1473855 18 -4.2073855 -0.3873855 19 -2.6673855 -4.2073855 20 3.8747886 -2.6673855 21 -8.6752114 3.8747886 22 4.7997886 -8.6752114 23 4.1171952 4.7997886 24 -1.1921494 4.1171952 25 2.5878506 -1.1921494 26 4.0678506 2.5878506 27 -3.2121494 4.0678506 28 5.9878506 -3.2121494 29 2.0478506 5.9878506 30 -5.1721494 2.0478506 31 -0.3321494 -5.1721494 32 -2.4899753 -0.3321494 33 0.8600247 -2.4899753 34 -1.1649753 0.8600247 35 -1.4171952 -1.1649753 36 1.6734602 -1.4171952 37 -1.7465398 1.6734602 38 -2.2665398 -1.7465398 39 -7.4465398 -2.2665398 40 -3.0465398 -7.4465398 41 -2.1865398 -3.0465398 42 0.6934602 -2.1865398 43 3.6334602 0.6934602 44 -5.2243658 3.6334602 45 9.3256342 -5.2243658 46 0.6006342 9.3256342 47 -5.3819591 0.6006342 48 3.7086963 -5.3819591 49 0.9886963 3.7086963 50 -6.6313037 0.9886963 51 9.4886963 -6.6313037 52 -0.3113037 9.4886963 53 -7.7513037 -0.3113037 54 10.7286963 -7.7513037 55 2.5686963 10.7286963 > 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/7n0jg1227352990.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/89e7o1227352990.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/9yhtv1227352990.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/10nnxz1227352990.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/11ay3n1227352990.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/12uaa11227352990.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/138vxz1227352990.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/148m3c1227352991.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/1516p31227352991.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/16v6xw1227352991.tab") + } > > system("convert tmp/16dxa1227352990.ps tmp/16dxa1227352990.png") > system("convert tmp/2c18h1227352990.ps tmp/2c18h1227352990.png") > system("convert tmp/34ysx1227352990.ps tmp/34ysx1227352990.png") > system("convert tmp/4uz1l1227352990.ps tmp/4uz1l1227352990.png") > system("convert tmp/5eli61227352990.ps tmp/5eli61227352990.png") > system("convert tmp/655b01227352990.ps tmp/655b01227352990.png") > system("convert tmp/7n0jg1227352990.ps tmp/7n0jg1227352990.png") > system("convert tmp/89e7o1227352990.ps tmp/89e7o1227352990.png") > system("convert tmp/9yhtv1227352990.ps tmp/9yhtv1227352990.png") > system("convert tmp/10nnxz1227352990.ps tmp/10nnxz1227352990.png") > > > proc.time() user system elapsed 2.371 1.543 3.269