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(8.4,99,8.4,98.6,8.4,98.6,8.6,98.5,8.9,98.9,8.8,99.4,8.3,99.8,7.5,99.9,7.2,100,7.4,100.1,8.8,100.1,9.3,100.2,9.3,100.3,8.7,100,8.2,99.9,8.3,99.4,8.5,99.8,8.6,99.6,8.5,100,8.2,99.9,8.1,100.3,7.9,100.6,8.6,100.7,8.7,100.8,8.7,100.8,8.5,100.6,8.4,101.1,8.5,101.1,8.7,100.9,8.7,101.1,8.6,101.2,8.5,101.4,8.3,101.9,8,102.1,8.2,102.1,8.1,103,8.1,103.4,8,103.2,7.9,103.1,7.9,103,8,103.7,8,103.4,7.9,103.5,8,103.8,7.7,104,7.2,104.2,7.5,104.4,7.3,104.4,7,104.9,7,105.3,7,105.2,7.2,105.4,7.3,105.4,7.1,105.5,6.8,105.7,6.4,105.6,6.1,105.8,6.5,105.4,7.7,105.5,7.9,105.8,7.5,106.1,6.9,106,6.6,105.5,6.9,105.4,7.7,106,8,106.1,8,106.4,7.7,106,7.3,106,7.4,106,8.1,106,8.3,106.1,8.2,106.1),dim=c(2,73),dimnames=list(c('werkl','afzetp'),1:73)) > y <- array(NA,dim=c(2,73),dimnames=list(c('werkl','afzetp'),1:73)) > 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 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 werkl afzetp 1 8.4 99.0 2 8.4 98.6 3 8.4 98.6 4 8.6 98.5 5 8.9 98.9 6 8.8 99.4 7 8.3 99.8 8 7.5 99.9 9 7.2 100.0 10 7.4 100.1 11 8.8 100.1 12 9.3 100.2 13 9.3 100.3 14 8.7 100.0 15 8.2 99.9 16 8.3 99.4 17 8.5 99.8 18 8.6 99.6 19 8.5 100.0 20 8.2 99.9 21 8.1 100.3 22 7.9 100.6 23 8.6 100.7 24 8.7 100.8 25 8.7 100.8 26 8.5 100.6 27 8.4 101.1 28 8.5 101.1 29 8.7 100.9 30 8.7 101.1 31 8.6 101.2 32 8.5 101.4 33 8.3 101.9 34 8.0 102.1 35 8.2 102.1 36 8.1 103.0 37 8.1 103.4 38 8.0 103.2 39 7.9 103.1 40 7.9 103.0 41 8.0 103.7 42 8.0 103.4 43 7.9 103.5 44 8.0 103.8 45 7.7 104.0 46 7.2 104.2 47 7.5 104.4 48 7.3 104.4 49 7.0 104.9 50 7.0 105.3 51 7.0 105.2 52 7.2 105.4 53 7.3 105.4 54 7.1 105.5 55 6.8 105.7 56 6.4 105.6 57 6.1 105.8 58 6.5 105.4 59 7.7 105.5 60 7.9 105.8 61 7.5 106.1 62 6.9 106.0 63 6.6 105.5 64 6.9 105.4 65 7.7 106.0 66 8.0 106.1 67 8.0 106.4 68 7.7 106.0 69 7.3 106.0 70 7.4 106.0 71 8.1 106.0 72 8.3 106.1 73 8.2 106.1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) afzetp 26.9283 -0.1849 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.26163 -0.29321 0.07535 0.29451 0.99385 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 26.92835 2.35187 11.45 < 2e-16 *** afzetp -0.18494 0.02289 -8.08 1.19e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.5051 on 71 degrees of freedom Multiple R-squared: 0.4791, Adjusted R-squared: 0.4717 F-statistic: 65.29 on 1 and 71 DF, p-value: 1.186e-11 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.12030804 0.24061608 0.87969196 [2,] 0.04597748 0.09195497 0.95402252 [3,] 0.05121549 0.10243098 0.94878451 [4,] 0.24338869 0.48677739 0.75661131 [5,] 0.41345767 0.82691534 0.58654233 [6,] 0.39106954 0.78213907 0.60893046 [7,] 0.71646550 0.56706900 0.28353450 [8,] 0.94407183 0.11185635 0.05592817 [9,] 0.98148158 0.03703683 0.01851842 [10,] 0.97284186 0.05431629 0.02715814 [11,] 0.96060525 0.07878949 0.03939475 [12,] 0.94410719 0.11178561 0.05589281 [13,] 0.91869494 0.16261012 0.08130506 [14,] 0.88765984 0.22468032 0.11234016 [15,] 0.84721368 0.30557264 0.15278632 [16,] 0.81371570 0.37256860 0.18628430 [17,] 0.78323841 0.43352318 0.21676159 [18,] 0.77726212 0.44547577 0.22273788 [19,] 0.73627890 0.52744219 0.26372110 [20,] 0.70043370 0.59913259 0.29956630 [21,] 0.65667667 0.68664666 0.34332333 [22,] 0.59007409 0.81985182 0.40992591 [23,] 0.51917453 0.96165094 0.48082547 [24,] 0.45022452 0.90044903 0.54977548 [25,] 0.39984974 0.79969949 0.60015026 [26,] 0.35363288 0.70726576 0.64636712 [27,] 0.30099152 0.60198304 0.69900848 [28,] 0.24983497 0.49966994 0.75016503 [29,] 0.20602841 0.41205682 0.79397159 [30,] 0.18082920 0.36165840 0.81917080 [31,] 0.14433946 0.28867893 0.85566054 [32,] 0.11677668 0.23355336 0.88322332 [33,] 0.09483046 0.18966091 0.90516954 [34,] 0.07539014 0.15078028 0.92460986 [35,] 0.05956563 0.11913126 0.94043437 [36,] 0.04635429 0.09270859 0.95364571 [37,] 0.03756427 0.07512853 0.96243573 [38,] 0.03239289 0.06478578 0.96760711 [39,] 0.02994984 0.05989968 0.97005016 [40,] 0.03817931 0.07635862 0.96182069 [41,] 0.04768746 0.09537493 0.95231254 [42,] 0.05797020 0.11594039 0.94202980 [43,] 0.07789096 0.15578191 0.92210904 [44,] 0.14424634 0.28849269 0.85575366 [45,] 0.17259595 0.34519191 0.82740405 [46,] 0.15428574 0.30857147 0.84571426 [47,] 0.14521322 0.29042644 0.85478678 [48,] 0.12546830 0.25093659 0.87453170 [49,] 0.12404039 0.24808079 0.87595961 [50,] 0.10022067 0.20044134 0.89977933 [51,] 0.08846992 0.17693984 0.91153008 [52,] 0.12900726 0.25801453 0.87099274 [53,] 0.53577152 0.92845695 0.46422848 [54,] 0.55721743 0.88556515 0.44278257 [55,] 0.65407480 0.69185041 0.34592520 [56,] 0.72804936 0.54390128 0.27195064 [57,] 0.68462095 0.63075809 0.31537905 [58,] 0.86004189 0.27991623 0.13995811 [59,] 0.86293426 0.27413149 0.13706574 [60,] 0.79146267 0.41707467 0.20853733 [61,] 0.70481824 0.59036351 0.29518176 [62,] 0.61672510 0.76654981 0.38327490 [63,] 0.79260823 0.41478355 0.20739177 [64,] 0.64969964 0.70060072 0.35030036 > postscript(file="/var/www/html/rcomp/tmp/174wb1258762637.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/2soxr1258762637.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/3bmw51258762637.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/4xv9k1258762637.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/5c71z1258762637.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 = 73 Frequency = 1 1 2 3 4 5 6 -0.219230655 -0.293206887 -0.293206887 -0.111700945 0.262275287 0.254745577 7 8 9 10 11 12 -0.171278190 -0.952784132 -1.234290074 -1.015796016 0.384203984 0.902698042 13 14 15 16 17 18 0.921192100 0.265709926 -0.252784132 -0.245254423 0.028721810 0.091733693 19 20 21 22 23 24 0.065709926 -0.252784132 -0.278807900 -0.423325726 0.295168332 0.413662390 25 26 27 28 29 30 0.413662390 0.176674274 0.169144564 0.269144564 0.432156448 0.469144564 31 32 33 34 35 36 0.387638622 0.324626738 0.217097028 -0.045914856 0.154085144 0.220531666 37 38 39 40 41 42 0.294507898 0.157519782 0.039025724 0.020531666 0.249990072 0.194507898 43 44 45 46 47 48 0.113001956 0.268484130 0.005472246 -0.457539638 -0.120551522 -0.320551522 49 50 51 52 53 54 -0.528081232 -0.454105000 -0.472599058 -0.235610942 -0.135610942 -0.317116884 55 56 57 58 59 60 -0.580128768 -0.998622826 -1.261634710 -0.935610942 0.282883116 0.538365290 61 62 63 64 65 66 0.193847464 -0.424646594 -0.817116884 -0.535610942 0.375353406 0.693847464 67 68 69 70 71 72 0.749329638 0.375353406 -0.024646594 0.075353406 0.775353406 0.993847464 73 0.893847464 > postscript(file="/var/www/html/rcomp/tmp/6sa2w1258762637.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 = 73 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.219230655 NA 1 -0.293206887 -0.219230655 2 -0.293206887 -0.293206887 3 -0.111700945 -0.293206887 4 0.262275287 -0.111700945 5 0.254745577 0.262275287 6 -0.171278190 0.254745577 7 -0.952784132 -0.171278190 8 -1.234290074 -0.952784132 9 -1.015796016 -1.234290074 10 0.384203984 -1.015796016 11 0.902698042 0.384203984 12 0.921192100 0.902698042 13 0.265709926 0.921192100 14 -0.252784132 0.265709926 15 -0.245254423 -0.252784132 16 0.028721810 -0.245254423 17 0.091733693 0.028721810 18 0.065709926 0.091733693 19 -0.252784132 0.065709926 20 -0.278807900 -0.252784132 21 -0.423325726 -0.278807900 22 0.295168332 -0.423325726 23 0.413662390 0.295168332 24 0.413662390 0.413662390 25 0.176674274 0.413662390 26 0.169144564 0.176674274 27 0.269144564 0.169144564 28 0.432156448 0.269144564 29 0.469144564 0.432156448 30 0.387638622 0.469144564 31 0.324626738 0.387638622 32 0.217097028 0.324626738 33 -0.045914856 0.217097028 34 0.154085144 -0.045914856 35 0.220531666 0.154085144 36 0.294507898 0.220531666 37 0.157519782 0.294507898 38 0.039025724 0.157519782 39 0.020531666 0.039025724 40 0.249990072 0.020531666 41 0.194507898 0.249990072 42 0.113001956 0.194507898 43 0.268484130 0.113001956 44 0.005472246 0.268484130 45 -0.457539638 0.005472246 46 -0.120551522 -0.457539638 47 -0.320551522 -0.120551522 48 -0.528081232 -0.320551522 49 -0.454105000 -0.528081232 50 -0.472599058 -0.454105000 51 -0.235610942 -0.472599058 52 -0.135610942 -0.235610942 53 -0.317116884 -0.135610942 54 -0.580128768 -0.317116884 55 -0.998622826 -0.580128768 56 -1.261634710 -0.998622826 57 -0.935610942 -1.261634710 58 0.282883116 -0.935610942 59 0.538365290 0.282883116 60 0.193847464 0.538365290 61 -0.424646594 0.193847464 62 -0.817116884 -0.424646594 63 -0.535610942 -0.817116884 64 0.375353406 -0.535610942 65 0.693847464 0.375353406 66 0.749329638 0.693847464 67 0.375353406 0.749329638 68 -0.024646594 0.375353406 69 0.075353406 -0.024646594 70 0.775353406 0.075353406 71 0.993847464 0.775353406 72 0.893847464 0.993847464 73 NA 0.893847464 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.293206887 -0.219230655 [2,] -0.293206887 -0.293206887 [3,] -0.111700945 -0.293206887 [4,] 0.262275287 -0.111700945 [5,] 0.254745577 0.262275287 [6,] -0.171278190 0.254745577 [7,] -0.952784132 -0.171278190 [8,] -1.234290074 -0.952784132 [9,] -1.015796016 -1.234290074 [10,] 0.384203984 -1.015796016 [11,] 0.902698042 0.384203984 [12,] 0.921192100 0.902698042 [13,] 0.265709926 0.921192100 [14,] -0.252784132 0.265709926 [15,] -0.245254423 -0.252784132 [16,] 0.028721810 -0.245254423 [17,] 0.091733693 0.028721810 [18,] 0.065709926 0.091733693 [19,] -0.252784132 0.065709926 [20,] -0.278807900 -0.252784132 [21,] -0.423325726 -0.278807900 [22,] 0.295168332 -0.423325726 [23,] 0.413662390 0.295168332 [24,] 0.413662390 0.413662390 [25,] 0.176674274 0.413662390 [26,] 0.169144564 0.176674274 [27,] 0.269144564 0.169144564 [28,] 0.432156448 0.269144564 [29,] 0.469144564 0.432156448 [30,] 0.387638622 0.469144564 [31,] 0.324626738 0.387638622 [32,] 0.217097028 0.324626738 [33,] -0.045914856 0.217097028 [34,] 0.154085144 -0.045914856 [35,] 0.220531666 0.154085144 [36,] 0.294507898 0.220531666 [37,] 0.157519782 0.294507898 [38,] 0.039025724 0.157519782 [39,] 0.020531666 0.039025724 [40,] 0.249990072 0.020531666 [41,] 0.194507898 0.249990072 [42,] 0.113001956 0.194507898 [43,] 0.268484130 0.113001956 [44,] 0.005472246 0.268484130 [45,] -0.457539638 0.005472246 [46,] -0.120551522 -0.457539638 [47,] -0.320551522 -0.120551522 [48,] -0.528081232 -0.320551522 [49,] -0.454105000 -0.528081232 [50,] -0.472599058 -0.454105000 [51,] -0.235610942 -0.472599058 [52,] -0.135610942 -0.235610942 [53,] -0.317116884 -0.135610942 [54,] -0.580128768 -0.317116884 [55,] -0.998622826 -0.580128768 [56,] -1.261634710 -0.998622826 [57,] -0.935610942 -1.261634710 [58,] 0.282883116 -0.935610942 [59,] 0.538365290 0.282883116 [60,] 0.193847464 0.538365290 [61,] -0.424646594 0.193847464 [62,] -0.817116884 -0.424646594 [63,] -0.535610942 -0.817116884 [64,] 0.375353406 -0.535610942 [65,] 0.693847464 0.375353406 [66,] 0.749329638 0.693847464 [67,] 0.375353406 0.749329638 [68,] -0.024646594 0.375353406 [69,] 0.075353406 -0.024646594 [70,] 0.775353406 0.075353406 [71,] 0.993847464 0.775353406 [72,] 0.893847464 0.993847464 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.293206887 -0.219230655 2 -0.293206887 -0.293206887 3 -0.111700945 -0.293206887 4 0.262275287 -0.111700945 5 0.254745577 0.262275287 6 -0.171278190 0.254745577 7 -0.952784132 -0.171278190 8 -1.234290074 -0.952784132 9 -1.015796016 -1.234290074 10 0.384203984 -1.015796016 11 0.902698042 0.384203984 12 0.921192100 0.902698042 13 0.265709926 0.921192100 14 -0.252784132 0.265709926 15 -0.245254423 -0.252784132 16 0.028721810 -0.245254423 17 0.091733693 0.028721810 18 0.065709926 0.091733693 19 -0.252784132 0.065709926 20 -0.278807900 -0.252784132 21 -0.423325726 -0.278807900 22 0.295168332 -0.423325726 23 0.413662390 0.295168332 24 0.413662390 0.413662390 25 0.176674274 0.413662390 26 0.169144564 0.176674274 27 0.269144564 0.169144564 28 0.432156448 0.269144564 29 0.469144564 0.432156448 30 0.387638622 0.469144564 31 0.324626738 0.387638622 32 0.217097028 0.324626738 33 -0.045914856 0.217097028 34 0.154085144 -0.045914856 35 0.220531666 0.154085144 36 0.294507898 0.220531666 37 0.157519782 0.294507898 38 0.039025724 0.157519782 39 0.020531666 0.039025724 40 0.249990072 0.020531666 41 0.194507898 0.249990072 42 0.113001956 0.194507898 43 0.268484130 0.113001956 44 0.005472246 0.268484130 45 -0.457539638 0.005472246 46 -0.120551522 -0.457539638 47 -0.320551522 -0.120551522 48 -0.528081232 -0.320551522 49 -0.454105000 -0.528081232 50 -0.472599058 -0.454105000 51 -0.235610942 -0.472599058 52 -0.135610942 -0.235610942 53 -0.317116884 -0.135610942 54 -0.580128768 -0.317116884 55 -0.998622826 -0.580128768 56 -1.261634710 -0.998622826 57 -0.935610942 -1.261634710 58 0.282883116 -0.935610942 59 0.538365290 0.282883116 60 0.193847464 0.538365290 61 -0.424646594 0.193847464 62 -0.817116884 -0.424646594 63 -0.535610942 -0.817116884 64 0.375353406 -0.535610942 65 0.693847464 0.375353406 66 0.749329638 0.693847464 67 0.375353406 0.749329638 68 -0.024646594 0.375353406 69 0.075353406 -0.024646594 70 0.775353406 0.075353406 71 0.993847464 0.775353406 72 0.893847464 0.993847464 > 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/7ch3a1258762637.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/8bvyo1258762637.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/9c1621258762637.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/10gi8x1258762637.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/11z4al1258762637.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/12q50x1258762637.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/13yiv51258762637.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/144yft1258762637.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/15pdnh1258762638.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/16u2mj1258762638.tab") + } > > system("convert tmp/174wb1258762637.ps tmp/174wb1258762637.png") > system("convert tmp/2soxr1258762637.ps tmp/2soxr1258762637.png") > system("convert tmp/3bmw51258762637.ps tmp/3bmw51258762637.png") > system("convert tmp/4xv9k1258762637.ps tmp/4xv9k1258762637.png") > system("convert tmp/5c71z1258762637.ps tmp/5c71z1258762637.png") > system("convert tmp/6sa2w1258762637.ps tmp/6sa2w1258762637.png") > system("convert tmp/7ch3a1258762637.ps tmp/7ch3a1258762637.png") > system("convert tmp/8bvyo1258762637.ps tmp/8bvyo1258762637.png") > system("convert tmp/9c1621258762637.ps tmp/9c1621258762637.png") > system("convert tmp/10gi8x1258762637.ps tmp/10gi8x1258762637.png") > > > proc.time() user system elapsed 2.603 1.573 3.049