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,97,93.8,112.7,107.6,102.9,101,97.4,95.4,111.4,96.5,87.4,89.2,96.8,87.1,114.1,110.5,110.3,110.8,103.9,104.2,101.6,88.9,94.6,89.8,95.9,90,104.7,93.9,102.8,91.3,98.1,87.8,113.9,99.7,80.9,73.5,95.7,79.2,113.2,96.9,105.9,95.2,108.8,95.6,102.3,89.7,99,92.8,100.7,88,115.5,101.1,100.7,92.7,109.9,95.8,114.6,103.8,85.4,81.8,100.5,87.1,114.8,105.9,116.5,108.1,112.9,102.6,102,93.7,106,103.5,105.3,100.6,118.8,113.3,106.1,102.4,109.3,102.1,117.2,106.9,92.5,87.3,104.2,93.1,112.5,109.1,122.4,120.3,113.3,104.9,100,92.6,110.7,109.8,112.8,111.4,109.8,117.9,117.3,121.6,109.1,117.8,115.9,124.2,96,106.8,99.8,102.7,116.8,116.8,115.7,113.6,99.4,96.1,94.3,85),dim=c(2,60),dimnames=list(c('TIA','IAidM'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('TIA','IAidM'),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 = '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 TIA IAidM M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 95.1 93.8 1 0 0 0 0 0 0 0 0 0 0 1 2 97.0 93.8 0 1 0 0 0 0 0 0 0 0 0 2 3 112.7 107.6 0 0 1 0 0 0 0 0 0 0 0 3 4 102.9 101.0 0 0 0 1 0 0 0 0 0 0 0 4 5 97.4 95.4 0 0 0 0 1 0 0 0 0 0 0 5 6 111.4 96.5 0 0 0 0 0 1 0 0 0 0 0 6 7 87.4 89.2 0 0 0 0 0 0 1 0 0 0 0 7 8 96.8 87.1 0 0 0 0 0 0 0 1 0 0 0 8 9 114.1 110.5 0 0 0 0 0 0 0 0 1 0 0 9 10 110.3 110.8 0 0 0 0 0 0 0 0 0 1 0 10 11 103.9 104.2 0 0 0 0 0 0 0 0 0 0 1 11 12 101.6 88.9 0 0 0 0 0 0 0 0 0 0 0 12 13 94.6 89.8 1 0 0 0 0 0 0 0 0 0 0 13 14 95.9 90.0 0 1 0 0 0 0 0 0 0 0 0 14 15 104.7 93.9 0 0 1 0 0 0 0 0 0 0 0 15 16 102.8 91.3 0 0 0 1 0 0 0 0 0 0 0 16 17 98.1 87.8 0 0 0 0 1 0 0 0 0 0 0 17 18 113.9 99.7 0 0 0 0 0 1 0 0 0 0 0 18 19 80.9 73.5 0 0 0 0 0 0 1 0 0 0 0 19 20 95.7 79.2 0 0 0 0 0 0 0 1 0 0 0 20 21 113.2 96.9 0 0 0 0 0 0 0 0 1 0 0 21 22 105.9 95.2 0 0 0 0 0 0 0 0 0 1 0 22 23 108.8 95.6 0 0 0 0 0 0 0 0 0 0 1 23 24 102.3 89.7 0 0 0 0 0 0 0 0 0 0 0 24 25 99.0 92.8 1 0 0 0 0 0 0 0 0 0 0 25 26 100.7 88.0 0 1 0 0 0 0 0 0 0 0 0 26 27 115.5 101.1 0 0 1 0 0 0 0 0 0 0 0 27 28 100.7 92.7 0 0 0 1 0 0 0 0 0 0 0 28 29 109.9 95.8 0 0 0 0 1 0 0 0 0 0 0 29 30 114.6 103.8 0 0 0 0 0 1 0 0 0 0 0 30 31 85.4 81.8 0 0 0 0 0 0 1 0 0 0 0 31 32 100.5 87.1 0 0 0 0 0 0 0 1 0 0 0 32 33 114.8 105.9 0 0 0 0 0 0 0 0 1 0 0 33 34 116.5 108.1 0 0 0 0 0 0 0 0 0 1 0 34 35 112.9 102.6 0 0 0 0 0 0 0 0 0 0 1 35 36 102.0 93.7 0 0 0 0 0 0 0 0 0 0 0 36 37 106.0 103.5 1 0 0 0 0 0 0 0 0 0 0 37 38 105.3 100.6 0 1 0 0 0 0 0 0 0 0 0 38 39 118.8 113.3 0 0 1 0 0 0 0 0 0 0 0 39 40 106.1 102.4 0 0 0 1 0 0 0 0 0 0 0 40 41 109.3 102.1 0 0 0 0 1 0 0 0 0 0 0 41 42 117.2 106.9 0 0 0 0 0 1 0 0 0 0 0 42 43 92.5 87.3 0 0 0 0 0 0 1 0 0 0 0 43 44 104.2 93.1 0 0 0 0 0 0 0 1 0 0 0 44 45 112.5 109.1 0 0 0 0 0 0 0 0 1 0 0 45 46 122.4 120.3 0 0 0 0 0 0 0 0 0 1 0 46 47 113.3 104.9 0 0 0 0 0 0 0 0 0 0 1 47 48 100.0 92.6 0 0 0 0 0 0 0 0 0 0 0 48 49 110.7 109.8 1 0 0 0 0 0 0 0 0 0 0 49 50 112.8 111.4 0 1 0 0 0 0 0 0 0 0 0 50 51 109.8 117.9 0 0 1 0 0 0 0 0 0 0 0 51 52 117.3 121.6 0 0 0 1 0 0 0 0 0 0 0 52 53 109.1 117.8 0 0 0 0 1 0 0 0 0 0 0 53 54 115.9 124.2 0 0 0 0 0 1 0 0 0 0 0 54 55 96.0 106.8 0 0 0 0 0 0 1 0 0 0 0 55 56 99.8 102.7 0 0 0 0 0 0 0 1 0 0 0 56 57 116.8 116.8 0 0 0 0 0 0 0 0 1 0 0 57 58 115.7 113.6 0 0 0 0 0 0 0 0 0 1 0 58 59 99.4 96.1 0 0 0 0 0 0 0 0 0 0 1 59 60 94.3 85.0 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) IAidM M1 M2 M3 M4 65.18435 0.37055 -1.44718 0.20803 6.42047 1.87637 M5 M6 M7 M8 M9 M10 1.38285 8.79446 -10.55236 -0.41997 7.74805 6.93384 M11 t 3.69713 0.04204 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.6369 -2.3526 0.2124 2.9141 6.6148 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 65.18435 6.18655 10.536 7.52e-14 *** IAidM 0.37055 0.07438 4.982 9.35e-06 *** M1 -1.44718 2.52705 -0.573 0.56965 M2 0.20803 2.48887 0.084 0.93375 M3 6.42047 2.78499 2.305 0.02571 * M4 1.87637 2.59930 0.722 0.47402 M5 1.38285 2.53107 0.546 0.58747 M6 8.79446 2.72307 3.230 0.00229 ** M7 -10.55236 2.36625 -4.460 5.25e-05 *** M8 -0.41997 2.36550 -0.178 0.85986 M9 7.74805 2.74506 2.823 0.00702 ** M10 6.93384 2.80086 2.476 0.01704 * M11 3.69713 2.49946 1.479 0.14591 t 0.04204 0.03648 1.152 0.25518 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.734 on 46 degrees of freedom Multiple R-squared: 0.8658, Adjusted R-squared: 0.8279 F-statistic: 22.83 on 13 and 46 DF, p-value: 8.927e-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.22421124 0.44842249 0.7757888 [2,] 0.11618349 0.23236698 0.8838165 [3,] 0.05652834 0.11305667 0.9434717 [4,] 0.02552554 0.05105108 0.9744745 [5,] 0.02801078 0.05602156 0.9719892 [6,] 0.01769785 0.03539570 0.9823021 [7,] 0.07517465 0.15034931 0.9248253 [8,] 0.04675064 0.09350129 0.9532494 [9,] 0.03609707 0.07219414 0.9639029 [10,] 0.02856037 0.05712073 0.9714396 [11,] 0.02557920 0.05115840 0.9744208 [12,] 0.05542064 0.11084127 0.9445794 [13,] 0.10653003 0.21306007 0.8934700 [14,] 0.12928271 0.25856542 0.8707173 [15,] 0.14914656 0.29829312 0.8508534 [16,] 0.10153883 0.20307765 0.8984612 [17,] 0.08083359 0.16166719 0.9191664 [18,] 0.07287655 0.14575310 0.9271235 [19,] 0.04618846 0.09237692 0.9538115 [20,] 0.05930886 0.11861773 0.9406911 [21,] 0.06195698 0.12391396 0.9380430 [22,] 0.09190861 0.18381722 0.9080914 [23,] 0.10744199 0.21488397 0.8925580 [24,] 0.26754381 0.53508762 0.7324562 [25,] 0.17560331 0.35120662 0.8243967 [26,] 0.15941622 0.31883245 0.8405838 [27,] 0.09051138 0.18102277 0.9094886 > postscript(file="/var/www/html/rcomp/tmp/1ndu51258744597.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/2lhjm1258744597.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/3rhq81258744597.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/4snjx1258744597.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/5k0em1258744597.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 -3.4370105 -3.2342622 1.0976393 -1.7546550 -4.7280780 1.4106710 -0.5795142 8 9 10 11 12 13 14 -0.5757837 -0.1567658 -3.2957595 -4.0554407 2.9690996 -2.9592531 -3.4306152 15 16 17 18 19 20 21 -2.3302466 1.2352502 -1.7163325 2.2204522 -1.7662955 0.7471275 3.4782931 22 23 24 25 26 27 28 -2.4195961 3.5268570 2.8682062 -0.1753615 1.6060377 5.2973257 -1.8879746 29 30 31 32 33 34 35 6.6147979 0.8967364 -0.8463307 2.1153132 1.2388714 2.8958284 4.5285397 36 37 38 39 40 41 42 0.5815457 2.3552779 1.0326278 3.5721367 -0.5867829 3.1758672 1.8435729 43 44 45 46 47 48 49 3.7111804 3.0875481 -2.7513474 3.7706394 3.5718179 -1.5152985 4.2163472 50 51 52 53 54 55 56 4.0262120 -7.6368552 2.9941624 -3.3462546 -6.3714325 -0.5190400 -5.3742050 57 58 59 60 -1.8090513 -0.9511121 -7.5717739 -4.9035530 > postscript(file="/var/www/html/rcomp/tmp/6pnez1258744597.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 -3.4370105 NA 1 -3.2342622 -3.4370105 2 1.0976393 -3.2342622 3 -1.7546550 1.0976393 4 -4.7280780 -1.7546550 5 1.4106710 -4.7280780 6 -0.5795142 1.4106710 7 -0.5757837 -0.5795142 8 -0.1567658 -0.5757837 9 -3.2957595 -0.1567658 10 -4.0554407 -3.2957595 11 2.9690996 -4.0554407 12 -2.9592531 2.9690996 13 -3.4306152 -2.9592531 14 -2.3302466 -3.4306152 15 1.2352502 -2.3302466 16 -1.7163325 1.2352502 17 2.2204522 -1.7163325 18 -1.7662955 2.2204522 19 0.7471275 -1.7662955 20 3.4782931 0.7471275 21 -2.4195961 3.4782931 22 3.5268570 -2.4195961 23 2.8682062 3.5268570 24 -0.1753615 2.8682062 25 1.6060377 -0.1753615 26 5.2973257 1.6060377 27 -1.8879746 5.2973257 28 6.6147979 -1.8879746 29 0.8967364 6.6147979 30 -0.8463307 0.8967364 31 2.1153132 -0.8463307 32 1.2388714 2.1153132 33 2.8958284 1.2388714 34 4.5285397 2.8958284 35 0.5815457 4.5285397 36 2.3552779 0.5815457 37 1.0326278 2.3552779 38 3.5721367 1.0326278 39 -0.5867829 3.5721367 40 3.1758672 -0.5867829 41 1.8435729 3.1758672 42 3.7111804 1.8435729 43 3.0875481 3.7111804 44 -2.7513474 3.0875481 45 3.7706394 -2.7513474 46 3.5718179 3.7706394 47 -1.5152985 3.5718179 48 4.2163472 -1.5152985 49 4.0262120 4.2163472 50 -7.6368552 4.0262120 51 2.9941624 -7.6368552 52 -3.3462546 2.9941624 53 -6.3714325 -3.3462546 54 -0.5190400 -6.3714325 55 -5.3742050 -0.5190400 56 -1.8090513 -5.3742050 57 -0.9511121 -1.8090513 58 -7.5717739 -0.9511121 59 -4.9035530 -7.5717739 60 NA -4.9035530 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.2342622 -3.4370105 [2,] 1.0976393 -3.2342622 [3,] -1.7546550 1.0976393 [4,] -4.7280780 -1.7546550 [5,] 1.4106710 -4.7280780 [6,] -0.5795142 1.4106710 [7,] -0.5757837 -0.5795142 [8,] -0.1567658 -0.5757837 [9,] -3.2957595 -0.1567658 [10,] -4.0554407 -3.2957595 [11,] 2.9690996 -4.0554407 [12,] -2.9592531 2.9690996 [13,] -3.4306152 -2.9592531 [14,] -2.3302466 -3.4306152 [15,] 1.2352502 -2.3302466 [16,] -1.7163325 1.2352502 [17,] 2.2204522 -1.7163325 [18,] -1.7662955 2.2204522 [19,] 0.7471275 -1.7662955 [20,] 3.4782931 0.7471275 [21,] -2.4195961 3.4782931 [22,] 3.5268570 -2.4195961 [23,] 2.8682062 3.5268570 [24,] -0.1753615 2.8682062 [25,] 1.6060377 -0.1753615 [26,] 5.2973257 1.6060377 [27,] -1.8879746 5.2973257 [28,] 6.6147979 -1.8879746 [29,] 0.8967364 6.6147979 [30,] -0.8463307 0.8967364 [31,] 2.1153132 -0.8463307 [32,] 1.2388714 2.1153132 [33,] 2.8958284 1.2388714 [34,] 4.5285397 2.8958284 [35,] 0.5815457 4.5285397 [36,] 2.3552779 0.5815457 [37,] 1.0326278 2.3552779 [38,] 3.5721367 1.0326278 [39,] -0.5867829 3.5721367 [40,] 3.1758672 -0.5867829 [41,] 1.8435729 3.1758672 [42,] 3.7111804 1.8435729 [43,] 3.0875481 3.7111804 [44,] -2.7513474 3.0875481 [45,] 3.7706394 -2.7513474 [46,] 3.5718179 3.7706394 [47,] -1.5152985 3.5718179 [48,] 4.2163472 -1.5152985 [49,] 4.0262120 4.2163472 [50,] -7.6368552 4.0262120 [51,] 2.9941624 -7.6368552 [52,] -3.3462546 2.9941624 [53,] -6.3714325 -3.3462546 [54,] -0.5190400 -6.3714325 [55,] -5.3742050 -0.5190400 [56,] -1.8090513 -5.3742050 [57,] -0.9511121 -1.8090513 [58,] -7.5717739 -0.9511121 [59,] -4.9035530 -7.5717739 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.2342622 -3.4370105 2 1.0976393 -3.2342622 3 -1.7546550 1.0976393 4 -4.7280780 -1.7546550 5 1.4106710 -4.7280780 6 -0.5795142 1.4106710 7 -0.5757837 -0.5795142 8 -0.1567658 -0.5757837 9 -3.2957595 -0.1567658 10 -4.0554407 -3.2957595 11 2.9690996 -4.0554407 12 -2.9592531 2.9690996 13 -3.4306152 -2.9592531 14 -2.3302466 -3.4306152 15 1.2352502 -2.3302466 16 -1.7163325 1.2352502 17 2.2204522 -1.7163325 18 -1.7662955 2.2204522 19 0.7471275 -1.7662955 20 3.4782931 0.7471275 21 -2.4195961 3.4782931 22 3.5268570 -2.4195961 23 2.8682062 3.5268570 24 -0.1753615 2.8682062 25 1.6060377 -0.1753615 26 5.2973257 1.6060377 27 -1.8879746 5.2973257 28 6.6147979 -1.8879746 29 0.8967364 6.6147979 30 -0.8463307 0.8967364 31 2.1153132 -0.8463307 32 1.2388714 2.1153132 33 2.8958284 1.2388714 34 4.5285397 2.8958284 35 0.5815457 4.5285397 36 2.3552779 0.5815457 37 1.0326278 2.3552779 38 3.5721367 1.0326278 39 -0.5867829 3.5721367 40 3.1758672 -0.5867829 41 1.8435729 3.1758672 42 3.7111804 1.8435729 43 3.0875481 3.7111804 44 -2.7513474 3.0875481 45 3.7706394 -2.7513474 46 3.5718179 3.7706394 47 -1.5152985 3.5718179 48 4.2163472 -1.5152985 49 4.0262120 4.2163472 50 -7.6368552 4.0262120 51 2.9941624 -7.6368552 52 -3.3462546 2.9941624 53 -6.3714325 -3.3462546 54 -0.5190400 -6.3714325 55 -5.3742050 -0.5190400 56 -1.8090513 -5.3742050 57 -0.9511121 -1.8090513 58 -7.5717739 -0.9511121 59 -4.9035530 -7.5717739 > 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/7rbi51258744597.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/8ff5s1258744597.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/9bh601258744597.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/10iajl1258744597.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/11q4py1258744597.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/12pwo01258744597.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/139pty1258744597.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/14fula1258744597.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/15d6f51258744597.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/16jtyt1258744597.tab") + } > > system("convert tmp/1ndu51258744597.ps tmp/1ndu51258744597.png") > system("convert tmp/2lhjm1258744597.ps tmp/2lhjm1258744597.png") > system("convert tmp/3rhq81258744597.ps tmp/3rhq81258744597.png") > system("convert tmp/4snjx1258744597.ps tmp/4snjx1258744597.png") > system("convert tmp/5k0em1258744597.ps tmp/5k0em1258744597.png") > system("convert tmp/6pnez1258744597.ps tmp/6pnez1258744597.png") > system("convert tmp/7rbi51258744597.ps tmp/7rbi51258744597.png") > system("convert tmp/8ff5s1258744597.ps tmp/8ff5s1258744597.png") > system("convert tmp/9bh601258744597.ps tmp/9bh601258744597.png") > system("convert tmp/10iajl1258744597.ps tmp/10iajl1258744597.png") > > > proc.time() user system elapsed 2.446 1.569 2.795