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 = '2' > 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 time_in_rfc pop gender total_tests 1 210907 0 0 2 2 149061 0 0 0 3 237213 0 1 0 4 133131 0 1 4 5 324799 0 1 0 6 230964 0 0 -1 7 236785 0 1 0 8 344297 0 1 1 9 174724 0 1 0 10 174415 0 1 3 11 223632 0 1 -1 12 294424 0 0 4 13 325107 0 1 3 14 106408 0 0 1 15 96560 0 0 0 16 265769 0 1 -2 17 149112 0 0 -4 18 152871 0 0 2 19 362301 0 1 2 20 183167 0 0 -4 21 218946 0 1 2 22 244052 0 1 2 23 341570 0 1 0 24 196553 0 1 -3 25 143246 0 0 2 26 143756 0 0 4 27 152299 0 1 2 28 193339 0 1 2 29 130585 0 0 -4 30 112611 0 1 3 31 148446 0 1 3 32 182079 0 0 2 33 243060 0 1 -1 34 162765 0 1 -3 35 85574 0 1 0 36 225060 0 0 1 37 133328 0 1 -3 38 100750 0 1 3 39 101523 0 1 0 40 243511 0 1 0 41 152474 0 1 0 42 132487 0 1 3 43 317394 0 0 -3 44 244749 0 1 0 45 128423 0 0 2 46 97839 0 0 -1 47 229242 1 1 2 48 324598 1 0 2 49 195838 1 0 -2 50 254488 1 0 0 51 92499 1 1 -2 52 224330 1 0 0 53 181633 1 1 6 54 271856 1 1 -3 55 95227 1 1 3 56 98146 1 0 0 57 118612 1 0 -2 58 65475 1 1 1 59 108446 1 0 0 60 121848 1 0 2 61 76302 1 1 2 62 98104 1 0 -3 63 30989 1 1 -2 64 31774 1 0 1 65 150580 1 1 -4 66 59382 1 0 1 67 84105 1 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) pop gender total_tests 182305.5 -52039.0 19860.2 -431.8 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -120001 -53526 -21820 42667 195195 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 182305.5 16950.7 10.755 6.78e-16 *** pop -52039.0 21029.9 -2.475 0.0160 * gender 19860.2 19758.6 1.005 0.3187 total_tests -431.8 4271.8 -0.101 0.9198 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 78260 on 63 degrees of freedom Multiple R-squared: 0.1171, Adjusted R-squared: 0.0751 F-statistic: 2.786 on 3 and 63 DF, p-value: 0.04789 > 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.4049993 0.80999850 0.59500075 [2,] 0.5326049 0.93479013 0.46739507 [3,] 0.5688047 0.86239064 0.43119532 [4,] 0.4438595 0.88771905 0.55614047 [5,] 0.3644864 0.72897276 0.63551362 [6,] 0.5139003 0.97219932 0.48609966 [7,] 0.5799116 0.84017681 0.42008840 [8,] 0.6239093 0.75218138 0.37609069 [9,] 0.6408047 0.71839051 0.35919525 [10,] 0.5765855 0.84682908 0.42341454 [11,] 0.4934521 0.98690416 0.50654792 [12,] 0.4137590 0.82751808 0.58624096 [13,] 0.5762880 0.84742409 0.42371204 [14,] 0.4971522 0.99430444 0.50284778 [15,] 0.4370291 0.87405818 0.56297091 [16,] 0.3806092 0.76121849 0.61939076 [17,] 0.5148961 0.97020780 0.48510390 [18,] 0.4648058 0.92961151 0.53519424 [19,] 0.4021889 0.80437785 0.59781108 [20,] 0.3412172 0.68243447 0.65878277 [21,] 0.3560936 0.71218710 0.64390645 [22,] 0.3153997 0.63079950 0.68460025 [23,] 0.2731629 0.54632581 0.72683709 [24,] 0.3349493 0.66989854 0.66505073 [25,] 0.3161429 0.63228577 0.68385712 [26,] 0.2547459 0.50949184 0.74525408 [27,] 0.2238676 0.44773529 0.77613236 [28,] 0.1969630 0.39392606 0.80303697 [29,] 0.2669936 0.53398728 0.73300636 [30,] 0.2342691 0.46853825 0.76573087 [31,] 0.2162299 0.43245988 0.78377006 [32,] 0.2393431 0.47868629 0.76065685 [33,] 0.2613976 0.52279519 0.73860241 [34,] 0.2254224 0.45084484 0.77457758 [35,] 0.1860021 0.37200416 0.81399792 [36,] 0.1655815 0.33116291 0.83441855 [37,] 0.2695021 0.53900428 0.73049786 [38,] 0.2830287 0.56605748 0.71697126 [39,] 0.2289705 0.45794100 0.77102950 [40,] 0.1905836 0.38116722 0.80941639 [41,] 0.1883069 0.37661385 0.81169307 [42,] 0.4375377 0.87507539 0.56246231 [43,] 0.4112934 0.82258685 0.58870658 [44,] 0.5675805 0.86483908 0.43241954 [45,] 0.5738998 0.85220037 0.42610018 [46,] 0.7088297 0.58234066 0.29117033 [47,] 0.7991311 0.40173781 0.20086891 [48,] 0.9830898 0.03382045 0.01691023 [49,] 0.9772145 0.04557108 0.02278554 [50,] 0.9564813 0.08703731 0.04351865 [51,] 0.9202262 0.15954767 0.07977384 [52,] 0.8614940 0.27701210 0.13850605 [53,] 0.7726161 0.45476780 0.22738390 [54,] 0.7706995 0.45860100 0.22930050 > postscript(file="/var/www/rcomp/tmp/1zvmk1323614130.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/2j6v61323614130.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/3wmtr1323614130.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/4djv41323614130.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/5yhif1323614130.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 29465.0949 -33244.4665 35047.3439 -67307.5332 122633.3439 48226.7528 7 8 9 10 11 12 34619.3439 142563.1246 -27441.6561 -26455.3140 21034.5632 113845.6564 13 14 15 16 17 18 124236.6860 -75465.6858 -85745.4665 62739.7825 -34920.5893 -28570.9051 19 20 21 22 23 24 160998.9053 -865.5893 17643.9053 42749.9053 139404.3439 -6907.9982 25 26 27 28 29 30 -38195.9051 -36822.3436 -49003.0947 -7963.0947 -53447.5893 -88259.3140 31 32 33 34 35 36 -52424.3140 637.0949 40462.5632 -40695.9982 -116591.6561 43186.3142 37 38 39 40 41 42 -70132.9982 -100120.3140 -100642.6561 41345.3439 -49691.6561 -68383.3140 43 44 45 46 47 48 133793.1914 42583.3439 -53018.9051 -84898.2472 79978.9025 195195.0921 49 50 51 52 53 54 64707.9693 124221.5307 -58491.2203 94063.5307 34097.0254 120433.9990 55 56 57 58 59 60 -53604.3168 -32120.4693 -12518.0307 -84219.8782 -21820.4693 -7554.9079 61 62 63 64 65 66 -72961.0975 -33457.8114 -120001.2203 -98060.6886 -1273.7817 -70452.6886 67 -46161.4693 > postscript(file="/var/www/rcomp/tmp/6gpyg1323614130.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 29465.0949 NA 1 -33244.4665 29465.0949 2 35047.3439 -33244.4665 3 -67307.5332 35047.3439 4 122633.3439 -67307.5332 5 48226.7528 122633.3439 6 34619.3439 48226.7528 7 142563.1246 34619.3439 8 -27441.6561 142563.1246 9 -26455.3140 -27441.6561 10 21034.5632 -26455.3140 11 113845.6564 21034.5632 12 124236.6860 113845.6564 13 -75465.6858 124236.6860 14 -85745.4665 -75465.6858 15 62739.7825 -85745.4665 16 -34920.5893 62739.7825 17 -28570.9051 -34920.5893 18 160998.9053 -28570.9051 19 -865.5893 160998.9053 20 17643.9053 -865.5893 21 42749.9053 17643.9053 22 139404.3439 42749.9053 23 -6907.9982 139404.3439 24 -38195.9051 -6907.9982 25 -36822.3436 -38195.9051 26 -49003.0947 -36822.3436 27 -7963.0947 -49003.0947 28 -53447.5893 -7963.0947 29 -88259.3140 -53447.5893 30 -52424.3140 -88259.3140 31 637.0949 -52424.3140 32 40462.5632 637.0949 33 -40695.9982 40462.5632 34 -116591.6561 -40695.9982 35 43186.3142 -116591.6561 36 -70132.9982 43186.3142 37 -100120.3140 -70132.9982 38 -100642.6561 -100120.3140 39 41345.3439 -100642.6561 40 -49691.6561 41345.3439 41 -68383.3140 -49691.6561 42 133793.1914 -68383.3140 43 42583.3439 133793.1914 44 -53018.9051 42583.3439 45 -84898.2472 -53018.9051 46 79978.9025 -84898.2472 47 195195.0921 79978.9025 48 64707.9693 195195.0921 49 124221.5307 64707.9693 50 -58491.2203 124221.5307 51 94063.5307 -58491.2203 52 34097.0254 94063.5307 53 120433.9990 34097.0254 54 -53604.3168 120433.9990 55 -32120.4693 -53604.3168 56 -12518.0307 -32120.4693 57 -84219.8782 -12518.0307 58 -21820.4693 -84219.8782 59 -7554.9079 -21820.4693 60 -72961.0975 -7554.9079 61 -33457.8114 -72961.0975 62 -120001.2203 -33457.8114 63 -98060.6886 -120001.2203 64 -1273.7817 -98060.6886 65 -70452.6886 -1273.7817 66 -46161.4693 -70452.6886 67 NA -46161.4693 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -33244.4665 29465.0949 [2,] 35047.3439 -33244.4665 [3,] -67307.5332 35047.3439 [4,] 122633.3439 -67307.5332 [5,] 48226.7528 122633.3439 [6,] 34619.3439 48226.7528 [7,] 142563.1246 34619.3439 [8,] -27441.6561 142563.1246 [9,] -26455.3140 -27441.6561 [10,] 21034.5632 -26455.3140 [11,] 113845.6564 21034.5632 [12,] 124236.6860 113845.6564 [13,] -75465.6858 124236.6860 [14,] -85745.4665 -75465.6858 [15,] 62739.7825 -85745.4665 [16,] -34920.5893 62739.7825 [17,] -28570.9051 -34920.5893 [18,] 160998.9053 -28570.9051 [19,] -865.5893 160998.9053 [20,] 17643.9053 -865.5893 [21,] 42749.9053 17643.9053 [22,] 139404.3439 42749.9053 [23,] -6907.9982 139404.3439 [24,] -38195.9051 -6907.9982 [25,] -36822.3436 -38195.9051 [26,] -49003.0947 -36822.3436 [27,] -7963.0947 -49003.0947 [28,] -53447.5893 -7963.0947 [29,] -88259.3140 -53447.5893 [30,] -52424.3140 -88259.3140 [31,] 637.0949 -52424.3140 [32,] 40462.5632 637.0949 [33,] -40695.9982 40462.5632 [34,] -116591.6561 -40695.9982 [35,] 43186.3142 -116591.6561 [36,] -70132.9982 43186.3142 [37,] -100120.3140 -70132.9982 [38,] -100642.6561 -100120.3140 [39,] 41345.3439 -100642.6561 [40,] -49691.6561 41345.3439 [41,] -68383.3140 -49691.6561 [42,] 133793.1914 -68383.3140 [43,] 42583.3439 133793.1914 [44,] -53018.9051 42583.3439 [45,] -84898.2472 -53018.9051 [46,] 79978.9025 -84898.2472 [47,] 195195.0921 79978.9025 [48,] 64707.9693 195195.0921 [49,] 124221.5307 64707.9693 [50,] -58491.2203 124221.5307 [51,] 94063.5307 -58491.2203 [52,] 34097.0254 94063.5307 [53,] 120433.9990 34097.0254 [54,] -53604.3168 120433.9990 [55,] -32120.4693 -53604.3168 [56,] -12518.0307 -32120.4693 [57,] -84219.8782 -12518.0307 [58,] -21820.4693 -84219.8782 [59,] -7554.9079 -21820.4693 [60,] -72961.0975 -7554.9079 [61,] -33457.8114 -72961.0975 [62,] -120001.2203 -33457.8114 [63,] -98060.6886 -120001.2203 [64,] -1273.7817 -98060.6886 [65,] -70452.6886 -1273.7817 [66,] -46161.4693 -70452.6886 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -33244.4665 29465.0949 2 35047.3439 -33244.4665 3 -67307.5332 35047.3439 4 122633.3439 -67307.5332 5 48226.7528 122633.3439 6 34619.3439 48226.7528 7 142563.1246 34619.3439 8 -27441.6561 142563.1246 9 -26455.3140 -27441.6561 10 21034.5632 -26455.3140 11 113845.6564 21034.5632 12 124236.6860 113845.6564 13 -75465.6858 124236.6860 14 -85745.4665 -75465.6858 15 62739.7825 -85745.4665 16 -34920.5893 62739.7825 17 -28570.9051 -34920.5893 18 160998.9053 -28570.9051 19 -865.5893 160998.9053 20 17643.9053 -865.5893 21 42749.9053 17643.9053 22 139404.3439 42749.9053 23 -6907.9982 139404.3439 24 -38195.9051 -6907.9982 25 -36822.3436 -38195.9051 26 -49003.0947 -36822.3436 27 -7963.0947 -49003.0947 28 -53447.5893 -7963.0947 29 -88259.3140 -53447.5893 30 -52424.3140 -88259.3140 31 637.0949 -52424.3140 32 40462.5632 637.0949 33 -40695.9982 40462.5632 34 -116591.6561 -40695.9982 35 43186.3142 -116591.6561 36 -70132.9982 43186.3142 37 -100120.3140 -70132.9982 38 -100642.6561 -100120.3140 39 41345.3439 -100642.6561 40 -49691.6561 41345.3439 41 -68383.3140 -49691.6561 42 133793.1914 -68383.3140 43 42583.3439 133793.1914 44 -53018.9051 42583.3439 45 -84898.2472 -53018.9051 46 79978.9025 -84898.2472 47 195195.0921 79978.9025 48 64707.9693 195195.0921 49 124221.5307 64707.9693 50 -58491.2203 124221.5307 51 94063.5307 -58491.2203 52 34097.0254 94063.5307 53 120433.9990 34097.0254 54 -53604.3168 120433.9990 55 -32120.4693 -53604.3168 56 -12518.0307 -32120.4693 57 -84219.8782 -12518.0307 58 -21820.4693 -84219.8782 59 -7554.9079 -21820.4693 60 -72961.0975 -7554.9079 61 -33457.8114 -72961.0975 62 -120001.2203 -33457.8114 63 -98060.6886 -120001.2203 64 -1273.7817 -98060.6886 65 -70452.6886 -1273.7817 66 -46161.4693 -70452.6886 > 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/75mdh1323614130.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/8nyim1323614130.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/9t57d1323614130.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/10b2k81323614130.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/11pez31323614130.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/12xv7w1323614130.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/13dqbt1323614130.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/14gaal1323614130.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/15xn3k1323614130.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/16ml7f1323614130.tab") + } > > try(system("convert tmp/1zvmk1323614130.ps tmp/1zvmk1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/2j6v61323614130.ps tmp/2j6v61323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/3wmtr1323614130.ps tmp/3wmtr1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/4djv41323614130.ps tmp/4djv41323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/5yhif1323614130.ps tmp/5yhif1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/6gpyg1323614130.ps tmp/6gpyg1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/75mdh1323614130.ps tmp/75mdh1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/8nyim1323614130.ps tmp/8nyim1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/9t57d1323614130.ps tmp/9t57d1323614130.png",intern=TRUE)) character(0) > try(system("convert tmp/10b2k81323614130.ps tmp/10b2k81323614130.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.732 0.760 6.575