R version 2.12.1 (2010-12-16) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(0,210907,0,2,0,149061,0,0,0,237213,1,0,0,133131,1,4,0,324799,1,0,0,230964,0,-1,0,236785,1,0,0,344297,1,1,0,174724,1,0,0,174415,1,3,0,223632,1,-1,0,294424,0,4,0,325107,1,3,0,106408,0,1,0,96560,0,0,0,265769,1,-2,0,149112,0,-4,0,152871,0,2,0,362301,1,2,0,183167,0,-4,0,218946,1,2,0,244052,1,2,0,341570,1,0,0,196553,1,-3,0,143246,0,2,0,143756,0,4,0,152299,1,2,0,193339,1,2,0,130585,0,-4,0,112611,1,3,0,148446,1,3,0,182079,0,2,0,243060,1,-1,0,162765,1,-3,0,85574,1,0,0,225060,0,1,0,133328,1,-3,0,100750,1,3,0,101523,1,0,0,243511,1,0,0,152474,1,0,0,132487,1,3,0,317394,0,-3,0,244749,1,0,0,128423,0,2,0,97839,0,-1,1,229242,1,2,1,324598,0,2,1,195838,0,-2,1,254488,0,0,1,92499,1,-2,1,224330,0,0,1,181633,1,6,1,271856,1,-3,1,95227,1,3,1,98146,0,0,1,118612,0,-2,1,65475,1,1,1,108446,0,0,1,121848,0,2,1,76302,1,2,1,98104,0,-3,1,30989,1,-2,1,31774,0,1,1,150580,1,-4,1,59382,0,1,1,84105,0,0),dim=c(4,67),dimnames=list(c('pop','time_in_rfc','gender','total_tests'),1:67)) > y <- array(NA,dim=c(4,67),dimnames=list(c('pop','time_in_rfc','gender','total_tests'),1:67)) > 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 = 'Do not include Seasonal Dummies' > par1 = '4' > library(lattice) > library(lmtest) Loading required package: zoo > 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 total_tests pop time_in_rfc gender 1 2 0 210907 0 2 0 0 149061 0 3 0 0 237213 1 4 4 0 133131 1 5 0 0 324799 1 6 -1 0 230964 0 7 0 0 236785 1 8 1 0 344297 1 9 0 0 174724 1 10 3 0 174415 1 11 -1 0 223632 1 12 4 0 294424 0 13 3 0 325107 1 14 1 0 106408 0 15 0 0 96560 0 16 -2 0 265769 1 17 -4 0 149112 0 18 2 0 152871 0 19 2 0 362301 1 20 -4 0 183167 0 21 2 0 218946 1 22 2 0 244052 1 23 0 0 341570 1 24 -3 0 196553 1 25 2 0 143246 0 26 4 0 143756 0 27 2 0 152299 1 28 2 0 193339 1 29 -4 0 130585 0 30 3 0 112611 1 31 3 0 148446 1 32 2 0 182079 0 33 -1 0 243060 1 34 -3 0 162765 1 35 0 0 85574 1 36 1 0 225060 0 37 -3 0 133328 1 38 3 0 100750 1 39 0 0 101523 1 40 0 0 243511 1 41 0 0 152474 1 42 3 0 132487 1 43 -3 0 317394 0 44 0 0 244749 1 45 2 0 128423 0 46 -1 0 97839 0 47 2 1 229242 1 48 2 1 324598 0 49 -2 1 195838 0 50 0 1 254488 0 51 -2 1 92499 1 52 0 1 224330 0 53 6 1 181633 1 54 -3 1 271856 1 55 3 1 95227 1 56 0 1 98146 0 57 -2 1 118612 0 58 1 1 65475 1 59 0 1 108446 0 60 2 1 121848 0 61 2 1 76302 1 62 -3 1 98104 0 63 -2 1 30989 1 64 1 1 31774 0 65 -4 1 150580 1 66 1 1 59382 0 67 0 1 84105 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) pop time_in_rfc gender 2.646e-01 -3.270e-01 -3.755e-07 4.893e-01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.3704 -1.4453 0.1031 1.7864 5.6413 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.646e-01 8.412e-01 0.315 0.754 pop -3.270e-01 6.483e-01 -0.504 0.616 time_in_rfc -3.755e-07 3.715e-06 -0.101 0.920 gender 4.893e-01 5.841e-01 0.838 0.405 Residual standard error: 2.308 on 63 degrees of freedom Multiple R-squared: 0.01785, Adjusted R-squared: -0.02892 F-statistic: 0.3817 on 3 and 63 DF, p-value: 0.7665 > 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.3435247 0.6870494 0.6564753 [2,] 0.2627954 0.5255908 0.7372046 [3,] 0.2181812 0.4363624 0.7818188 [4,] 0.1667827 0.3335654 0.8332173 [5,] 0.1674944 0.3349887 0.8325056 [6,] 0.3598532 0.7197064 0.6401468 [7,] 0.3542154 0.7084307 0.6457846 [8,] 0.2632217 0.5264434 0.7367783 [9,] 0.1987435 0.3974870 0.8012565 [10,] 0.2507412 0.5014824 0.7492588 [11,] 0.4847548 0.9695096 0.5152452 [12,] 0.4410157 0.8820314 0.5589843 [13,] 0.3747969 0.7495939 0.6252031 [14,] 0.5561450 0.8877100 0.4438550 [15,] 0.4960401 0.9920801 0.5039599 [16,] 0.4363595 0.8727189 0.5636405 [17,] 0.3717722 0.7435444 0.6282278 [18,] 0.4772726 0.9545452 0.5227274 [19,] 0.4477474 0.8954949 0.5522526 [20,] 0.5624136 0.8751727 0.4375864 [21,] 0.5124406 0.9751188 0.4875594 [22,] 0.4623314 0.9246629 0.5376686 [23,] 0.6164447 0.7671105 0.3835553 [24,] 0.6102757 0.7794486 0.3897243 [25,] 0.6078760 0.7842480 0.3921240 [26,] 0.5875509 0.8248981 0.4124491 [27,] 0.5454743 0.9090513 0.4545257 [28,] 0.6344846 0.7310308 0.3655154 [29,] 0.5670462 0.8659076 0.4329538 [30,] 0.5073485 0.9853029 0.4926515 [31,] 0.5958777 0.8082446 0.4041223 [32,] 0.5969534 0.8060931 0.4030466 [33,] 0.5262255 0.9475490 0.4737745 [34,] 0.4537392 0.9074783 0.5462608 [35,] 0.3835601 0.7671201 0.6164399 [36,] 0.3915867 0.7831734 0.6084133 [37,] 0.4261274 0.8522548 0.5738726 [38,] 0.3582015 0.7164029 0.6417985 [39,] 0.3325500 0.6651000 0.6674500 [40,] 0.2692523 0.5385047 0.7307477 [41,] 0.2247357 0.4494714 0.7752643 [42,] 0.2085715 0.4171431 0.7914285 [43,] 0.1934529 0.3869059 0.8065471 [44,] 0.1421310 0.2842620 0.8578690 [45,] 0.1392597 0.2785193 0.8607403 [46,] 0.0987560 0.1975120 0.9012440 [47,] 0.5539054 0.8921893 0.4460946 [48,] 0.4946343 0.9892686 0.5053657 [49,] 0.6235548 0.7528904 0.3764452 [50,] 0.5109381 0.9781238 0.4890619 [51,] 0.4347389 0.8694778 0.5652611 [52,] 0.3634154 0.7268307 0.6365846 [53,] 0.2407826 0.4815651 0.7592174 [54,] 0.2915011 0.5830022 0.7084989 > postscript(file="/var/www/rcomp/tmp/1pb1n1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/2fj1b1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/3g0vr1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/47bbb1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/50mz01323612886.ps",horizontal=F,onefile=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 = 67 Frequency = 1 1 2 3 4 5 6 1.81457084 -0.20865329 -0.66481813 3.29609746 -0.63192823 -1.17789745 7 8 9 10 11 12 -0.66497885 0.37539357 -0.68828372 2.31160025 -1.66991801 3.84593277 13 14 15 16 17 18 2.36818743 0.77532985 -0.22836823 -2.65409491 -4.20863414 1.79277742 19 20 21 22 23 24 1.38215435 -4.19584596 1.32832233 1.33775002 -0.62563046 -3.68008659 25 26 27 28 29 30 1.78916308 3.78935460 1.30329535 1.31870650 -4.21559132 2.28839189 31 32 33 34 35 36 2.30184848 1.80374548 -1.66262249 -3.69277451 -0.72176093 0.81988551 37 38 39 40 41 42 -3.70382856 2.28393790 -0.71577183 -0.66245313 -0.69663894 2.29585563 43 44 45 46 47 48 -3.14544164 -0.66198825 1.78359682 -1.22788795 1.65916669 2.18424162 49 50 51 52 53 54 -1.86410975 0.15791423 -2.39218243 0.14658943 5.64128877 -3.32483110 55 56 57 58 59 60 2.60884198 0.09920539 -1.89310931 0.59766964 0.10307320 2.10810585 61 62 63 64 65 66 1.60173535 -2.90081039 -2.41528039 1.07428167 -4.37037211 1.08464890 67 0.09393277 > postscript(file="/var/www/rcomp/tmp/67sd51323612886.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 67 Frequency = 1 lag(myerror, k = 1) myerror 0 1.81457084 NA 1 -0.20865329 1.81457084 2 -0.66481813 -0.20865329 3 3.29609746 -0.66481813 4 -0.63192823 3.29609746 5 -1.17789745 -0.63192823 6 -0.66497885 -1.17789745 7 0.37539357 -0.66497885 8 -0.68828372 0.37539357 9 2.31160025 -0.68828372 10 -1.66991801 2.31160025 11 3.84593277 -1.66991801 12 2.36818743 3.84593277 13 0.77532985 2.36818743 14 -0.22836823 0.77532985 15 -2.65409491 -0.22836823 16 -4.20863414 -2.65409491 17 1.79277742 -4.20863414 18 1.38215435 1.79277742 19 -4.19584596 1.38215435 20 1.32832233 -4.19584596 21 1.33775002 1.32832233 22 -0.62563046 1.33775002 23 -3.68008659 -0.62563046 24 1.78916308 -3.68008659 25 3.78935460 1.78916308 26 1.30329535 3.78935460 27 1.31870650 1.30329535 28 -4.21559132 1.31870650 29 2.28839189 -4.21559132 30 2.30184848 2.28839189 31 1.80374548 2.30184848 32 -1.66262249 1.80374548 33 -3.69277451 -1.66262249 34 -0.72176093 -3.69277451 35 0.81988551 -0.72176093 36 -3.70382856 0.81988551 37 2.28393790 -3.70382856 38 -0.71577183 2.28393790 39 -0.66245313 -0.71577183 40 -0.69663894 -0.66245313 41 2.29585563 -0.69663894 42 -3.14544164 2.29585563 43 -0.66198825 -3.14544164 44 1.78359682 -0.66198825 45 -1.22788795 1.78359682 46 1.65916669 -1.22788795 47 2.18424162 1.65916669 48 -1.86410975 2.18424162 49 0.15791423 -1.86410975 50 -2.39218243 0.15791423 51 0.14658943 -2.39218243 52 5.64128877 0.14658943 53 -3.32483110 5.64128877 54 2.60884198 -3.32483110 55 0.09920539 2.60884198 56 -1.89310931 0.09920539 57 0.59766964 -1.89310931 58 0.10307320 0.59766964 59 2.10810585 0.10307320 60 1.60173535 2.10810585 61 -2.90081039 1.60173535 62 -2.41528039 -2.90081039 63 1.07428167 -2.41528039 64 -4.37037211 1.07428167 65 1.08464890 -4.37037211 66 0.09393277 1.08464890 67 NA 0.09393277 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.20865329 1.81457084 [2,] -0.66481813 -0.20865329 [3,] 3.29609746 -0.66481813 [4,] -0.63192823 3.29609746 [5,] -1.17789745 -0.63192823 [6,] -0.66497885 -1.17789745 [7,] 0.37539357 -0.66497885 [8,] -0.68828372 0.37539357 [9,] 2.31160025 -0.68828372 [10,] -1.66991801 2.31160025 [11,] 3.84593277 -1.66991801 [12,] 2.36818743 3.84593277 [13,] 0.77532985 2.36818743 [14,] -0.22836823 0.77532985 [15,] -2.65409491 -0.22836823 [16,] -4.20863414 -2.65409491 [17,] 1.79277742 -4.20863414 [18,] 1.38215435 1.79277742 [19,] -4.19584596 1.38215435 [20,] 1.32832233 -4.19584596 [21,] 1.33775002 1.32832233 [22,] -0.62563046 1.33775002 [23,] -3.68008659 -0.62563046 [24,] 1.78916308 -3.68008659 [25,] 3.78935460 1.78916308 [26,] 1.30329535 3.78935460 [27,] 1.31870650 1.30329535 [28,] -4.21559132 1.31870650 [29,] 2.28839189 -4.21559132 [30,] 2.30184848 2.28839189 [31,] 1.80374548 2.30184848 [32,] -1.66262249 1.80374548 [33,] -3.69277451 -1.66262249 [34,] -0.72176093 -3.69277451 [35,] 0.81988551 -0.72176093 [36,] -3.70382856 0.81988551 [37,] 2.28393790 -3.70382856 [38,] -0.71577183 2.28393790 [39,] -0.66245313 -0.71577183 [40,] -0.69663894 -0.66245313 [41,] 2.29585563 -0.69663894 [42,] -3.14544164 2.29585563 [43,] -0.66198825 -3.14544164 [44,] 1.78359682 -0.66198825 [45,] -1.22788795 1.78359682 [46,] 1.65916669 -1.22788795 [47,] 2.18424162 1.65916669 [48,] -1.86410975 2.18424162 [49,] 0.15791423 -1.86410975 [50,] -2.39218243 0.15791423 [51,] 0.14658943 -2.39218243 [52,] 5.64128877 0.14658943 [53,] -3.32483110 5.64128877 [54,] 2.60884198 -3.32483110 [55,] 0.09920539 2.60884198 [56,] -1.89310931 0.09920539 [57,] 0.59766964 -1.89310931 [58,] 0.10307320 0.59766964 [59,] 2.10810585 0.10307320 [60,] 1.60173535 2.10810585 [61,] -2.90081039 1.60173535 [62,] -2.41528039 -2.90081039 [63,] 1.07428167 -2.41528039 [64,] -4.37037211 1.07428167 [65,] 1.08464890 -4.37037211 [66,] 0.09393277 1.08464890 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.20865329 1.81457084 2 -0.66481813 -0.20865329 3 3.29609746 -0.66481813 4 -0.63192823 3.29609746 5 -1.17789745 -0.63192823 6 -0.66497885 -1.17789745 7 0.37539357 -0.66497885 8 -0.68828372 0.37539357 9 2.31160025 -0.68828372 10 -1.66991801 2.31160025 11 3.84593277 -1.66991801 12 2.36818743 3.84593277 13 0.77532985 2.36818743 14 -0.22836823 0.77532985 15 -2.65409491 -0.22836823 16 -4.20863414 -2.65409491 17 1.79277742 -4.20863414 18 1.38215435 1.79277742 19 -4.19584596 1.38215435 20 1.32832233 -4.19584596 21 1.33775002 1.32832233 22 -0.62563046 1.33775002 23 -3.68008659 -0.62563046 24 1.78916308 -3.68008659 25 3.78935460 1.78916308 26 1.30329535 3.78935460 27 1.31870650 1.30329535 28 -4.21559132 1.31870650 29 2.28839189 -4.21559132 30 2.30184848 2.28839189 31 1.80374548 2.30184848 32 -1.66262249 1.80374548 33 -3.69277451 -1.66262249 34 -0.72176093 -3.69277451 35 0.81988551 -0.72176093 36 -3.70382856 0.81988551 37 2.28393790 -3.70382856 38 -0.71577183 2.28393790 39 -0.66245313 -0.71577183 40 -0.69663894 -0.66245313 41 2.29585563 -0.69663894 42 -3.14544164 2.29585563 43 -0.66198825 -3.14544164 44 1.78359682 -0.66198825 45 -1.22788795 1.78359682 46 1.65916669 -1.22788795 47 2.18424162 1.65916669 48 -1.86410975 2.18424162 49 0.15791423 -1.86410975 50 -2.39218243 0.15791423 51 0.14658943 -2.39218243 52 5.64128877 0.14658943 53 -3.32483110 5.64128877 54 2.60884198 -3.32483110 55 0.09920539 2.60884198 56 -1.89310931 0.09920539 57 0.59766964 -1.89310931 58 0.10307320 0.59766964 59 2.10810585 0.10307320 60 1.60173535 2.10810585 61 -2.90081039 1.60173535 62 -2.41528039 -2.90081039 63 1.07428167 -2.41528039 64 -4.37037211 1.07428167 65 1.08464890 -4.37037211 66 0.09393277 1.08464890 > 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/rcomp/tmp/7b9ja1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/8k43a1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/9f4yu1323612886.ps",horizontal=F,onefile=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/rcomp/tmp/10oz551323612886.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11z1x71323612886.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/rcomp/tmp/12c8id1323612886.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/rcomp/tmp/13vhd31323612886.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/rcomp/tmp/14ar8m1323612886.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/rcomp/tmp/151swl1323612886.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/rcomp/tmp/16wzwb1323612886.tab") + } > > try(system("convert tmp/1pb1n1323612886.ps tmp/1pb1n1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/2fj1b1323612886.ps tmp/2fj1b1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/3g0vr1323612886.ps tmp/3g0vr1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/47bbb1323612886.ps tmp/47bbb1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/50mz01323612886.ps tmp/50mz01323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/67sd51323612886.ps tmp/67sd51323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/7b9ja1323612886.ps tmp/7b9ja1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/8k43a1323612886.ps tmp/8k43a1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/9f4yu1323612886.ps tmp/9f4yu1323612886.png",intern=TRUE)) character(0) > try(system("convert tmp/10oz551323612886.ps tmp/10oz551323612886.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.704 0.644 4.412