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(14.5,14.8,14.3,14.7,15.3,16,14.4,15.4,13.7,15,14.2,15.5,13.5,15.1,11.9,11.7,14.6,16.3,15.6,16.7,14.1,15,14.9,14.9,14.2,14.6,14.6,15.3,17.2,17.9,15.4,16.4,14.3,15.4,17.5,17.9,14.5,15.9,14.4,13.9,16.6,17.8,16.7,17.9,16.6,17.4,16.9,16.7,15.7,16,16.4,16.6,18.4,19.1,16.9,17.8,16.5,17.2,18.3,18.6,15.1,16.3,15.7,15.1,18.1,19.2,16.8,17.7,18.9,19.1,19,18,18.1,17.5,17.8,17.8,21.5,21.1,17.1,17.2,18.7,19.4,19,19.8,16.4,17.6,16.9,16.2,18.6,19.5,19.3,19.9,19.4,20,17.6,17.3,18.6,18.9,18.1,18.6,20.4,21.4,18.1,18.6,19.6,19.8,19.9,20.8,19.2,19.6,17.8,17.7,19.2,19.8,22,22.2,21.1,20.7,19.5,17.9,22.2,20.9,20.9,21.2,22.2,21.4,23.5,23,21.5,21.3,24.3,23.9,22.8,22.4,20.3,18.3,23.7,22.8,23.3,22.3,19.6,17.8,18,16.4,17.3,16,16.8,16.4,18.2,17.7,16.5,16.6,16,16.2,18.4,18.3),dim=c(2,78),dimnames=list(c('Y','X'),1:78)) > y <- array(NA,dim=c(2,78),dimnames=list(c('Y','X'),1:78)) > 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 Y X 1 14.5 14.8 2 14.3 14.7 3 15.3 16.0 4 14.4 15.4 5 13.7 15.0 6 14.2 15.5 7 13.5 15.1 8 11.9 11.7 9 14.6 16.3 10 15.6 16.7 11 14.1 15.0 12 14.9 14.9 13 14.2 14.6 14 14.6 15.3 15 17.2 17.9 16 15.4 16.4 17 14.3 15.4 18 17.5 17.9 19 14.5 15.9 20 14.4 13.9 21 16.6 17.8 22 16.7 17.9 23 16.6 17.4 24 16.9 16.7 25 15.7 16.0 26 16.4 16.6 27 18.4 19.1 28 16.9 17.8 29 16.5 17.2 30 18.3 18.6 31 15.1 16.3 32 15.7 15.1 33 18.1 19.2 34 16.8 17.7 35 18.9 19.1 36 19.0 18.0 37 18.1 17.5 38 17.8 17.8 39 21.5 21.1 40 17.1 17.2 41 18.7 19.4 42 19.0 19.8 43 16.4 17.6 44 16.9 16.2 45 18.6 19.5 46 19.3 19.9 47 19.4 20.0 48 17.6 17.3 49 18.6 18.9 50 18.1 18.6 51 20.4 21.4 52 18.1 18.6 53 19.6 19.8 54 19.9 20.8 55 19.2 19.6 56 17.8 17.7 57 19.2 19.8 58 22.0 22.2 59 21.1 20.7 60 19.5 17.9 61 22.2 20.9 62 20.9 21.2 63 22.2 21.4 64 23.5 23.0 65 21.5 21.3 66 24.3 23.9 67 22.8 22.4 68 20.3 18.3 69 23.7 22.8 70 23.3 22.3 71 19.6 17.8 72 18.0 16.4 73 17.3 16.0 74 16.8 16.4 75 18.2 17.7 76 16.5 16.6 77 16.0 16.2 78 18.4 18.3 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X -1.536 1.074 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.3716 -0.6040 -0.1366 0.4247 2.1801 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.53648 0.69584 -2.208 0.0303 * X 1.07412 0.03839 27.976 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.8172 on 76 degrees of freedom Multiple R-squared: 0.9115, Adjusted R-squared: 0.9103 F-statistic: 782.7 on 1 and 76 DF, p-value: < 2.2e-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,] 0.177746941 0.35549388 0.82225306 [2,] 0.120413186 0.24082637 0.87958681 [3,] 0.157095258 0.31419052 0.84290474 [4,] 0.085673157 0.17134631 0.91432684 [5,] 0.061271393 0.12254279 0.93872861 [6,] 0.042002781 0.08400556 0.95799722 [7,] 0.021488683 0.04297737 0.97851132 [8,] 0.035487515 0.07097503 0.96451249 [9,] 0.021084749 0.04216950 0.97891525 [10,] 0.011720920 0.02344184 0.98827908 [11,] 0.019534341 0.03906868 0.98046566 [12,] 0.011481326 0.02296265 0.98851867 [13,] 0.007653369 0.01530674 0.99234663 [14,] 0.012405193 0.02481039 0.98759481 [15,] 0.012751252 0.02550250 0.98724875 [16,] 0.024998235 0.04999647 0.97500177 [17,] 0.018571364 0.03714273 0.98142864 [18,] 0.014072342 0.02814468 0.98592766 [19,] 0.010626955 0.02125391 0.98937304 [20,] 0.023904730 0.04780946 0.97609527 [21,] 0.018971649 0.03794330 0.98102835 [22,] 0.017464058 0.03492812 0.98253594 [23,] 0.014484546 0.02896909 0.98551545 [24,] 0.010962034 0.02192407 0.98903797 [25,] 0.007989534 0.01597907 0.99201047 [26,] 0.007727144 0.01545429 0.99227286 [27,] 0.009252821 0.01850564 0.99074718 [28,] 0.018591932 0.03718386 0.98140807 [29,] 0.017511159 0.03502232 0.98248884 [30,] 0.015828338 0.03165668 0.98417166 [31,] 0.016454345 0.03290869 0.98354565 [32,] 0.071412194 0.14282439 0.92858781 [33,] 0.099850770 0.19970154 0.90014923 [34,] 0.086605289 0.17321058 0.91339471 [35,] 0.092474716 0.18494943 0.90752528 [36,] 0.074954652 0.14990930 0.92504535 [37,] 0.065571590 0.13114318 0.93442841 [38,] 0.061141010 0.12228202 0.93885899 [39,] 0.092107978 0.18421596 0.90789202 [40,] 0.111217334 0.22243467 0.88878267 [41,] 0.120233693 0.24046739 0.87976631 [42,] 0.110207411 0.22041482 0.88979259 [43,] 0.102630210 0.20526042 0.89736979 [44,] 0.093850725 0.18770145 0.90614927 [45,] 0.080950056 0.16190011 0.91904994 [46,] 0.078124903 0.15624981 0.92187510 [47,] 0.104946786 0.20989357 0.89505321 [48,] 0.110848157 0.22169631 0.88915184 [49,] 0.100138344 0.20027669 0.89986166 [50,] 0.152037525 0.30407505 0.84796248 [51,] 0.167174186 0.33434837 0.83282581 [52,] 0.160878542 0.32175708 0.83912146 [53,] 0.229316161 0.45863232 0.77068384 [54,] 0.233365599 0.46673120 0.76663440 [55,] 0.215207752 0.43041550 0.78479225 [56,] 0.382453515 0.76490703 0.61754649 [57,] 0.458512862 0.91702572 0.54148714 [58,] 0.495102797 0.99020559 0.50489720 [59,] 0.447804237 0.89560847 0.55219576 [60,] 0.375551773 0.75110355 0.62444823 [61,] 0.329658947 0.65931789 0.67034105 [62,] 0.270837825 0.54167565 0.72916218 [63,] 0.232641193 0.46528239 0.76735881 [64,] 0.459654103 0.91930821 0.54034590 [65,] 0.364705879 0.72941176 0.63529412 [66,] 0.275802845 0.55160569 0.72419716 [67,] 0.524679344 0.95064131 0.47532066 [68,] 0.714233072 0.57153386 0.28576693 [69,] 0.927104917 0.14579017 0.07289508 > postscript(file="/var/www/html/rcomp/tmp/11igu1258656798.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/2p8x61258656798.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/3cw8o1258656798.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/41q2g1258656798.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/538sc1258656798.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 = 78 Frequency = 1 1 2 3 4 5 6 0.13954673 0.04695843 -0.34939358 -0.60492342 -0.87527665 -0.91233511 7 8 9 10 11 12 -1.18268834 0.86930920 -1.37162865 -0.80127542 -0.47527665 0.43213504 13 14 15 16 17 18 0.05437012 -0.29751173 -0.49021573 -0.67904035 -0.70492342 -0.19021573 19 20 21 22 23 24 -1.04198188 1.00625197 -0.98280404 -0.99021573 -0.55315727 0.49872458 25 26 27 28 29 30 0.05060642 0.10613627 -0.57915604 -0.68280404 -0.43833388 -0.14209758 31 32 33 34 35 36 -0.87162865 1.01731166 -0.98656773 -0.67539235 -0.07915604 1.20237258 37 38 39 40 41 42 0.83943104 0.21719596 0.37261011 0.16166612 -0.60139112 -0.73103789 43 44 45 46 47 48 -0.96798065 1.03578304 -0.80880281 -0.53844958 -0.54586127 0.55425442 49 50 51 52 53 54 -0.16433266 -0.34209758 -1.04962497 -0.34209758 -0.13103789 -0.90515481 55 56 57 58 59 60 -0.31621450 0.32460765 -0.53103789 -0.30891851 0.40225688 1.80978427 61 62 63 64 65 66 1.28743350 -0.33480158 0.75037503 0.33178795 0.15778673 0.16508272 67 68 69 70 71 72 0.27625811 2.18013750 0.74661134 0.88366980 2.01719596 1.92095965 73 74 75 76 77 78 1.65060642 0.72095965 0.72460765 0.20613627 0.13578304 0.28013750 > postscript(file="/var/www/html/rcomp/tmp/6zkj91258656798.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 = 78 Frequency = 1 lag(myerror, k = 1) myerror 0 0.13954673 NA 1 0.04695843 0.13954673 2 -0.34939358 0.04695843 3 -0.60492342 -0.34939358 4 -0.87527665 -0.60492342 5 -0.91233511 -0.87527665 6 -1.18268834 -0.91233511 7 0.86930920 -1.18268834 8 -1.37162865 0.86930920 9 -0.80127542 -1.37162865 10 -0.47527665 -0.80127542 11 0.43213504 -0.47527665 12 0.05437012 0.43213504 13 -0.29751173 0.05437012 14 -0.49021573 -0.29751173 15 -0.67904035 -0.49021573 16 -0.70492342 -0.67904035 17 -0.19021573 -0.70492342 18 -1.04198188 -0.19021573 19 1.00625197 -1.04198188 20 -0.98280404 1.00625197 21 -0.99021573 -0.98280404 22 -0.55315727 -0.99021573 23 0.49872458 -0.55315727 24 0.05060642 0.49872458 25 0.10613627 0.05060642 26 -0.57915604 0.10613627 27 -0.68280404 -0.57915604 28 -0.43833388 -0.68280404 29 -0.14209758 -0.43833388 30 -0.87162865 -0.14209758 31 1.01731166 -0.87162865 32 -0.98656773 1.01731166 33 -0.67539235 -0.98656773 34 -0.07915604 -0.67539235 35 1.20237258 -0.07915604 36 0.83943104 1.20237258 37 0.21719596 0.83943104 38 0.37261011 0.21719596 39 0.16166612 0.37261011 40 -0.60139112 0.16166612 41 -0.73103789 -0.60139112 42 -0.96798065 -0.73103789 43 1.03578304 -0.96798065 44 -0.80880281 1.03578304 45 -0.53844958 -0.80880281 46 -0.54586127 -0.53844958 47 0.55425442 -0.54586127 48 -0.16433266 0.55425442 49 -0.34209758 -0.16433266 50 -1.04962497 -0.34209758 51 -0.34209758 -1.04962497 52 -0.13103789 -0.34209758 53 -0.90515481 -0.13103789 54 -0.31621450 -0.90515481 55 0.32460765 -0.31621450 56 -0.53103789 0.32460765 57 -0.30891851 -0.53103789 58 0.40225688 -0.30891851 59 1.80978427 0.40225688 60 1.28743350 1.80978427 61 -0.33480158 1.28743350 62 0.75037503 -0.33480158 63 0.33178795 0.75037503 64 0.15778673 0.33178795 65 0.16508272 0.15778673 66 0.27625811 0.16508272 67 2.18013750 0.27625811 68 0.74661134 2.18013750 69 0.88366980 0.74661134 70 2.01719596 0.88366980 71 1.92095965 2.01719596 72 1.65060642 1.92095965 73 0.72095965 1.65060642 74 0.72460765 0.72095965 75 0.20613627 0.72460765 76 0.13578304 0.20613627 77 0.28013750 0.13578304 78 NA 0.28013750 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.04695843 0.13954673 [2,] -0.34939358 0.04695843 [3,] -0.60492342 -0.34939358 [4,] -0.87527665 -0.60492342 [5,] -0.91233511 -0.87527665 [6,] -1.18268834 -0.91233511 [7,] 0.86930920 -1.18268834 [8,] -1.37162865 0.86930920 [9,] -0.80127542 -1.37162865 [10,] -0.47527665 -0.80127542 [11,] 0.43213504 -0.47527665 [12,] 0.05437012 0.43213504 [13,] -0.29751173 0.05437012 [14,] -0.49021573 -0.29751173 [15,] -0.67904035 -0.49021573 [16,] -0.70492342 -0.67904035 [17,] -0.19021573 -0.70492342 [18,] -1.04198188 -0.19021573 [19,] 1.00625197 -1.04198188 [20,] -0.98280404 1.00625197 [21,] -0.99021573 -0.98280404 [22,] -0.55315727 -0.99021573 [23,] 0.49872458 -0.55315727 [24,] 0.05060642 0.49872458 [25,] 0.10613627 0.05060642 [26,] -0.57915604 0.10613627 [27,] -0.68280404 -0.57915604 [28,] -0.43833388 -0.68280404 [29,] -0.14209758 -0.43833388 [30,] -0.87162865 -0.14209758 [31,] 1.01731166 -0.87162865 [32,] -0.98656773 1.01731166 [33,] -0.67539235 -0.98656773 [34,] -0.07915604 -0.67539235 [35,] 1.20237258 -0.07915604 [36,] 0.83943104 1.20237258 [37,] 0.21719596 0.83943104 [38,] 0.37261011 0.21719596 [39,] 0.16166612 0.37261011 [40,] -0.60139112 0.16166612 [41,] -0.73103789 -0.60139112 [42,] -0.96798065 -0.73103789 [43,] 1.03578304 -0.96798065 [44,] -0.80880281 1.03578304 [45,] -0.53844958 -0.80880281 [46,] -0.54586127 -0.53844958 [47,] 0.55425442 -0.54586127 [48,] -0.16433266 0.55425442 [49,] -0.34209758 -0.16433266 [50,] -1.04962497 -0.34209758 [51,] -0.34209758 -1.04962497 [52,] -0.13103789 -0.34209758 [53,] -0.90515481 -0.13103789 [54,] -0.31621450 -0.90515481 [55,] 0.32460765 -0.31621450 [56,] -0.53103789 0.32460765 [57,] -0.30891851 -0.53103789 [58,] 0.40225688 -0.30891851 [59,] 1.80978427 0.40225688 [60,] 1.28743350 1.80978427 [61,] -0.33480158 1.28743350 [62,] 0.75037503 -0.33480158 [63,] 0.33178795 0.75037503 [64,] 0.15778673 0.33178795 [65,] 0.16508272 0.15778673 [66,] 0.27625811 0.16508272 [67,] 2.18013750 0.27625811 [68,] 0.74661134 2.18013750 [69,] 0.88366980 0.74661134 [70,] 2.01719596 0.88366980 [71,] 1.92095965 2.01719596 [72,] 1.65060642 1.92095965 [73,] 0.72095965 1.65060642 [74,] 0.72460765 0.72095965 [75,] 0.20613627 0.72460765 [76,] 0.13578304 0.20613627 [77,] 0.28013750 0.13578304 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.04695843 0.13954673 2 -0.34939358 0.04695843 3 -0.60492342 -0.34939358 4 -0.87527665 -0.60492342 5 -0.91233511 -0.87527665 6 -1.18268834 -0.91233511 7 0.86930920 -1.18268834 8 -1.37162865 0.86930920 9 -0.80127542 -1.37162865 10 -0.47527665 -0.80127542 11 0.43213504 -0.47527665 12 0.05437012 0.43213504 13 -0.29751173 0.05437012 14 -0.49021573 -0.29751173 15 -0.67904035 -0.49021573 16 -0.70492342 -0.67904035 17 -0.19021573 -0.70492342 18 -1.04198188 -0.19021573 19 1.00625197 -1.04198188 20 -0.98280404 1.00625197 21 -0.99021573 -0.98280404 22 -0.55315727 -0.99021573 23 0.49872458 -0.55315727 24 0.05060642 0.49872458 25 0.10613627 0.05060642 26 -0.57915604 0.10613627 27 -0.68280404 -0.57915604 28 -0.43833388 -0.68280404 29 -0.14209758 -0.43833388 30 -0.87162865 -0.14209758 31 1.01731166 -0.87162865 32 -0.98656773 1.01731166 33 -0.67539235 -0.98656773 34 -0.07915604 -0.67539235 35 1.20237258 -0.07915604 36 0.83943104 1.20237258 37 0.21719596 0.83943104 38 0.37261011 0.21719596 39 0.16166612 0.37261011 40 -0.60139112 0.16166612 41 -0.73103789 -0.60139112 42 -0.96798065 -0.73103789 43 1.03578304 -0.96798065 44 -0.80880281 1.03578304 45 -0.53844958 -0.80880281 46 -0.54586127 -0.53844958 47 0.55425442 -0.54586127 48 -0.16433266 0.55425442 49 -0.34209758 -0.16433266 50 -1.04962497 -0.34209758 51 -0.34209758 -1.04962497 52 -0.13103789 -0.34209758 53 -0.90515481 -0.13103789 54 -0.31621450 -0.90515481 55 0.32460765 -0.31621450 56 -0.53103789 0.32460765 57 -0.30891851 -0.53103789 58 0.40225688 -0.30891851 59 1.80978427 0.40225688 60 1.28743350 1.80978427 61 -0.33480158 1.28743350 62 0.75037503 -0.33480158 63 0.33178795 0.75037503 64 0.15778673 0.33178795 65 0.16508272 0.15778673 66 0.27625811 0.16508272 67 2.18013750 0.27625811 68 0.74661134 2.18013750 69 0.88366980 0.74661134 70 2.01719596 0.88366980 71 1.92095965 2.01719596 72 1.65060642 1.92095965 73 0.72095965 1.65060642 74 0.72460765 0.72095965 75 0.20613627 0.72460765 76 0.13578304 0.20613627 77 0.28013750 0.13578304 > 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/7x4x21258656798.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/8cfhb1258656798.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/9btre1258656798.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/103p0q1258656798.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/11nqk61258656798.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/12ld3q1258656798.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/13bpse1258656798.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/14m4la1258656798.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/15nem71258656798.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/16ggh01258656798.tab") + } > > system("convert tmp/11igu1258656798.ps tmp/11igu1258656798.png") > system("convert tmp/2p8x61258656798.ps tmp/2p8x61258656798.png") > system("convert tmp/3cw8o1258656798.ps tmp/3cw8o1258656798.png") > system("convert tmp/41q2g1258656798.ps tmp/41q2g1258656798.png") > system("convert tmp/538sc1258656798.ps tmp/538sc1258656798.png") > system("convert tmp/6zkj91258656798.ps tmp/6zkj91258656798.png") > system("convert tmp/7x4x21258656798.ps tmp/7x4x21258656798.png") > system("convert tmp/8cfhb1258656798.ps tmp/8cfhb1258656798.png") > system("convert tmp/9btre1258656798.ps tmp/9btre1258656798.png") > system("convert tmp/103p0q1258656798.ps tmp/103p0q1258656798.png") > > > proc.time() user system elapsed 2.617 1.613 3.058