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.2 + ,2.4 + ,7.5 + ,8.3 + ,8.9 + ,7.4 + ,2 + ,7.2 + ,7.5 + ,8.8 + ,8.8 + ,2.1 + ,7.4 + ,7.2 + ,8.3 + ,9.3 + ,2 + ,8.8 + ,7.4 + ,7.5 + ,9.3 + ,1.8 + ,9.3 + ,8.8 + ,7.2 + ,8.7 + ,2.7 + ,9.3 + ,9.3 + ,7.4 + ,8.2 + ,2.3 + ,8.7 + ,9.3 + ,8.8 + ,8.3 + ,1.9 + ,8.2 + ,8.7 + ,9.3 + ,8.5 + ,2 + ,8.3 + ,8.2 + ,9.3 + ,8.6 + ,2.3 + ,8.5 + ,8.3 + ,8.7 + ,8.5 + ,2.8 + ,8.6 + ,8.5 + ,8.2 + ,8.2 + ,2.4 + ,8.5 + ,8.6 + ,8.3 + ,8.1 + ,2.3 + ,8.2 + ,8.5 + ,8.5 + ,7.9 + ,2.7 + ,8.1 + ,8.2 + ,8.6 + ,8.6 + ,2.7 + ,7.9 + ,8.1 + ,8.5 + ,8.7 + ,2.9 + ,8.6 + ,7.9 + ,8.2 + ,8.7 + ,3 + ,8.7 + ,8.6 + ,8.1 + ,8.5 + ,2.2 + ,8.7 + ,8.7 + ,7.9 + ,8.4 + ,2.3 + ,8.5 + ,8.7 + ,8.6 + ,8.5 + ,2.8 + ,8.4 + ,8.5 + ,8.7 + ,8.7 + ,2.8 + ,8.5 + ,8.4 + ,8.7 + ,8.7 + ,2.8 + ,8.7 + ,8.5 + ,8.5 + ,8.6 + ,2.2 + ,8.7 + ,8.7 + ,8.4 + ,8.5 + ,2.6 + ,8.6 + ,8.7 + ,8.5 + ,8.3 + ,2.8 + ,8.5 + ,8.6 + ,8.7 + ,8 + ,2.5 + ,8.3 + ,8.5 + ,8.7 + ,8.2 + ,2.4 + ,8 + ,8.3 + ,8.6 + ,8.1 + ,2.3 + ,8.2 + ,8 + ,8.5 + ,8.1 + ,1.9 + ,8.1 + ,8.2 + ,8.3 + ,8 + ,1.7 + ,8.1 + ,8.1 + ,8 + ,7.9 + ,2 + ,8 + ,8.1 + ,8.2 + ,7.9 + ,2.1 + ,7.9 + ,8 + ,8.1 + ,8 + ,1.7 + ,7.9 + ,7.9 + ,8.1 + ,8 + ,1.8 + ,8 + ,7.9 + ,8 + ,7.9 + ,1.8 + ,8 + ,8 + ,7.9 + ,8 + ,1.8 + ,7.9 + ,8 + ,7.9 + ,7.7 + ,1.3 + ,8 + ,7.9 + ,8 + ,7.2 + ,1.3 + ,7.7 + ,8 + ,8 + ,7.5 + ,1.3 + ,7.2 + ,7.7 + ,7.9 + ,7.3 + ,1.2 + ,7.5 + ,7.2 + ,8 + ,7 + ,1.4 + ,7.3 + ,7.5 + ,7.7 + ,7 + ,2.2 + ,7 + ,7.3 + ,7.2 + ,7 + ,2.9 + ,7 + ,7 + ,7.5 + ,7.2 + ,3.1 + ,7 + ,7 + ,7.3 + ,7.3 + ,3.5 + ,7.2 + ,7 + ,7 + ,7.1 + ,3.6 + ,7.3 + ,7.2 + ,7 + ,6.8 + ,4.4 + ,7.1 + ,7.3 + ,7 + ,6.4 + ,4.1 + ,6.8 + ,7.1 + ,7.2 + ,6.1 + ,5.1 + ,6.4 + ,6.8 + ,7.3 + ,6.5 + ,5.8 + ,6.1 + ,6.4 + ,7.1 + ,7.7 + ,5.9 + ,6.5 + ,6.1 + ,6.8 + ,7.9 + ,5.4 + ,7.7 + ,6.5 + ,6.4 + ,7.5 + ,5.5 + ,7.9 + ,7.7 + ,6.1 + ,6.9 + ,4.8 + ,7.5 + ,7.9 + ,6.5 + ,6.6 + ,3.2 + ,6.9 + ,7.5 + ,7.7 + ,6.9 + ,2.7 + ,6.6 + ,6.9 + ,7.9) + ,dim=c(5 + ,56) + ,dimnames=list(c('Y(t)' + ,'X(t)' + ,'Y(t-1)' + ,'Y(t-2)' + ,'Y(t-4) ') + ,1:56)) > y <- array(NA,dim=c(5,56),dimnames=list(c('Y(t)','X(t)','Y(t-1)','Y(t-2)','Y(t-4) '),1:56)) > 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(t) X(t) Y(t-1) Y(t-2) Y(t-4)\r t 1 7.2 2.4 7.5 8.3 8.9 1 2 7.4 2.0 7.2 7.5 8.8 2 3 8.8 2.1 7.4 7.2 8.3 3 4 9.3 2.0 8.8 7.4 7.5 4 5 9.3 1.8 9.3 8.8 7.2 5 6 8.7 2.7 9.3 9.3 7.4 6 7 8.2 2.3 8.7 9.3 8.8 7 8 8.3 1.9 8.2 8.7 9.3 8 9 8.5 2.0 8.3 8.2 9.3 9 10 8.6 2.3 8.5 8.3 8.7 10 11 8.5 2.8 8.6 8.5 8.2 11 12 8.2 2.4 8.5 8.6 8.3 12 13 8.1 2.3 8.2 8.5 8.5 13 14 7.9 2.7 8.1 8.2 8.6 14 15 8.6 2.7 7.9 8.1 8.5 15 16 8.7 2.9 8.6 7.9 8.2 16 17 8.7 3.0 8.7 8.6 8.1 17 18 8.5 2.2 8.7 8.7 7.9 18 19 8.4 2.3 8.5 8.7 8.6 19 20 8.5 2.8 8.4 8.5 8.7 20 21 8.7 2.8 8.5 8.4 8.7 21 22 8.7 2.8 8.7 8.5 8.5 22 23 8.6 2.2 8.7 8.7 8.4 23 24 8.5 2.6 8.6 8.7 8.5 24 25 8.3 2.8 8.5 8.6 8.7 25 26 8.0 2.5 8.3 8.5 8.7 26 27 8.2 2.4 8.0 8.3 8.6 27 28 8.1 2.3 8.2 8.0 8.5 28 29 8.1 1.9 8.1 8.2 8.3 29 30 8.0 1.7 8.1 8.1 8.0 30 31 7.9 2.0 8.0 8.1 8.2 31 32 7.9 2.1 7.9 8.0 8.1 32 33 8.0 1.7 7.9 7.9 8.1 33 34 8.0 1.8 8.0 7.9 8.0 34 35 7.9 1.8 8.0 8.0 7.9 35 36 8.0 1.8 7.9 8.0 7.9 36 37 7.7 1.3 8.0 7.9 8.0 37 38 7.2 1.3 7.7 8.0 8.0 38 39 7.5 1.3 7.2 7.7 7.9 39 40 7.3 1.2 7.5 7.2 8.0 40 41 7.0 1.4 7.3 7.5 7.7 41 42 7.0 2.2 7.0 7.3 7.2 42 43 7.0 2.9 7.0 7.0 7.5 43 44 7.2 3.1 7.0 7.0 7.3 44 45 7.3 3.5 7.2 7.0 7.0 45 46 7.1 3.6 7.3 7.2 7.0 46 47 6.8 4.4 7.1 7.3 7.0 47 48 6.4 4.1 6.8 7.1 7.2 48 49 6.1 5.1 6.4 6.8 7.3 49 50 6.5 5.8 6.1 6.4 7.1 50 51 7.7 5.9 6.5 6.1 6.8 51 52 7.9 5.4 7.7 6.5 6.4 52 53 7.5 5.5 7.9 7.7 6.1 53 54 6.9 4.8 7.5 7.9 6.5 54 55 6.6 3.2 6.9 7.5 7.7 55 56 6.9 2.7 6.6 6.9 7.9 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `X(t)` `Y(t-1)` `Y(t-2)` `Y(t-4)\r` t 2.27327 0.02721 1.21402 -0.67019 0.19691 -0.01091 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.427519 -0.185148 0.003312 0.122321 0.709617 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.273266 1.061935 2.141 0.0372 * `X(t)` 0.027206 0.041235 0.660 0.5124 `Y(t-1)` 1.214015 0.113851 10.663 1.77e-14 *** `Y(t-2)` -0.670191 0.116490 -5.753 5.28e-07 *** `Y(t-4)\r` 0.196911 0.088435 2.227 0.0305 * t -0.010905 0.003926 -2.777 0.0077 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2642 on 50 degrees of freedom Multiple R-squared: 0.8853, Adjusted R-squared: 0.8739 F-statistic: 77.22 on 5 and 50 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.83847089 0.32305823 0.16152911 [2,] 0.86465016 0.27069968 0.13534984 [3,] 0.83932589 0.32134822 0.16067411 [4,] 0.90251585 0.19496829 0.09748415 [5,] 0.86257853 0.27484294 0.13742147 [6,] 0.87326448 0.25347104 0.12673552 [7,] 0.95095926 0.09808149 0.04904074 [8,] 0.93880557 0.12238885 0.06119443 [9,] 0.91120865 0.17758269 0.08879135 [10,] 0.90126685 0.19746630 0.09873315 [11,] 0.85523391 0.28953218 0.14476609 [12,] 0.80628702 0.38742595 0.19371298 [13,] 0.75236292 0.49527417 0.24763708 [14,] 0.67644827 0.64710345 0.32355173 [15,] 0.60929199 0.78141601 0.39070801 [16,] 0.52932802 0.94134397 0.47067198 [17,] 0.46131186 0.92262372 0.53868814 [18,] 0.47662077 0.95324154 0.52337923 [19,] 0.42061404 0.84122808 0.57938596 [20,] 0.47062905 0.94125811 0.52937095 [21,] 0.39749510 0.79499020 0.60250490 [22,] 0.33994494 0.67988988 0.66005506 [23,] 0.27508203 0.55016407 0.72491797 [24,] 0.21081223 0.42162446 0.78918777 [25,] 0.16328468 0.32656937 0.83671532 [26,] 0.12229755 0.24459510 0.87770245 [27,] 0.09253325 0.18506650 0.90746675 [28,] 0.14615964 0.29231927 0.85384036 [29,] 0.14320909 0.28641818 0.85679091 [30,] 0.13676241 0.27352483 0.86323759 [31,] 0.69482451 0.61035097 0.30517549 [32,] 0.70428821 0.59142359 0.29571179 [33,] 0.66262343 0.67475314 0.33737657 [34,] 0.61593067 0.76813866 0.38406933 [35,] 0.57411099 0.85177802 0.42588901 [36,] 0.52523486 0.94953028 0.47476514 [37,] 0.39856280 0.79712559 0.60143720 [38,] 0.28854784 0.57709568 0.71145216 [39,] 0.43638502 0.87277003 0.56361498 > postscript(file="/var/www/html/rcomp/tmp/1duts1258566575.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/2zhih1258566575.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/3cv451258566575.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/4djc11258566575.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/5cgin1258566575.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 = 56 Frequency = 1 1 2 3 4 5 6 -0.422692885 -0.353162253 0.709617384 -0.184811173 0.221867933 -0.095999539 7 8 9 10 11 12 -0.121478136 0.106747122 -0.141565332 -0.096459580 -0.088065608 -0.197548503 13 14 15 16 17 18 -0.026119530 -0.325443817 0.580936282 -0.238375370 0.137232161 0.076303573 19 20 21 22 23 24 0.089453388 0.154427539 0.176912020 0.051415321 0.132373444 0.134106381 25 26 27 28 29 30 -0.045429574 -0.150578655 0.312904514 -0.197638937 0.118970513 0.027371047 31 32 33 34 35 36 0.012133530 0.094391483 0.149160019 0.055634028 0.053249257 0.285555831 37 38 39 40 41 42 -0.198047596 -0.255918929 0.480627548 -0.424737742 -0.216340438 0.101421363 43 44 45 46 47 48 -0.166848524 0.077997448 -0.005709782 -0.184888714 -0.185926650 -0.376075478 49 50 51 52 53 54 -0.427519057 0.099851961 0.680446399 -0.205022805 0.023660770 -0.005509884 55 56 -0.027034959 0.220181188 > postscript(file="/var/www/html/rcomp/tmp/6i34g1258566575.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.422692885 NA 1 -0.353162253 -0.422692885 2 0.709617384 -0.353162253 3 -0.184811173 0.709617384 4 0.221867933 -0.184811173 5 -0.095999539 0.221867933 6 -0.121478136 -0.095999539 7 0.106747122 -0.121478136 8 -0.141565332 0.106747122 9 -0.096459580 -0.141565332 10 -0.088065608 -0.096459580 11 -0.197548503 -0.088065608 12 -0.026119530 -0.197548503 13 -0.325443817 -0.026119530 14 0.580936282 -0.325443817 15 -0.238375370 0.580936282 16 0.137232161 -0.238375370 17 0.076303573 0.137232161 18 0.089453388 0.076303573 19 0.154427539 0.089453388 20 0.176912020 0.154427539 21 0.051415321 0.176912020 22 0.132373444 0.051415321 23 0.134106381 0.132373444 24 -0.045429574 0.134106381 25 -0.150578655 -0.045429574 26 0.312904514 -0.150578655 27 -0.197638937 0.312904514 28 0.118970513 -0.197638937 29 0.027371047 0.118970513 30 0.012133530 0.027371047 31 0.094391483 0.012133530 32 0.149160019 0.094391483 33 0.055634028 0.149160019 34 0.053249257 0.055634028 35 0.285555831 0.053249257 36 -0.198047596 0.285555831 37 -0.255918929 -0.198047596 38 0.480627548 -0.255918929 39 -0.424737742 0.480627548 40 -0.216340438 -0.424737742 41 0.101421363 -0.216340438 42 -0.166848524 0.101421363 43 0.077997448 -0.166848524 44 -0.005709782 0.077997448 45 -0.184888714 -0.005709782 46 -0.185926650 -0.184888714 47 -0.376075478 -0.185926650 48 -0.427519057 -0.376075478 49 0.099851961 -0.427519057 50 0.680446399 0.099851961 51 -0.205022805 0.680446399 52 0.023660770 -0.205022805 53 -0.005509884 0.023660770 54 -0.027034959 -0.005509884 55 0.220181188 -0.027034959 56 NA 0.220181188 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.353162253 -0.422692885 [2,] 0.709617384 -0.353162253 [3,] -0.184811173 0.709617384 [4,] 0.221867933 -0.184811173 [5,] -0.095999539 0.221867933 [6,] -0.121478136 -0.095999539 [7,] 0.106747122 -0.121478136 [8,] -0.141565332 0.106747122 [9,] -0.096459580 -0.141565332 [10,] -0.088065608 -0.096459580 [11,] -0.197548503 -0.088065608 [12,] -0.026119530 -0.197548503 [13,] -0.325443817 -0.026119530 [14,] 0.580936282 -0.325443817 [15,] -0.238375370 0.580936282 [16,] 0.137232161 -0.238375370 [17,] 0.076303573 0.137232161 [18,] 0.089453388 0.076303573 [19,] 0.154427539 0.089453388 [20,] 0.176912020 0.154427539 [21,] 0.051415321 0.176912020 [22,] 0.132373444 0.051415321 [23,] 0.134106381 0.132373444 [24,] -0.045429574 0.134106381 [25,] -0.150578655 -0.045429574 [26,] 0.312904514 -0.150578655 [27,] -0.197638937 0.312904514 [28,] 0.118970513 -0.197638937 [29,] 0.027371047 0.118970513 [30,] 0.012133530 0.027371047 [31,] 0.094391483 0.012133530 [32,] 0.149160019 0.094391483 [33,] 0.055634028 0.149160019 [34,] 0.053249257 0.055634028 [35,] 0.285555831 0.053249257 [36,] -0.198047596 0.285555831 [37,] -0.255918929 -0.198047596 [38,] 0.480627548 -0.255918929 [39,] -0.424737742 0.480627548 [40,] -0.216340438 -0.424737742 [41,] 0.101421363 -0.216340438 [42,] -0.166848524 0.101421363 [43,] 0.077997448 -0.166848524 [44,] -0.005709782 0.077997448 [45,] -0.184888714 -0.005709782 [46,] -0.185926650 -0.184888714 [47,] -0.376075478 -0.185926650 [48,] -0.427519057 -0.376075478 [49,] 0.099851961 -0.427519057 [50,] 0.680446399 0.099851961 [51,] -0.205022805 0.680446399 [52,] 0.023660770 -0.205022805 [53,] -0.005509884 0.023660770 [54,] -0.027034959 -0.005509884 [55,] 0.220181188 -0.027034959 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.353162253 -0.422692885 2 0.709617384 -0.353162253 3 -0.184811173 0.709617384 4 0.221867933 -0.184811173 5 -0.095999539 0.221867933 6 -0.121478136 -0.095999539 7 0.106747122 -0.121478136 8 -0.141565332 0.106747122 9 -0.096459580 -0.141565332 10 -0.088065608 -0.096459580 11 -0.197548503 -0.088065608 12 -0.026119530 -0.197548503 13 -0.325443817 -0.026119530 14 0.580936282 -0.325443817 15 -0.238375370 0.580936282 16 0.137232161 -0.238375370 17 0.076303573 0.137232161 18 0.089453388 0.076303573 19 0.154427539 0.089453388 20 0.176912020 0.154427539 21 0.051415321 0.176912020 22 0.132373444 0.051415321 23 0.134106381 0.132373444 24 -0.045429574 0.134106381 25 -0.150578655 -0.045429574 26 0.312904514 -0.150578655 27 -0.197638937 0.312904514 28 0.118970513 -0.197638937 29 0.027371047 0.118970513 30 0.012133530 0.027371047 31 0.094391483 0.012133530 32 0.149160019 0.094391483 33 0.055634028 0.149160019 34 0.053249257 0.055634028 35 0.285555831 0.053249257 36 -0.198047596 0.285555831 37 -0.255918929 -0.198047596 38 0.480627548 -0.255918929 39 -0.424737742 0.480627548 40 -0.216340438 -0.424737742 41 0.101421363 -0.216340438 42 -0.166848524 0.101421363 43 0.077997448 -0.166848524 44 -0.005709782 0.077997448 45 -0.184888714 -0.005709782 46 -0.185926650 -0.184888714 47 -0.376075478 -0.185926650 48 -0.427519057 -0.376075478 49 0.099851961 -0.427519057 50 0.680446399 0.099851961 51 -0.205022805 0.680446399 52 0.023660770 -0.205022805 53 -0.005509884 0.023660770 54 -0.027034959 -0.005509884 55 0.220181188 -0.027034959 > 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/7zgvv1258566575.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/8fy081258566575.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/9gl4i1258566575.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/10eihf1258566575.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/11ruw41258566575.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/12vx911258566575.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/136t6z1258566575.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/14etbn1258566575.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/15jdmv1258566575.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/161oaq1258566575.tab") + } > > system("convert tmp/1duts1258566575.ps tmp/1duts1258566575.png") > system("convert tmp/2zhih1258566575.ps tmp/2zhih1258566575.png") > system("convert tmp/3cv451258566575.ps tmp/3cv451258566575.png") > system("convert tmp/4djc11258566575.ps tmp/4djc11258566575.png") > system("convert tmp/5cgin1258566575.ps tmp/5cgin1258566575.png") > system("convert tmp/6i34g1258566575.ps tmp/6i34g1258566575.png") > system("convert tmp/7zgvv1258566575.ps tmp/7zgvv1258566575.png") > system("convert tmp/8fy081258566575.ps tmp/8fy081258566575.png") > system("convert tmp/9gl4i1258566575.ps tmp/9gl4i1258566575.png") > system("convert tmp/10eihf1258566575.ps tmp/10eihf1258566575.png") > > > proc.time() user system elapsed 2.439 1.578 2.858