R version 2.11.1 (2010-05-31) Copyright (C) 2010 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(94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1,104.5,105.1,95.1,88.7,86.3,91.8,111.5,99.7,97.5,111.7,86.2,95.4),dim=c(1,68),dimnames=list(c('productie'),1:68)) > y <- array(NA,dim=c(1,68),dimnames=list(c('productie'),1:68)) > 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 = '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 > 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 productie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 94.6 1 0 0 0 0 0 0 0 0 0 0 2 95.9 0 1 0 0 0 0 0 0 0 0 0 3 104.7 0 0 1 0 0 0 0 0 0 0 0 4 102.8 0 0 0 1 0 0 0 0 0 0 0 5 98.1 0 0 0 0 1 0 0 0 0 0 0 6 113.9 0 0 0 0 0 1 0 0 0 0 0 7 80.9 0 0 0 0 0 0 1 0 0 0 0 8 95.7 0 0 0 0 0 0 0 1 0 0 0 9 113.2 0 0 0 0 0 0 0 0 1 0 0 10 105.9 0 0 0 0 0 0 0 0 0 1 0 11 108.8 0 0 0 0 0 0 0 0 0 0 1 12 102.3 0 0 0 0 0 0 0 0 0 0 0 13 99.0 1 0 0 0 0 0 0 0 0 0 0 14 100.7 0 1 0 0 0 0 0 0 0 0 0 15 115.5 0 0 1 0 0 0 0 0 0 0 0 16 100.7 0 0 0 1 0 0 0 0 0 0 0 17 109.9 0 0 0 0 1 0 0 0 0 0 0 18 114.6 0 0 0 0 0 1 0 0 0 0 0 19 85.4 0 0 0 0 0 0 1 0 0 0 0 20 100.5 0 0 0 0 0 0 0 1 0 0 0 21 114.8 0 0 0 0 0 0 0 0 1 0 0 22 116.5 0 0 0 0 0 0 0 0 0 1 0 23 112.9 0 0 0 0 0 0 0 0 0 0 1 24 102.0 0 0 0 0 0 0 0 0 0 0 0 25 106.0 1 0 0 0 0 0 0 0 0 0 0 26 105.3 0 1 0 0 0 0 0 0 0 0 0 27 118.8 0 0 1 0 0 0 0 0 0 0 0 28 106.1 0 0 0 1 0 0 0 0 0 0 0 29 109.3 0 0 0 0 1 0 0 0 0 0 0 30 117.2 0 0 0 0 0 1 0 0 0 0 0 31 92.5 0 0 0 0 0 0 1 0 0 0 0 32 104.2 0 0 0 0 0 0 0 1 0 0 0 33 112.5 0 0 0 0 0 0 0 0 1 0 0 34 122.4 0 0 0 0 0 0 0 0 0 1 0 35 113.3 0 0 0 0 0 0 0 0 0 0 1 36 100.0 0 0 0 0 0 0 0 0 0 0 0 37 110.7 1 0 0 0 0 0 0 0 0 0 0 38 112.8 0 1 0 0 0 0 0 0 0 0 0 39 109.8 0 0 1 0 0 0 0 0 0 0 0 40 117.3 0 0 0 1 0 0 0 0 0 0 0 41 109.1 0 0 0 0 1 0 0 0 0 0 0 42 115.9 0 0 0 0 0 1 0 0 0 0 0 43 96.0 0 0 0 0 0 0 1 0 0 0 0 44 99.8 0 0 0 0 0 0 0 1 0 0 0 45 116.8 0 0 0 0 0 0 0 0 1 0 0 46 115.7 0 0 0 0 0 0 0 0 0 1 0 47 99.4 0 0 0 0 0 0 0 0 0 0 1 48 94.3 0 0 0 0 0 0 0 0 0 0 0 49 91.0 1 0 0 0 0 0 0 0 0 0 0 50 93.2 0 1 0 0 0 0 0 0 0 0 0 51 103.1 0 0 1 0 0 0 0 0 0 0 0 52 94.1 0 0 0 1 0 0 0 0 0 0 0 53 91.8 0 0 0 0 1 0 0 0 0 0 0 54 102.7 0 0 0 0 0 1 0 0 0 0 0 55 82.6 0 0 0 0 0 0 1 0 0 0 0 56 89.1 0 0 0 0 0 0 0 1 0 0 0 57 104.5 0 0 0 0 0 0 0 0 1 0 0 58 105.1 0 0 0 0 0 0 0 0 0 1 0 59 95.1 0 0 0 0 0 0 0 0 0 0 1 60 88.7 0 0 0 0 0 0 0 0 0 0 0 61 86.3 1 0 0 0 0 0 0 0 0 0 0 62 91.8 0 1 0 0 0 0 0 0 0 0 0 63 111.5 0 0 1 0 0 0 0 0 0 0 0 64 99.7 0 0 0 1 0 0 0 0 0 0 0 65 97.5 0 0 0 0 1 0 0 0 0 0 0 66 111.7 0 0 0 0 0 1 0 0 0 0 0 67 86.2 0 0 0 0 0 0 1 0 0 0 0 68 95.4 0 0 0 0 0 0 0 1 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 97.4600 0.4733 2.4900 13.1067 5.9900 5.1567 M6 M7 M8 M9 M10 M11 15.2067 -10.1933 -0.0100 14.9000 15.6600 8.4400 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.633 -5.304 0.795 4.615 13.850 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 97.4600 3.1072 31.365 < 2e-16 *** M1 0.4733 4.2072 0.113 0.910826 M2 2.4900 4.2072 0.592 0.556341 M3 13.1067 4.2072 3.115 0.002897 ** M4 5.9900 4.2072 1.424 0.160071 M5 5.1567 4.2072 1.226 0.225454 M6 15.2067 4.2072 3.614 0.000646 *** M7 -10.1933 4.2072 -2.423 0.018660 * M8 -0.0100 4.2072 -0.002 0.998112 M9 14.9000 4.3943 3.391 0.001284 ** M10 15.6600 4.3943 3.564 0.000756 *** M11 8.4400 4.3943 1.921 0.059871 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.948 on 56 degrees of freedom Multiple R-squared: 0.5924, Adjusted R-squared: 0.5124 F-statistic: 7.4 on 11 and 56 DF, p-value: 1.215e-07 > 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.279903946 0.559807892 0.7200961 [2,] 0.149490446 0.298980892 0.8505096 [3,] 0.225069076 0.450138153 0.7749309 [4,] 0.130239131 0.260478262 0.8697609 [5,] 0.082861794 0.165723587 0.9171382 [6,] 0.052729445 0.105458890 0.9472706 [7,] 0.027454843 0.054909685 0.9725452 [8,] 0.035761970 0.071523941 0.9642380 [9,] 0.024021388 0.048042776 0.9759786 [10,] 0.013144185 0.026288371 0.9868558 [11,] 0.019118079 0.038236158 0.9808819 [12,] 0.016971280 0.033942561 0.9830287 [13,] 0.021214498 0.042428996 0.9787855 [14,] 0.013670111 0.027340223 0.9863299 [15,] 0.011191616 0.022383231 0.9888084 [16,] 0.007090026 0.014180051 0.9929100 [17,] 0.008084295 0.016168590 0.9919157 [18,] 0.007075815 0.014151631 0.9929242 [19,] 0.003784346 0.007568692 0.9962157 [20,] 0.007170997 0.014341995 0.9928290 [21,] 0.007649126 0.015298252 0.9923509 [22,] 0.005171648 0.010343297 0.9948284 [23,] 0.027358624 0.054717247 0.9726414 [24,] 0.119511095 0.239022191 0.8804889 [25,] 0.086318395 0.172636790 0.9136816 [26,] 0.364523705 0.729047409 0.6354763 [27,] 0.504444226 0.991111547 0.4955558 [28,] 0.508005535 0.983988930 0.4919945 [29,] 0.663396262 0.673207475 0.3366037 [30,] 0.660297261 0.679405478 0.3397027 [31,] 0.765777349 0.468445301 0.2342227 [32,] 0.833076188 0.333847623 0.1669238 [33,] 0.829276755 0.341446491 0.1707232 [34,] 0.807723103 0.384553794 0.1922769 [35,] 0.789564117 0.420871767 0.2104359 [36,] 0.717245406 0.565509187 0.2827546 [37,] 0.750608491 0.498783018 0.2493915 [38,] 0.716205540 0.567588919 0.2837945 [39,] 0.669717308 0.660565383 0.3302827 > postscript(file="/var/www/rcomp/tmp/1obx31290883615.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/rcomp/tmp/2obx31290883615.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/rcomp/tmp/3obx31290883615.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/rcomp/tmp/4y3eo1290883615.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/rcomp/tmp/5y3eo1290883615.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 = 68 Frequency = 1 1 2 3 4 5 6 -3.3333333 -4.0500000 -5.8666667 -0.6500000 -4.5166667 1.2333333 7 8 9 10 11 12 -6.3666667 -1.7500000 0.8400000 -7.2200000 2.9000000 4.8400000 13 14 15 16 17 18 1.0666667 0.7500000 4.9333333 -2.7500000 7.2833333 1.9333333 19 20 21 22 23 24 -1.8666667 3.0500000 2.4400000 3.3800000 7.0000000 4.5400000 25 26 27 28 29 30 8.0666667 5.3500000 8.2333333 2.6500000 6.6833333 4.5333333 31 32 33 34 35 36 5.2333333 6.7500000 0.1400000 9.2800000 7.4000000 2.5400000 37 38 39 40 41 42 12.7666667 12.8500000 -0.7666667 13.8500000 6.4833333 3.2333333 43 44 45 46 47 48 8.7333333 2.3500000 4.4400000 2.5800000 -6.5000000 -3.1600000 49 50 51 52 53 54 -6.9333333 -6.7500000 -7.4666667 -9.3500000 -10.8166667 -9.9666667 55 56 57 58 59 60 -4.6666667 -8.3500000 -7.8600000 -8.0200000 -10.8000000 -8.7600000 61 62 63 64 65 66 -11.6333333 -8.1500000 0.9333333 -3.7500000 -5.1166667 -0.9666667 67 68 -1.0666667 -2.0500000 > postscript(file="/var/www/rcomp/tmp/6y3eo1290883615.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 = 68 Frequency = 1 lag(myerror, k = 1) myerror 0 -3.3333333 NA 1 -4.0500000 -3.3333333 2 -5.8666667 -4.0500000 3 -0.6500000 -5.8666667 4 -4.5166667 -0.6500000 5 1.2333333 -4.5166667 6 -6.3666667 1.2333333 7 -1.7500000 -6.3666667 8 0.8400000 -1.7500000 9 -7.2200000 0.8400000 10 2.9000000 -7.2200000 11 4.8400000 2.9000000 12 1.0666667 4.8400000 13 0.7500000 1.0666667 14 4.9333333 0.7500000 15 -2.7500000 4.9333333 16 7.2833333 -2.7500000 17 1.9333333 7.2833333 18 -1.8666667 1.9333333 19 3.0500000 -1.8666667 20 2.4400000 3.0500000 21 3.3800000 2.4400000 22 7.0000000 3.3800000 23 4.5400000 7.0000000 24 8.0666667 4.5400000 25 5.3500000 8.0666667 26 8.2333333 5.3500000 27 2.6500000 8.2333333 28 6.6833333 2.6500000 29 4.5333333 6.6833333 30 5.2333333 4.5333333 31 6.7500000 5.2333333 32 0.1400000 6.7500000 33 9.2800000 0.1400000 34 7.4000000 9.2800000 35 2.5400000 7.4000000 36 12.7666667 2.5400000 37 12.8500000 12.7666667 38 -0.7666667 12.8500000 39 13.8500000 -0.7666667 40 6.4833333 13.8500000 41 3.2333333 6.4833333 42 8.7333333 3.2333333 43 2.3500000 8.7333333 44 4.4400000 2.3500000 45 2.5800000 4.4400000 46 -6.5000000 2.5800000 47 -3.1600000 -6.5000000 48 -6.9333333 -3.1600000 49 -6.7500000 -6.9333333 50 -7.4666667 -6.7500000 51 -9.3500000 -7.4666667 52 -10.8166667 -9.3500000 53 -9.9666667 -10.8166667 54 -4.6666667 -9.9666667 55 -8.3500000 -4.6666667 56 -7.8600000 -8.3500000 57 -8.0200000 -7.8600000 58 -10.8000000 -8.0200000 59 -8.7600000 -10.8000000 60 -11.6333333 -8.7600000 61 -8.1500000 -11.6333333 62 0.9333333 -8.1500000 63 -3.7500000 0.9333333 64 -5.1166667 -3.7500000 65 -0.9666667 -5.1166667 66 -1.0666667 -0.9666667 67 -2.0500000 -1.0666667 68 NA -2.0500000 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -4.0500000 -3.3333333 [2,] -5.8666667 -4.0500000 [3,] -0.6500000 -5.8666667 [4,] -4.5166667 -0.6500000 [5,] 1.2333333 -4.5166667 [6,] -6.3666667 1.2333333 [7,] -1.7500000 -6.3666667 [8,] 0.8400000 -1.7500000 [9,] -7.2200000 0.8400000 [10,] 2.9000000 -7.2200000 [11,] 4.8400000 2.9000000 [12,] 1.0666667 4.8400000 [13,] 0.7500000 1.0666667 [14,] 4.9333333 0.7500000 [15,] -2.7500000 4.9333333 [16,] 7.2833333 -2.7500000 [17,] 1.9333333 7.2833333 [18,] -1.8666667 1.9333333 [19,] 3.0500000 -1.8666667 [20,] 2.4400000 3.0500000 [21,] 3.3800000 2.4400000 [22,] 7.0000000 3.3800000 [23,] 4.5400000 7.0000000 [24,] 8.0666667 4.5400000 [25,] 5.3500000 8.0666667 [26,] 8.2333333 5.3500000 [27,] 2.6500000 8.2333333 [28,] 6.6833333 2.6500000 [29,] 4.5333333 6.6833333 [30,] 5.2333333 4.5333333 [31,] 6.7500000 5.2333333 [32,] 0.1400000 6.7500000 [33,] 9.2800000 0.1400000 [34,] 7.4000000 9.2800000 [35,] 2.5400000 7.4000000 [36,] 12.7666667 2.5400000 [37,] 12.8500000 12.7666667 [38,] -0.7666667 12.8500000 [39,] 13.8500000 -0.7666667 [40,] 6.4833333 13.8500000 [41,] 3.2333333 6.4833333 [42,] 8.7333333 3.2333333 [43,] 2.3500000 8.7333333 [44,] 4.4400000 2.3500000 [45,] 2.5800000 4.4400000 [46,] -6.5000000 2.5800000 [47,] -3.1600000 -6.5000000 [48,] -6.9333333 -3.1600000 [49,] -6.7500000 -6.9333333 [50,] -7.4666667 -6.7500000 [51,] -9.3500000 -7.4666667 [52,] -10.8166667 -9.3500000 [53,] -9.9666667 -10.8166667 [54,] -4.6666667 -9.9666667 [55,] -8.3500000 -4.6666667 [56,] -7.8600000 -8.3500000 [57,] -8.0200000 -7.8600000 [58,] -10.8000000 -8.0200000 [59,] -8.7600000 -10.8000000 [60,] -11.6333333 -8.7600000 [61,] -8.1500000 -11.6333333 [62,] 0.9333333 -8.1500000 [63,] -3.7500000 0.9333333 [64,] -5.1166667 -3.7500000 [65,] -0.9666667 -5.1166667 [66,] -1.0666667 -0.9666667 [67,] -2.0500000 -1.0666667 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -4.0500000 -3.3333333 2 -5.8666667 -4.0500000 3 -0.6500000 -5.8666667 4 -4.5166667 -0.6500000 5 1.2333333 -4.5166667 6 -6.3666667 1.2333333 7 -1.7500000 -6.3666667 8 0.8400000 -1.7500000 9 -7.2200000 0.8400000 10 2.9000000 -7.2200000 11 4.8400000 2.9000000 12 1.0666667 4.8400000 13 0.7500000 1.0666667 14 4.9333333 0.7500000 15 -2.7500000 4.9333333 16 7.2833333 -2.7500000 17 1.9333333 7.2833333 18 -1.8666667 1.9333333 19 3.0500000 -1.8666667 20 2.4400000 3.0500000 21 3.3800000 2.4400000 22 7.0000000 3.3800000 23 4.5400000 7.0000000 24 8.0666667 4.5400000 25 5.3500000 8.0666667 26 8.2333333 5.3500000 27 2.6500000 8.2333333 28 6.6833333 2.6500000 29 4.5333333 6.6833333 30 5.2333333 4.5333333 31 6.7500000 5.2333333 32 0.1400000 6.7500000 33 9.2800000 0.1400000 34 7.4000000 9.2800000 35 2.5400000 7.4000000 36 12.7666667 2.5400000 37 12.8500000 12.7666667 38 -0.7666667 12.8500000 39 13.8500000 -0.7666667 40 6.4833333 13.8500000 41 3.2333333 6.4833333 42 8.7333333 3.2333333 43 2.3500000 8.7333333 44 4.4400000 2.3500000 45 2.5800000 4.4400000 46 -6.5000000 2.5800000 47 -3.1600000 -6.5000000 48 -6.9333333 -3.1600000 49 -6.7500000 -6.9333333 50 -7.4666667 -6.7500000 51 -9.3500000 -7.4666667 52 -10.8166667 -9.3500000 53 -9.9666667 -10.8166667 54 -4.6666667 -9.9666667 55 -8.3500000 -4.6666667 56 -7.8600000 -8.3500000 57 -8.0200000 -7.8600000 58 -10.8000000 -8.0200000 59 -8.7600000 -10.8000000 60 -11.6333333 -8.7600000 61 -8.1500000 -11.6333333 62 0.9333333 -8.1500000 63 -3.7500000 0.9333333 64 -5.1166667 -3.7500000 65 -0.9666667 -5.1166667 66 -1.0666667 -0.9666667 67 -2.0500000 -1.0666667 > 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/79ce91290883615.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/rcomp/tmp/89ce91290883615.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/rcomp/tmp/92lvc1290883615.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/rcomp/tmp/102lvc1290883615.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/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/11n3t01290883615.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/12r4a61290883615.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/138xru1290883616.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/14tg8i1290883616.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/15fy661290883616.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/160h5c1290883616.tab") + } > > try(system("convert tmp/1obx31290883615.ps tmp/1obx31290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/2obx31290883615.ps tmp/2obx31290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/3obx31290883615.ps tmp/3obx31290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/4y3eo1290883615.ps tmp/4y3eo1290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/5y3eo1290883615.ps tmp/5y3eo1290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/6y3eo1290883615.ps tmp/6y3eo1290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/79ce91290883615.ps tmp/79ce91290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/89ce91290883615.ps tmp/89ce91290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/92lvc1290883615.ps tmp/92lvc1290883615.png",intern=TRUE)) character(0) > try(system("convert tmp/102lvc1290883615.ps tmp/102lvc1290883615.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.82 1.02 4.84