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(21,2472.81,19,2407.6,25,2454.62,21,2448.05,23,2497.84,23,2645.64,19,2756.76,18,2849.27,19,2921.44,19,2981.85,22,3080.58,23,3106.22,20,3119.31,14,3061.26,14,3097.31,14,3161.69,15,3257.16,11,3277.01,17,3295.32,16,3363.99,20,3494.17,24,3667.03,23,3813.06,20,3917.96,21,3895.51,19,3801.06,23,3570.12,23,3701.61,23,3862.27,23,3970.1,27,4138.52,26,4199.75,17,4290.89,24,4443.91,26,4502.64,24,4356.98,27,4591.27,27,4696.96,26,4621.4,24,4562.84,23,4202.52,23,4296.49,24,4435.23,17,4105.18,21,4116.68,19,3844.49,22,3720.98,22,3674.4,18,3857.62,16,3801.06,14,3504.37,12,3032.6,14,3047.03,16,2962.34,8,2197.82,3,2014.45,0,1862.83,5,1905.41,1,1810.99,1,1670.07,3,1864.44),dim=c(2,61),dimnames=list(c('Consvertr','Aand'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Consvertr','Aand'),1:61)) > 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 Consvertr Aand M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 21 2472.81 1 0 0 0 0 0 0 0 0 0 0 1 2 19 2407.60 0 1 0 0 0 0 0 0 0 0 0 2 3 25 2454.62 0 0 1 0 0 0 0 0 0 0 0 3 4 21 2448.05 0 0 0 1 0 0 0 0 0 0 0 4 5 23 2497.84 0 0 0 0 1 0 0 0 0 0 0 5 6 23 2645.64 0 0 0 0 0 1 0 0 0 0 0 6 7 19 2756.76 0 0 0 0 0 0 1 0 0 0 0 7 8 18 2849.27 0 0 0 0 0 0 0 1 0 0 0 8 9 19 2921.44 0 0 0 0 0 0 0 0 1 0 0 9 10 19 2981.85 0 0 0 0 0 0 0 0 0 1 0 10 11 22 3080.58 0 0 0 0 0 0 0 0 0 0 1 11 12 23 3106.22 0 0 0 0 0 0 0 0 0 0 0 12 13 20 3119.31 1 0 0 0 0 0 0 0 0 0 0 13 14 14 3061.26 0 1 0 0 0 0 0 0 0 0 0 14 15 14 3097.31 0 0 1 0 0 0 0 0 0 0 0 15 16 14 3161.69 0 0 0 1 0 0 0 0 0 0 0 16 17 15 3257.16 0 0 0 0 1 0 0 0 0 0 0 17 18 11 3277.01 0 0 0 0 0 1 0 0 0 0 0 18 19 17 3295.32 0 0 0 0 0 0 1 0 0 0 0 19 20 16 3363.99 0 0 0 0 0 0 0 1 0 0 0 20 21 20 3494.17 0 0 0 0 0 0 0 0 1 0 0 21 22 24 3667.03 0 0 0 0 0 0 0 0 0 1 0 22 23 23 3813.06 0 0 0 0 0 0 0 0 0 0 1 23 24 20 3917.96 0 0 0 0 0 0 0 0 0 0 0 24 25 21 3895.51 1 0 0 0 0 0 0 0 0 0 0 25 26 19 3801.06 0 1 0 0 0 0 0 0 0 0 0 26 27 23 3570.12 0 0 1 0 0 0 0 0 0 0 0 27 28 23 3701.61 0 0 0 1 0 0 0 0 0 0 0 28 29 23 3862.27 0 0 0 0 1 0 0 0 0 0 0 29 30 23 3970.10 0 0 0 0 0 1 0 0 0 0 0 30 31 27 4138.52 0 0 0 0 0 0 1 0 0 0 0 31 32 26 4199.75 0 0 0 0 0 0 0 1 0 0 0 32 33 17 4290.89 0 0 0 0 0 0 0 0 1 0 0 33 34 24 4443.91 0 0 0 0 0 0 0 0 0 1 0 34 35 26 4502.64 0 0 0 0 0 0 0 0 0 0 1 35 36 24 4356.98 0 0 0 0 0 0 0 0 0 0 0 36 37 27 4591.27 1 0 0 0 0 0 0 0 0 0 0 37 38 27 4696.96 0 1 0 0 0 0 0 0 0 0 0 38 39 26 4621.40 0 0 1 0 0 0 0 0 0 0 0 39 40 24 4562.84 0 0 0 1 0 0 0 0 0 0 0 40 41 23 4202.52 0 0 0 0 1 0 0 0 0 0 0 41 42 23 4296.49 0 0 0 0 0 1 0 0 0 0 0 42 43 24 4435.23 0 0 0 0 0 0 1 0 0 0 0 43 44 17 4105.18 0 0 0 0 0 0 0 1 0 0 0 44 45 21 4116.68 0 0 0 0 0 0 0 0 1 0 0 45 46 19 3844.49 0 0 0 0 0 0 0 0 0 1 0 46 47 22 3720.98 0 0 0 0 0 0 0 0 0 0 1 47 48 22 3674.40 0 0 0 0 0 0 0 0 0 0 0 48 49 18 3857.62 1 0 0 0 0 0 0 0 0 0 0 49 50 16 3801.06 0 1 0 0 0 0 0 0 0 0 0 50 51 14 3504.37 0 0 1 0 0 0 0 0 0 0 0 51 52 12 3032.60 0 0 0 1 0 0 0 0 0 0 0 52 53 14 3047.03 0 0 0 0 1 0 0 0 0 0 0 53 54 16 2962.34 0 0 0 0 0 1 0 0 0 0 0 54 55 8 2197.82 0 0 0 0 0 0 1 0 0 0 0 55 56 3 2014.45 0 0 0 0 0 0 0 1 0 0 0 56 57 0 1862.83 0 0 0 0 0 0 0 0 1 0 0 57 58 5 1905.41 0 0 0 0 0 0 0 0 0 1 0 58 59 1 1810.99 0 0 0 0 0 0 0 0 0 0 1 59 60 1 1670.07 0 0 0 0 0 0 0 0 0 0 0 60 61 3 1864.44 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Aand M1 M2 M3 M4 3.556717 0.006381 -0.338286 -2.247249 0.008222 -0.964857 M5 M6 M7 M8 M9 M10 0.077860 -0.493835 -0.083631 -2.520544 -3.124563 -0.332805 M11 t 0.349714 -0.191708 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.5223 -1.3912 0.2804 1.8307 6.3476 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.5567173 2.4708073 1.439 0.157 Aand 0.0063809 0.0005358 11.910 8.49e-16 *** M1 -0.3382861 2.0456233 -0.165 0.869 M2 -2.2472489 2.1507266 -1.045 0.301 M3 0.0082218 2.1453916 0.004 0.997 M4 -0.9648571 2.1420509 -0.450 0.654 M5 0.0778597 2.1398064 0.036 0.971 M6 -0.4938347 2.1384652 -0.231 0.818 M7 -0.0836315 2.1362553 -0.039 0.969 M8 -2.5205445 2.1349289 -1.181 0.244 M9 -3.1245627 2.1338614 -1.464 0.150 M10 -0.3328051 2.1331916 -0.156 0.877 M11 0.3497138 2.1328260 0.164 0.870 t -0.1917082 0.0249267 -7.691 7.40e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.372 on 47 degrees of freedom Multiple R-squared: 0.8103, Adjusted R-squared: 0.7578 F-statistic: 15.44 on 13 and 47 DF, p-value: 8.78e-13 > 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.6477555 0.704488952 0.352244476 [2,] 0.8307956 0.338408842 0.169204421 [3,] 0.8269862 0.346027639 0.173013820 [4,] 0.7568372 0.486325536 0.243162768 [5,] 0.7994725 0.401055046 0.200527523 [6,] 0.9721997 0.055600579 0.027800289 [7,] 0.9735848 0.052830470 0.026415235 [8,] 0.9699101 0.060179768 0.030089884 [9,] 0.9741943 0.051611343 0.025805671 [10,] 0.9805711 0.038857721 0.019428861 [11,] 0.9837208 0.032558413 0.016279206 [12,] 0.9869517 0.026096692 0.013048346 [13,] 0.9823559 0.035288204 0.017644102 [14,] 0.9813675 0.037265021 0.018632510 [15,] 0.9875905 0.024818976 0.012409488 [16,] 0.9970185 0.005963066 0.002981533 [17,] 0.9974550 0.005090069 0.002545034 [18,] 0.9948399 0.010320236 0.005160118 [19,] 0.9892038 0.021592425 0.010796213 [20,] 0.9837561 0.032487757 0.016243879 [21,] 0.9706789 0.058642191 0.029321096 [22,] 0.9627634 0.074473276 0.037236638 [23,] 0.9507985 0.098402931 0.049201465 [24,] 0.9057824 0.188435253 0.094217626 [25,] 0.8447764 0.310447281 0.155223641 [26,] 0.8130876 0.373824769 0.186912384 [27,] 0.7113926 0.577214865 0.288607432 [28,] 0.6860739 0.627852109 0.313926055 > postscript(file="/var/www/html/rcomp/tmp/1kft21258617496.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/2vkns1258617496.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/3uap71258617496.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/4n1gy1258617496.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/5a51r1258617496.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 = 61 Frequency = 1 1 2 3 4 5 6 2.19462405 2.71139099 6.34760046 3.55430981 4.38559823 4.20590992 7 8 9 10 11 12 -0.72162623 0.31670169 1.65192155 -1.33359556 0.54561146 1.92342827 13 14 15 16 17 18 -0.63010290 -4.15902291 -6.45281541 -5.69882804 -6.15901728 -9.52227463 19 20 21 22 23 24 -3.85760321 -2.66715561 1.29791060 1.59486585 -0.82774178 -3.95567188 25 26 27 28 29 30 -2.28242732 -1.57908404 1.83074911 2.15651701 0.28035955 0.35571418 31 32 33 34 35 36 3.06255480 4.30047599 -4.48534905 -1.06179755 0.07264385 -0.45649812 37 38 39 40 41 42 1.57852460 3.00480267 0.42317789 -0.03837188 0.40977080 0.57356414 43 44 45 46 47 48 0.46978866 -1.79558747 2.92675913 0.06351586 3.36080508 4.19944756 49 50 51 52 53 54 -0.43965923 0.02191328 -2.14871206 0.02637309 1.08328870 4.38708639 55 56 57 58 59 60 1.04688598 -0.15443461 -1.39124222 0.73701140 -3.15131859 -1.71070583 61 -0.42095920 > postscript(file="/var/www/html/rcomp/tmp/6yxoy1258617496.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 2.19462405 NA 1 2.71139099 2.19462405 2 6.34760046 2.71139099 3 3.55430981 6.34760046 4 4.38559823 3.55430981 5 4.20590992 4.38559823 6 -0.72162623 4.20590992 7 0.31670169 -0.72162623 8 1.65192155 0.31670169 9 -1.33359556 1.65192155 10 0.54561146 -1.33359556 11 1.92342827 0.54561146 12 -0.63010290 1.92342827 13 -4.15902291 -0.63010290 14 -6.45281541 -4.15902291 15 -5.69882804 -6.45281541 16 -6.15901728 -5.69882804 17 -9.52227463 -6.15901728 18 -3.85760321 -9.52227463 19 -2.66715561 -3.85760321 20 1.29791060 -2.66715561 21 1.59486585 1.29791060 22 -0.82774178 1.59486585 23 -3.95567188 -0.82774178 24 -2.28242732 -3.95567188 25 -1.57908404 -2.28242732 26 1.83074911 -1.57908404 27 2.15651701 1.83074911 28 0.28035955 2.15651701 29 0.35571418 0.28035955 30 3.06255480 0.35571418 31 4.30047599 3.06255480 32 -4.48534905 4.30047599 33 -1.06179755 -4.48534905 34 0.07264385 -1.06179755 35 -0.45649812 0.07264385 36 1.57852460 -0.45649812 37 3.00480267 1.57852460 38 0.42317789 3.00480267 39 -0.03837188 0.42317789 40 0.40977080 -0.03837188 41 0.57356414 0.40977080 42 0.46978866 0.57356414 43 -1.79558747 0.46978866 44 2.92675913 -1.79558747 45 0.06351586 2.92675913 46 3.36080508 0.06351586 47 4.19944756 3.36080508 48 -0.43965923 4.19944756 49 0.02191328 -0.43965923 50 -2.14871206 0.02191328 51 0.02637309 -2.14871206 52 1.08328870 0.02637309 53 4.38708639 1.08328870 54 1.04688598 4.38708639 55 -0.15443461 1.04688598 56 -1.39124222 -0.15443461 57 0.73701140 -1.39124222 58 -3.15131859 0.73701140 59 -1.71070583 -3.15131859 60 -0.42095920 -1.71070583 61 NA -0.42095920 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.71139099 2.19462405 [2,] 6.34760046 2.71139099 [3,] 3.55430981 6.34760046 [4,] 4.38559823 3.55430981 [5,] 4.20590992 4.38559823 [6,] -0.72162623 4.20590992 [7,] 0.31670169 -0.72162623 [8,] 1.65192155 0.31670169 [9,] -1.33359556 1.65192155 [10,] 0.54561146 -1.33359556 [11,] 1.92342827 0.54561146 [12,] -0.63010290 1.92342827 [13,] -4.15902291 -0.63010290 [14,] -6.45281541 -4.15902291 [15,] -5.69882804 -6.45281541 [16,] -6.15901728 -5.69882804 [17,] -9.52227463 -6.15901728 [18,] -3.85760321 -9.52227463 [19,] -2.66715561 -3.85760321 [20,] 1.29791060 -2.66715561 [21,] 1.59486585 1.29791060 [22,] -0.82774178 1.59486585 [23,] -3.95567188 -0.82774178 [24,] -2.28242732 -3.95567188 [25,] -1.57908404 -2.28242732 [26,] 1.83074911 -1.57908404 [27,] 2.15651701 1.83074911 [28,] 0.28035955 2.15651701 [29,] 0.35571418 0.28035955 [30,] 3.06255480 0.35571418 [31,] 4.30047599 3.06255480 [32,] -4.48534905 4.30047599 [33,] -1.06179755 -4.48534905 [34,] 0.07264385 -1.06179755 [35,] -0.45649812 0.07264385 [36,] 1.57852460 -0.45649812 [37,] 3.00480267 1.57852460 [38,] 0.42317789 3.00480267 [39,] -0.03837188 0.42317789 [40,] 0.40977080 -0.03837188 [41,] 0.57356414 0.40977080 [42,] 0.46978866 0.57356414 [43,] -1.79558747 0.46978866 [44,] 2.92675913 -1.79558747 [45,] 0.06351586 2.92675913 [46,] 3.36080508 0.06351586 [47,] 4.19944756 3.36080508 [48,] -0.43965923 4.19944756 [49,] 0.02191328 -0.43965923 [50,] -2.14871206 0.02191328 [51,] 0.02637309 -2.14871206 [52,] 1.08328870 0.02637309 [53,] 4.38708639 1.08328870 [54,] 1.04688598 4.38708639 [55,] -0.15443461 1.04688598 [56,] -1.39124222 -0.15443461 [57,] 0.73701140 -1.39124222 [58,] -3.15131859 0.73701140 [59,] -1.71070583 -3.15131859 [60,] -0.42095920 -1.71070583 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.71139099 2.19462405 2 6.34760046 2.71139099 3 3.55430981 6.34760046 4 4.38559823 3.55430981 5 4.20590992 4.38559823 6 -0.72162623 4.20590992 7 0.31670169 -0.72162623 8 1.65192155 0.31670169 9 -1.33359556 1.65192155 10 0.54561146 -1.33359556 11 1.92342827 0.54561146 12 -0.63010290 1.92342827 13 -4.15902291 -0.63010290 14 -6.45281541 -4.15902291 15 -5.69882804 -6.45281541 16 -6.15901728 -5.69882804 17 -9.52227463 -6.15901728 18 -3.85760321 -9.52227463 19 -2.66715561 -3.85760321 20 1.29791060 -2.66715561 21 1.59486585 1.29791060 22 -0.82774178 1.59486585 23 -3.95567188 -0.82774178 24 -2.28242732 -3.95567188 25 -1.57908404 -2.28242732 26 1.83074911 -1.57908404 27 2.15651701 1.83074911 28 0.28035955 2.15651701 29 0.35571418 0.28035955 30 3.06255480 0.35571418 31 4.30047599 3.06255480 32 -4.48534905 4.30047599 33 -1.06179755 -4.48534905 34 0.07264385 -1.06179755 35 -0.45649812 0.07264385 36 1.57852460 -0.45649812 37 3.00480267 1.57852460 38 0.42317789 3.00480267 39 -0.03837188 0.42317789 40 0.40977080 -0.03837188 41 0.57356414 0.40977080 42 0.46978866 0.57356414 43 -1.79558747 0.46978866 44 2.92675913 -1.79558747 45 0.06351586 2.92675913 46 3.36080508 0.06351586 47 4.19944756 3.36080508 48 -0.43965923 4.19944756 49 0.02191328 -0.43965923 50 -2.14871206 0.02191328 51 0.02637309 -2.14871206 52 1.08328870 0.02637309 53 4.38708639 1.08328870 54 1.04688598 4.38708639 55 -0.15443461 1.04688598 56 -1.39124222 -0.15443461 57 0.73701140 -1.39124222 58 -3.15131859 0.73701140 59 -1.71070583 -3.15131859 60 -0.42095920 -1.71070583 > 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/7at7q1258617496.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/81ory1258617496.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/9wwg41258617496.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/1050i21258617496.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/11cuka1258617496.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/12a90i1258617496.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/13yb1j1258617496.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/149rd01258617496.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/15lcv71258617496.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/16bpoa1258617496.tab") + } > > system("convert tmp/1kft21258617496.ps tmp/1kft21258617496.png") > system("convert tmp/2vkns1258617496.ps tmp/2vkns1258617496.png") > system("convert tmp/3uap71258617496.ps tmp/3uap71258617496.png") > system("convert tmp/4n1gy1258617496.ps tmp/4n1gy1258617496.png") > system("convert tmp/5a51r1258617496.ps tmp/5a51r1258617496.png") > system("convert tmp/6yxoy1258617496.ps tmp/6yxoy1258617496.png") > system("convert tmp/7at7q1258617496.ps tmp/7at7q1258617496.png") > system("convert tmp/81ory1258617496.ps tmp/81ory1258617496.png") > system("convert tmp/9wwg41258617496.ps tmp/9wwg41258617496.png") > system("convert tmp/1050i21258617496.ps tmp/1050i21258617496.png") > > > proc.time() user system elapsed 2.352 1.557 3.389