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(7.3,7.9,7.6,9.1,7.5,9.4,7.6,9.4,7.9,9.1,7.9,9,8.1,9.3,8.2,9.9,8,9.8,7.5,9.3,6.8,8.3,6.5,8,6.6,8.5,7.6,10.4,8,11.1,8.1,10.9,7.7,10,7.5,9.2,7.6,9.2,7.8,9.5,7.8,9.6,7.8,9.5,7.5,9.1,7.5,8.9,7.1,9,7.5,10.1,7.5,10.3,7.6,10.2,7.7,9.6,7.7,9.2,7.9,9.3,8.1,9.4,8.2,9.4,8.2,9.2,8.2,9,7.9,9,7.3,9,6.9,9.8,6.6,10,6.7,9.8,6.9,9.3,7,9,7.1,9,7.2,9.1,7.1,9.1,6.9,9.1,7,9.2,6.8,8.8,6.4,8.3,6.7,8.4,6.6,8.1,6.4,7.7,6.3,7.9,6.2,7.9,6.5,8,6.8,7.9,6.8,7.6,6.4,7.1,6.1,6.8,5.8,6.5,6.1,6.9,7.2,8.2,7.3,8.7,6.9,8.3,6.1,7.9,5.8,7.5,6.2,7.8,7.1,8.3,7.7,8.4,7.9,8.2,7.7,7.7,7.4,7.2,7.5,7.3),dim=c(2,73),dimnames=list(c('WGM','WGV'),1:73)) > y <- array(NA,dim=c(2,73),dimnames=list(c('WGM','WGV'),1:73)) > 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 = 'Do not include Seasonal 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 WGM WGV 1 7.3 7.9 2 7.6 9.1 3 7.5 9.4 4 7.6 9.4 5 7.9 9.1 6 7.9 9.0 7 8.1 9.3 8 8.2 9.9 9 8.0 9.8 10 7.5 9.3 11 6.8 8.3 12 6.5 8.0 13 6.6 8.5 14 7.6 10.4 15 8.0 11.1 16 8.1 10.9 17 7.7 10.0 18 7.5 9.2 19 7.6 9.2 20 7.8 9.5 21 7.8 9.6 22 7.8 9.5 23 7.5 9.1 24 7.5 8.9 25 7.1 9.0 26 7.5 10.1 27 7.5 10.3 28 7.6 10.2 29 7.7 9.6 30 7.7 9.2 31 7.9 9.3 32 8.1 9.4 33 8.2 9.4 34 8.2 9.2 35 8.2 9.0 36 7.9 9.0 37 7.3 9.0 38 6.9 9.8 39 6.6 10.0 40 6.7 9.8 41 6.9 9.3 42 7.0 9.0 43 7.1 9.0 44 7.2 9.1 45 7.1 9.1 46 6.9 9.1 47 7.0 9.2 48 6.8 8.8 49 6.4 8.3 50 6.7 8.4 51 6.6 8.1 52 6.4 7.7 53 6.3 7.9 54 6.2 7.9 55 6.5 8.0 56 6.8 7.9 57 6.8 7.6 58 6.4 7.1 59 6.1 6.8 60 5.8 6.5 61 6.1 6.9 62 7.2 8.2 63 7.3 8.7 64 6.9 8.3 65 6.1 7.9 66 5.8 7.5 67 6.2 7.8 68 7.1 8.3 69 7.7 8.4 70 7.9 8.2 71 7.7 7.7 72 7.4 7.2 73 7.5 7.3 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) WGV 3.3697 0.4370 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.14013 -0.34086 -0.03347 0.27839 0.96507 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.3697 0.5358 6.289 2.30e-08 *** WGV 0.4370 0.0604 7.236 4.32e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4931 on 71 degrees of freedom Multiple R-squared: 0.4245, Adjusted R-squared: 0.4164 F-statistic: 52.37 on 1 and 71 DF, p-value: 4.319e-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.0787070370 0.1574140740 0.92129296 [2,] 0.0658207654 0.1316415309 0.93417923 [3,] 0.0739120516 0.1478241031 0.92608795 [4,] 0.0455554816 0.0911109631 0.95444452 [5,] 0.0205581783 0.0411163566 0.97944182 [6,] 0.0173843932 0.0347687864 0.98261561 [7,] 0.0390512711 0.0781025423 0.96094873 [8,] 0.0546145793 0.1092291586 0.94538542 [9,] 0.0897142756 0.1794285512 0.91028572 [10,] 0.1674387134 0.3348774268 0.83256129 [11,] 0.1582959437 0.3165918874 0.84170406 [12,] 0.1121573159 0.2243146318 0.88784268 [13,] 0.0774244905 0.1548489811 0.92257551 [14,] 0.0503187797 0.1006375594 0.94968122 [15,] 0.0326718122 0.0653436245 0.96732819 [16,] 0.0219962366 0.0439924732 0.97800376 [17,] 0.0139993753 0.0279987505 0.98600062 [18,] 0.0090868444 0.0181736889 0.99091316 [19,] 0.0052618237 0.0105236473 0.99473818 [20,] 0.0031051767 0.0062103535 0.99689482 [21,] 0.0024763820 0.0049527639 0.99752362 [22,] 0.0021095837 0.0042191674 0.99789042 [23,] 0.0020072711 0.0040145422 0.99799273 [24,] 0.0013251304 0.0026502607 0.99867487 [25,] 0.0007297308 0.0014594617 0.99927027 [26,] 0.0004736113 0.0009472225 0.99952639 [27,] 0.0004543748 0.0009087496 0.99954563 [28,] 0.0007760161 0.0015520322 0.99922398 [29,] 0.0019518791 0.0039037582 0.99804812 [30,] 0.0061979705 0.0123959409 0.99380203 [31,] 0.0233427980 0.0466855960 0.97665720 [32,] 0.0346713831 0.0693427661 0.96532862 [33,] 0.0278451660 0.0556903320 0.97215483 [34,] 0.0522469639 0.1044939278 0.94775304 [35,] 0.1668631819 0.3337263639 0.83313682 [36,] 0.2712131472 0.5424262943 0.72878685 [37,] 0.2770484179 0.5540968359 0.72295158 [38,] 0.2470373760 0.4940747520 0.75296262 [39,] 0.2074596552 0.4149193104 0.79254034 [40,] 0.1672484491 0.3344968982 0.83275155 [41,] 0.1365724026 0.2731448052 0.86342760 [42,] 0.1266461838 0.2532923676 0.87335382 [43,] 0.1110966299 0.2221932598 0.88890337 [44,] 0.1043731574 0.2087463147 0.89562684 [45,] 0.1276106048 0.2552212096 0.87238940 [46,] 0.1137489218 0.2274978436 0.88625108 [47,] 0.0970657855 0.1941315709 0.90293421 [48,] 0.0814070613 0.1628141226 0.91859294 [49,] 0.0852419526 0.1704839052 0.91475805 [50,] 0.1052895744 0.2105791488 0.89471043 [51,] 0.0960557768 0.1921115537 0.90394422 [52,] 0.0682568784 0.1365137569 0.93174312 [53,] 0.0462891920 0.0925783840 0.95371081 [54,] 0.0296596366 0.0593192733 0.97034036 [55,] 0.0190165788 0.0380331576 0.98098342 [56,] 0.0142378379 0.0284756757 0.98576216 [57,] 0.0115653101 0.0231306201 0.98843469 [58,] 0.0067138033 0.0134276067 0.99328620 [59,] 0.0034813399 0.0069626798 0.99651866 [60,] 0.0018601956 0.0037203912 0.99813980 [61,] 0.0061520311 0.0123040622 0.99384797 [62,] 0.0900404694 0.1800809389 0.90995953 [63,] 0.7352541985 0.5294916031 0.26474580 [64,] 0.9714032883 0.0571934233 0.02859671 > postscript(file="/var/www/html/rcomp/tmp/1kuiu1258730665.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/2tgwv1258730665.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/3f2te1258730665.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/4mt841258730665.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/5cndd1258730665.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 = 73 Frequency = 1 1 2 3 4 5 6 0.477662696 0.253209539 0.022096249 0.122096249 0.553209539 0.596913968 7 8 9 10 11 12 0.665800679 0.503574100 0.347278530 0.065800679 -0.197155023 -0.366041733 13 14 15 16 17 18 -0.484563883 -0.314948049 -0.220879058 -0.033470198 -0.040130330 0.109505109 19 20 21 22 23 24 0.209505109 0.278391819 0.234687390 0.278391819 0.153209539 0.240618398 25 26 27 28 29 30 -0.203086032 -0.283834760 -0.371243619 -0.227539189 0.134687390 0.309505109 31 32 33 34 35 36 0.465800679 0.622096249 0.722096249 0.809505109 0.896913968 0.596913968 37 38 39 40 41 42 -0.003086032 -0.752721470 -1.140130330 -0.952721470 -0.534199321 -0.303086032 43 44 45 46 47 48 -0.203086032 -0.146790461 -0.246790461 -0.446790461 -0.390494891 -0.415677172 49 50 51 52 53 54 -0.597155023 -0.340859453 -0.309746163 -0.334928444 -0.522337304 -0.622337304 55 56 57 58 59 60 -0.366041733 -0.022337304 0.108775986 -0.072701865 -0.241588576 -0.410475286 61 62 63 64 65 66 -0.285293006 0.246549407 0.128027258 -0.097155023 -0.722337304 -0.847519584 67 68 69 70 71 72 -0.578632874 0.102844977 0.659140547 0.946549407 0.965071556 0.883593705 73 0.939889275 > postscript(file="/var/www/html/rcomp/tmp/6t7ku1258730665.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 = 73 Frequency = 1 lag(myerror, k = 1) myerror 0 0.477662696 NA 1 0.253209539 0.477662696 2 0.022096249 0.253209539 3 0.122096249 0.022096249 4 0.553209539 0.122096249 5 0.596913968 0.553209539 6 0.665800679 0.596913968 7 0.503574100 0.665800679 8 0.347278530 0.503574100 9 0.065800679 0.347278530 10 -0.197155023 0.065800679 11 -0.366041733 -0.197155023 12 -0.484563883 -0.366041733 13 -0.314948049 -0.484563883 14 -0.220879058 -0.314948049 15 -0.033470198 -0.220879058 16 -0.040130330 -0.033470198 17 0.109505109 -0.040130330 18 0.209505109 0.109505109 19 0.278391819 0.209505109 20 0.234687390 0.278391819 21 0.278391819 0.234687390 22 0.153209539 0.278391819 23 0.240618398 0.153209539 24 -0.203086032 0.240618398 25 -0.283834760 -0.203086032 26 -0.371243619 -0.283834760 27 -0.227539189 -0.371243619 28 0.134687390 -0.227539189 29 0.309505109 0.134687390 30 0.465800679 0.309505109 31 0.622096249 0.465800679 32 0.722096249 0.622096249 33 0.809505109 0.722096249 34 0.896913968 0.809505109 35 0.596913968 0.896913968 36 -0.003086032 0.596913968 37 -0.752721470 -0.003086032 38 -1.140130330 -0.752721470 39 -0.952721470 -1.140130330 40 -0.534199321 -0.952721470 41 -0.303086032 -0.534199321 42 -0.203086032 -0.303086032 43 -0.146790461 -0.203086032 44 -0.246790461 -0.146790461 45 -0.446790461 -0.246790461 46 -0.390494891 -0.446790461 47 -0.415677172 -0.390494891 48 -0.597155023 -0.415677172 49 -0.340859453 -0.597155023 50 -0.309746163 -0.340859453 51 -0.334928444 -0.309746163 52 -0.522337304 -0.334928444 53 -0.622337304 -0.522337304 54 -0.366041733 -0.622337304 55 -0.022337304 -0.366041733 56 0.108775986 -0.022337304 57 -0.072701865 0.108775986 58 -0.241588576 -0.072701865 59 -0.410475286 -0.241588576 60 -0.285293006 -0.410475286 61 0.246549407 -0.285293006 62 0.128027258 0.246549407 63 -0.097155023 0.128027258 64 -0.722337304 -0.097155023 65 -0.847519584 -0.722337304 66 -0.578632874 -0.847519584 67 0.102844977 -0.578632874 68 0.659140547 0.102844977 69 0.946549407 0.659140547 70 0.965071556 0.946549407 71 0.883593705 0.965071556 72 0.939889275 0.883593705 73 NA 0.939889275 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.253209539 0.477662696 [2,] 0.022096249 0.253209539 [3,] 0.122096249 0.022096249 [4,] 0.553209539 0.122096249 [5,] 0.596913968 0.553209539 [6,] 0.665800679 0.596913968 [7,] 0.503574100 0.665800679 [8,] 0.347278530 0.503574100 [9,] 0.065800679 0.347278530 [10,] -0.197155023 0.065800679 [11,] -0.366041733 -0.197155023 [12,] -0.484563883 -0.366041733 [13,] -0.314948049 -0.484563883 [14,] -0.220879058 -0.314948049 [15,] -0.033470198 -0.220879058 [16,] -0.040130330 -0.033470198 [17,] 0.109505109 -0.040130330 [18,] 0.209505109 0.109505109 [19,] 0.278391819 0.209505109 [20,] 0.234687390 0.278391819 [21,] 0.278391819 0.234687390 [22,] 0.153209539 0.278391819 [23,] 0.240618398 0.153209539 [24,] -0.203086032 0.240618398 [25,] -0.283834760 -0.203086032 [26,] -0.371243619 -0.283834760 [27,] -0.227539189 -0.371243619 [28,] 0.134687390 -0.227539189 [29,] 0.309505109 0.134687390 [30,] 0.465800679 0.309505109 [31,] 0.622096249 0.465800679 [32,] 0.722096249 0.622096249 [33,] 0.809505109 0.722096249 [34,] 0.896913968 0.809505109 [35,] 0.596913968 0.896913968 [36,] -0.003086032 0.596913968 [37,] -0.752721470 -0.003086032 [38,] -1.140130330 -0.752721470 [39,] -0.952721470 -1.140130330 [40,] -0.534199321 -0.952721470 [41,] -0.303086032 -0.534199321 [42,] -0.203086032 -0.303086032 [43,] -0.146790461 -0.203086032 [44,] -0.246790461 -0.146790461 [45,] -0.446790461 -0.246790461 [46,] -0.390494891 -0.446790461 [47,] -0.415677172 -0.390494891 [48,] -0.597155023 -0.415677172 [49,] -0.340859453 -0.597155023 [50,] -0.309746163 -0.340859453 [51,] -0.334928444 -0.309746163 [52,] -0.522337304 -0.334928444 [53,] -0.622337304 -0.522337304 [54,] -0.366041733 -0.622337304 [55,] -0.022337304 -0.366041733 [56,] 0.108775986 -0.022337304 [57,] -0.072701865 0.108775986 [58,] -0.241588576 -0.072701865 [59,] -0.410475286 -0.241588576 [60,] -0.285293006 -0.410475286 [61,] 0.246549407 -0.285293006 [62,] 0.128027258 0.246549407 [63,] -0.097155023 0.128027258 [64,] -0.722337304 -0.097155023 [65,] -0.847519584 -0.722337304 [66,] -0.578632874 -0.847519584 [67,] 0.102844977 -0.578632874 [68,] 0.659140547 0.102844977 [69,] 0.946549407 0.659140547 [70,] 0.965071556 0.946549407 [71,] 0.883593705 0.965071556 [72,] 0.939889275 0.883593705 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.253209539 0.477662696 2 0.022096249 0.253209539 3 0.122096249 0.022096249 4 0.553209539 0.122096249 5 0.596913968 0.553209539 6 0.665800679 0.596913968 7 0.503574100 0.665800679 8 0.347278530 0.503574100 9 0.065800679 0.347278530 10 -0.197155023 0.065800679 11 -0.366041733 -0.197155023 12 -0.484563883 -0.366041733 13 -0.314948049 -0.484563883 14 -0.220879058 -0.314948049 15 -0.033470198 -0.220879058 16 -0.040130330 -0.033470198 17 0.109505109 -0.040130330 18 0.209505109 0.109505109 19 0.278391819 0.209505109 20 0.234687390 0.278391819 21 0.278391819 0.234687390 22 0.153209539 0.278391819 23 0.240618398 0.153209539 24 -0.203086032 0.240618398 25 -0.283834760 -0.203086032 26 -0.371243619 -0.283834760 27 -0.227539189 -0.371243619 28 0.134687390 -0.227539189 29 0.309505109 0.134687390 30 0.465800679 0.309505109 31 0.622096249 0.465800679 32 0.722096249 0.622096249 33 0.809505109 0.722096249 34 0.896913968 0.809505109 35 0.596913968 0.896913968 36 -0.003086032 0.596913968 37 -0.752721470 -0.003086032 38 -1.140130330 -0.752721470 39 -0.952721470 -1.140130330 40 -0.534199321 -0.952721470 41 -0.303086032 -0.534199321 42 -0.203086032 -0.303086032 43 -0.146790461 -0.203086032 44 -0.246790461 -0.146790461 45 -0.446790461 -0.246790461 46 -0.390494891 -0.446790461 47 -0.415677172 -0.390494891 48 -0.597155023 -0.415677172 49 -0.340859453 -0.597155023 50 -0.309746163 -0.340859453 51 -0.334928444 -0.309746163 52 -0.522337304 -0.334928444 53 -0.622337304 -0.522337304 54 -0.366041733 -0.622337304 55 -0.022337304 -0.366041733 56 0.108775986 -0.022337304 57 -0.072701865 0.108775986 58 -0.241588576 -0.072701865 59 -0.410475286 -0.241588576 60 -0.285293006 -0.410475286 61 0.246549407 -0.285293006 62 0.128027258 0.246549407 63 -0.097155023 0.128027258 64 -0.722337304 -0.097155023 65 -0.847519584 -0.722337304 66 -0.578632874 -0.847519584 67 0.102844977 -0.578632874 68 0.659140547 0.102844977 69 0.946549407 0.659140547 70 0.965071556 0.946549407 71 0.883593705 0.965071556 72 0.939889275 0.883593705 > 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/7plrl1258730665.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/80gbl1258730665.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/9uvxc1258730665.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/1067aj1258730665.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/11tfqt1258730665.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/124spw1258730665.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/136ha91258730665.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/14oep01258730665.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/156b8k1258730665.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/16n1fv1258730665.tab") + } > > system("convert tmp/1kuiu1258730665.ps tmp/1kuiu1258730665.png") > system("convert tmp/2tgwv1258730665.ps tmp/2tgwv1258730665.png") > system("convert tmp/3f2te1258730665.ps tmp/3f2te1258730665.png") > system("convert tmp/4mt841258730665.ps tmp/4mt841258730665.png") > system("convert tmp/5cndd1258730665.ps tmp/5cndd1258730665.png") > system("convert tmp/6t7ku1258730665.ps tmp/6t7ku1258730665.png") > system("convert tmp/7plrl1258730665.ps tmp/7plrl1258730665.png") > system("convert tmp/80gbl1258730665.ps tmp/80gbl1258730665.png") > system("convert tmp/9uvxc1258730665.ps tmp/9uvxc1258730665.png") > system("convert tmp/1067aj1258730665.ps tmp/1067aj1258730665.png") > > > proc.time() user system elapsed 2.673 1.598 3.137