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(95.1 + ,93.8 + ,96.9 + ,98.6 + ,111.7 + ,97 + ,93.8 + ,95.1 + ,96.9 + ,98.6 + ,112.7 + ,107.6 + ,97 + ,95.1 + ,96.9 + ,102.9 + ,101 + ,112.7 + ,97 + ,95.1 + ,97.4 + ,95.4 + ,102.9 + ,112.7 + ,97 + ,111.4 + ,96.5 + ,97.4 + ,102.9 + ,112.7 + ,87.4 + ,89.2 + ,111.4 + ,97.4 + ,102.9 + ,96.8 + ,87.1 + ,87.4 + ,111.4 + ,97.4 + ,114.1 + ,110.5 + ,96.8 + ,87.4 + ,111.4 + ,110.3 + ,110.8 + ,114.1 + ,96.8 + ,87.4 + ,103.9 + ,104.2 + ,110.3 + ,114.1 + ,96.8 + ,101.6 + ,88.9 + ,103.9 + ,110.3 + ,114.1 + ,94.6 + ,89.8 + ,101.6 + ,103.9 + ,110.3 + ,95.9 + ,90 + ,94.6 + ,101.6 + ,103.9 + ,104.7 + ,93.9 + ,95.9 + ,94.6 + ,101.6 + ,102.8 + ,91.3 + ,104.7 + ,95.9 + ,94.6 + ,98.1 + ,87.8 + ,102.8 + ,104.7 + ,95.9 + ,113.9 + ,99.7 + ,98.1 + ,102.8 + ,104.7 + ,80.9 + ,73.5 + ,113.9 + ,98.1 + ,102.8 + ,95.7 + ,79.2 + ,80.9 + ,113.9 + ,98.1 + ,113.2 + ,96.9 + ,95.7 + ,80.9 + ,113.9 + ,105.9 + ,95.2 + ,113.2 + ,95.7 + ,80.9 + ,108.8 + ,95.6 + ,105.9 + ,113.2 + ,95.7 + ,102.3 + ,89.7 + ,108.8 + ,105.9 + ,113.2 + ,99 + ,92.8 + ,102.3 + ,108.8 + ,105.9 + ,100.7 + ,88 + ,99 + ,102.3 + ,108.8 + ,115.5 + ,101.1 + ,100.7 + ,99 + ,102.3 + ,100.7 + ,92.7 + ,115.5 + ,100.7 + ,99 + ,109.9 + ,95.8 + ,100.7 + ,115.5 + ,100.7 + ,114.6 + ,103.8 + ,109.9 + ,100.7 + ,115.5 + ,85.4 + ,81.8 + ,114.6 + ,109.9 + ,100.7 + ,100.5 + ,87.1 + ,85.4 + ,114.6 + ,109.9 + ,114.8 + ,105.9 + ,100.5 + ,85.4 + ,114.6 + ,116.5 + ,108.1 + ,114.8 + ,100.5 + ,85.4 + ,112.9 + ,102.6 + ,116.5 + ,114.8 + ,100.5 + ,102 + ,93.7 + ,112.9 + ,116.5 + ,114.8 + ,106 + ,103.5 + ,102 + ,112.9 + ,116.5 + ,105.3 + ,100.6 + ,106 + ,102 + ,112.9 + ,118.8 + ,113.3 + ,105.3 + ,106 + ,102 + ,106.1 + ,102.4 + ,118.8 + ,105.3 + ,106 + ,109.3 + ,102.1 + ,106.1 + ,118.8 + ,105.3 + ,117.2 + ,106.9 + ,109.3 + ,106.1 + ,118.8 + ,92.5 + ,87.3 + ,117.2 + ,109.3 + ,106.1 + ,104.2 + ,93.1 + ,92.5 + ,117.2 + ,109.3 + ,112.5 + ,109.1 + ,104.2 + ,92.5 + ,117.2 + ,122.4 + ,120.3 + ,112.5 + ,104.2 + ,92.5 + ,113.3 + ,104.9 + ,122.4 + ,112.5 + ,104.2 + ,100 + ,92.6 + ,113.3 + ,122.4 + ,112.5 + ,110.7 + ,109.8 + ,100 + ,113.3 + ,122.4 + ,112.8 + ,111.4 + ,110.7 + ,100 + ,113.3 + ,109.8 + ,117.9 + ,112.8 + ,110.7 + ,100 + ,117.3 + ,121.6 + ,109.8 + ,112.8 + ,110.7 + ,109.1 + ,117.8 + ,117.3 + ,109.8 + ,112.8 + ,115.9 + ,124.2 + ,109.1 + ,117.3 + ,109.8 + ,96 + ,106.8 + ,115.9 + ,109.1 + ,117.3 + ,99.8 + ,102.7 + ,96 + ,115.9 + ,109.1 + ,116.8 + ,116.8 + ,99.8 + ,96 + ,115.9 + ,115.7 + ,113.6 + ,116.8 + ,99.8 + ,96 + ,99.4 + ,96.1 + ,115.7 + ,116.8 + ,99.8 + ,94.3 + ,85 + ,99.4 + ,115.7 + ,116.8) + ,dim=c(5 + ,60) + ,dimnames=list(c('Y(t)' + ,'X(t)' + ,'Y(t-1)' + ,'Y(t-2)' + ,'Y(t-3)') + ,1:60)) > y <- array(NA,dim=c(5,60),dimnames=list(c('Y(t)','X(t)','Y(t-1)','Y(t-2)','Y(t-3)'),1:60)) > 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 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y(t) X(t) Y(t-1) Y(t-2) Y(t-3) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 95.1 93.8 96.9 98.6 111.7 1 0 0 0 0 0 0 0 0 0 0 2 97.0 93.8 95.1 96.9 98.6 0 1 0 0 0 0 0 0 0 0 0 3 112.7 107.6 97.0 95.1 96.9 0 0 1 0 0 0 0 0 0 0 0 4 102.9 101.0 112.7 97.0 95.1 0 0 0 1 0 0 0 0 0 0 0 5 97.4 95.4 102.9 112.7 97.0 0 0 0 0 1 0 0 0 0 0 0 6 111.4 96.5 97.4 102.9 112.7 0 0 0 0 0 1 0 0 0 0 0 7 87.4 89.2 111.4 97.4 102.9 0 0 0 0 0 0 1 0 0 0 0 8 96.8 87.1 87.4 111.4 97.4 0 0 0 0 0 0 0 1 0 0 0 9 114.1 110.5 96.8 87.4 111.4 0 0 0 0 0 0 0 0 1 0 0 10 110.3 110.8 114.1 96.8 87.4 0 0 0 0 0 0 0 0 0 1 0 11 103.9 104.2 110.3 114.1 96.8 0 0 0 0 0 0 0 0 0 0 1 12 101.6 88.9 103.9 110.3 114.1 0 0 0 0 0 0 0 0 0 0 0 13 94.6 89.8 101.6 103.9 110.3 1 0 0 0 0 0 0 0 0 0 0 14 95.9 90.0 94.6 101.6 103.9 0 1 0 0 0 0 0 0 0 0 0 15 104.7 93.9 95.9 94.6 101.6 0 0 1 0 0 0 0 0 0 0 0 16 102.8 91.3 104.7 95.9 94.6 0 0 0 1 0 0 0 0 0 0 0 17 98.1 87.8 102.8 104.7 95.9 0 0 0 0 1 0 0 0 0 0 0 18 113.9 99.7 98.1 102.8 104.7 0 0 0 0 0 1 0 0 0 0 0 19 80.9 73.5 113.9 98.1 102.8 0 0 0 0 0 0 1 0 0 0 0 20 95.7 79.2 80.9 113.9 98.1 0 0 0 0 0 0 0 1 0 0 0 21 113.2 96.9 95.7 80.9 113.9 0 0 0 0 0 0 0 0 1 0 0 22 105.9 95.2 113.2 95.7 80.9 0 0 0 0 0 0 0 0 0 1 0 23 108.8 95.6 105.9 113.2 95.7 0 0 0 0 0 0 0 0 0 0 1 24 102.3 89.7 108.8 105.9 113.2 0 0 0 0 0 0 0 0 0 0 0 25 99.0 92.8 102.3 108.8 105.9 1 0 0 0 0 0 0 0 0 0 0 26 100.7 88.0 99.0 102.3 108.8 0 1 0 0 0 0 0 0 0 0 0 27 115.5 101.1 100.7 99.0 102.3 0 0 1 0 0 0 0 0 0 0 0 28 100.7 92.7 115.5 100.7 99.0 0 0 0 1 0 0 0 0 0 0 0 29 109.9 95.8 100.7 115.5 100.7 0 0 0 0 1 0 0 0 0 0 0 30 114.6 103.8 109.9 100.7 115.5 0 0 0 0 0 1 0 0 0 0 0 31 85.4 81.8 114.6 109.9 100.7 0 0 0 0 0 0 1 0 0 0 0 32 100.5 87.1 85.4 114.6 109.9 0 0 0 0 0 0 0 1 0 0 0 33 114.8 105.9 100.5 85.4 114.6 0 0 0 0 0 0 0 0 1 0 0 34 116.5 108.1 114.8 100.5 85.4 0 0 0 0 0 0 0 0 0 1 0 35 112.9 102.6 116.5 114.8 100.5 0 0 0 0 0 0 0 0 0 0 1 36 102.0 93.7 112.9 116.5 114.8 0 0 0 0 0 0 0 0 0 0 0 37 106.0 103.5 102.0 112.9 116.5 1 0 0 0 0 0 0 0 0 0 0 38 105.3 100.6 106.0 102.0 112.9 0 1 0 0 0 0 0 0 0 0 0 39 118.8 113.3 105.3 106.0 102.0 0 0 1 0 0 0 0 0 0 0 0 40 106.1 102.4 118.8 105.3 106.0 0 0 0 1 0 0 0 0 0 0 0 41 109.3 102.1 106.1 118.8 105.3 0 0 0 0 1 0 0 0 0 0 0 42 117.2 106.9 109.3 106.1 118.8 0 0 0 0 0 1 0 0 0 0 0 43 92.5 87.3 117.2 109.3 106.1 0 0 0 0 0 0 1 0 0 0 0 44 104.2 93.1 92.5 117.2 109.3 0 0 0 0 0 0 0 1 0 0 0 45 112.5 109.1 104.2 92.5 117.2 0 0 0 0 0 0 0 0 1 0 0 46 122.4 120.3 112.5 104.2 92.5 0 0 0 0 0 0 0 0 0 1 0 47 113.3 104.9 122.4 112.5 104.2 0 0 0 0 0 0 0 0 0 0 1 48 100.0 92.6 113.3 122.4 112.5 0 0 0 0 0 0 0 0 0 0 0 49 110.7 109.8 100.0 113.3 122.4 1 0 0 0 0 0 0 0 0 0 0 50 112.8 111.4 110.7 100.0 113.3 0 1 0 0 0 0 0 0 0 0 0 51 109.8 117.9 112.8 110.7 100.0 0 0 1 0 0 0 0 0 0 0 0 52 117.3 121.6 109.8 112.8 110.7 0 0 0 1 0 0 0 0 0 0 0 53 109.1 117.8 117.3 109.8 112.8 0 0 0 0 1 0 0 0 0 0 0 54 115.9 124.2 109.1 117.3 109.8 0 0 0 0 0 1 0 0 0 0 0 55 96.0 106.8 115.9 109.1 117.3 0 0 0 0 0 0 1 0 0 0 0 56 99.8 102.7 96.0 115.9 109.1 0 0 0 0 0 0 0 1 0 0 0 57 116.8 116.8 99.8 96.0 115.9 0 0 0 0 0 0 0 0 1 0 0 58 115.7 113.6 116.8 99.8 96.0 0 0 0 0 0 0 0 0 0 1 0 59 99.4 96.1 115.7 116.8 99.8 0 0 0 0 0 0 0 0 0 0 1 60 94.3 85.0 99.4 115.7 116.8 0 0 0 0 0 0 0 0 0 0 0 > 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-3)` M1 38.18167 0.31175 -0.12622 0.05106 0.36373 -1.66303 M2 M3 M4 M5 M6 M7 2.51624 12.01548 8.22541 5.88814 10.26995 -6.51336 M8 M9 M10 M11 0.41800 8.82630 18.99128 10.51080 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.9120 -2.2479 0.3065 2.3983 6.1500 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 38.18167 16.48338 2.316 0.025257 * `X(t)` 0.31175 0.08704 3.582 0.000848 *** `Y(t-1)` -0.12622 0.11688 -1.080 0.286066 `Y(t-2)` 0.05106 0.11773 0.434 0.666652 `Y(t-3)` 0.36373 0.12578 2.892 0.005933 ** M1 -1.66303 2.76684 -0.601 0.550887 M2 2.51624 3.25014 0.774 0.442955 M3 12.01548 4.17929 2.875 0.006203 ** M4 8.22541 3.74889 2.194 0.033554 * M5 5.88814 3.07150 1.917 0.061743 . M6 10.26995 3.15341 3.257 0.002173 ** M7 -6.51336 2.85289 -2.283 0.027313 * M8 0.41800 3.23227 0.129 0.897694 M9 8.82630 4.74857 1.859 0.069762 . M10 18.99128 5.50952 3.447 0.001259 ** M11 10.51080 3.41147 3.081 0.003551 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.535 on 44 degrees of freedom Multiple R-squared: 0.8849, Adjusted R-squared: 0.8457 F-statistic: 22.56 on 15 and 44 DF, p-value: 7.966e-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.15550110 0.31100220 0.8444989 [2,] 0.06266270 0.12532540 0.9373373 [3,] 0.04573558 0.09147116 0.9542644 [4,] 0.02357337 0.04714675 0.9764266 [5,] 0.06731275 0.13462549 0.9326873 [6,] 0.03491224 0.06982447 0.9650878 [7,] 0.04145418 0.08290836 0.9585458 [8,] 0.12592326 0.25184651 0.8740767 [9,] 0.16907393 0.33814786 0.8309261 [10,] 0.14003820 0.28007640 0.8599618 [11,] 0.27681539 0.55363078 0.7231846 [12,] 0.20122783 0.40245566 0.7987722 [13,] 0.15143594 0.30287188 0.8485641 [14,] 0.09579524 0.19159049 0.9042048 [15,] 0.05685144 0.11370287 0.9431486 [16,] 0.05025443 0.10050886 0.9497456 [17,] 0.05531260 0.11062520 0.9446874 [18,] 0.04410165 0.08820330 0.9558984 [19,] 0.02463122 0.04926244 0.9753688 [20,] 0.01779728 0.03559456 0.9822027 [21,] 0.03373146 0.06746292 0.9662685 [22,] 0.02301897 0.04603795 0.9769810 [23,] 0.01464492 0.02928984 0.9853551 > postscript(file="/var/www/html/rcomp/tmp/198ke1261914350.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/24bmd1261914350.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/3yktm1261914350.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/4ad0k1261914350.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/5vhou1261914350.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 = 60 Frequency = 1 1 2 3 4 5 6 7 -4.0931172 -1.7479450 1.1006879 -0.3123833 -4.4588612 -1.0879817 -0.4165114 8 9 10 11 12 13 14 0.9633512 -0.1203963 -3.7458010 -4.3896800 1.6846635 -2.5142650 -3.8941124 15 16 17 18 19 20 21 -4.4511377 1.8399085 -0.5936230 3.4176920 -1.7058257 1.1235410 2.5031357 22 23 24 25 26 27 28 -0.9756671 3.0820887 3.3057194 2.3890623 0.2667377 4.2308313 -1.1788774 29 30 31 32 33 34 35 6.1500139 0.5078128 0.4563592 -0.2990582 1.4188451 3.9228333 4.5101321 36 37 38 39 40 41 42 1.1530469 1.9506046 0.3462044 4.0597802 -1.1673110 2.4259112 0.5896504 43 44 45 46 47 48 49 4.2363857 2.5120568 -2.7199468 2.9577849 3.7094110 0.0818097 2.2677154 50 51 52 53 54 55 56 5.0291153 -4.9401618 0.8186632 -3.5234410 -3.4271735 -2.5704078 -4.2998909 57 58 59 60 -1.0816377 -2.1591501 -6.9119518 -6.2252395 > postscript(file="/var/www/html/rcomp/tmp/6su6b1261914350.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -4.0931172 NA 1 -1.7479450 -4.0931172 2 1.1006879 -1.7479450 3 -0.3123833 1.1006879 4 -4.4588612 -0.3123833 5 -1.0879817 -4.4588612 6 -0.4165114 -1.0879817 7 0.9633512 -0.4165114 8 -0.1203963 0.9633512 9 -3.7458010 -0.1203963 10 -4.3896800 -3.7458010 11 1.6846635 -4.3896800 12 -2.5142650 1.6846635 13 -3.8941124 -2.5142650 14 -4.4511377 -3.8941124 15 1.8399085 -4.4511377 16 -0.5936230 1.8399085 17 3.4176920 -0.5936230 18 -1.7058257 3.4176920 19 1.1235410 -1.7058257 20 2.5031357 1.1235410 21 -0.9756671 2.5031357 22 3.0820887 -0.9756671 23 3.3057194 3.0820887 24 2.3890623 3.3057194 25 0.2667377 2.3890623 26 4.2308313 0.2667377 27 -1.1788774 4.2308313 28 6.1500139 -1.1788774 29 0.5078128 6.1500139 30 0.4563592 0.5078128 31 -0.2990582 0.4563592 32 1.4188451 -0.2990582 33 3.9228333 1.4188451 34 4.5101321 3.9228333 35 1.1530469 4.5101321 36 1.9506046 1.1530469 37 0.3462044 1.9506046 38 4.0597802 0.3462044 39 -1.1673110 4.0597802 40 2.4259112 -1.1673110 41 0.5896504 2.4259112 42 4.2363857 0.5896504 43 2.5120568 4.2363857 44 -2.7199468 2.5120568 45 2.9577849 -2.7199468 46 3.7094110 2.9577849 47 0.0818097 3.7094110 48 2.2677154 0.0818097 49 5.0291153 2.2677154 50 -4.9401618 5.0291153 51 0.8186632 -4.9401618 52 -3.5234410 0.8186632 53 -3.4271735 -3.5234410 54 -2.5704078 -3.4271735 55 -4.2998909 -2.5704078 56 -1.0816377 -4.2998909 57 -2.1591501 -1.0816377 58 -6.9119518 -2.1591501 59 -6.2252395 -6.9119518 60 NA -6.2252395 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.7479450 -4.0931172 [2,] 1.1006879 -1.7479450 [3,] -0.3123833 1.1006879 [4,] -4.4588612 -0.3123833 [5,] -1.0879817 -4.4588612 [6,] -0.4165114 -1.0879817 [7,] 0.9633512 -0.4165114 [8,] -0.1203963 0.9633512 [9,] -3.7458010 -0.1203963 [10,] -4.3896800 -3.7458010 [11,] 1.6846635 -4.3896800 [12,] -2.5142650 1.6846635 [13,] -3.8941124 -2.5142650 [14,] -4.4511377 -3.8941124 [15,] 1.8399085 -4.4511377 [16,] -0.5936230 1.8399085 [17,] 3.4176920 -0.5936230 [18,] -1.7058257 3.4176920 [19,] 1.1235410 -1.7058257 [20,] 2.5031357 1.1235410 [21,] -0.9756671 2.5031357 [22,] 3.0820887 -0.9756671 [23,] 3.3057194 3.0820887 [24,] 2.3890623 3.3057194 [25,] 0.2667377 2.3890623 [26,] 4.2308313 0.2667377 [27,] -1.1788774 4.2308313 [28,] 6.1500139 -1.1788774 [29,] 0.5078128 6.1500139 [30,] 0.4563592 0.5078128 [31,] -0.2990582 0.4563592 [32,] 1.4188451 -0.2990582 [33,] 3.9228333 1.4188451 [34,] 4.5101321 3.9228333 [35,] 1.1530469 4.5101321 [36,] 1.9506046 1.1530469 [37,] 0.3462044 1.9506046 [38,] 4.0597802 0.3462044 [39,] -1.1673110 4.0597802 [40,] 2.4259112 -1.1673110 [41,] 0.5896504 2.4259112 [42,] 4.2363857 0.5896504 [43,] 2.5120568 4.2363857 [44,] -2.7199468 2.5120568 [45,] 2.9577849 -2.7199468 [46,] 3.7094110 2.9577849 [47,] 0.0818097 3.7094110 [48,] 2.2677154 0.0818097 [49,] 5.0291153 2.2677154 [50,] -4.9401618 5.0291153 [51,] 0.8186632 -4.9401618 [52,] -3.5234410 0.8186632 [53,] -3.4271735 -3.5234410 [54,] -2.5704078 -3.4271735 [55,] -4.2998909 -2.5704078 [56,] -1.0816377 -4.2998909 [57,] -2.1591501 -1.0816377 [58,] -6.9119518 -2.1591501 [59,] -6.2252395 -6.9119518 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.7479450 -4.0931172 2 1.1006879 -1.7479450 3 -0.3123833 1.1006879 4 -4.4588612 -0.3123833 5 -1.0879817 -4.4588612 6 -0.4165114 -1.0879817 7 0.9633512 -0.4165114 8 -0.1203963 0.9633512 9 -3.7458010 -0.1203963 10 -4.3896800 -3.7458010 11 1.6846635 -4.3896800 12 -2.5142650 1.6846635 13 -3.8941124 -2.5142650 14 -4.4511377 -3.8941124 15 1.8399085 -4.4511377 16 -0.5936230 1.8399085 17 3.4176920 -0.5936230 18 -1.7058257 3.4176920 19 1.1235410 -1.7058257 20 2.5031357 1.1235410 21 -0.9756671 2.5031357 22 3.0820887 -0.9756671 23 3.3057194 3.0820887 24 2.3890623 3.3057194 25 0.2667377 2.3890623 26 4.2308313 0.2667377 27 -1.1788774 4.2308313 28 6.1500139 -1.1788774 29 0.5078128 6.1500139 30 0.4563592 0.5078128 31 -0.2990582 0.4563592 32 1.4188451 -0.2990582 33 3.9228333 1.4188451 34 4.5101321 3.9228333 35 1.1530469 4.5101321 36 1.9506046 1.1530469 37 0.3462044 1.9506046 38 4.0597802 0.3462044 39 -1.1673110 4.0597802 40 2.4259112 -1.1673110 41 0.5896504 2.4259112 42 4.2363857 0.5896504 43 2.5120568 4.2363857 44 -2.7199468 2.5120568 45 2.9577849 -2.7199468 46 3.7094110 2.9577849 47 0.0818097 3.7094110 48 2.2677154 0.0818097 49 5.0291153 2.2677154 50 -4.9401618 5.0291153 51 0.8186632 -4.9401618 52 -3.5234410 0.8186632 53 -3.4271735 -3.5234410 54 -2.5704078 -3.4271735 55 -4.2998909 -2.5704078 56 -1.0816377 -4.2998909 57 -2.1591501 -1.0816377 58 -6.9119518 -2.1591501 59 -6.2252395 -6.9119518 > 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/7ark81261914350.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/88rmb1261914350.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/9klai1261914350.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/10rchh1261914350.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/11u01q1261914351.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/122urg1261914351.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/1353sv1261914351.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/14ut6v1261914351.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/15hdia1261914351.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/16j7wp1261914351.tab") + } > > try(system("convert tmp/198ke1261914350.ps tmp/198ke1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/24bmd1261914350.ps tmp/24bmd1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/3yktm1261914350.ps tmp/3yktm1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/4ad0k1261914350.ps tmp/4ad0k1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/5vhou1261914350.ps tmp/5vhou1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/6su6b1261914350.ps tmp/6su6b1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/7ark81261914350.ps tmp/7ark81261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/88rmb1261914350.ps tmp/88rmb1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/9klai1261914350.ps tmp/9klai1261914350.png",intern=TRUE)) character(0) > try(system("convert tmp/10rchh1261914350.ps tmp/10rchh1261914350.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.425 1.555 3.604