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(105.29,0,101.23,0,102.33,0,100.26,0,104.13,0,103.54,0,100.02,0,98.66,0,108.64,0,105.67,0,102.66,0,100.3,0,95.13,0,93.2,0,102.84,0,101.36,0,102.55,0,103.12,0,96.3,0,99.13,0,102.23,0,104.3,0,99.58,0,98.45,0,96.23,0,97.62,0,102.32,0,105.23,0,100.05,0,102.66,0,100.98,0,99.2,0,98.36,0,102.56,0,97.33,0,96.22,0,99.22,0,102.32,0,104.22,0,100.06,0,107.23,0,99.62,0,98.32,1,101.23,1,102.33,1,100.6,1,95.63,1,94.63,1,95.66,1,100.78,1,90.36,1,95.45,1,103.65,1,99.89,1,97.68,1,99.62,1,98.33,1,96.23,1,102.65,1,99.35,1,92.65,1,100.6,1,97.67,1),dim=c(2,63),dimnames=list(c('Y','X'),1:63)) > y <- array(NA,dim=c(2,63),dimnames=list(c('Y','X'),1:63)) > 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 = '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 X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 105.29 0 1 0 0 0 0 0 0 0 0 0 0 1 2 101.23 0 0 1 0 0 0 0 0 0 0 0 0 2 3 102.33 0 0 0 1 0 0 0 0 0 0 0 0 3 4 100.26 0 0 0 0 1 0 0 0 0 0 0 0 4 5 104.13 0 0 0 0 0 1 0 0 0 0 0 0 5 6 103.54 0 0 0 0 0 0 1 0 0 0 0 0 6 7 100.02 0 0 0 0 0 0 0 1 0 0 0 0 7 8 98.66 0 0 0 0 0 0 0 0 1 0 0 0 8 9 108.64 0 0 0 0 0 0 0 0 0 1 0 0 9 10 105.67 0 0 0 0 0 0 0 0 0 0 1 0 10 11 102.66 0 0 0 0 0 0 0 0 0 0 0 1 11 12 100.30 0 0 0 0 0 0 0 0 0 0 0 0 12 13 95.13 0 1 0 0 0 0 0 0 0 0 0 0 13 14 93.20 0 0 1 0 0 0 0 0 0 0 0 0 14 15 102.84 0 0 0 1 0 0 0 0 0 0 0 0 15 16 101.36 0 0 0 0 1 0 0 0 0 0 0 0 16 17 102.55 0 0 0 0 0 1 0 0 0 0 0 0 17 18 103.12 0 0 0 0 0 0 1 0 0 0 0 0 18 19 96.30 0 0 0 0 0 0 0 1 0 0 0 0 19 20 99.13 0 0 0 0 0 0 0 0 1 0 0 0 20 21 102.23 0 0 0 0 0 0 0 0 0 1 0 0 21 22 104.30 0 0 0 0 0 0 0 0 0 0 1 0 22 23 99.58 0 0 0 0 0 0 0 0 0 0 0 1 23 24 98.45 0 0 0 0 0 0 0 0 0 0 0 0 24 25 96.23 0 1 0 0 0 0 0 0 0 0 0 0 25 26 97.62 0 0 1 0 0 0 0 0 0 0 0 0 26 27 102.32 0 0 0 1 0 0 0 0 0 0 0 0 27 28 105.23 0 0 0 0 1 0 0 0 0 0 0 0 28 29 100.05 0 0 0 0 0 1 0 0 0 0 0 0 29 30 102.66 0 0 0 0 0 0 1 0 0 0 0 0 30 31 100.98 0 0 0 0 0 0 0 1 0 0 0 0 31 32 99.20 0 0 0 0 0 0 0 0 1 0 0 0 32 33 98.36 0 0 0 0 0 0 0 0 0 1 0 0 33 34 102.56 0 0 0 0 0 0 0 0 0 0 1 0 34 35 97.33 0 0 0 0 0 0 0 0 0 0 0 1 35 36 96.22 0 0 0 0 0 0 0 0 0 0 0 0 36 37 99.22 0 1 0 0 0 0 0 0 0 0 0 0 37 38 102.32 0 0 1 0 0 0 0 0 0 0 0 0 38 39 104.22 0 0 0 1 0 0 0 0 0 0 0 0 39 40 100.06 0 0 0 0 1 0 0 0 0 0 0 0 40 41 107.23 0 0 0 0 0 1 0 0 0 0 0 0 41 42 99.62 0 0 0 0 0 0 1 0 0 0 0 0 42 43 98.32 1 0 0 0 0 0 0 1 0 0 0 0 43 44 101.23 1 0 0 0 0 0 0 0 1 0 0 0 44 45 102.33 1 0 0 0 0 0 0 0 0 1 0 0 45 46 100.60 1 0 0 0 0 0 0 0 0 0 1 0 46 47 95.63 1 0 0 0 0 0 0 0 0 0 0 1 47 48 94.63 1 0 0 0 0 0 0 0 0 0 0 0 48 49 95.66 1 1 0 0 0 0 0 0 0 0 0 0 49 50 100.78 1 0 1 0 0 0 0 0 0 0 0 0 50 51 90.36 1 0 0 1 0 0 0 0 0 0 0 0 51 52 95.45 1 0 0 0 1 0 0 0 0 0 0 0 52 53 103.65 1 0 0 0 0 1 0 0 0 0 0 0 53 54 99.89 1 0 0 0 0 0 1 0 0 0 0 0 54 55 97.68 1 0 0 0 0 0 0 1 0 0 0 0 55 56 99.62 1 0 0 0 0 0 0 0 1 0 0 0 56 57 98.33 1 0 0 0 0 0 0 0 0 1 0 0 57 58 96.23 1 0 0 0 0 0 0 0 0 0 1 0 58 59 102.65 1 0 0 0 0 0 0 0 0 0 0 1 59 60 99.35 1 0 0 0 0 0 0 0 0 0 0 0 60 61 92.65 1 1 0 0 0 0 0 0 0 0 0 0 61 62 100.60 1 0 1 0 0 0 0 0 0 0 0 0 62 63 97.67 1 0 0 1 0 0 0 0 0 0 0 0 63 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 99.81614 -1.16315 -0.72100 1.25069 1.95905 2.10251 M5 M6 M7 M8 M9 M10 5.19587 3.48322 0.65321 1.60457 4.05793 3.99528 M11 t 1.73664 -0.04336 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.0408 -1.8839 0.0951 1.7223 6.2382 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 99.81614 1.69538 58.875 <2e-16 *** X -1.16315 1.47918 -0.786 0.4355 M1 -0.72100 1.90516 -0.378 0.7067 M2 1.25069 1.90335 0.657 0.5142 M3 1.95905 1.90230 1.030 0.3081 M4 2.10251 1.99396 1.054 0.2969 M5 5.19587 1.99313 2.607 0.0121 * M6 3.48322 1.99302 1.748 0.0868 . M7 0.65321 1.99480 0.327 0.7447 M8 1.60457 1.99152 0.806 0.4243 M9 4.05793 1.98897 2.040 0.0467 * M10 3.99528 1.98715 2.011 0.0499 * M11 1.73664 1.98606 0.874 0.3862 t -0.04336 0.03808 -1.139 0.2604 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.14 on 49 degrees of freedom Multiple R-squared: 0.3798, Adjusted R-squared: 0.2153 F-statistic: 2.309 on 13 and 49 DF, p-value: 0.01767 > 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.8548108 0.2903785 0.1451892 [2,] 0.7829411 0.4341178 0.2170589 [3,] 0.6832005 0.6335990 0.3167995 [4,] 0.6205788 0.7588425 0.3794212 [5,] 0.5559732 0.8880536 0.4440268 [6,] 0.4687468 0.9374937 0.5312532 [7,] 0.3549768 0.7099536 0.6450232 [8,] 0.2609714 0.5219429 0.7390286 [9,] 0.1800207 0.3600414 0.8199793 [10,] 0.2199544 0.4399088 0.7800456 [11,] 0.2016052 0.4032104 0.7983948 [12,] 0.4186514 0.8373027 0.5813486 [13,] 0.4216736 0.8433473 0.5783264 [14,] 0.3503122 0.7006245 0.6496878 [15,] 0.3454867 0.6909733 0.6545133 [16,] 0.3021261 0.6042522 0.6978739 [17,] 0.3745993 0.7491986 0.6254007 [18,] 0.2920514 0.5841029 0.7079486 [19,] 0.2927360 0.5854720 0.7072640 [20,] 0.2859160 0.5718319 0.7140840 [21,] 0.2330204 0.4660407 0.7669796 [22,] 0.3078558 0.6157115 0.6921442 [23,] 0.4271413 0.8542827 0.5728587 [24,] 0.3464899 0.6929798 0.6535101 [25,] 0.3543298 0.7086596 0.6456702 [26,] 0.2612805 0.5225611 0.7387195 [27,] 0.1759100 0.3518200 0.8240900 [28,] 0.1212082 0.2424164 0.8787918 [29,] 0.1182676 0.2365352 0.8817324 [30,] 0.1851582 0.3703164 0.8148418 > postscript(file="/var/www/html/rcomp/tmp/183rg1258990276.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/2xmjj1258990276.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/3nu5l1258990276.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/4lp2d1258990276.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/5f5ht1258990276.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 = 63 Frequency = 1 1 2 3 4 5 6 6.23821911 0.24988577 0.68488577 -1.48521495 -0.66521495 0.50078505 7 8 9 10 11 12 -0.14584424 -2.41384424 5.15615576 2.29215576 1.58415576 1.00415576 13 14 15 16 17 18 -3.40148806 -7.25982139 1.71517861 0.13507788 -1.72492212 0.60107788 19 20 21 22 23 24 -3.34555140 -1.42355140 -0.73355140 1.44244860 -0.97555140 -0.32555140 25 26 27 28 29 30 -1.78119522 -2.31952856 1.71547144 4.52537072 -3.70462928 0.66137072 31 32 33 34 35 36 1.85474143 -0.83325857 -4.08325857 0.22274143 -2.70525857 -2.03525857 37 38 39 40 41 42 1.72909761 2.90076428 4.13576428 -0.12433645 3.99566355 -1.85833645 43 44 45 46 47 48 0.87818069 2.88018069 1.57018069 -0.05381931 -2.72181931 -1.94181931 49 50 51 52 53 54 -0.14746314 3.04420353 -8.04079647 -3.05089720 2.09910280 0.09510280 55 56 57 58 59 60 0.75847352 1.79047352 -1.90952648 -3.90352648 4.81847352 3.29847352 61 62 63 -2.63717030 3.38449637 -0.21050363 > postscript(file="/var/www/html/rcomp/tmp/6v8m01258990276.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 = 63 Frequency = 1 lag(myerror, k = 1) myerror 0 6.23821911 NA 1 0.24988577 6.23821911 2 0.68488577 0.24988577 3 -1.48521495 0.68488577 4 -0.66521495 -1.48521495 5 0.50078505 -0.66521495 6 -0.14584424 0.50078505 7 -2.41384424 -0.14584424 8 5.15615576 -2.41384424 9 2.29215576 5.15615576 10 1.58415576 2.29215576 11 1.00415576 1.58415576 12 -3.40148806 1.00415576 13 -7.25982139 -3.40148806 14 1.71517861 -7.25982139 15 0.13507788 1.71517861 16 -1.72492212 0.13507788 17 0.60107788 -1.72492212 18 -3.34555140 0.60107788 19 -1.42355140 -3.34555140 20 -0.73355140 -1.42355140 21 1.44244860 -0.73355140 22 -0.97555140 1.44244860 23 -0.32555140 -0.97555140 24 -1.78119522 -0.32555140 25 -2.31952856 -1.78119522 26 1.71547144 -2.31952856 27 4.52537072 1.71547144 28 -3.70462928 4.52537072 29 0.66137072 -3.70462928 30 1.85474143 0.66137072 31 -0.83325857 1.85474143 32 -4.08325857 -0.83325857 33 0.22274143 -4.08325857 34 -2.70525857 0.22274143 35 -2.03525857 -2.70525857 36 1.72909761 -2.03525857 37 2.90076428 1.72909761 38 4.13576428 2.90076428 39 -0.12433645 4.13576428 40 3.99566355 -0.12433645 41 -1.85833645 3.99566355 42 0.87818069 -1.85833645 43 2.88018069 0.87818069 44 1.57018069 2.88018069 45 -0.05381931 1.57018069 46 -2.72181931 -0.05381931 47 -1.94181931 -2.72181931 48 -0.14746314 -1.94181931 49 3.04420353 -0.14746314 50 -8.04079647 3.04420353 51 -3.05089720 -8.04079647 52 2.09910280 -3.05089720 53 0.09510280 2.09910280 54 0.75847352 0.09510280 55 1.79047352 0.75847352 56 -1.90952648 1.79047352 57 -3.90352648 -1.90952648 58 4.81847352 -3.90352648 59 3.29847352 4.81847352 60 -2.63717030 3.29847352 61 3.38449637 -2.63717030 62 -0.21050363 3.38449637 63 NA -0.21050363 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.24988577 6.23821911 [2,] 0.68488577 0.24988577 [3,] -1.48521495 0.68488577 [4,] -0.66521495 -1.48521495 [5,] 0.50078505 -0.66521495 [6,] -0.14584424 0.50078505 [7,] -2.41384424 -0.14584424 [8,] 5.15615576 -2.41384424 [9,] 2.29215576 5.15615576 [10,] 1.58415576 2.29215576 [11,] 1.00415576 1.58415576 [12,] -3.40148806 1.00415576 [13,] -7.25982139 -3.40148806 [14,] 1.71517861 -7.25982139 [15,] 0.13507788 1.71517861 [16,] -1.72492212 0.13507788 [17,] 0.60107788 -1.72492212 [18,] -3.34555140 0.60107788 [19,] -1.42355140 -3.34555140 [20,] -0.73355140 -1.42355140 [21,] 1.44244860 -0.73355140 [22,] -0.97555140 1.44244860 [23,] -0.32555140 -0.97555140 [24,] -1.78119522 -0.32555140 [25,] -2.31952856 -1.78119522 [26,] 1.71547144 -2.31952856 [27,] 4.52537072 1.71547144 [28,] -3.70462928 4.52537072 [29,] 0.66137072 -3.70462928 [30,] 1.85474143 0.66137072 [31,] -0.83325857 1.85474143 [32,] -4.08325857 -0.83325857 [33,] 0.22274143 -4.08325857 [34,] -2.70525857 0.22274143 [35,] -2.03525857 -2.70525857 [36,] 1.72909761 -2.03525857 [37,] 2.90076428 1.72909761 [38,] 4.13576428 2.90076428 [39,] -0.12433645 4.13576428 [40,] 3.99566355 -0.12433645 [41,] -1.85833645 3.99566355 [42,] 0.87818069 -1.85833645 [43,] 2.88018069 0.87818069 [44,] 1.57018069 2.88018069 [45,] -0.05381931 1.57018069 [46,] -2.72181931 -0.05381931 [47,] -1.94181931 -2.72181931 [48,] -0.14746314 -1.94181931 [49,] 3.04420353 -0.14746314 [50,] -8.04079647 3.04420353 [51,] -3.05089720 -8.04079647 [52,] 2.09910280 -3.05089720 [53,] 0.09510280 2.09910280 [54,] 0.75847352 0.09510280 [55,] 1.79047352 0.75847352 [56,] -1.90952648 1.79047352 [57,] -3.90352648 -1.90952648 [58,] 4.81847352 -3.90352648 [59,] 3.29847352 4.81847352 [60,] -2.63717030 3.29847352 [61,] 3.38449637 -2.63717030 [62,] -0.21050363 3.38449637 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.24988577 6.23821911 2 0.68488577 0.24988577 3 -1.48521495 0.68488577 4 -0.66521495 -1.48521495 5 0.50078505 -0.66521495 6 -0.14584424 0.50078505 7 -2.41384424 -0.14584424 8 5.15615576 -2.41384424 9 2.29215576 5.15615576 10 1.58415576 2.29215576 11 1.00415576 1.58415576 12 -3.40148806 1.00415576 13 -7.25982139 -3.40148806 14 1.71517861 -7.25982139 15 0.13507788 1.71517861 16 -1.72492212 0.13507788 17 0.60107788 -1.72492212 18 -3.34555140 0.60107788 19 -1.42355140 -3.34555140 20 -0.73355140 -1.42355140 21 1.44244860 -0.73355140 22 -0.97555140 1.44244860 23 -0.32555140 -0.97555140 24 -1.78119522 -0.32555140 25 -2.31952856 -1.78119522 26 1.71547144 -2.31952856 27 4.52537072 1.71547144 28 -3.70462928 4.52537072 29 0.66137072 -3.70462928 30 1.85474143 0.66137072 31 -0.83325857 1.85474143 32 -4.08325857 -0.83325857 33 0.22274143 -4.08325857 34 -2.70525857 0.22274143 35 -2.03525857 -2.70525857 36 1.72909761 -2.03525857 37 2.90076428 1.72909761 38 4.13576428 2.90076428 39 -0.12433645 4.13576428 40 3.99566355 -0.12433645 41 -1.85833645 3.99566355 42 0.87818069 -1.85833645 43 2.88018069 0.87818069 44 1.57018069 2.88018069 45 -0.05381931 1.57018069 46 -2.72181931 -0.05381931 47 -1.94181931 -2.72181931 48 -0.14746314 -1.94181931 49 3.04420353 -0.14746314 50 -8.04079647 3.04420353 51 -3.05089720 -8.04079647 52 2.09910280 -3.05089720 53 0.09510280 2.09910280 54 0.75847352 0.09510280 55 1.79047352 0.75847352 56 -1.90952648 1.79047352 57 -3.90352648 -1.90952648 58 4.81847352 -3.90352648 59 3.29847352 4.81847352 60 -2.63717030 3.29847352 61 3.38449637 -2.63717030 62 -0.21050363 3.38449637 > 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/7sm4f1258990276.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/80qe01258990276.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/9l6g61258990276.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/10y2651258990276.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/11o9wh1258990276.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/127wuj1258990276.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/13de8r1258990276.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/14ifha1258990276.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/15aerv1258990276.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/16joct1258990276.tab") + } > > system("convert tmp/183rg1258990276.ps tmp/183rg1258990276.png") > system("convert tmp/2xmjj1258990276.ps tmp/2xmjj1258990276.png") > system("convert tmp/3nu5l1258990276.ps tmp/3nu5l1258990276.png") > system("convert tmp/4lp2d1258990276.ps tmp/4lp2d1258990276.png") > system("convert tmp/5f5ht1258990276.ps tmp/5f5ht1258990276.png") > system("convert tmp/6v8m01258990276.ps tmp/6v8m01258990276.png") > system("convert tmp/7sm4f1258990276.ps tmp/7sm4f1258990276.png") > system("convert tmp/80qe01258990276.ps tmp/80qe01258990276.png") > system("convert tmp/9l6g61258990276.ps tmp/9l6g61258990276.png") > system("convert tmp/10y2651258990276.ps tmp/10y2651258990276.png") > > > proc.time() user system elapsed 2.450 1.596 3.568