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(96.8,92.9,114.1,107.7,110.3,103.5,103.9,91.1,101.6,79.8,94.6,71.9,95.9,82.9,104.7,90.1,102.8,100.7,98.1,90.7,113.9,108.8,80.9,44.1,95.7,93.6,113.2,107.4,105.9,96.5,108.8,93.6,102.3,76.5,99,76.7,100.7,84,115.5,103.3,100.7,88.5,109.9,99,114.6,105.9,85.4,44.7,100.5,94,114.8,107.1,116.5,104.8,112.9,102.5,102,77.7,106,85.2,105.3,91.3,118.8,106.5,106.1,92.4,109.3,97.5,117.2,107,92.5,51.1,104.2,98.6,112.5,102.2,122.4,114.3,113.3,99.4,100,72.5,110.7,92.3,112.8,99.4,109.8,85.9,117.3,109.4,109.1,97.6,115.9,104.7,96,56.9,99.8,86.7,116.8,108.5,115.7,103.4,99.4,86.2,94.3,71,91,75.9,93.2,87.1,103.1,102,94.1,88.5,91.8,87.8,102.7,100.8,82.6,50.6),dim=c(2,60),dimnames=list(c('Totind','Bouw'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Totind','Bouw'),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 Totind Bouw M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 96.8 92.9 1 0 0 0 0 0 0 0 0 0 0 1 2 114.1 107.7 0 1 0 0 0 0 0 0 0 0 0 2 3 110.3 103.5 0 0 1 0 0 0 0 0 0 0 0 3 4 103.9 91.1 0 0 0 1 0 0 0 0 0 0 0 4 5 101.6 79.8 0 0 0 0 1 0 0 0 0 0 0 5 6 94.6 71.9 0 0 0 0 0 1 0 0 0 0 0 6 7 95.9 82.9 0 0 0 0 0 0 1 0 0 0 0 7 8 104.7 90.1 0 0 0 0 0 0 0 1 0 0 0 8 9 102.8 100.7 0 0 0 0 0 0 0 0 1 0 0 9 10 98.1 90.7 0 0 0 0 0 0 0 0 0 1 0 10 11 113.9 108.8 0 0 0 0 0 0 0 0 0 0 1 11 12 80.9 44.1 0 0 0 0 0 0 0 0 0 0 0 12 13 95.7 93.6 1 0 0 0 0 0 0 0 0 0 0 13 14 113.2 107.4 0 1 0 0 0 0 0 0 0 0 0 14 15 105.9 96.5 0 0 1 0 0 0 0 0 0 0 0 15 16 108.8 93.6 0 0 0 1 0 0 0 0 0 0 0 16 17 102.3 76.5 0 0 0 0 1 0 0 0 0 0 0 17 18 99.0 76.7 0 0 0 0 0 1 0 0 0 0 0 18 19 100.7 84.0 0 0 0 0 0 0 1 0 0 0 0 19 20 115.5 103.3 0 0 0 0 0 0 0 1 0 0 0 20 21 100.7 88.5 0 0 0 0 0 0 0 0 1 0 0 21 22 109.9 99.0 0 0 0 0 0 0 0 0 0 1 0 22 23 114.6 105.9 0 0 0 0 0 0 0 0 0 0 1 23 24 85.4 44.7 0 0 0 0 0 0 0 0 0 0 0 24 25 100.5 94.0 1 0 0 0 0 0 0 0 0 0 0 25 26 114.8 107.1 0 1 0 0 0 0 0 0 0 0 0 26 27 116.5 104.8 0 0 1 0 0 0 0 0 0 0 0 27 28 112.9 102.5 0 0 0 1 0 0 0 0 0 0 0 28 29 102.0 77.7 0 0 0 0 1 0 0 0 0 0 0 29 30 106.0 85.2 0 0 0 0 0 1 0 0 0 0 0 30 31 105.3 91.3 0 0 0 0 0 0 1 0 0 0 0 31 32 118.8 106.5 0 0 0 0 0 0 0 1 0 0 0 32 33 106.1 92.4 0 0 0 0 0 0 0 0 1 0 0 33 34 109.3 97.5 0 0 0 0 0 0 0 0 0 1 0 34 35 117.2 107.0 0 0 0 0 0 0 0 0 0 0 1 35 36 92.5 51.1 0 0 0 0 0 0 0 0 0 0 0 36 37 104.2 98.6 1 0 0 0 0 0 0 0 0 0 0 37 38 112.5 102.2 0 1 0 0 0 0 0 0 0 0 0 38 39 122.4 114.3 0 0 1 0 0 0 0 0 0 0 0 39 40 113.3 99.4 0 0 0 1 0 0 0 0 0 0 0 40 41 100.0 72.5 0 0 0 0 1 0 0 0 0 0 0 41 42 110.7 92.3 0 0 0 0 0 1 0 0 0 0 0 42 43 112.8 99.4 0 0 0 0 0 0 1 0 0 0 0 43 44 109.8 85.9 0 0 0 0 0 0 0 1 0 0 0 44 45 117.3 109.4 0 0 0 0 0 0 0 0 1 0 0 45 46 109.1 97.6 0 0 0 0 0 0 0 0 0 1 0 46 47 115.9 104.7 0 0 0 0 0 0 0 0 0 0 1 47 48 96.0 56.9 0 0 0 0 0 0 0 0 0 0 0 48 49 99.8 86.7 1 0 0 0 0 0 0 0 0 0 0 49 50 116.8 108.5 0 1 0 0 0 0 0 0 0 0 0 50 51 115.7 103.4 0 0 1 0 0 0 0 0 0 0 0 51 52 99.4 86.2 0 0 0 1 0 0 0 0 0 0 0 52 53 94.3 71.0 0 0 0 0 1 0 0 0 0 0 0 53 54 91.0 75.9 0 0 0 0 0 1 0 0 0 0 0 54 55 93.2 87.1 0 0 0 0 0 0 1 0 0 0 0 55 56 103.1 102.0 0 0 0 0 0 0 0 1 0 0 0 56 57 94.1 88.5 0 0 0 0 0 0 0 0 1 0 0 57 58 91.8 87.8 0 0 0 0 0 0 0 0 0 1 0 58 59 102.7 100.8 0 0 0 0 0 0 0 0 0 0 1 59 60 82.6 50.6 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) Bouw M1 M2 M3 M4 46.83452 0.83186 -24.57313 -20.84242 -19.21784 -17.43482 M5 M6 M7 M8 M9 M10 -9.18521 -13.02703 -18.79683 -17.15317 -21.93797 -21.33570 M11 t -21.18533 -0.01431 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.6301 -1.9750 0.5794 2.1582 9.2912 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 46.83452 4.88821 9.581 1.56e-12 *** Bouw 0.83186 0.09124 9.117 7.08e-12 *** M1 -24.57313 4.71499 -5.212 4.31e-06 *** M2 -20.84242 5.78846 -3.601 0.000775 *** M3 -19.21784 5.61425 -3.423 0.001311 ** M4 -17.43482 4.81363 -3.622 0.000727 *** M5 -9.18521 3.43644 -2.673 0.010371 * M6 -13.02703 3.75790 -3.467 0.001154 ** M7 -18.79683 4.37270 -4.299 8.83e-05 *** M8 -17.15317 5.03915 -3.404 0.001386 ** M9 -21.93797 4.90522 -4.472 5.04e-05 *** M10 -21.33570 4.79455 -4.450 5.42e-05 *** M11 -21.18533 5.67052 -3.736 0.000515 *** t -0.01431 0.02968 -0.482 0.632092 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.893 on 46 degrees of freedom Multiple R-squared: 0.8682, Adjusted R-squared: 0.8309 F-statistic: 23.3 on 13 and 46 DF, p-value: 6.04e-16 > 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,] 1.138742e-01 0.2277484266 0.8861258 [2,] 4.100113e-02 0.0820022623 0.9589989 [3,] 2.945426e-02 0.0589085220 0.9705457 [4,] 1.079587e-02 0.0215917432 0.9892041 [5,] 1.500316e-02 0.0300063132 0.9849968 [6,] 2.056919e-02 0.0411383863 0.9794308 [7,] 9.429960e-03 0.0188599195 0.9905700 [8,] 5.117958e-03 0.0102359154 0.9948820 [9,] 2.948148e-03 0.0058962966 0.9970519 [10,] 2.434397e-03 0.0048687934 0.9975656 [11,] 1.662364e-03 0.0033247284 0.9983376 [12,] 2.549718e-03 0.0050994351 0.9974503 [13,] 2.858026e-03 0.0057160513 0.9971420 [14,] 1.334982e-03 0.0026699635 0.9986650 [15,] 6.878304e-04 0.0013756608 0.9993122 [16,] 3.294018e-04 0.0006588035 0.9996706 [17,] 2.742971e-04 0.0005485942 0.9997257 [18,] 1.217506e-04 0.0002435012 0.9998782 [19,] 6.143269e-05 0.0001228654 0.9999386 [20,] 7.805448e-05 0.0001561090 0.9999219 [21,] 3.467020e-04 0.0006934040 0.9996533 [22,] 6.298484e-03 0.0125969671 0.9937015 [23,] 8.298075e-02 0.1659615083 0.9170192 [24,] 9.981260e-02 0.1996252095 0.9001874 [25,] 8.261016e-01 0.3477967031 0.1738984 [26,] 7.177429e-01 0.5645141940 0.2822571 [27,] 6.303185e-01 0.7393629747 0.3696815 > postscript(file="/var/www/html/rcomp/tmp/1fpc61258730153.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/2g9sb1258730153.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/33yo61258730153.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/4ix761258730154.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/5rtil1258730154.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 -2.72709549 -1.45506557 -3.37151733 -1.22513588 -2.36038793 1.06745051 7 8 9 10 11 12 -0.99893094 0.18231363 -5.73631912 -2.70566542 -2.09843730 -2.44796011 13 14 15 16 17 18 -4.23770930 -1.93381700 -1.77679083 1.76689803 1.25644777 1.64620095 19 20 21 22 23 24 3.05771029 0.17342010 2.48409174 2.36156669 1.18565345 1.72461231 25 26 27 28 29 30 0.40123560 0.08743156 2.09044129 -1.36498728 0.12990277 1.74706059 31 32 33 34 35 36 1.75680479 0.98315034 4.81151832 3.18105011 3.04229469 3.67238295 37 38 39 40 41 42 0.44635852 2.03524707 0.25943855 1.78547594 2.62727699 0.71252755 43 44 45 46 47 48 2.69040938 9.29120518 2.04154775 3.06955373 3.82726801 2.51927101 49 50 51 52 53 54 6.11721067 1.26620394 2.79842832 -0.96225081 -1.65323959 -5.17323959 55 56 57 58 59 60 -6.50599352 -10.63008925 -3.60083870 -5.90650511 -5.95677886 -5.46830616 > postscript(file="/var/www/html/rcomp/tmp/6mxpz1258730154.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 -2.72709549 NA 1 -1.45506557 -2.72709549 2 -3.37151733 -1.45506557 3 -1.22513588 -3.37151733 4 -2.36038793 -1.22513588 5 1.06745051 -2.36038793 6 -0.99893094 1.06745051 7 0.18231363 -0.99893094 8 -5.73631912 0.18231363 9 -2.70566542 -5.73631912 10 -2.09843730 -2.70566542 11 -2.44796011 -2.09843730 12 -4.23770930 -2.44796011 13 -1.93381700 -4.23770930 14 -1.77679083 -1.93381700 15 1.76689803 -1.77679083 16 1.25644777 1.76689803 17 1.64620095 1.25644777 18 3.05771029 1.64620095 19 0.17342010 3.05771029 20 2.48409174 0.17342010 21 2.36156669 2.48409174 22 1.18565345 2.36156669 23 1.72461231 1.18565345 24 0.40123560 1.72461231 25 0.08743156 0.40123560 26 2.09044129 0.08743156 27 -1.36498728 2.09044129 28 0.12990277 -1.36498728 29 1.74706059 0.12990277 30 1.75680479 1.74706059 31 0.98315034 1.75680479 32 4.81151832 0.98315034 33 3.18105011 4.81151832 34 3.04229469 3.18105011 35 3.67238295 3.04229469 36 0.44635852 3.67238295 37 2.03524707 0.44635852 38 0.25943855 2.03524707 39 1.78547594 0.25943855 40 2.62727699 1.78547594 41 0.71252755 2.62727699 42 2.69040938 0.71252755 43 9.29120518 2.69040938 44 2.04154775 9.29120518 45 3.06955373 2.04154775 46 3.82726801 3.06955373 47 2.51927101 3.82726801 48 6.11721067 2.51927101 49 1.26620394 6.11721067 50 2.79842832 1.26620394 51 -0.96225081 2.79842832 52 -1.65323959 -0.96225081 53 -5.17323959 -1.65323959 54 -6.50599352 -5.17323959 55 -10.63008925 -6.50599352 56 -3.60083870 -10.63008925 57 -5.90650511 -3.60083870 58 -5.95677886 -5.90650511 59 -5.46830616 -5.95677886 60 NA -5.46830616 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.45506557 -2.72709549 [2,] -3.37151733 -1.45506557 [3,] -1.22513588 -3.37151733 [4,] -2.36038793 -1.22513588 [5,] 1.06745051 -2.36038793 [6,] -0.99893094 1.06745051 [7,] 0.18231363 -0.99893094 [8,] -5.73631912 0.18231363 [9,] -2.70566542 -5.73631912 [10,] -2.09843730 -2.70566542 [11,] -2.44796011 -2.09843730 [12,] -4.23770930 -2.44796011 [13,] -1.93381700 -4.23770930 [14,] -1.77679083 -1.93381700 [15,] 1.76689803 -1.77679083 [16,] 1.25644777 1.76689803 [17,] 1.64620095 1.25644777 [18,] 3.05771029 1.64620095 [19,] 0.17342010 3.05771029 [20,] 2.48409174 0.17342010 [21,] 2.36156669 2.48409174 [22,] 1.18565345 2.36156669 [23,] 1.72461231 1.18565345 [24,] 0.40123560 1.72461231 [25,] 0.08743156 0.40123560 [26,] 2.09044129 0.08743156 [27,] -1.36498728 2.09044129 [28,] 0.12990277 -1.36498728 [29,] 1.74706059 0.12990277 [30,] 1.75680479 1.74706059 [31,] 0.98315034 1.75680479 [32,] 4.81151832 0.98315034 [33,] 3.18105011 4.81151832 [34,] 3.04229469 3.18105011 [35,] 3.67238295 3.04229469 [36,] 0.44635852 3.67238295 [37,] 2.03524707 0.44635852 [38,] 0.25943855 2.03524707 [39,] 1.78547594 0.25943855 [40,] 2.62727699 1.78547594 [41,] 0.71252755 2.62727699 [42,] 2.69040938 0.71252755 [43,] 9.29120518 2.69040938 [44,] 2.04154775 9.29120518 [45,] 3.06955373 2.04154775 [46,] 3.82726801 3.06955373 [47,] 2.51927101 3.82726801 [48,] 6.11721067 2.51927101 [49,] 1.26620394 6.11721067 [50,] 2.79842832 1.26620394 [51,] -0.96225081 2.79842832 [52,] -1.65323959 -0.96225081 [53,] -5.17323959 -1.65323959 [54,] -6.50599352 -5.17323959 [55,] -10.63008925 -6.50599352 [56,] -3.60083870 -10.63008925 [57,] -5.90650511 -3.60083870 [58,] -5.95677886 -5.90650511 [59,] -5.46830616 -5.95677886 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.45506557 -2.72709549 2 -3.37151733 -1.45506557 3 -1.22513588 -3.37151733 4 -2.36038793 -1.22513588 5 1.06745051 -2.36038793 6 -0.99893094 1.06745051 7 0.18231363 -0.99893094 8 -5.73631912 0.18231363 9 -2.70566542 -5.73631912 10 -2.09843730 -2.70566542 11 -2.44796011 -2.09843730 12 -4.23770930 -2.44796011 13 -1.93381700 -4.23770930 14 -1.77679083 -1.93381700 15 1.76689803 -1.77679083 16 1.25644777 1.76689803 17 1.64620095 1.25644777 18 3.05771029 1.64620095 19 0.17342010 3.05771029 20 2.48409174 0.17342010 21 2.36156669 2.48409174 22 1.18565345 2.36156669 23 1.72461231 1.18565345 24 0.40123560 1.72461231 25 0.08743156 0.40123560 26 2.09044129 0.08743156 27 -1.36498728 2.09044129 28 0.12990277 -1.36498728 29 1.74706059 0.12990277 30 1.75680479 1.74706059 31 0.98315034 1.75680479 32 4.81151832 0.98315034 33 3.18105011 4.81151832 34 3.04229469 3.18105011 35 3.67238295 3.04229469 36 0.44635852 3.67238295 37 2.03524707 0.44635852 38 0.25943855 2.03524707 39 1.78547594 0.25943855 40 2.62727699 1.78547594 41 0.71252755 2.62727699 42 2.69040938 0.71252755 43 9.29120518 2.69040938 44 2.04154775 9.29120518 45 3.06955373 2.04154775 46 3.82726801 3.06955373 47 2.51927101 3.82726801 48 6.11721067 2.51927101 49 1.26620394 6.11721067 50 2.79842832 1.26620394 51 -0.96225081 2.79842832 52 -1.65323959 -0.96225081 53 -5.17323959 -1.65323959 54 -6.50599352 -5.17323959 55 -10.63008925 -6.50599352 56 -3.60083870 -10.63008925 57 -5.90650511 -3.60083870 58 -5.95677886 -5.90650511 59 -5.46830616 -5.95677886 > 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/7t9cr1258730154.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/81hdj1258730154.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/99llc1258730154.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/10gage1258730154.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/11dyod1258730154.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/121gu61258730154.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/13bkfn1258730154.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/14rqzp1258730154.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/155xdg1258730154.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/163bjm1258730154.tab") + } > > system("convert tmp/1fpc61258730153.ps tmp/1fpc61258730153.png") > system("convert tmp/2g9sb1258730153.ps tmp/2g9sb1258730153.png") > system("convert tmp/33yo61258730153.ps tmp/33yo61258730153.png") > system("convert tmp/4ix761258730154.ps tmp/4ix761258730154.png") > system("convert tmp/5rtil1258730154.ps tmp/5rtil1258730154.png") > system("convert tmp/6mxpz1258730154.ps tmp/6mxpz1258730154.png") > system("convert tmp/7t9cr1258730154.ps tmp/7t9cr1258730154.png") > system("convert tmp/81hdj1258730154.ps tmp/81hdj1258730154.png") > system("convert tmp/99llc1258730154.ps tmp/99llc1258730154.png") > system("convert tmp/10gage1258730154.ps tmp/10gage1258730154.png") > > > proc.time() user system elapsed 2.391 1.601 2.965