R version 2.13.0 (2011-04-13) Copyright (C) 2011 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 = '1' > 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 pop time_in_rfc gender total_tests 1 0 210907 0 2 2 0 149061 0 0 3 0 237213 1 0 4 0 133131 1 4 5 0 324799 1 0 6 0 230964 0 -1 7 0 236785 1 0 8 0 344297 1 1 9 0 174724 1 0 10 0 174415 1 3 11 0 223632 1 -1 12 0 294424 0 4 13 0 325107 1 3 14 0 106408 0 1 15 0 96560 0 0 16 0 265769 1 -2 17 0 149112 0 -4 18 0 152871 0 2 19 0 362301 1 2 20 0 183167 0 -4 21 0 218946 1 2 22 0 244052 1 2 23 0 341570 1 0 24 0 196553 1 -3 25 0 143246 0 2 26 0 143756 0 4 27 0 152299 1 2 28 0 193339 1 2 29 0 130585 0 -4 30 0 112611 1 3 31 0 148446 1 3 32 0 182079 0 2 33 0 243060 1 -1 34 0 162765 1 -3 35 0 85574 1 0 36 0 225060 0 1 37 0 133328 1 -3 38 0 100750 1 3 39 0 101523 1 0 40 0 243511 1 0 41 0 152474 1 0 42 0 132487 1 3 43 0 317394 0 -3 44 0 244749 1 0 45 0 128423 0 2 46 0 97839 0 -1 47 1 229242 1 2 48 1 324598 0 2 49 1 195838 0 -2 50 1 254488 0 0 51 1 92499 1 -2 52 1 224330 0 0 53 1 181633 1 6 54 1 271856 1 -3 55 1 95227 1 3 56 1 98146 0 0 57 1 118612 0 -2 58 1 65475 1 1 59 1 108446 0 0 60 1 121848 0 2 61 1 76302 1 2 62 1 98104 0 -3 63 1 30989 1 -2 64 1 31774 0 1 65 1 150580 1 -4 66 1 59382 0 1 67 1 84105 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) time_in_rfc gender total_tests 6.883e-01 -1.702e-06 -1.213e-01 -1.230e-02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.5340 -0.3326 -0.1656 0.4580 0.8889 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.883e-01 1.383e-01 4.975 5.32e-06 *** time_in_rfc -1.702e-06 6.879e-07 -2.475 0.016 * gender -1.213e-01 1.129e-01 -1.074 0.287 total_tests -1.230e-02 2.439e-02 -0.504 0.616 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4476 on 63 degrees of freedom Multiple R-squared: 0.1246, Adjusted R-squared: 0.08288 F-statistic: 2.988 on 3 and 63 DF, p-value: 0.03763 > 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 0.000000e+00 1.000000e+00 [2,] 0 0.000000e+00 1.000000e+00 [3,] 0 0.000000e+00 1.000000e+00 [4,] 0 0.000000e+00 1.000000e+00 [5,] 0 0.000000e+00 1.000000e+00 [6,] 0 0.000000e+00 1.000000e+00 [7,] 0 0.000000e+00 1.000000e+00 [8,] 0 0.000000e+00 1.000000e+00 [9,] 0 0.000000e+00 1.000000e+00 [10,] 0 0.000000e+00 1.000000e+00 [11,] 0 0.000000e+00 1.000000e+00 [12,] 0 0.000000e+00 1.000000e+00 [13,] 0 0.000000e+00 1.000000e+00 [14,] 0 0.000000e+00 1.000000e+00 [15,] 0 0.000000e+00 1.000000e+00 [16,] 0 0.000000e+00 1.000000e+00 [17,] 0 0.000000e+00 1.000000e+00 [18,] 0 0.000000e+00 1.000000e+00 [19,] 0 0.000000e+00 1.000000e+00 [20,] 0 0.000000e+00 1.000000e+00 [21,] 0 0.000000e+00 1.000000e+00 [22,] 0 0.000000e+00 1.000000e+00 [23,] 0 0.000000e+00 1.000000e+00 [24,] 0 0.000000e+00 1.000000e+00 [25,] 0 0.000000e+00 1.000000e+00 [26,] 0 0.000000e+00 1.000000e+00 [27,] 0 0.000000e+00 1.000000e+00 [28,] 0 0.000000e+00 1.000000e+00 [29,] 0 0.000000e+00 1.000000e+00 [30,] 0 0.000000e+00 1.000000e+00 [31,] 0 0.000000e+00 1.000000e+00 [32,] 0 0.000000e+00 1.000000e+00 [33,] 0 0.000000e+00 1.000000e+00 [34,] 0 0.000000e+00 1.000000e+00 [35,] 0 0.000000e+00 1.000000e+00 [36,] 0 0.000000e+00 1.000000e+00 [37,] 0 0.000000e+00 1.000000e+00 [38,] 0 0.000000e+00 1.000000e+00 [39,] 0 0.000000e+00 1.000000e+00 [40,] 0 0.000000e+00 1.000000e+00 [41,] 1 2.684099e-251 1.342050e-251 [42,] 1 1.703577e-225 8.517884e-226 [43,] 1 1.115176e-213 5.575882e-214 [44,] 1 9.249760e-212 4.624880e-212 [45,] 1 0.000000e+00 0.000000e+00 [46,] 1 5.980538e-169 2.990269e-169 [47,] 1 1.314256e-154 6.571279e-155 [48,] 1 1.406342e-157 7.031709e-158 [49,] 1 5.475018e-123 2.737509e-123 [50,] 1 1.773026e-115 8.865131e-116 [51,] 1 8.516464e-95 4.258232e-95 [52,] 1 6.359993e-79 3.179997e-79 [53,] 1 3.435673e-62 1.717836e-62 [54,] 1 1.756747e-47 8.783734e-48 > postscript(file="/var/wessaorg/rcomp/tmp/1j7sf1323616265.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/wessaorg/rcomp/tmp/2ie2m1323616265.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/wessaorg/rcomp/tmp/3syhr1323616265.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/wessaorg/rcomp/tmp/4fqmq1323616265.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/wessaorg/rcomp/tmp/5r5h41323616265.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 -0.30464953 -0.43452618 -0.16319996 -0.29118245 -0.01410381 -0.30740274 7 8 9 10 11 12 -0.16392854 0.03138593 -0.26957392 -0.23320403 -0.19861730 -0.13788271 13 14 15 16 17 18 0.02331638 -0.49483502 -0.52389773 -0.13918684 -0.48363389 -0.40344322 19 20 21 22 23 24 0.07433246 -0.42566264 -0.16969830 -0.12696079 0.01444517 -0.26931068 25 26 27 28 29 30 -0.41982769 -0.39436226 -0.28315035 -0.21328866 -0.51517208 -0.33841192 31 32 33 34 35 36 -0.27741061 -0.35372294 -0.16554535 -0.32682741 -0.42133244 -0.29285575 37 38 39 40 41 42 -0.37693752 -0.35860270 -0.39418273 -0.15247899 -0.30744971 -0.30457735 43 44 45 46 47 48 -0.18487169 -0.15037156 -0.44506063 -0.53401915 0.84782840 0.88888472 49 50 51 52 53 54 0.62050424 0.74494040 0.56585861 0.69360295 0.81597894 0.85887633 55 56 57 58 59 60 0.63199559 0.47880209 0.48904375 0.55675201 0.49633560 0.54374686 61 62 63 64 65 66 0.58748126 0.44183470 0.46115119 0.37811680 0.64013164 0.42511342 67 0.45490033 > postscript(file="/var/wessaorg/rcomp/tmp/66ypb1323616265.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 -0.30464953 NA 1 -0.43452618 -0.30464953 2 -0.16319996 -0.43452618 3 -0.29118245 -0.16319996 4 -0.01410381 -0.29118245 5 -0.30740274 -0.01410381 6 -0.16392854 -0.30740274 7 0.03138593 -0.16392854 8 -0.26957392 0.03138593 9 -0.23320403 -0.26957392 10 -0.19861730 -0.23320403 11 -0.13788271 -0.19861730 12 0.02331638 -0.13788271 13 -0.49483502 0.02331638 14 -0.52389773 -0.49483502 15 -0.13918684 -0.52389773 16 -0.48363389 -0.13918684 17 -0.40344322 -0.48363389 18 0.07433246 -0.40344322 19 -0.42566264 0.07433246 20 -0.16969830 -0.42566264 21 -0.12696079 -0.16969830 22 0.01444517 -0.12696079 23 -0.26931068 0.01444517 24 -0.41982769 -0.26931068 25 -0.39436226 -0.41982769 26 -0.28315035 -0.39436226 27 -0.21328866 -0.28315035 28 -0.51517208 -0.21328866 29 -0.33841192 -0.51517208 30 -0.27741061 -0.33841192 31 -0.35372294 -0.27741061 32 -0.16554535 -0.35372294 33 -0.32682741 -0.16554535 34 -0.42133244 -0.32682741 35 -0.29285575 -0.42133244 36 -0.37693752 -0.29285575 37 -0.35860270 -0.37693752 38 -0.39418273 -0.35860270 39 -0.15247899 -0.39418273 40 -0.30744971 -0.15247899 41 -0.30457735 -0.30744971 42 -0.18487169 -0.30457735 43 -0.15037156 -0.18487169 44 -0.44506063 -0.15037156 45 -0.53401915 -0.44506063 46 0.84782840 -0.53401915 47 0.88888472 0.84782840 48 0.62050424 0.88888472 49 0.74494040 0.62050424 50 0.56585861 0.74494040 51 0.69360295 0.56585861 52 0.81597894 0.69360295 53 0.85887633 0.81597894 54 0.63199559 0.85887633 55 0.47880209 0.63199559 56 0.48904375 0.47880209 57 0.55675201 0.48904375 58 0.49633560 0.55675201 59 0.54374686 0.49633560 60 0.58748126 0.54374686 61 0.44183470 0.58748126 62 0.46115119 0.44183470 63 0.37811680 0.46115119 64 0.64013164 0.37811680 65 0.42511342 0.64013164 66 0.45490033 0.42511342 67 NA 0.45490033 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.43452618 -0.30464953 [2,] -0.16319996 -0.43452618 [3,] -0.29118245 -0.16319996 [4,] -0.01410381 -0.29118245 [5,] -0.30740274 -0.01410381 [6,] -0.16392854 -0.30740274 [7,] 0.03138593 -0.16392854 [8,] -0.26957392 0.03138593 [9,] -0.23320403 -0.26957392 [10,] -0.19861730 -0.23320403 [11,] -0.13788271 -0.19861730 [12,] 0.02331638 -0.13788271 [13,] -0.49483502 0.02331638 [14,] -0.52389773 -0.49483502 [15,] -0.13918684 -0.52389773 [16,] -0.48363389 -0.13918684 [17,] -0.40344322 -0.48363389 [18,] 0.07433246 -0.40344322 [19,] -0.42566264 0.07433246 [20,] -0.16969830 -0.42566264 [21,] -0.12696079 -0.16969830 [22,] 0.01444517 -0.12696079 [23,] -0.26931068 0.01444517 [24,] -0.41982769 -0.26931068 [25,] -0.39436226 -0.41982769 [26,] -0.28315035 -0.39436226 [27,] -0.21328866 -0.28315035 [28,] -0.51517208 -0.21328866 [29,] -0.33841192 -0.51517208 [30,] -0.27741061 -0.33841192 [31,] -0.35372294 -0.27741061 [32,] -0.16554535 -0.35372294 [33,] -0.32682741 -0.16554535 [34,] -0.42133244 -0.32682741 [35,] -0.29285575 -0.42133244 [36,] -0.37693752 -0.29285575 [37,] -0.35860270 -0.37693752 [38,] -0.39418273 -0.35860270 [39,] -0.15247899 -0.39418273 [40,] -0.30744971 -0.15247899 [41,] -0.30457735 -0.30744971 [42,] -0.18487169 -0.30457735 [43,] -0.15037156 -0.18487169 [44,] -0.44506063 -0.15037156 [45,] -0.53401915 -0.44506063 [46,] 0.84782840 -0.53401915 [47,] 0.88888472 0.84782840 [48,] 0.62050424 0.88888472 [49,] 0.74494040 0.62050424 [50,] 0.56585861 0.74494040 [51,] 0.69360295 0.56585861 [52,] 0.81597894 0.69360295 [53,] 0.85887633 0.81597894 [54,] 0.63199559 0.85887633 [55,] 0.47880209 0.63199559 [56,] 0.48904375 0.47880209 [57,] 0.55675201 0.48904375 [58,] 0.49633560 0.55675201 [59,] 0.54374686 0.49633560 [60,] 0.58748126 0.54374686 [61,] 0.44183470 0.58748126 [62,] 0.46115119 0.44183470 [63,] 0.37811680 0.46115119 [64,] 0.64013164 0.37811680 [65,] 0.42511342 0.64013164 [66,] 0.45490033 0.42511342 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.43452618 -0.30464953 2 -0.16319996 -0.43452618 3 -0.29118245 -0.16319996 4 -0.01410381 -0.29118245 5 -0.30740274 -0.01410381 6 -0.16392854 -0.30740274 7 0.03138593 -0.16392854 8 -0.26957392 0.03138593 9 -0.23320403 -0.26957392 10 -0.19861730 -0.23320403 11 -0.13788271 -0.19861730 12 0.02331638 -0.13788271 13 -0.49483502 0.02331638 14 -0.52389773 -0.49483502 15 -0.13918684 -0.52389773 16 -0.48363389 -0.13918684 17 -0.40344322 -0.48363389 18 0.07433246 -0.40344322 19 -0.42566264 0.07433246 20 -0.16969830 -0.42566264 21 -0.12696079 -0.16969830 22 0.01444517 -0.12696079 23 -0.26931068 0.01444517 24 -0.41982769 -0.26931068 25 -0.39436226 -0.41982769 26 -0.28315035 -0.39436226 27 -0.21328866 -0.28315035 28 -0.51517208 -0.21328866 29 -0.33841192 -0.51517208 30 -0.27741061 -0.33841192 31 -0.35372294 -0.27741061 32 -0.16554535 -0.35372294 33 -0.32682741 -0.16554535 34 -0.42133244 -0.32682741 35 -0.29285575 -0.42133244 36 -0.37693752 -0.29285575 37 -0.35860270 -0.37693752 38 -0.39418273 -0.35860270 39 -0.15247899 -0.39418273 40 -0.30744971 -0.15247899 41 -0.30457735 -0.30744971 42 -0.18487169 -0.30457735 43 -0.15037156 -0.18487169 44 -0.44506063 -0.15037156 45 -0.53401915 -0.44506063 46 0.84782840 -0.53401915 47 0.88888472 0.84782840 48 0.62050424 0.88888472 49 0.74494040 0.62050424 50 0.56585861 0.74494040 51 0.69360295 0.56585861 52 0.81597894 0.69360295 53 0.85887633 0.81597894 54 0.63199559 0.85887633 55 0.47880209 0.63199559 56 0.48904375 0.47880209 57 0.55675201 0.48904375 58 0.49633560 0.55675201 59 0.54374686 0.49633560 60 0.58748126 0.54374686 61 0.44183470 0.58748126 62 0.46115119 0.44183470 63 0.37811680 0.46115119 64 0.64013164 0.37811680 65 0.42511342 0.64013164 66 0.45490033 0.42511342 > 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/wessaorg/rcomp/tmp/7to8g1323616265.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/wessaorg/rcomp/tmp/8jfr21323616265.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/wessaorg/rcomp/tmp/9mjh51323616265.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/wessaorg/rcomp/tmp/10ykrr1323616265.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11j9iy1323616265.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/wessaorg/rcomp/tmp/12z4pq1323616265.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/wessaorg/rcomp/tmp/1396uf1323616266.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/wessaorg/rcomp/tmp/145jrz1323616266.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/wessaorg/rcomp/tmp/1580fr1323616266.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/wessaorg/rcomp/tmp/16f7u21323616266.tab") + } > > try(system("convert tmp/1j7sf1323616265.ps tmp/1j7sf1323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/2ie2m1323616265.ps tmp/2ie2m1323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/3syhr1323616265.ps tmp/3syhr1323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/4fqmq1323616265.ps tmp/4fqmq1323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/5r5h41323616265.ps tmp/5r5h41323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/66ypb1323616265.ps tmp/66ypb1323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/7to8g1323616265.ps tmp/7to8g1323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/8jfr21323616265.ps tmp/8jfr21323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/9mjh51323616265.ps tmp/9mjh51323616265.png",intern=TRUE)) character(0) > try(system("convert tmp/10ykrr1323616265.ps tmp/10ykrr1323616265.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.367 0.481 3.887