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(99.9,98.8,98.6,100.5,107.2,110.4,95.7,96.4,93.7,101.9,106.7,106.2,86.7,81,95.3,94.7,99.3,101,101.8,109.4,96,102.3,91.7,90.7,95.3,96.2,96.6,96.1,107.2,106,108,103.1,98.4,102,103.1,104.7,81.1,86,96.6,92.1,103.7,106.9,106.6,112.6,97.6,101.7,87.6,92,99.4,97.4,98.5,97,105.2,105.4,104.6,102.7,97.5,98.1,108.9,104.5,86.8,87.4,88.9,89.9,110.3,109.8,114.8,111.7,94.6,98.6,92,96.9,93.8,95.1,93.8,97,107.6,112.7,101,102.9,95.4,97.4,96.5,111.4,89.2,87.4,87.1,96.8,110.5,114.1,110.8,110.3,104.2,103.9,88.9,101.6,89.8,94.6,90,95.9,93.9,104.7,91.3,102.8,87.8,98.1,99.7,113.9,73.5,80.9,79.2,95.7,96.9,113.2,95.2,105.9,95.6,108.8,89.7,102.3),dim=c(2,60),dimnames=list(c('TotProd','ProdMetal'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('TotProd','ProdMetal'),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 TotProd ProdMetal M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 99.9 98.8 1 0 0 0 0 0 0 0 0 0 0 1 2 98.6 100.5 0 1 0 0 0 0 0 0 0 0 0 2 3 107.2 110.4 0 0 1 0 0 0 0 0 0 0 0 3 4 95.7 96.4 0 0 0 1 0 0 0 0 0 0 0 4 5 93.7 101.9 0 0 0 0 1 0 0 0 0 0 0 5 6 106.7 106.2 0 0 0 0 0 1 0 0 0 0 0 6 7 86.7 81.0 0 0 0 0 0 0 1 0 0 0 0 7 8 95.3 94.7 0 0 0 0 0 0 0 1 0 0 0 8 9 99.3 101.0 0 0 0 0 0 0 0 0 1 0 0 9 10 101.8 109.4 0 0 0 0 0 0 0 0 0 1 0 10 11 96.0 102.3 0 0 0 0 0 0 0 0 0 0 1 11 12 91.7 90.7 0 0 0 0 0 0 0 0 0 0 0 12 13 95.3 96.2 1 0 0 0 0 0 0 0 0 0 0 13 14 96.6 96.1 0 1 0 0 0 0 0 0 0 0 0 14 15 107.2 106.0 0 0 1 0 0 0 0 0 0 0 0 15 16 108.0 103.1 0 0 0 1 0 0 0 0 0 0 0 16 17 98.4 102.0 0 0 0 0 1 0 0 0 0 0 0 17 18 103.1 104.7 0 0 0 0 0 1 0 0 0 0 0 18 19 81.1 86.0 0 0 0 0 0 0 1 0 0 0 0 19 20 96.6 92.1 0 0 0 0 0 0 0 1 0 0 0 20 21 103.7 106.9 0 0 0 0 0 0 0 0 1 0 0 21 22 106.6 112.6 0 0 0 0 0 0 0 0 0 1 0 22 23 97.6 101.7 0 0 0 0 0 0 0 0 0 0 1 23 24 87.6 92.0 0 0 0 0 0 0 0 0 0 0 0 24 25 99.4 97.4 1 0 0 0 0 0 0 0 0 0 0 25 26 98.5 97.0 0 1 0 0 0 0 0 0 0 0 0 26 27 105.2 105.4 0 0 1 0 0 0 0 0 0 0 0 27 28 104.6 102.7 0 0 0 1 0 0 0 0 0 0 0 28 29 97.5 98.1 0 0 0 0 1 0 0 0 0 0 0 29 30 108.9 104.5 0 0 0 0 0 1 0 0 0 0 0 30 31 86.8 87.4 0 0 0 0 0 0 1 0 0 0 0 31 32 88.9 89.9 0 0 0 0 0 0 0 1 0 0 0 32 33 110.3 109.8 0 0 0 0 0 0 0 0 1 0 0 33 34 114.8 111.7 0 0 0 0 0 0 0 0 0 1 0 34 35 94.6 98.6 0 0 0 0 0 0 0 0 0 0 1 35 36 92.0 96.9 0 0 0 0 0 0 0 0 0 0 0 36 37 93.8 95.1 1 0 0 0 0 0 0 0 0 0 0 37 38 93.8 97.0 0 1 0 0 0 0 0 0 0 0 0 38 39 107.6 112.7 0 0 1 0 0 0 0 0 0 0 0 39 40 101.0 102.9 0 0 0 1 0 0 0 0 0 0 0 40 41 95.4 97.4 0 0 0 0 1 0 0 0 0 0 0 41 42 96.5 111.4 0 0 0 0 0 1 0 0 0 0 0 42 43 89.2 87.4 0 0 0 0 0 0 1 0 0 0 0 43 44 87.1 96.8 0 0 0 0 0 0 0 1 0 0 0 44 45 110.5 114.1 0 0 0 0 0 0 0 0 1 0 0 45 46 110.8 110.3 0 0 0 0 0 0 0 0 0 1 0 46 47 104.2 103.9 0 0 0 0 0 0 0 0 0 0 1 47 48 88.9 101.6 0 0 0 0 0 0 0 0 0 0 0 48 49 89.8 94.6 1 0 0 0 0 0 0 0 0 0 0 49 50 90.0 95.9 0 1 0 0 0 0 0 0 0 0 0 50 51 93.9 104.7 0 0 1 0 0 0 0 0 0 0 0 51 52 91.3 102.8 0 0 0 1 0 0 0 0 0 0 0 52 53 87.8 98.1 0 0 0 0 1 0 0 0 0 0 0 53 54 99.7 113.9 0 0 0 0 0 1 0 0 0 0 0 54 55 73.5 80.9 0 0 0 0 0 0 1 0 0 0 0 55 56 79.2 95.7 0 0 0 0 0 0 0 1 0 0 0 56 57 96.9 113.2 0 0 0 0 0 0 0 0 1 0 0 57 58 95.2 105.9 0 0 0 0 0 0 0 0 0 1 0 58 59 95.6 108.8 0 0 0 0 0 0 0 0 0 0 1 59 60 89.7 102.3 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) ProdMetal M1 M2 M3 M4 39.1033 0.5853 4.0763 3.5802 6.2903 6.0129 M5 M6 M7 M8 M9 M10 1.8292 5.3513 -0.1974 0.4784 6.4845 7.7698 M11 t 3.7388 -0.1589 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.51335 -2.60922 0.06143 2.41654 8.05040 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 39.10326 18.93174 2.065 0.04454 * ProdMetal 0.58527 0.19820 2.953 0.00494 ** M1 4.07634 2.92656 1.393 0.17035 M2 3.58017 2.93028 1.222 0.22801 M3 6.29025 3.71809 1.692 0.09745 . M4 6.01293 3.09853 1.941 0.05845 . M5 1.82917 2.97832 0.614 0.54214 M6 5.35127 3.72766 1.436 0.15789 M7 -0.19741 3.74112 -0.053 0.95815 M8 0.47841 2.95082 0.162 0.87191 M9 6.48453 3.81130 1.701 0.09562 . M10 7.76983 3.93192 1.976 0.05416 . M11 3.73879 3.16716 1.180 0.24388 t -0.15887 0.03651 -4.351 7.46e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.586 on 46 degrees of freedom Multiple R-squared: 0.762, Adjusted R-squared: 0.6948 F-statistic: 11.33 on 13 and 46 DF, p-value: 2.42e-10 > 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.1233225 0.2466449 0.8766775 [2,] 0.1137249 0.2274497 0.8862751 [3,] 0.5502614 0.8994772 0.4497386 [4,] 0.4529614 0.9059228 0.5470386 [5,] 0.3558673 0.7117347 0.6441327 [6,] 0.4034990 0.8069981 0.5965010 [7,] 0.4034009 0.8068017 0.5965991 [8,] 0.4640094 0.9280187 0.5359906 [9,] 0.3749494 0.7498988 0.6250506 [10,] 0.2887376 0.5774753 0.7112624 [11,] 0.2120110 0.4240219 0.7879890 [12,] 0.1436783 0.2873566 0.8563217 [13,] 0.1170690 0.2341380 0.8829310 [14,] 0.2119323 0.4238646 0.7880677 [15,] 0.2514165 0.5028329 0.7485835 [16,] 0.3394385 0.6788770 0.6605615 [17,] 0.3099977 0.6199953 0.6900023 [18,] 0.4130881 0.8261762 0.5869119 [19,] 0.3939797 0.7879594 0.6060203 [20,] 0.3267411 0.6534822 0.6732589 [21,] 0.3019532 0.6039064 0.6980468 [22,] 0.3052086 0.6104172 0.6947914 [23,] 0.2590531 0.5181062 0.7409469 [24,] 0.1954777 0.3909554 0.8045223 [25,] 0.1201111 0.2402222 0.8798889 [26,] 0.3789907 0.7579814 0.6210093 [27,] 0.2431061 0.4862121 0.7568939 > postscript(file="/var/www/html/rcomp/tmp/1ge3y1258984713.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/2krhg1258984714.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/39zc71258984714.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/4pbqm1258984714.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/5bivu1258984714.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 7 -0.9457575 -2.5856818 -2.3311067 -5.2010897 -6.0774629 1.0426241 1.4990618 8 9 10 11 12 13 14 1.5638583 -3.9706183 -7.5133478 -4.9679986 1.4188346 -2.1176431 -0.1040750 15 16 17 18 19 20 21 2.1505000 5.0839810 0.4704130 0.2269377 -5.1209026 6.2919727 -1.1173289 22 23 24 25 26 27 28 -2.6798199 -1.1104313 -1.5356177 3.1864319 3.1755821 2.4080674 3.8244937 29 30 31 32 33 34 35 3.7593829 8.0503956 1.6661177 1.7859777 5.6917812 7.9533295 -0.3896801 36 37 38 39 40 41 42 1.9029453 0.8389643 0.3819853 2.4419739 2.0138422 3.9754776 -6.4815884 43 44 45 46 47 48 49 5.9725210 -2.1460064 5.2815083 6.6791157 8.0147735 -2.0414370 -0.9619957 50 51 52 53 54 55 56 -0.8678106 -4.6694347 -5.7212272 -2.1278106 -2.8383690 -4.0167979 -7.4958023 57 58 59 60 -5.8853423 -4.4392775 -1.5466635 0.2552748 > postscript(file="/var/www/html/rcomp/tmp/64y581258984714.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.9457575 NA 1 -2.5856818 -0.9457575 2 -2.3311067 -2.5856818 3 -5.2010897 -2.3311067 4 -6.0774629 -5.2010897 5 1.0426241 -6.0774629 6 1.4990618 1.0426241 7 1.5638583 1.4990618 8 -3.9706183 1.5638583 9 -7.5133478 -3.9706183 10 -4.9679986 -7.5133478 11 1.4188346 -4.9679986 12 -2.1176431 1.4188346 13 -0.1040750 -2.1176431 14 2.1505000 -0.1040750 15 5.0839810 2.1505000 16 0.4704130 5.0839810 17 0.2269377 0.4704130 18 -5.1209026 0.2269377 19 6.2919727 -5.1209026 20 -1.1173289 6.2919727 21 -2.6798199 -1.1173289 22 -1.1104313 -2.6798199 23 -1.5356177 -1.1104313 24 3.1864319 -1.5356177 25 3.1755821 3.1864319 26 2.4080674 3.1755821 27 3.8244937 2.4080674 28 3.7593829 3.8244937 29 8.0503956 3.7593829 30 1.6661177 8.0503956 31 1.7859777 1.6661177 32 5.6917812 1.7859777 33 7.9533295 5.6917812 34 -0.3896801 7.9533295 35 1.9029453 -0.3896801 36 0.8389643 1.9029453 37 0.3819853 0.8389643 38 2.4419739 0.3819853 39 2.0138422 2.4419739 40 3.9754776 2.0138422 41 -6.4815884 3.9754776 42 5.9725210 -6.4815884 43 -2.1460064 5.9725210 44 5.2815083 -2.1460064 45 6.6791157 5.2815083 46 8.0147735 6.6791157 47 -2.0414370 8.0147735 48 -0.9619957 -2.0414370 49 -0.8678106 -0.9619957 50 -4.6694347 -0.8678106 51 -5.7212272 -4.6694347 52 -2.1278106 -5.7212272 53 -2.8383690 -2.1278106 54 -4.0167979 -2.8383690 55 -7.4958023 -4.0167979 56 -5.8853423 -7.4958023 57 -4.4392775 -5.8853423 58 -1.5466635 -4.4392775 59 0.2552748 -1.5466635 60 NA 0.2552748 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.5856818 -0.9457575 [2,] -2.3311067 -2.5856818 [3,] -5.2010897 -2.3311067 [4,] -6.0774629 -5.2010897 [5,] 1.0426241 -6.0774629 [6,] 1.4990618 1.0426241 [7,] 1.5638583 1.4990618 [8,] -3.9706183 1.5638583 [9,] -7.5133478 -3.9706183 [10,] -4.9679986 -7.5133478 [11,] 1.4188346 -4.9679986 [12,] -2.1176431 1.4188346 [13,] -0.1040750 -2.1176431 [14,] 2.1505000 -0.1040750 [15,] 5.0839810 2.1505000 [16,] 0.4704130 5.0839810 [17,] 0.2269377 0.4704130 [18,] -5.1209026 0.2269377 [19,] 6.2919727 -5.1209026 [20,] -1.1173289 6.2919727 [21,] -2.6798199 -1.1173289 [22,] -1.1104313 -2.6798199 [23,] -1.5356177 -1.1104313 [24,] 3.1864319 -1.5356177 [25,] 3.1755821 3.1864319 [26,] 2.4080674 3.1755821 [27,] 3.8244937 2.4080674 [28,] 3.7593829 3.8244937 [29,] 8.0503956 3.7593829 [30,] 1.6661177 8.0503956 [31,] 1.7859777 1.6661177 [32,] 5.6917812 1.7859777 [33,] 7.9533295 5.6917812 [34,] -0.3896801 7.9533295 [35,] 1.9029453 -0.3896801 [36,] 0.8389643 1.9029453 [37,] 0.3819853 0.8389643 [38,] 2.4419739 0.3819853 [39,] 2.0138422 2.4419739 [40,] 3.9754776 2.0138422 [41,] -6.4815884 3.9754776 [42,] 5.9725210 -6.4815884 [43,] -2.1460064 5.9725210 [44,] 5.2815083 -2.1460064 [45,] 6.6791157 5.2815083 [46,] 8.0147735 6.6791157 [47,] -2.0414370 8.0147735 [48,] -0.9619957 -2.0414370 [49,] -0.8678106 -0.9619957 [50,] -4.6694347 -0.8678106 [51,] -5.7212272 -4.6694347 [52,] -2.1278106 -5.7212272 [53,] -2.8383690 -2.1278106 [54,] -4.0167979 -2.8383690 [55,] -7.4958023 -4.0167979 [56,] -5.8853423 -7.4958023 [57,] -4.4392775 -5.8853423 [58,] -1.5466635 -4.4392775 [59,] 0.2552748 -1.5466635 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.5856818 -0.9457575 2 -2.3311067 -2.5856818 3 -5.2010897 -2.3311067 4 -6.0774629 -5.2010897 5 1.0426241 -6.0774629 6 1.4990618 1.0426241 7 1.5638583 1.4990618 8 -3.9706183 1.5638583 9 -7.5133478 -3.9706183 10 -4.9679986 -7.5133478 11 1.4188346 -4.9679986 12 -2.1176431 1.4188346 13 -0.1040750 -2.1176431 14 2.1505000 -0.1040750 15 5.0839810 2.1505000 16 0.4704130 5.0839810 17 0.2269377 0.4704130 18 -5.1209026 0.2269377 19 6.2919727 -5.1209026 20 -1.1173289 6.2919727 21 -2.6798199 -1.1173289 22 -1.1104313 -2.6798199 23 -1.5356177 -1.1104313 24 3.1864319 -1.5356177 25 3.1755821 3.1864319 26 2.4080674 3.1755821 27 3.8244937 2.4080674 28 3.7593829 3.8244937 29 8.0503956 3.7593829 30 1.6661177 8.0503956 31 1.7859777 1.6661177 32 5.6917812 1.7859777 33 7.9533295 5.6917812 34 -0.3896801 7.9533295 35 1.9029453 -0.3896801 36 0.8389643 1.9029453 37 0.3819853 0.8389643 38 2.4419739 0.3819853 39 2.0138422 2.4419739 40 3.9754776 2.0138422 41 -6.4815884 3.9754776 42 5.9725210 -6.4815884 43 -2.1460064 5.9725210 44 5.2815083 -2.1460064 45 6.6791157 5.2815083 46 8.0147735 6.6791157 47 -2.0414370 8.0147735 48 -0.9619957 -2.0414370 49 -0.8678106 -0.9619957 50 -4.6694347 -0.8678106 51 -5.7212272 -4.6694347 52 -2.1278106 -5.7212272 53 -2.8383690 -2.1278106 54 -4.0167979 -2.8383690 55 -7.4958023 -4.0167979 56 -5.8853423 -7.4958023 57 -4.4392775 -5.8853423 58 -1.5466635 -4.4392775 59 0.2552748 -1.5466635 > 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/72tbd1258984714.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/8olyc1258984714.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/9yiqz1258984714.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/10381h1258984714.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/11e0bm1258984714.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/12y3ac1258984714.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/13xf391258984714.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/14yy8r1258984714.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/15pzml1258984714.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/16k5u61258984714.tab") + } > > system("convert tmp/1ge3y1258984713.ps tmp/1ge3y1258984713.png") > system("convert tmp/2krhg1258984714.ps tmp/2krhg1258984714.png") > system("convert tmp/39zc71258984714.ps tmp/39zc71258984714.png") > system("convert tmp/4pbqm1258984714.ps tmp/4pbqm1258984714.png") > system("convert tmp/5bivu1258984714.ps tmp/5bivu1258984714.png") > system("convert tmp/64y581258984714.ps tmp/64y581258984714.png") > system("convert tmp/72tbd1258984714.ps tmp/72tbd1258984714.png") > system("convert tmp/8olyc1258984714.ps tmp/8olyc1258984714.png") > system("convert tmp/9yiqz1258984714.ps tmp/9yiqz1258984714.png") > system("convert tmp/10381h1258984714.ps tmp/10381h1258984714.png") > > > proc.time() user system elapsed 2.434 1.559 3.285