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(126.51,0,131.02,0,136.51,0,138.04,0,132.92,0,129.61,0,122.96,0,124.04,0,121.29,0,124.56,0,118.53,0,113.14,0,114.15,0,122.17,0,129.23,0,131.19,0,129.12,0,128.28,0,126.83,0,138.13,0,140.52,0,146.83,0,135.14,0,131.84,0,125.7,0,128.98,0,133.25,0,136.76,0,133.24,0,128.54,0,121.08,0,120.23,0,119.08,0,125.75,0,126.89,0,126.6,0,121.89,0,123.44,0,126.46,0,129.49,0,127.78,0,125.29,0,119.02,0,119.96,0,122.86,0,131.89,0,132.73,0,135.01,0,136.71,1,142.73,1,144.43,1,144.93,1,138.75,1,130.22,1,122.19,1,128.4,1,140.43,1,153.5,1,149.33,1,142.97,1),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = '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 1 126.51 0 1 0 0 0 0 0 0 0 0 0 0 2 131.02 0 0 1 0 0 0 0 0 0 0 0 0 3 136.51 0 0 0 1 0 0 0 0 0 0 0 0 4 138.04 0 0 0 0 1 0 0 0 0 0 0 0 5 132.92 0 0 0 0 0 1 0 0 0 0 0 0 6 129.61 0 0 0 0 0 0 1 0 0 0 0 0 7 122.96 0 0 0 0 0 0 0 1 0 0 0 0 8 124.04 0 0 0 0 0 0 0 0 1 0 0 0 9 121.29 0 0 0 0 0 0 0 0 0 1 0 0 10 124.56 0 0 0 0 0 0 0 0 0 0 1 0 11 118.53 0 0 0 0 0 0 0 0 0 0 0 1 12 113.14 0 0 0 0 0 0 0 0 0 0 0 0 13 114.15 0 1 0 0 0 0 0 0 0 0 0 0 14 122.17 0 0 1 0 0 0 0 0 0 0 0 0 15 129.23 0 0 0 1 0 0 0 0 0 0 0 0 16 131.19 0 0 0 0 1 0 0 0 0 0 0 0 17 129.12 0 0 0 0 0 1 0 0 0 0 0 0 18 128.28 0 0 0 0 0 0 1 0 0 0 0 0 19 126.83 0 0 0 0 0 0 0 1 0 0 0 0 20 138.13 0 0 0 0 0 0 0 0 1 0 0 0 21 140.52 0 0 0 0 0 0 0 0 0 1 0 0 22 146.83 0 0 0 0 0 0 0 0 0 0 1 0 23 135.14 0 0 0 0 0 0 0 0 0 0 0 1 24 131.84 0 0 0 0 0 0 0 0 0 0 0 0 25 125.70 0 1 0 0 0 0 0 0 0 0 0 0 26 128.98 0 0 1 0 0 0 0 0 0 0 0 0 27 133.25 0 0 0 1 0 0 0 0 0 0 0 0 28 136.76 0 0 0 0 1 0 0 0 0 0 0 0 29 133.24 0 0 0 0 0 1 0 0 0 0 0 0 30 128.54 0 0 0 0 0 0 1 0 0 0 0 0 31 121.08 0 0 0 0 0 0 0 1 0 0 0 0 32 120.23 0 0 0 0 0 0 0 0 1 0 0 0 33 119.08 0 0 0 0 0 0 0 0 0 1 0 0 34 125.75 0 0 0 0 0 0 0 0 0 0 1 0 35 126.89 0 0 0 0 0 0 0 0 0 0 0 1 36 126.60 0 0 0 0 0 0 0 0 0 0 0 0 37 121.89 0 1 0 0 0 0 0 0 0 0 0 0 38 123.44 0 0 1 0 0 0 0 0 0 0 0 0 39 126.46 0 0 0 1 0 0 0 0 0 0 0 0 40 129.49 0 0 0 0 1 0 0 0 0 0 0 0 41 127.78 0 0 0 0 0 1 0 0 0 0 0 0 42 125.29 0 0 0 0 0 0 1 0 0 0 0 0 43 119.02 0 0 0 0 0 0 0 1 0 0 0 0 44 119.96 0 0 0 0 0 0 0 0 1 0 0 0 45 122.86 0 0 0 0 0 0 0 0 0 1 0 0 46 131.89 0 0 0 0 0 0 0 0 0 0 1 0 47 132.73 0 0 0 0 0 0 0 0 0 0 0 1 48 135.01 0 0 0 0 0 0 0 0 0 0 0 0 49 136.71 1 1 0 0 0 0 0 0 0 0 0 0 50 142.73 1 0 1 0 0 0 0 0 0 0 0 0 51 144.43 1 0 0 1 0 0 0 0 0 0 0 0 52 144.93 1 0 0 0 1 0 0 0 0 0 0 0 53 138.75 1 0 0 0 0 1 0 0 0 0 0 0 54 130.22 1 0 0 0 0 0 1 0 0 0 0 0 55 122.19 1 0 0 0 0 0 0 1 0 0 0 0 56 128.40 1 0 0 0 0 0 0 0 1 0 0 0 57 140.43 1 0 0 0 0 0 0 0 0 1 0 0 58 153.50 1 0 0 0 0 0 0 0 0 0 1 0 59 149.33 1 0 0 0 0 0 0 0 0 0 0 1 60 142.97 1 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 127.562 11.748 -4.920 -0.244 4.064 6.170 M5 M6 M7 M8 M9 M10 2.450 -1.524 -7.496 -3.760 -1.076 6.594 M11 2.612 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.4225 -3.6805 0.6255 3.5936 14.3275 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 127.562 2.981 42.786 < 2e-16 *** X 11.748 2.130 5.516 1.44e-06 *** M1 -4.920 4.173 -1.179 0.2443 M2 -0.244 4.173 -0.058 0.9536 M3 4.064 4.173 0.974 0.3351 M4 6.170 4.173 1.479 0.1459 M5 2.450 4.173 0.587 0.5600 M6 -1.524 4.173 -0.365 0.7166 M7 -7.496 4.173 -1.796 0.0789 . M8 -3.760 4.173 -0.901 0.3722 M9 -1.076 4.173 -0.258 0.7977 M10 6.594 4.173 1.580 0.1208 M11 2.612 4.173 0.626 0.5344 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.598 on 47 degrees of freedom Multiple R-squared: 0.5363, Adjusted R-squared: 0.4179 F-statistic: 4.529 on 12 and 47 DF, p-value: 8.29e-05 > 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.7358964 0.528207201 0.264103601 [2,] 0.6035398 0.792920351 0.396460175 [3,] 0.4587530 0.917505963 0.541247019 [4,] 0.3755412 0.751082455 0.624458773 [5,] 0.6823680 0.635264080 0.317632040 [6,] 0.9486833 0.102633354 0.051316677 [7,] 0.9965595 0.006881097 0.003440548 [8,] 0.9976291 0.004741859 0.002370930 [9,] 0.9983878 0.003224490 0.001612245 [10,] 0.9970193 0.005961440 0.002980720 [11,] 0.9941342 0.011731608 0.005865804 [12,] 0.9898525 0.020294936 0.010147468 [13,] 0.9855475 0.028905023 0.014452511 [14,] 0.9810901 0.037819731 0.018909866 [15,] 0.9781791 0.043641881 0.021820941 [16,] 0.9763589 0.047282297 0.023641148 [17,] 0.9712314 0.057537186 0.028768593 [18,] 0.9701077 0.059784617 0.029892308 [19,] 0.9821640 0.035671981 0.017835990 [20,] 0.9808790 0.038242020 0.019121010 [21,] 0.9754311 0.049137866 0.024568933 [22,] 0.9539043 0.092191330 0.046095665 [23,] 0.9414536 0.117092715 0.058546357 [24,] 0.9237918 0.152416428 0.076208214 [25,] 0.8826864 0.234627105 0.117313553 [26,] 0.8023236 0.395352703 0.197676352 [27,] 0.7624560 0.475087951 0.237543976 [28,] 0.8212976 0.357404794 0.178702397 [29,] 0.7898589 0.420282119 0.210141059 > postscript(file="/var/www/html/rcomp/tmp/19lut1258718588.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/2tfjg1258718588.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/368on1258718588.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/45bsz1258718588.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/5esew1258718588.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 = 60 Frequency = 1 1 2 3 4 5 6 7 8 3.8675 3.7015 4.8835 4.3075 2.9075 3.5715 2.8935 0.2375 9 10 11 12 13 14 15 16 -5.1965 -9.5965 -11.6445 -14.4225 -8.4925 -5.1485 -2.3965 -2.5425 17 18 19 20 21 22 23 24 -0.8925 2.2415 6.7635 14.3275 14.0335 12.6735 4.9655 4.2775 25 26 27 28 29 30 31 32 3.0575 1.6615 1.6235 3.0275 3.2275 2.5015 1.0135 -3.5725 33 34 35 36 37 38 39 40 -7.4065 -8.4065 -3.2845 -0.9625 -0.7525 -3.8785 -5.1665 -4.2425 41 42 43 44 45 46 47 48 -2.2325 -0.7485 -1.0465 -3.8425 -3.6265 -2.2665 2.5555 7.4475 49 50 51 52 53 54 55 56 2.3200 3.6640 1.0560 -0.5500 -3.0100 -7.5660 -9.6240 -7.1500 57 58 59 60 2.1960 7.5960 7.4080 3.6600 > postscript(file="/var/www/html/rcomp/tmp/6np6w1258718588.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 3.8675 NA 1 3.7015 3.8675 2 4.8835 3.7015 3 4.3075 4.8835 4 2.9075 4.3075 5 3.5715 2.9075 6 2.8935 3.5715 7 0.2375 2.8935 8 -5.1965 0.2375 9 -9.5965 -5.1965 10 -11.6445 -9.5965 11 -14.4225 -11.6445 12 -8.4925 -14.4225 13 -5.1485 -8.4925 14 -2.3965 -5.1485 15 -2.5425 -2.3965 16 -0.8925 -2.5425 17 2.2415 -0.8925 18 6.7635 2.2415 19 14.3275 6.7635 20 14.0335 14.3275 21 12.6735 14.0335 22 4.9655 12.6735 23 4.2775 4.9655 24 3.0575 4.2775 25 1.6615 3.0575 26 1.6235 1.6615 27 3.0275 1.6235 28 3.2275 3.0275 29 2.5015 3.2275 30 1.0135 2.5015 31 -3.5725 1.0135 32 -7.4065 -3.5725 33 -8.4065 -7.4065 34 -3.2845 -8.4065 35 -0.9625 -3.2845 36 -0.7525 -0.9625 37 -3.8785 -0.7525 38 -5.1665 -3.8785 39 -4.2425 -5.1665 40 -2.2325 -4.2425 41 -0.7485 -2.2325 42 -1.0465 -0.7485 43 -3.8425 -1.0465 44 -3.6265 -3.8425 45 -2.2665 -3.6265 46 2.5555 -2.2665 47 7.4475 2.5555 48 2.3200 7.4475 49 3.6640 2.3200 50 1.0560 3.6640 51 -0.5500 1.0560 52 -3.0100 -0.5500 53 -7.5660 -3.0100 54 -9.6240 -7.5660 55 -7.1500 -9.6240 56 2.1960 -7.1500 57 7.5960 2.1960 58 7.4080 7.5960 59 3.6600 7.4080 60 NA 3.6600 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.7015 3.8675 [2,] 4.8835 3.7015 [3,] 4.3075 4.8835 [4,] 2.9075 4.3075 [5,] 3.5715 2.9075 [6,] 2.8935 3.5715 [7,] 0.2375 2.8935 [8,] -5.1965 0.2375 [9,] -9.5965 -5.1965 [10,] -11.6445 -9.5965 [11,] -14.4225 -11.6445 [12,] -8.4925 -14.4225 [13,] -5.1485 -8.4925 [14,] -2.3965 -5.1485 [15,] -2.5425 -2.3965 [16,] -0.8925 -2.5425 [17,] 2.2415 -0.8925 [18,] 6.7635 2.2415 [19,] 14.3275 6.7635 [20,] 14.0335 14.3275 [21,] 12.6735 14.0335 [22,] 4.9655 12.6735 [23,] 4.2775 4.9655 [24,] 3.0575 4.2775 [25,] 1.6615 3.0575 [26,] 1.6235 1.6615 [27,] 3.0275 1.6235 [28,] 3.2275 3.0275 [29,] 2.5015 3.2275 [30,] 1.0135 2.5015 [31,] -3.5725 1.0135 [32,] -7.4065 -3.5725 [33,] -8.4065 -7.4065 [34,] -3.2845 -8.4065 [35,] -0.9625 -3.2845 [36,] -0.7525 -0.9625 [37,] -3.8785 -0.7525 [38,] -5.1665 -3.8785 [39,] -4.2425 -5.1665 [40,] -2.2325 -4.2425 [41,] -0.7485 -2.2325 [42,] -1.0465 -0.7485 [43,] -3.8425 -1.0465 [44,] -3.6265 -3.8425 [45,] -2.2665 -3.6265 [46,] 2.5555 -2.2665 [47,] 7.4475 2.5555 [48,] 2.3200 7.4475 [49,] 3.6640 2.3200 [50,] 1.0560 3.6640 [51,] -0.5500 1.0560 [52,] -3.0100 -0.5500 [53,] -7.5660 -3.0100 [54,] -9.6240 -7.5660 [55,] -7.1500 -9.6240 [56,] 2.1960 -7.1500 [57,] 7.5960 2.1960 [58,] 7.4080 7.5960 [59,] 3.6600 7.4080 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.7015 3.8675 2 4.8835 3.7015 3 4.3075 4.8835 4 2.9075 4.3075 5 3.5715 2.9075 6 2.8935 3.5715 7 0.2375 2.8935 8 -5.1965 0.2375 9 -9.5965 -5.1965 10 -11.6445 -9.5965 11 -14.4225 -11.6445 12 -8.4925 -14.4225 13 -5.1485 -8.4925 14 -2.3965 -5.1485 15 -2.5425 -2.3965 16 -0.8925 -2.5425 17 2.2415 -0.8925 18 6.7635 2.2415 19 14.3275 6.7635 20 14.0335 14.3275 21 12.6735 14.0335 22 4.9655 12.6735 23 4.2775 4.9655 24 3.0575 4.2775 25 1.6615 3.0575 26 1.6235 1.6615 27 3.0275 1.6235 28 3.2275 3.0275 29 2.5015 3.2275 30 1.0135 2.5015 31 -3.5725 1.0135 32 -7.4065 -3.5725 33 -8.4065 -7.4065 34 -3.2845 -8.4065 35 -0.9625 -3.2845 36 -0.7525 -0.9625 37 -3.8785 -0.7525 38 -5.1665 -3.8785 39 -4.2425 -5.1665 40 -2.2325 -4.2425 41 -0.7485 -2.2325 42 -1.0465 -0.7485 43 -3.8425 -1.0465 44 -3.6265 -3.8425 45 -2.2665 -3.6265 46 2.5555 -2.2665 47 7.4475 2.5555 48 2.3200 7.4475 49 3.6640 2.3200 50 1.0560 3.6640 51 -0.5500 1.0560 52 -3.0100 -0.5500 53 -7.5660 -3.0100 54 -9.6240 -7.5660 55 -7.1500 -9.6240 56 2.1960 -7.1500 57 7.5960 2.1960 58 7.4080 7.5960 59 3.6600 7.4080 > 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/7hvrv1258718588.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/8bh7d1258718588.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/9jtpq1258718588.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/1003uf1258718588.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/11ilss1258718588.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/12cxbn1258718588.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/13z7ql1258718588.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/14pbfz1258718588.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/15q3x51258718588.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/16i2fn1258718588.tab") + } > > system("convert tmp/19lut1258718588.ps tmp/19lut1258718588.png") > system("convert tmp/2tfjg1258718588.ps tmp/2tfjg1258718588.png") > system("convert tmp/368on1258718588.ps tmp/368on1258718588.png") > system("convert tmp/45bsz1258718588.ps tmp/45bsz1258718588.png") > system("convert tmp/5esew1258718588.ps tmp/5esew1258718588.png") > system("convert tmp/6np6w1258718588.ps tmp/6np6w1258718588.png") > system("convert tmp/7hvrv1258718588.ps tmp/7hvrv1258718588.png") > system("convert tmp/8bh7d1258718588.ps tmp/8bh7d1258718588.png") > system("convert tmp/9jtpq1258718588.ps tmp/9jtpq1258718588.png") > system("convert tmp/1003uf1258718588.ps tmp/1003uf1258718588.png") > > > proc.time() user system elapsed 2.387 1.553 2.896