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.9,95.05,8.8,96.84,8.3,96.92,7.5,97.44,7.2,97.78,7.4,97.69,8.8,96.67,9.3,98.29,9.3,98.2,8.7,98.71,8.2,98.54,8.3,98.2,8.5,96.92,8.6,99.06,8.5,99.65,8.2,99.82,8.1,99.99,7.9,100.33,8.6,99.31,8.7,101.1,8.7,101.1,8.5,100.93,8.4,100.85,8.5,100.93,8.7,99.6,8.7,101.88,8.6,101.81,8.5,102.38,8.3,102.74,8,102.82,8.2,101.72,8.1,103.47,8.1,102.98,8,102.68,7.9,102.9,7.9,103.03,8,101.29,8,103.69,7.9,103.68,8,104.2,7.7,104.08,7.2,104.16,7.5,103.05,7.3,104.66,7,104.46,7,104.95,7,105.85,7.2,106.23,7.3,104.86,7.1,107.44,6.8,108.23,6.4,108.45,6.1,109.39,6.5,110.15,7.7,109.13,7.9,110.28,7.5,110.17,6.9,109.99,6.6,109.26,6.9,109.11),dim=c(2,60),dimnames=list(c('Werkloosheidsgraad','Consumptieprijs'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Werkloosheidsgraad','Consumptieprijs'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Werkloosheidsgraad Consumptieprijs M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 8.9 95.05 1 0 0 0 0 0 0 0 0 0 0 1 2 8.8 96.84 0 1 0 0 0 0 0 0 0 0 0 2 3 8.3 96.92 0 0 1 0 0 0 0 0 0 0 0 3 4 7.5 97.44 0 0 0 1 0 0 0 0 0 0 0 4 5 7.2 97.78 0 0 0 0 1 0 0 0 0 0 0 5 6 7.4 97.69 0 0 0 0 0 1 0 0 0 0 0 6 7 8.8 96.67 0 0 0 0 0 0 1 0 0 0 0 7 8 9.3 98.29 0 0 0 0 0 0 0 1 0 0 0 8 9 9.3 98.20 0 0 0 0 0 0 0 0 1 0 0 9 10 8.7 98.71 0 0 0 0 0 0 0 0 0 1 0 10 11 8.2 98.54 0 0 0 0 0 0 0 0 0 0 1 11 12 8.3 98.20 0 0 0 0 0 0 0 0 0 0 0 12 13 8.5 96.92 1 0 0 0 0 0 0 0 0 0 0 13 14 8.6 99.06 0 1 0 0 0 0 0 0 0 0 0 14 15 8.5 99.65 0 0 1 0 0 0 0 0 0 0 0 15 16 8.2 99.82 0 0 0 1 0 0 0 0 0 0 0 16 17 8.1 99.99 0 0 0 0 1 0 0 0 0 0 0 17 18 7.9 100.33 0 0 0 0 0 1 0 0 0 0 0 18 19 8.6 99.31 0 0 0 0 0 0 1 0 0 0 0 19 20 8.7 101.10 0 0 0 0 0 0 0 1 0 0 0 20 21 8.7 101.10 0 0 0 0 0 0 0 0 1 0 0 21 22 8.5 100.93 0 0 0 0 0 0 0 0 0 1 0 22 23 8.4 100.85 0 0 0 0 0 0 0 0 0 0 1 23 24 8.5 100.93 0 0 0 0 0 0 0 0 0 0 0 24 25 8.7 99.60 1 0 0 0 0 0 0 0 0 0 0 25 26 8.7 101.88 0 1 0 0 0 0 0 0 0 0 0 26 27 8.6 101.81 0 0 1 0 0 0 0 0 0 0 0 27 28 8.5 102.38 0 0 0 1 0 0 0 0 0 0 0 28 29 8.3 102.74 0 0 0 0 1 0 0 0 0 0 0 29 30 8.0 102.82 0 0 0 0 0 1 0 0 0 0 0 30 31 8.2 101.72 0 0 0 0 0 0 1 0 0 0 0 31 32 8.1 103.47 0 0 0 0 0 0 0 1 0 0 0 32 33 8.1 102.98 0 0 0 0 0 0 0 0 1 0 0 33 34 8.0 102.68 0 0 0 0 0 0 0 0 0 1 0 34 35 7.9 102.90 0 0 0 0 0 0 0 0 0 0 1 35 36 7.9 103.03 0 0 0 0 0 0 0 0 0 0 0 36 37 8.0 101.29 1 0 0 0 0 0 0 0 0 0 0 37 38 8.0 103.69 0 1 0 0 0 0 0 0 0 0 0 38 39 7.9 103.68 0 0 1 0 0 0 0 0 0 0 0 39 40 8.0 104.20 0 0 0 1 0 0 0 0 0 0 0 40 41 7.7 104.08 0 0 0 0 1 0 0 0 0 0 0 41 42 7.2 104.16 0 0 0 0 0 1 0 0 0 0 0 42 43 7.5 103.05 0 0 0 0 0 0 1 0 0 0 0 43 44 7.3 104.66 0 0 0 0 0 0 0 1 0 0 0 44 45 7.0 104.46 0 0 0 0 0 0 0 0 1 0 0 45 46 7.0 104.95 0 0 0 0 0 0 0 0 0 1 0 46 47 7.0 105.85 0 0 0 0 0 0 0 0 0 0 1 47 48 7.2 106.23 0 0 0 0 0 0 0 0 0 0 0 48 49 7.3 104.86 1 0 0 0 0 0 0 0 0 0 0 49 50 7.1 107.44 0 1 0 0 0 0 0 0 0 0 0 50 51 6.8 108.23 0 0 1 0 0 0 0 0 0 0 0 51 52 6.4 108.45 0 0 0 1 0 0 0 0 0 0 0 52 53 6.1 109.39 0 0 0 0 1 0 0 0 0 0 0 53 54 6.5 110.15 0 0 0 0 0 1 0 0 0 0 0 54 55 7.7 109.13 0 0 0 0 0 0 1 0 0 0 0 55 56 7.9 110.28 0 0 0 0 0 0 0 1 0 0 0 56 57 7.5 110.17 0 0 0 0 0 0 0 0 1 0 0 57 58 6.9 109.99 0 0 0 0 0 0 0 0 0 1 0 58 59 6.6 109.26 0 0 0 0 0 0 0 0 0 0 1 59 60 6.9 109.11 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Consumptieprijs M1 M2 12.623217 -0.039065 0.114912 0.185117 M3 M4 M5 M6 -0.001324 -0.262921 -0.466940 -0.515022 M7 M8 M9 M10 0.226580 0.411236 0.287060 0.012571 M11 t -0.163558 -0.022777 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.02260 -0.21669 0.06203 0.26488 0.81781 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 12.623217 7.494561 1.684 0.0989 . Consumptieprijs -0.039065 0.078488 -0.498 0.6211 M1 0.114912 0.319037 0.360 0.7204 M2 0.185117 0.299146 0.619 0.5391 M3 -0.001324 0.299335 -0.004 0.9965 M4 -0.262921 0.301371 -0.872 0.3875 M5 -0.466940 0.302935 -1.541 0.1301 M6 -0.515022 0.302843 -1.701 0.0958 . M7 0.226580 0.296438 0.764 0.4486 M8 0.411236 0.303954 1.353 0.1827 M9 0.287060 0.297591 0.965 0.3398 M10 0.012571 0.295961 0.042 0.9663 M11 -0.163558 0.294662 -0.555 0.5815 t -0.022777 0.017935 -1.270 0.2105 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4652 on 46 degrees of freedom Multiple R-squared: 0.6946, Adjusted R-squared: 0.6083 F-statistic: 8.049 on 13 and 46 DF, p-value: 4.648e-08 > 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.71431290 0.57137419 0.28568710 [2,] 0.58482769 0.83034462 0.41517231 [3,] 0.61445199 0.77109602 0.38554801 [4,] 0.72099247 0.55801507 0.27900753 [5,] 0.69724681 0.60550637 0.30275319 [6,] 0.61706931 0.76586138 0.38293069 [7,] 0.51131880 0.97736240 0.48868120 [8,] 0.42629357 0.85258714 0.57370643 [9,] 0.32462238 0.64924476 0.67537762 [10,] 0.23341791 0.46683583 0.76658209 [11,] 0.16521218 0.33042437 0.83478782 [12,] 0.17519789 0.35039579 0.82480211 [13,] 0.17924837 0.35849674 0.82075163 [14,] 0.12831155 0.25662310 0.87168845 [15,] 0.15255959 0.30511919 0.84744041 [16,] 0.27854013 0.55708025 0.72145987 [17,] 0.33278525 0.66557050 0.66721475 [18,] 0.25906160 0.51812320 0.74093840 [19,] 0.18431966 0.36863933 0.81568034 [20,] 0.14174395 0.28348790 0.85825605 [21,] 0.09263630 0.18527260 0.90736370 [22,] 0.06093603 0.12187207 0.93906397 [23,] 0.04523796 0.09047591 0.95476204 [24,] 0.09368758 0.18737515 0.90631242 [25,] 0.53384356 0.93231287 0.46615644 [26,] 0.91205812 0.17588377 0.08794188 [27,] 0.87651007 0.24697987 0.12348993 > postscript(file="/var/www/html/rcomp/tmp/1zor21258555889.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/2mz461258555889.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/395n51258555889.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/4zv6g1258555889.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/596xg1258555889.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 -0.10220465 -0.17970586 -0.46736264 -0.96267481 -1.02259668 -0.75525381 7 8 9 10 11 12 -0.11392559 0.28748076 0.43091849 0.14810718 -0.15962773 -0.21369120 13 14 15 16 17 18 -0.15582991 -0.01965829 0.11260818 0.10362318 0.23706023 0.12120114 19 20 21 22 23 24 0.06252936 0.07057679 0.21753039 0.30815475 0.40393570 0.36627962 25 26 27 28 29 30 0.42218765 0.46382839 0.57031183 0.77695291 0.81781235 0.59179631 31 32 33 34 35 36 0.02999931 -0.16351587 -0.03570421 0.14984167 0.25734218 0.12163936 37 38 39 40 41 42 0.06153066 0.10785922 0.21668658 0.62137440 0.54348254 0.11746650 43 44 45 46 47 48 -0.34472115 -0.64370546 -0.80456489 -0.48815751 -0.25409266 -0.18002918 49 50 51 52 53 54 -0.22568376 -0.37232346 -0.43224395 -0.53927568 -0.57575843 -0.07521014 55 56 57 58 59 60 0.36611808 0.44916378 0.19182022 -0.11794608 -0.24755750 -0.09419859 > postscript(file="/var/www/html/rcomp/tmp/6hspz1258555889.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.10220465 NA 1 -0.17970586 -0.10220465 2 -0.46736264 -0.17970586 3 -0.96267481 -0.46736264 4 -1.02259668 -0.96267481 5 -0.75525381 -1.02259668 6 -0.11392559 -0.75525381 7 0.28748076 -0.11392559 8 0.43091849 0.28748076 9 0.14810718 0.43091849 10 -0.15962773 0.14810718 11 -0.21369120 -0.15962773 12 -0.15582991 -0.21369120 13 -0.01965829 -0.15582991 14 0.11260818 -0.01965829 15 0.10362318 0.11260818 16 0.23706023 0.10362318 17 0.12120114 0.23706023 18 0.06252936 0.12120114 19 0.07057679 0.06252936 20 0.21753039 0.07057679 21 0.30815475 0.21753039 22 0.40393570 0.30815475 23 0.36627962 0.40393570 24 0.42218765 0.36627962 25 0.46382839 0.42218765 26 0.57031183 0.46382839 27 0.77695291 0.57031183 28 0.81781235 0.77695291 29 0.59179631 0.81781235 30 0.02999931 0.59179631 31 -0.16351587 0.02999931 32 -0.03570421 -0.16351587 33 0.14984167 -0.03570421 34 0.25734218 0.14984167 35 0.12163936 0.25734218 36 0.06153066 0.12163936 37 0.10785922 0.06153066 38 0.21668658 0.10785922 39 0.62137440 0.21668658 40 0.54348254 0.62137440 41 0.11746650 0.54348254 42 -0.34472115 0.11746650 43 -0.64370546 -0.34472115 44 -0.80456489 -0.64370546 45 -0.48815751 -0.80456489 46 -0.25409266 -0.48815751 47 -0.18002918 -0.25409266 48 -0.22568376 -0.18002918 49 -0.37232346 -0.22568376 50 -0.43224395 -0.37232346 51 -0.53927568 -0.43224395 52 -0.57575843 -0.53927568 53 -0.07521014 -0.57575843 54 0.36611808 -0.07521014 55 0.44916378 0.36611808 56 0.19182022 0.44916378 57 -0.11794608 0.19182022 58 -0.24755750 -0.11794608 59 -0.09419859 -0.24755750 60 NA -0.09419859 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.17970586 -0.10220465 [2,] -0.46736264 -0.17970586 [3,] -0.96267481 -0.46736264 [4,] -1.02259668 -0.96267481 [5,] -0.75525381 -1.02259668 [6,] -0.11392559 -0.75525381 [7,] 0.28748076 -0.11392559 [8,] 0.43091849 0.28748076 [9,] 0.14810718 0.43091849 [10,] -0.15962773 0.14810718 [11,] -0.21369120 -0.15962773 [12,] -0.15582991 -0.21369120 [13,] -0.01965829 -0.15582991 [14,] 0.11260818 -0.01965829 [15,] 0.10362318 0.11260818 [16,] 0.23706023 0.10362318 [17,] 0.12120114 0.23706023 [18,] 0.06252936 0.12120114 [19,] 0.07057679 0.06252936 [20,] 0.21753039 0.07057679 [21,] 0.30815475 0.21753039 [22,] 0.40393570 0.30815475 [23,] 0.36627962 0.40393570 [24,] 0.42218765 0.36627962 [25,] 0.46382839 0.42218765 [26,] 0.57031183 0.46382839 [27,] 0.77695291 0.57031183 [28,] 0.81781235 0.77695291 [29,] 0.59179631 0.81781235 [30,] 0.02999931 0.59179631 [31,] -0.16351587 0.02999931 [32,] -0.03570421 -0.16351587 [33,] 0.14984167 -0.03570421 [34,] 0.25734218 0.14984167 [35,] 0.12163936 0.25734218 [36,] 0.06153066 0.12163936 [37,] 0.10785922 0.06153066 [38,] 0.21668658 0.10785922 [39,] 0.62137440 0.21668658 [40,] 0.54348254 0.62137440 [41,] 0.11746650 0.54348254 [42,] -0.34472115 0.11746650 [43,] -0.64370546 -0.34472115 [44,] -0.80456489 -0.64370546 [45,] -0.48815751 -0.80456489 [46,] -0.25409266 -0.48815751 [47,] -0.18002918 -0.25409266 [48,] -0.22568376 -0.18002918 [49,] -0.37232346 -0.22568376 [50,] -0.43224395 -0.37232346 [51,] -0.53927568 -0.43224395 [52,] -0.57575843 -0.53927568 [53,] -0.07521014 -0.57575843 [54,] 0.36611808 -0.07521014 [55,] 0.44916378 0.36611808 [56,] 0.19182022 0.44916378 [57,] -0.11794608 0.19182022 [58,] -0.24755750 -0.11794608 [59,] -0.09419859 -0.24755750 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.17970586 -0.10220465 2 -0.46736264 -0.17970586 3 -0.96267481 -0.46736264 4 -1.02259668 -0.96267481 5 -0.75525381 -1.02259668 6 -0.11392559 -0.75525381 7 0.28748076 -0.11392559 8 0.43091849 0.28748076 9 0.14810718 0.43091849 10 -0.15962773 0.14810718 11 -0.21369120 -0.15962773 12 -0.15582991 -0.21369120 13 -0.01965829 -0.15582991 14 0.11260818 -0.01965829 15 0.10362318 0.11260818 16 0.23706023 0.10362318 17 0.12120114 0.23706023 18 0.06252936 0.12120114 19 0.07057679 0.06252936 20 0.21753039 0.07057679 21 0.30815475 0.21753039 22 0.40393570 0.30815475 23 0.36627962 0.40393570 24 0.42218765 0.36627962 25 0.46382839 0.42218765 26 0.57031183 0.46382839 27 0.77695291 0.57031183 28 0.81781235 0.77695291 29 0.59179631 0.81781235 30 0.02999931 0.59179631 31 -0.16351587 0.02999931 32 -0.03570421 -0.16351587 33 0.14984167 -0.03570421 34 0.25734218 0.14984167 35 0.12163936 0.25734218 36 0.06153066 0.12163936 37 0.10785922 0.06153066 38 0.21668658 0.10785922 39 0.62137440 0.21668658 40 0.54348254 0.62137440 41 0.11746650 0.54348254 42 -0.34472115 0.11746650 43 -0.64370546 -0.34472115 44 -0.80456489 -0.64370546 45 -0.48815751 -0.80456489 46 -0.25409266 -0.48815751 47 -0.18002918 -0.25409266 48 -0.22568376 -0.18002918 49 -0.37232346 -0.22568376 50 -0.43224395 -0.37232346 51 -0.53927568 -0.43224395 52 -0.57575843 -0.53927568 53 -0.07521014 -0.57575843 54 0.36611808 -0.07521014 55 0.44916378 0.36611808 56 0.19182022 0.44916378 57 -0.11794608 0.19182022 58 -0.24755750 -0.11794608 59 -0.09419859 -0.24755750 > 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/7sucn1258555889.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/8azsd1258555889.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/9qlw91258555889.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/10acpg1258555889.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/11hi3j1258555889.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/12drhh1258555889.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/13ng0j1258555889.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/149c2m1258555889.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/15p3zc1258555889.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/16234v1258555889.tab") + } > > system("convert tmp/1zor21258555889.ps tmp/1zor21258555889.png") > system("convert tmp/2mz461258555889.ps tmp/2mz461258555889.png") > system("convert tmp/395n51258555889.ps tmp/395n51258555889.png") > system("convert tmp/4zv6g1258555889.ps tmp/4zv6g1258555889.png") > system("convert tmp/596xg1258555889.ps tmp/596xg1258555889.png") > system("convert tmp/6hspz1258555889.ps tmp/6hspz1258555889.png") > system("convert tmp/7sucn1258555889.ps tmp/7sucn1258555889.png") > system("convert tmp/8azsd1258555889.ps tmp/8azsd1258555889.png") > system("convert tmp/9qlw91258555889.ps tmp/9qlw91258555889.png") > system("convert tmp/10acpg1258555889.ps tmp/10acpg1258555889.png") > > > proc.time() user system elapsed 2.399 1.571 3.306