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(8.7 + ,110.3 + ,9.3 + ,9.3 + ,8.2 + ,103.9 + ,8.7 + ,9.3 + ,8.3 + ,101.6 + ,8.2 + ,8.7 + ,8.5 + ,94.6 + ,8.3 + ,8.2 + ,8.6 + ,95.9 + ,8.5 + ,8.3 + ,8.5 + ,104.7 + ,8.6 + ,8.5 + ,8.2 + ,102.8 + ,8.5 + ,8.6 + ,8.1 + ,98.1 + ,8.2 + ,8.5 + ,7.9 + ,113.9 + ,8.1 + ,8.2 + ,8.6 + ,80.9 + ,7.9 + ,8.1 + ,8.7 + ,95.7 + ,8.6 + ,7.9 + ,8.7 + ,113.2 + ,8.7 + ,8.6 + ,8.5 + ,105.9 + ,8.7 + ,8.7 + ,8.4 + ,108.8 + ,8.5 + ,8.7 + ,8.5 + ,102.3 + ,8.4 + ,8.5 + ,8.7 + ,99 + ,8.5 + ,8.4 + ,8.7 + ,100.7 + ,8.7 + ,8.5 + ,8.6 + ,115.5 + ,8.7 + ,8.7 + ,8.5 + ,100.7 + ,8.6 + ,8.7 + ,8.3 + ,109.9 + ,8.5 + ,8.6 + ,8 + ,114.6 + ,8.3 + ,8.5 + ,8.2 + ,85.4 + ,8 + ,8.3 + ,8.1 + ,100.5 + ,8.2 + ,8 + ,8.1 + ,114.8 + ,8.1 + ,8.2 + ,8 + ,116.5 + ,8.1 + ,8.1 + ,7.9 + ,112.9 + ,8 + ,8.1 + ,7.9 + ,102 + ,7.9 + ,8 + ,8 + ,106 + ,7.9 + ,7.9 + ,8 + ,105.3 + ,8 + ,7.9 + ,7.9 + ,118.8 + ,8 + ,8 + ,8 + ,106.1 + ,7.9 + ,8 + ,7.7 + ,109.3 + ,8 + ,7.9 + ,7.2 + ,117.2 + ,7.7 + ,8 + ,7.5 + ,92.5 + ,7.2 + ,7.7 + ,7.3 + ,104.2 + ,7.5 + ,7.2 + ,7 + ,112.5 + ,7.3 + ,7.5 + ,7 + ,122.4 + ,7 + ,7.3 + ,7 + ,113.3 + ,7 + ,7 + ,7.2 + ,100 + ,7 + ,7 + ,7.3 + ,110.7 + ,7.2 + ,7 + ,7.1 + ,112.8 + ,7.3 + ,7.2 + ,6.8 + ,109.8 + ,7.1 + ,7.3 + ,6.4 + ,117.3 + ,6.8 + ,7.1 + ,6.1 + ,109.1 + ,6.4 + ,6.8 + ,6.5 + ,115.9 + ,6.1 + ,6.4 + ,7.7 + ,96 + ,6.5 + ,6.1 + ,7.9 + ,99.8 + ,7.7 + ,6.5 + ,7.5 + ,116.8 + ,7.9 + ,7.7 + ,6.9 + ,115.7 + ,7.5 + ,7.9 + ,6.6 + ,99.4 + ,6.9 + ,7.5 + ,6.9 + ,94.3 + ,6.6 + ,6.9 + ,7.7 + ,91 + ,6.9 + ,6.6 + ,8 + ,93.2 + ,7.7 + ,6.9 + ,8 + ,103.1 + ,8 + ,7.7 + ,7.7 + ,94.1 + ,8 + ,8 + ,7.3 + ,91.8 + ,7.7 + ,8 + ,7.4 + ,102.7 + ,7.3 + ,7.7 + ,8.1 + ,82.6 + ,7.4 + ,7.3) + ,dim=c(4 + ,58) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2') + ,1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58)) > 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 = '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 Y1 Y2 t 1 8.7 110.3 9.3 9.3 1 2 8.2 103.9 8.7 9.3 2 3 8.3 101.6 8.2 8.7 3 4 8.5 94.6 8.3 8.2 4 5 8.6 95.9 8.5 8.3 5 6 8.5 104.7 8.6 8.5 6 7 8.2 102.8 8.5 8.6 7 8 8.1 98.1 8.2 8.5 8 9 7.9 113.9 8.1 8.2 9 10 8.6 80.9 7.9 8.1 10 11 8.7 95.7 8.6 7.9 11 12 8.7 113.2 8.7 8.6 12 13 8.5 105.9 8.7 8.7 13 14 8.4 108.8 8.5 8.7 14 15 8.5 102.3 8.4 8.5 15 16 8.7 99.0 8.5 8.4 16 17 8.7 100.7 8.7 8.5 17 18 8.6 115.5 8.7 8.7 18 19 8.5 100.7 8.6 8.7 19 20 8.3 109.9 8.5 8.6 20 21 8.0 114.6 8.3 8.5 21 22 8.2 85.4 8.0 8.3 22 23 8.1 100.5 8.2 8.0 23 24 8.1 114.8 8.1 8.2 24 25 8.0 116.5 8.1 8.1 25 26 7.9 112.9 8.0 8.1 26 27 7.9 102.0 7.9 8.0 27 28 8.0 106.0 7.9 7.9 28 29 8.0 105.3 8.0 7.9 29 30 7.9 118.8 8.0 8.0 30 31 8.0 106.1 7.9 8.0 31 32 7.7 109.3 8.0 7.9 32 33 7.2 117.2 7.7 8.0 33 34 7.5 92.5 7.2 7.7 34 35 7.3 104.2 7.5 7.2 35 36 7.0 112.5 7.3 7.5 36 37 7.0 122.4 7.0 7.3 37 38 7.0 113.3 7.0 7.0 38 39 7.2 100.0 7.0 7.0 39 40 7.3 110.7 7.2 7.0 40 41 7.1 112.8 7.3 7.2 41 42 6.8 109.8 7.1 7.3 42 43 6.4 117.3 6.8 7.1 43 44 6.1 109.1 6.4 6.8 44 45 6.5 115.9 6.1 6.4 45 46 7.7 96.0 6.5 6.1 46 47 7.9 99.8 7.7 6.5 47 48 7.5 116.8 7.9 7.7 48 49 6.9 115.7 7.5 7.9 49 50 6.6 99.4 6.9 7.5 50 51 6.9 94.3 6.6 6.9 51 52 7.7 91.0 6.9 6.6 52 53 8.0 93.2 7.7 6.9 53 54 8.0 103.1 8.0 7.7 54 55 7.7 94.1 8.0 8.0 55 56 7.3 91.8 7.7 8.0 56 57 7.4 102.7 7.3 7.7 57 58 8.1 82.6 7.4 7.3 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 t 5.05137 -0.01873 1.05792 -0.41866 -0.00924 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.424773 -0.166898 -0.008002 0.173189 0.549440 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.051369 0.695912 7.259 1.73e-09 *** X -0.018734 0.003139 -5.969 2.03e-07 *** Y1 1.057922 0.099071 10.678 8.06e-15 *** Y2 -0.418658 0.098669 -4.243 8.90e-05 *** t -0.009240 0.002802 -3.298 0.00174 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2216 on 53 degrees of freedom Multiple R-squared: 0.8972, Adjusted R-squared: 0.8894 F-statistic: 115.6 on 4 and 53 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.035975585 0.071951170 0.9640244 [2,] 0.041327017 0.082654034 0.9586730 [3,] 0.106252714 0.212505428 0.8937473 [4,] 0.058728762 0.117457524 0.9412712 [5,] 0.309462315 0.618924630 0.6905377 [6,] 0.220460737 0.440921474 0.7795393 [7,] 0.146908896 0.293817791 0.8530911 [8,] 0.092896521 0.185793042 0.9071035 [9,] 0.057007907 0.114015814 0.9429921 [10,] 0.034860605 0.069721209 0.9651394 [11,] 0.027666693 0.055333386 0.9723333 [12,] 0.023340995 0.046681989 0.9766590 [13,] 0.017571471 0.035142943 0.9824285 [14,] 0.016722534 0.033445068 0.9832775 [15,] 0.018727121 0.037454243 0.9812729 [16,] 0.034360161 0.068720322 0.9656398 [17,] 0.026787931 0.053575863 0.9732121 [18,] 0.018382511 0.036765023 0.9816175 [19,] 0.012726975 0.025453951 0.9872730 [20,] 0.009677158 0.019354317 0.9903228 [21,] 0.006027415 0.012054829 0.9939726 [22,] 0.003859349 0.007718698 0.9961407 [23,] 0.004226187 0.008452373 0.9957738 [24,] 0.005274303 0.010548607 0.9947257 [25,] 0.009822588 0.019645176 0.9901774 [26,] 0.019084197 0.038168395 0.9809158 [27,] 0.025498848 0.050997697 0.9745012 [28,] 0.045853509 0.091707018 0.9541465 [29,] 0.041067997 0.082135994 0.9589320 [30,] 0.093083231 0.186166462 0.9069168 [31,] 0.074582580 0.149165159 0.9254174 [32,] 0.068918131 0.137836262 0.9310819 [33,] 0.091030445 0.182060891 0.9089696 [34,] 0.109148256 0.218296512 0.8908517 [35,] 0.190288939 0.380577878 0.8097111 [36,] 0.160804445 0.321608890 0.8391956 [37,] 0.241426492 0.482852985 0.7585735 [38,] 0.294824929 0.589649857 0.7051751 [39,] 0.825666411 0.348667177 0.1743336 [40,] 0.800972926 0.398054147 0.1990271 [41,] 0.739952490 0.520095021 0.2600475 [42,] 0.655390745 0.689218510 0.3446093 [43,] 0.498680873 0.997361745 0.5013191 > postscript(file="/var/www/html/rcomp/tmp/1pxcu1261078666.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/2d6da1261078666.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/3s4jp1261078666.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/42s951261078666.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/5h3df1261078666.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 = 58 Frequency = 1 1 2 3 4 5 -0.2209403159 -0.1968439618 0.1470744447 -0.0899438647 -0.1260684986 6 7 8 9 10 -0.0740310300 -0.2527274655 -0.1560259099 -0.0705957309 0.1901447427 11 12 13 14 15 -0.2476308438 0.2767202844 -0.0089313241 0.1662213074 0.1757516832 16 17 18 19 20 0.1755118445 0.0468807637 0.3171137347 0.0548844386 0.1004025459 21 22 23 24 25 0.0674103895 -0.0367339524 -0.1817941134 0.2848641238 0.1840859051 26 27 28 29 30 0.1316760929 0.0006431621 0.1429528731 0.0332869053 0.2373000527 31 32 33 34 35 0.2144119098 -0.1640576926 -0.1475776649 0.1022991029 -0.3959800187 36 37 38 39 40 -0.1940670927 0.2342833709 -0.0525523315 -0.0924730113 0.0056350739 41 42 43 44 45 -0.1678444702 -0.2613559691 -0.2779668235 -0.4247732019 0.2617706732 46 47 48 49 50 0.5494402101 -0.2721744628 -0.0536536014 -0.1581205323 -0.2869527205 51 52 53 54 55 -0.0070735998 0.2973705939 -0.0729152376 0.1393397452 -0.1944279108 56 57 58 -0.3108992608 0.3001115163 0.3595451226 > postscript(file="/var/www/html/rcomp/tmp/60f9j1261078666.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.2209403159 NA 1 -0.1968439618 -0.2209403159 2 0.1470744447 -0.1968439618 3 -0.0899438647 0.1470744447 4 -0.1260684986 -0.0899438647 5 -0.0740310300 -0.1260684986 6 -0.2527274655 -0.0740310300 7 -0.1560259099 -0.2527274655 8 -0.0705957309 -0.1560259099 9 0.1901447427 -0.0705957309 10 -0.2476308438 0.1901447427 11 0.2767202844 -0.2476308438 12 -0.0089313241 0.2767202844 13 0.1662213074 -0.0089313241 14 0.1757516832 0.1662213074 15 0.1755118445 0.1757516832 16 0.0468807637 0.1755118445 17 0.3171137347 0.0468807637 18 0.0548844386 0.3171137347 19 0.1004025459 0.0548844386 20 0.0674103895 0.1004025459 21 -0.0367339524 0.0674103895 22 -0.1817941134 -0.0367339524 23 0.2848641238 -0.1817941134 24 0.1840859051 0.2848641238 25 0.1316760929 0.1840859051 26 0.0006431621 0.1316760929 27 0.1429528731 0.0006431621 28 0.0332869053 0.1429528731 29 0.2373000527 0.0332869053 30 0.2144119098 0.2373000527 31 -0.1640576926 0.2144119098 32 -0.1475776649 -0.1640576926 33 0.1022991029 -0.1475776649 34 -0.3959800187 0.1022991029 35 -0.1940670927 -0.3959800187 36 0.2342833709 -0.1940670927 37 -0.0525523315 0.2342833709 38 -0.0924730113 -0.0525523315 39 0.0056350739 -0.0924730113 40 -0.1678444702 0.0056350739 41 -0.2613559691 -0.1678444702 42 -0.2779668235 -0.2613559691 43 -0.4247732019 -0.2779668235 44 0.2617706732 -0.4247732019 45 0.5494402101 0.2617706732 46 -0.2721744628 0.5494402101 47 -0.0536536014 -0.2721744628 48 -0.1581205323 -0.0536536014 49 -0.2869527205 -0.1581205323 50 -0.0070735998 -0.2869527205 51 0.2973705939 -0.0070735998 52 -0.0729152376 0.2973705939 53 0.1393397452 -0.0729152376 54 -0.1944279108 0.1393397452 55 -0.3108992608 -0.1944279108 56 0.3001115163 -0.3108992608 57 0.3595451226 0.3001115163 58 NA 0.3595451226 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.1968439618 -0.2209403159 [2,] 0.1470744447 -0.1968439618 [3,] -0.0899438647 0.1470744447 [4,] -0.1260684986 -0.0899438647 [5,] -0.0740310300 -0.1260684986 [6,] -0.2527274655 -0.0740310300 [7,] -0.1560259099 -0.2527274655 [8,] -0.0705957309 -0.1560259099 [9,] 0.1901447427 -0.0705957309 [10,] -0.2476308438 0.1901447427 [11,] 0.2767202844 -0.2476308438 [12,] -0.0089313241 0.2767202844 [13,] 0.1662213074 -0.0089313241 [14,] 0.1757516832 0.1662213074 [15,] 0.1755118445 0.1757516832 [16,] 0.0468807637 0.1755118445 [17,] 0.3171137347 0.0468807637 [18,] 0.0548844386 0.3171137347 [19,] 0.1004025459 0.0548844386 [20,] 0.0674103895 0.1004025459 [21,] -0.0367339524 0.0674103895 [22,] -0.1817941134 -0.0367339524 [23,] 0.2848641238 -0.1817941134 [24,] 0.1840859051 0.2848641238 [25,] 0.1316760929 0.1840859051 [26,] 0.0006431621 0.1316760929 [27,] 0.1429528731 0.0006431621 [28,] 0.0332869053 0.1429528731 [29,] 0.2373000527 0.0332869053 [30,] 0.2144119098 0.2373000527 [31,] -0.1640576926 0.2144119098 [32,] -0.1475776649 -0.1640576926 [33,] 0.1022991029 -0.1475776649 [34,] -0.3959800187 0.1022991029 [35,] -0.1940670927 -0.3959800187 [36,] 0.2342833709 -0.1940670927 [37,] -0.0525523315 0.2342833709 [38,] -0.0924730113 -0.0525523315 [39,] 0.0056350739 -0.0924730113 [40,] -0.1678444702 0.0056350739 [41,] -0.2613559691 -0.1678444702 [42,] -0.2779668235 -0.2613559691 [43,] -0.4247732019 -0.2779668235 [44,] 0.2617706732 -0.4247732019 [45,] 0.5494402101 0.2617706732 [46,] -0.2721744628 0.5494402101 [47,] -0.0536536014 -0.2721744628 [48,] -0.1581205323 -0.0536536014 [49,] -0.2869527205 -0.1581205323 [50,] -0.0070735998 -0.2869527205 [51,] 0.2973705939 -0.0070735998 [52,] -0.0729152376 0.2973705939 [53,] 0.1393397452 -0.0729152376 [54,] -0.1944279108 0.1393397452 [55,] -0.3108992608 -0.1944279108 [56,] 0.3001115163 -0.3108992608 [57,] 0.3595451226 0.3001115163 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.1968439618 -0.2209403159 2 0.1470744447 -0.1968439618 3 -0.0899438647 0.1470744447 4 -0.1260684986 -0.0899438647 5 -0.0740310300 -0.1260684986 6 -0.2527274655 -0.0740310300 7 -0.1560259099 -0.2527274655 8 -0.0705957309 -0.1560259099 9 0.1901447427 -0.0705957309 10 -0.2476308438 0.1901447427 11 0.2767202844 -0.2476308438 12 -0.0089313241 0.2767202844 13 0.1662213074 -0.0089313241 14 0.1757516832 0.1662213074 15 0.1755118445 0.1757516832 16 0.0468807637 0.1755118445 17 0.3171137347 0.0468807637 18 0.0548844386 0.3171137347 19 0.1004025459 0.0548844386 20 0.0674103895 0.1004025459 21 -0.0367339524 0.0674103895 22 -0.1817941134 -0.0367339524 23 0.2848641238 -0.1817941134 24 0.1840859051 0.2848641238 25 0.1316760929 0.1840859051 26 0.0006431621 0.1316760929 27 0.1429528731 0.0006431621 28 0.0332869053 0.1429528731 29 0.2373000527 0.0332869053 30 0.2144119098 0.2373000527 31 -0.1640576926 0.2144119098 32 -0.1475776649 -0.1640576926 33 0.1022991029 -0.1475776649 34 -0.3959800187 0.1022991029 35 -0.1940670927 -0.3959800187 36 0.2342833709 -0.1940670927 37 -0.0525523315 0.2342833709 38 -0.0924730113 -0.0525523315 39 0.0056350739 -0.0924730113 40 -0.1678444702 0.0056350739 41 -0.2613559691 -0.1678444702 42 -0.2779668235 -0.2613559691 43 -0.4247732019 -0.2779668235 44 0.2617706732 -0.4247732019 45 0.5494402101 0.2617706732 46 -0.2721744628 0.5494402101 47 -0.0536536014 -0.2721744628 48 -0.1581205323 -0.0536536014 49 -0.2869527205 -0.1581205323 50 -0.0070735998 -0.2869527205 51 0.2973705939 -0.0070735998 52 -0.0729152376 0.2973705939 53 0.1393397452 -0.0729152376 54 -0.1944279108 0.1393397452 55 -0.3108992608 -0.1944279108 56 0.3001115163 -0.3108992608 57 0.3595451226 0.3001115163 > 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/7hw3x1261078666.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/8upbw1261078666.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/9f0201261078666.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/107afw1261078666.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/11fo3l1261078666.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/12lm5y1261078666.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/135x361261078666.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/14xclt1261078666.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/15o28i1261078666.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/167ocq1261078666.tab") + } > > try(system("convert tmp/1pxcu1261078666.ps tmp/1pxcu1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/2d6da1261078666.ps tmp/2d6da1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/3s4jp1261078666.ps tmp/3s4jp1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/42s951261078666.ps tmp/42s951261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/5h3df1261078666.ps tmp/5h3df1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/60f9j1261078666.ps tmp/60f9j1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/7hw3x1261078666.ps tmp/7hw3x1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/8upbw1261078666.ps tmp/8upbw1261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/9f0201261078666.ps tmp/9f0201261078666.png",intern=TRUE)) character(0) > try(system("convert tmp/107afw1261078666.ps tmp/107afw1261078666.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.438 1.546 4.570