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 + ,111.7 + ,97 + ,93.8 + ,98.6 + ,112.7 + ,107.6 + ,96.9 + ,102.9 + ,101 + ,95.1 + ,97.4 + ,95.4 + ,97 + ,111.4 + ,96.5 + ,112.7 + ,87.4 + ,89.2 + ,102.9 + ,96.8 + ,87.1 + ,97.4 + ,114.1 + ,110.5 + ,111.4 + ,110.3 + ,110.8 + ,87.4 + ,103.9 + ,104.2 + ,96.8 + ,101.6 + ,88.9 + ,114.1 + ,94.6 + ,89.8 + ,110.3 + ,95.9 + ,90 + ,103.9 + ,104.7 + ,93.9 + ,101.6 + ,102.8 + ,91.3 + ,94.6 + ,98.1 + ,87.8 + ,95.9 + ,113.9 + ,99.7 + ,104.7 + ,80.9 + ,73.5 + ,102.8 + ,95.7 + ,79.2 + ,98.1 + ,113.2 + ,96.9 + ,113.9 + ,105.9 + ,95.2 + ,80.9 + ,108.8 + ,95.6 + ,95.7 + ,102.3 + ,89.7 + ,113.2 + ,99 + ,92.8 + ,105.9 + ,100.7 + ,88 + ,108.8 + ,115.5 + ,101.1 + ,102.3 + ,100.7 + ,92.7 + ,99 + ,109.9 + ,95.8 + ,100.7 + ,114.6 + ,103.8 + ,115.5 + ,85.4 + ,81.8 + ,100.7 + ,100.5 + ,87.1 + ,109.9 + ,114.8 + ,105.9 + ,114.6 + ,116.5 + ,108.1 + ,85.4 + ,112.9 + ,102.6 + ,100.5 + ,102 + ,93.7 + ,114.8 + ,106 + ,103.5 + ,116.5 + ,105.3 + ,100.6 + ,112.9 + ,118.8 + ,113.3 + ,102 + ,106.1 + ,102.4 + ,106 + ,109.3 + ,102.1 + ,105.3 + ,117.2 + ,106.9 + ,118.8 + ,92.5 + ,87.3 + ,106.1 + ,104.2 + ,93.1 + ,109.3 + ,112.5 + ,109.1 + ,117.2 + ,122.4 + ,120.3 + ,92.5 + ,113.3 + ,104.9 + ,104.2 + ,100 + ,92.6 + ,112.5 + ,110.7 + ,109.8 + ,122.4 + ,112.8 + ,111.4 + ,113.3 + ,109.8 + ,117.9 + ,100 + ,117.3 + ,121.6 + ,110.7 + ,109.1 + ,117.8 + ,112.8 + ,115.9 + ,124.2 + ,109.8 + ,96 + ,106.8 + ,117.3 + ,99.8 + ,102.7 + ,109.1 + ,116.8 + ,116.8 + ,115.9 + ,115.7 + ,113.6 + ,96 + ,99.4 + ,96.1 + ,99.8 + ,94.3 + ,85 + ,116.8) + ,dim=c(3 + ,60) + ,dimnames=list(c('TIA' + ,'IAidM' + ,'TIA(t-3)') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('TIA','IAidM','TIA(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 TIA IAidM TIA(t-3) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 95.1 93.8 111.7 1 0 0 0 0 0 0 0 0 0 0 2 97.0 93.8 98.6 0 1 0 0 0 0 0 0 0 0 0 3 112.7 107.6 96.9 0 0 1 0 0 0 0 0 0 0 0 4 102.9 101.0 95.1 0 0 0 1 0 0 0 0 0 0 0 5 97.4 95.4 97.0 0 0 0 0 1 0 0 0 0 0 0 6 111.4 96.5 112.7 0 0 0 0 0 1 0 0 0 0 0 7 87.4 89.2 102.9 0 0 0 0 0 0 1 0 0 0 0 8 96.8 87.1 97.4 0 0 0 0 0 0 0 1 0 0 0 9 114.1 110.5 111.4 0 0 0 0 0 0 0 0 1 0 0 10 110.3 110.8 87.4 0 0 0 0 0 0 0 0 0 1 0 11 103.9 104.2 96.8 0 0 0 0 0 0 0 0 0 0 1 12 101.6 88.9 114.1 0 0 0 0 0 0 0 0 0 0 0 13 94.6 89.8 110.3 1 0 0 0 0 0 0 0 0 0 0 14 95.9 90.0 103.9 0 1 0 0 0 0 0 0 0 0 0 15 104.7 93.9 101.6 0 0 1 0 0 0 0 0 0 0 0 16 102.8 91.3 94.6 0 0 0 1 0 0 0 0 0 0 0 17 98.1 87.8 95.9 0 0 0 0 1 0 0 0 0 0 0 18 113.9 99.7 104.7 0 0 0 0 0 1 0 0 0 0 0 19 80.9 73.5 102.8 0 0 0 0 0 0 1 0 0 0 0 20 95.7 79.2 98.1 0 0 0 0 0 0 0 1 0 0 0 21 113.2 96.9 113.9 0 0 0 0 0 0 0 0 1 0 0 22 105.9 95.2 80.9 0 0 0 0 0 0 0 0 0 1 0 23 108.8 95.6 95.7 0 0 0 0 0 0 0 0 0 0 1 24 102.3 89.7 113.2 0 0 0 0 0 0 0 0 0 0 0 25 99.0 92.8 105.9 1 0 0 0 0 0 0 0 0 0 0 26 100.7 88.0 108.8 0 1 0 0 0 0 0 0 0 0 0 27 115.5 101.1 102.3 0 0 1 0 0 0 0 0 0 0 0 28 100.7 92.7 99.0 0 0 0 1 0 0 0 0 0 0 0 29 109.9 95.8 100.7 0 0 0 0 1 0 0 0 0 0 0 30 114.6 103.8 115.5 0 0 0 0 0 1 0 0 0 0 0 31 85.4 81.8 100.7 0 0 0 0 0 0 1 0 0 0 0 32 100.5 87.1 109.9 0 0 0 0 0 0 0 1 0 0 0 33 114.8 105.9 114.6 0 0 0 0 0 0 0 0 1 0 0 34 116.5 108.1 85.4 0 0 0 0 0 0 0 0 0 1 0 35 112.9 102.6 100.5 0 0 0 0 0 0 0 0 0 0 1 36 102.0 93.7 114.8 0 0 0 0 0 0 0 0 0 0 0 37 106.0 103.5 116.5 1 0 0 0 0 0 0 0 0 0 0 38 105.3 100.6 112.9 0 1 0 0 0 0 0 0 0 0 0 39 118.8 113.3 102.0 0 0 1 0 0 0 0 0 0 0 0 40 106.1 102.4 106.0 0 0 0 1 0 0 0 0 0 0 0 41 109.3 102.1 105.3 0 0 0 0 1 0 0 0 0 0 0 42 117.2 106.9 118.8 0 0 0 0 0 1 0 0 0 0 0 43 92.5 87.3 106.1 0 0 0 0 0 0 1 0 0 0 0 44 104.2 93.1 109.3 0 0 0 0 0 0 0 1 0 0 0 45 112.5 109.1 117.2 0 0 0 0 0 0 0 0 1 0 0 46 122.4 120.3 92.5 0 0 0 0 0 0 0 0 0 1 0 47 113.3 104.9 104.2 0 0 0 0 0 0 0 0 0 0 1 48 100.0 92.6 112.5 0 0 0 0 0 0 0 0 0 0 0 49 110.7 109.8 122.4 1 0 0 0 0 0 0 0 0 0 0 50 112.8 111.4 113.3 0 1 0 0 0 0 0 0 0 0 0 51 109.8 117.9 100.0 0 0 1 0 0 0 0 0 0 0 0 52 117.3 121.6 110.7 0 0 0 1 0 0 0 0 0 0 0 53 109.1 117.8 112.8 0 0 0 0 1 0 0 0 0 0 0 54 115.9 124.2 109.8 0 0 0 0 0 1 0 0 0 0 0 55 96.0 106.8 117.3 0 0 0 0 0 0 1 0 0 0 0 56 99.8 102.7 109.1 0 0 0 0 0 0 0 1 0 0 0 57 116.8 116.8 115.9 0 0 0 0 0 0 0 0 1 0 0 58 115.7 113.6 96.0 0 0 0 0 0 0 0 0 0 1 0 59 99.4 96.1 99.8 0 0 0 0 0 0 0 0 0 0 1 60 94.3 85.0 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) IAidM `TIA(t-3)` M1 M2 M3 34.5998 0.2982 0.3378 -1.0230 2.5685 11.8908 M4 M5 M6 M7 M8 M9 6.8543 5.8310 10.3858 -8.1153 2.6178 8.8057 M10 M11 16.9982 9.4558 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.0293 -2.2131 0.1442 2.3253 6.8809 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 34.59975 11.15105 3.103 0.003273 ** IAidM 0.29822 0.07112 4.193 0.000124 *** `TIA(t-3)` 0.33782 0.12263 2.755 0.008386 ** M1 -1.02304 2.31085 -0.443 0.660048 M2 2.56850 2.52281 1.018 0.313951 M3 11.89077 3.42996 3.467 0.001153 ** M4 6.85428 3.16283 2.167 0.035438 * M5 5.83103 2.97795 1.958 0.056303 . M6 10.38578 2.58428 4.019 0.000215 *** M7 -8.11534 2.40422 -3.375 0.001506 ** M8 2.61782 2.50453 1.045 0.301377 M9 8.80567 2.54464 3.460 0.001174 ** M10 16.99823 4.75454 3.575 0.000836 *** M11 9.45583 3.25902 2.901 0.005682 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.509 on 46 degrees of freedom Multiple R-squared: 0.8815, Adjusted R-squared: 0.848 F-statistic: 26.32 on 13 and 46 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.13001039 0.26002077 0.8699896 [2,] 0.06620626 0.13241253 0.9337937 [3,] 0.04006644 0.08013287 0.9599336 [4,] 0.01842166 0.03684333 0.9815783 [5,] 0.01817393 0.03634787 0.9818261 [6,] 0.01058148 0.02116297 0.9894185 [7,] 0.05032610 0.10065220 0.9496739 [8,] 0.02926803 0.05853606 0.9707320 [9,] 0.02070023 0.04140047 0.9792998 [10,] 0.05787740 0.11575480 0.9421226 [11,] 0.11831820 0.23663640 0.8816818 [12,] 0.08976043 0.17952087 0.9102396 [13,] 0.32753836 0.65507673 0.6724616 [14,] 0.24410011 0.48820023 0.7558999 [15,] 0.18480965 0.36961929 0.8151904 [16,] 0.12693668 0.25387336 0.8730633 [17,] 0.08547577 0.17095153 0.9145242 [18,] 0.09177752 0.18355504 0.9082225 [19,] 0.10593465 0.21186930 0.8940654 [20,] 0.07676989 0.15353978 0.9232301 [21,] 0.05589663 0.11179326 0.9441034 [22,] 0.03961512 0.07923025 0.9603849 [23,] 0.06598041 0.13196081 0.9340196 [24,] 0.06156397 0.12312793 0.9384360 [25,] 0.04394704 0.08789408 0.9560530 [26,] 0.03856003 0.07712007 0.9614400 [27,] 0.04335246 0.08670492 0.9566475 > postscript(file="/var/www/html/rcomp/tmp/1f80x1258748237.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/2elau1258748237.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/34rbp1258748237.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/4r2ie1258748237.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/5xm2w1258748237.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 -4.184580156 -1.450648402 1.385923508 -0.801246566 -4.249821500 -0.436420538 7 8 9 10 11 12 -0.447631252 0.703496821 0.107763047 -3.866530162 -3.931400338 1.942886695 13 14 15 16 17 18 -3.018745021 -3.207866056 -4.116212722 2.160408435 -0.911737339 3.811849606 19 20 21 22 23 24 -2.231778990 1.722967370 2.419013503 -1.418438072 3.904904845 2.708349837 25 26 27 28 29 30 1.973009491 0.533247322 4.300120396 -1.843518573 6.880948037 -0.359336093 31 32 33 34 35 36 0.502413099 0.180719612 1.098548782 3.814310950 4.295811244 0.674950267 37 38 39 40 41 42 2.201129483 -0.009408478 4.063170582 -1.701017723 2.848173586 0.201365556 43 44 45 46 47 48 4.137957724 2.294086786 -3.034096147 3.677477028 2.759960839 -0.220015603 49 50 51 52 53 54 3.029186203 4.134675614 -5.633001765 2.185374426 -4.567562783 -3.217458532 55 56 57 58 59 60 -1.960960582 -4.901270589 -0.591229186 -2.206819744 -7.029276590 -5.106171196 > postscript(file="/var/www/html/rcomp/tmp/660oq1258748237.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.184580156 NA 1 -1.450648402 -4.184580156 2 1.385923508 -1.450648402 3 -0.801246566 1.385923508 4 -4.249821500 -0.801246566 5 -0.436420538 -4.249821500 6 -0.447631252 -0.436420538 7 0.703496821 -0.447631252 8 0.107763047 0.703496821 9 -3.866530162 0.107763047 10 -3.931400338 -3.866530162 11 1.942886695 -3.931400338 12 -3.018745021 1.942886695 13 -3.207866056 -3.018745021 14 -4.116212722 -3.207866056 15 2.160408435 -4.116212722 16 -0.911737339 2.160408435 17 3.811849606 -0.911737339 18 -2.231778990 3.811849606 19 1.722967370 -2.231778990 20 2.419013503 1.722967370 21 -1.418438072 2.419013503 22 3.904904845 -1.418438072 23 2.708349837 3.904904845 24 1.973009491 2.708349837 25 0.533247322 1.973009491 26 4.300120396 0.533247322 27 -1.843518573 4.300120396 28 6.880948037 -1.843518573 29 -0.359336093 6.880948037 30 0.502413099 -0.359336093 31 0.180719612 0.502413099 32 1.098548782 0.180719612 33 3.814310950 1.098548782 34 4.295811244 3.814310950 35 0.674950267 4.295811244 36 2.201129483 0.674950267 37 -0.009408478 2.201129483 38 4.063170582 -0.009408478 39 -1.701017723 4.063170582 40 2.848173586 -1.701017723 41 0.201365556 2.848173586 42 4.137957724 0.201365556 43 2.294086786 4.137957724 44 -3.034096147 2.294086786 45 3.677477028 -3.034096147 46 2.759960839 3.677477028 47 -0.220015603 2.759960839 48 3.029186203 -0.220015603 49 4.134675614 3.029186203 50 -5.633001765 4.134675614 51 2.185374426 -5.633001765 52 -4.567562783 2.185374426 53 -3.217458532 -4.567562783 54 -1.960960582 -3.217458532 55 -4.901270589 -1.960960582 56 -0.591229186 -4.901270589 57 -2.206819744 -0.591229186 58 -7.029276590 -2.206819744 59 -5.106171196 -7.029276590 60 NA -5.106171196 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.450648402 -4.184580156 [2,] 1.385923508 -1.450648402 [3,] -0.801246566 1.385923508 [4,] -4.249821500 -0.801246566 [5,] -0.436420538 -4.249821500 [6,] -0.447631252 -0.436420538 [7,] 0.703496821 -0.447631252 [8,] 0.107763047 0.703496821 [9,] -3.866530162 0.107763047 [10,] -3.931400338 -3.866530162 [11,] 1.942886695 -3.931400338 [12,] -3.018745021 1.942886695 [13,] -3.207866056 -3.018745021 [14,] -4.116212722 -3.207866056 [15,] 2.160408435 -4.116212722 [16,] -0.911737339 2.160408435 [17,] 3.811849606 -0.911737339 [18,] -2.231778990 3.811849606 [19,] 1.722967370 -2.231778990 [20,] 2.419013503 1.722967370 [21,] -1.418438072 2.419013503 [22,] 3.904904845 -1.418438072 [23,] 2.708349837 3.904904845 [24,] 1.973009491 2.708349837 [25,] 0.533247322 1.973009491 [26,] 4.300120396 0.533247322 [27,] -1.843518573 4.300120396 [28,] 6.880948037 -1.843518573 [29,] -0.359336093 6.880948037 [30,] 0.502413099 -0.359336093 [31,] 0.180719612 0.502413099 [32,] 1.098548782 0.180719612 [33,] 3.814310950 1.098548782 [34,] 4.295811244 3.814310950 [35,] 0.674950267 4.295811244 [36,] 2.201129483 0.674950267 [37,] -0.009408478 2.201129483 [38,] 4.063170582 -0.009408478 [39,] -1.701017723 4.063170582 [40,] 2.848173586 -1.701017723 [41,] 0.201365556 2.848173586 [42,] 4.137957724 0.201365556 [43,] 2.294086786 4.137957724 [44,] -3.034096147 2.294086786 [45,] 3.677477028 -3.034096147 [46,] 2.759960839 3.677477028 [47,] -0.220015603 2.759960839 [48,] 3.029186203 -0.220015603 [49,] 4.134675614 3.029186203 [50,] -5.633001765 4.134675614 [51,] 2.185374426 -5.633001765 [52,] -4.567562783 2.185374426 [53,] -3.217458532 -4.567562783 [54,] -1.960960582 -3.217458532 [55,] -4.901270589 -1.960960582 [56,] -0.591229186 -4.901270589 [57,] -2.206819744 -0.591229186 [58,] -7.029276590 -2.206819744 [59,] -5.106171196 -7.029276590 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.450648402 -4.184580156 2 1.385923508 -1.450648402 3 -0.801246566 1.385923508 4 -4.249821500 -0.801246566 5 -0.436420538 -4.249821500 6 -0.447631252 -0.436420538 7 0.703496821 -0.447631252 8 0.107763047 0.703496821 9 -3.866530162 0.107763047 10 -3.931400338 -3.866530162 11 1.942886695 -3.931400338 12 -3.018745021 1.942886695 13 -3.207866056 -3.018745021 14 -4.116212722 -3.207866056 15 2.160408435 -4.116212722 16 -0.911737339 2.160408435 17 3.811849606 -0.911737339 18 -2.231778990 3.811849606 19 1.722967370 -2.231778990 20 2.419013503 1.722967370 21 -1.418438072 2.419013503 22 3.904904845 -1.418438072 23 2.708349837 3.904904845 24 1.973009491 2.708349837 25 0.533247322 1.973009491 26 4.300120396 0.533247322 27 -1.843518573 4.300120396 28 6.880948037 -1.843518573 29 -0.359336093 6.880948037 30 0.502413099 -0.359336093 31 0.180719612 0.502413099 32 1.098548782 0.180719612 33 3.814310950 1.098548782 34 4.295811244 3.814310950 35 0.674950267 4.295811244 36 2.201129483 0.674950267 37 -0.009408478 2.201129483 38 4.063170582 -0.009408478 39 -1.701017723 4.063170582 40 2.848173586 -1.701017723 41 0.201365556 2.848173586 42 4.137957724 0.201365556 43 2.294086786 4.137957724 44 -3.034096147 2.294086786 45 3.677477028 -3.034096147 46 2.759960839 3.677477028 47 -0.220015603 2.759960839 48 3.029186203 -0.220015603 49 4.134675614 3.029186203 50 -5.633001765 4.134675614 51 2.185374426 -5.633001765 52 -4.567562783 2.185374426 53 -3.217458532 -4.567562783 54 -1.960960582 -3.217458532 55 -4.901270589 -1.960960582 56 -0.591229186 -4.901270589 57 -2.206819744 -0.591229186 58 -7.029276590 -2.206819744 59 -5.106171196 -7.029276590 > 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/79uyz1258748237.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/8mmvr1258748237.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/9axdr1258748237.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/102l4y1258748237.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/112cl31258748237.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/12r8la1258748237.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/13edaq1258748237.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/14zsab1258748237.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/15znu41258748237.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/16f7tw1258748237.tab") + } > > system("convert tmp/1f80x1258748237.ps tmp/1f80x1258748237.png") > system("convert tmp/2elau1258748237.ps tmp/2elau1258748237.png") > system("convert tmp/34rbp1258748237.ps tmp/34rbp1258748237.png") > system("convert tmp/4r2ie1258748237.ps tmp/4r2ie1258748237.png") > system("convert tmp/5xm2w1258748237.ps tmp/5xm2w1258748237.png") > system("convert tmp/660oq1258748237.ps tmp/660oq1258748237.png") > system("convert tmp/79uyz1258748237.ps tmp/79uyz1258748237.png") > system("convert tmp/8mmvr1258748237.ps tmp/8mmvr1258748237.png") > system("convert tmp/9axdr1258748237.ps tmp/9axdr1258748237.png") > system("convert tmp/102l4y1258748237.ps tmp/102l4y1258748237.png") > > > proc.time() user system elapsed 2.416 1.583 2.855