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(8.8 + ,99.4 + ,8.9 + ,8.6 + ,8.4 + ,8.4 + ,8.4 + ,8.3 + ,99.8 + ,8.8 + ,8.9 + ,8.6 + ,8.4 + ,8.4 + ,7.5 + ,99.9 + ,8.3 + ,8.8 + ,8.9 + ,8.6 + ,8.4 + ,7.2 + ,100 + ,7.5 + ,8.3 + ,8.8 + ,8.9 + ,8.6 + ,7.4 + ,100.1 + ,7.2 + ,7.5 + ,8.3 + ,8.8 + ,8.9 + ,8.8 + ,100.1 + ,7.4 + ,7.2 + ,7.5 + ,8.3 + ,8.8 + ,9.3 + ,100.2 + ,8.8 + ,7.4 + ,7.2 + ,7.5 + ,8.3 + ,9.3 + ,100.3 + ,9.3 + ,8.8 + ,7.4 + ,7.2 + ,7.5 + ,8.7 + ,100 + ,9.3 + ,9.3 + ,8.8 + ,7.4 + ,7.2 + ,8.2 + ,99.9 + ,8.7 + ,9.3 + ,9.3 + ,8.8 + ,7.4 + ,8.3 + ,99.4 + ,8.2 + ,8.7 + ,9.3 + ,9.3 + ,8.8 + ,8.5 + ,99.8 + ,8.3 + ,8.2 + ,8.7 + ,9.3 + ,9.3 + ,8.6 + ,99.6 + ,8.5 + ,8.3 + ,8.2 + ,8.7 + ,9.3 + ,8.5 + ,100 + ,8.6 + ,8.5 + ,8.3 + ,8.2 + ,8.7 + ,8.2 + ,99.9 + ,8.5 + ,8.6 + ,8.5 + ,8.3 + ,8.2 + ,8.1 + ,100.3 + ,8.2 + ,8.5 + ,8.6 + ,8.5 + ,8.3 + ,7.9 + ,100.6 + ,8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.7 + ,6.9 + ,6.6 + ,6.9 + ,7.5 + ,8 + ,106.4 + ,8 + ,7.7 + ,6.9 + ,6.6 + ,6.9 + ,7.7 + ,106 + ,8 + ,8 + ,7.7 + ,6.9 + ,6.6 + ,7.3 + ,106 + ,7.7 + ,8 + ,8 + ,7.7 + ,6.9 + ,7.4 + ,106 + ,7.3 + ,7.7 + ,8 + ,8 + ,7.7 + ,8.1 + ,106 + ,7.4 + ,7.3 + ,7.7 + ,8 + ,8 + ,8.3 + ,106.1 + ,8.1 + ,7.4 + ,7.3 + ,7.7 + ,8 + ,8.2 + ,106.1 + ,8.3 + ,8.1 + ,7.4 + ,7.3 + ,7.7) + ,dim=c(7 + ,68) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4' + ,'Y5') + ,1:68)) > y <- array(NA,dim=c(7,68),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4','Y5'),1:68)) > 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 Y1 Y2 Y3 Y4 Y5 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 8.8 99.4 8.9 8.6 8.4 8.4 8.4 1 0 0 0 0 0 0 0 0 0 0 1 2 8.3 99.8 8.8 8.9 8.6 8.4 8.4 0 1 0 0 0 0 0 0 0 0 0 2 3 7.5 99.9 8.3 8.8 8.9 8.6 8.4 0 0 1 0 0 0 0 0 0 0 0 3 4 7.2 100.0 7.5 8.3 8.8 8.9 8.6 0 0 0 1 0 0 0 0 0 0 0 4 5 7.4 100.1 7.2 7.5 8.3 8.8 8.9 0 0 0 0 1 0 0 0 0 0 0 5 6 8.8 100.1 7.4 7.2 7.5 8.3 8.8 0 0 0 0 0 1 0 0 0 0 0 6 7 9.3 100.2 8.8 7.4 7.2 7.5 8.3 0 0 0 0 0 0 1 0 0 0 0 7 8 9.3 100.3 9.3 8.8 7.4 7.2 7.5 0 0 0 0 0 0 0 1 0 0 0 8 9 8.7 100.0 9.3 9.3 8.8 7.4 7.2 0 0 0 0 0 0 0 0 1 0 0 9 10 8.2 99.9 8.7 9.3 9.3 8.8 7.4 0 0 0 0 0 0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 0 0 0 1 0 0 0 0 67 68 8.2 106.1 8.3 8.1 7.4 7.3 7.7 0 0 0 0 0 0 0 1 0 0 0 68 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 19.42508 -0.17458 1.38018 -0.69401 -0.20040 0.21750 Y5 M1 M2 M3 M4 M5 0.05085 -0.22626 -0.12951 -0.14849 -0.16973 -0.11923 M6 M7 M8 M9 M10 M11 0.48905 -0.41556 -0.10456 0.01589 -0.03509 0.05062 t 0.01621 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.266644 -0.105373 -0.002965 0.105067 0.344305 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 19.425085 6.034377 3.219 0.002284 ** X -0.174580 0.055399 -3.151 0.002771 ** Y1 1.380180 0.146104 9.447 1.29e-12 *** Y2 -0.694005 0.247281 -2.807 0.007166 ** Y3 -0.200396 0.270402 -0.741 0.462167 Y4 0.217500 0.248385 0.876 0.385489 Y5 0.050848 0.134054 0.379 0.706096 M1 -0.226258 0.102885 -2.199 0.032619 * M2 -0.129506 0.116627 -1.110 0.272234 M3 -0.148491 0.113998 -1.303 0.198810 M4 -0.169728 0.108223 -1.568 0.123242 M5 -0.119228 0.106469 -1.120 0.268240 M6 0.489047 0.103489 4.726 1.97e-05 *** M7 -0.415558 0.118310 -3.512 0.000965 *** M8 -0.104561 0.152152 -0.687 0.495186 M9 0.015894 0.162364 0.098 0.922420 M10 -0.035093 0.131428 -0.267 0.790577 M11 0.050620 0.107891 0.469 0.641027 t 0.016213 0.005522 2.936 0.005048 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.1614 on 49 degrees of freedom Multiple R-squared: 0.9608, Adjusted R-squared: 0.9465 F-statistic: 66.81 on 18 and 49 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.071080176 0.14216035 0.9289198 [2,] 0.033191866 0.06638373 0.9668081 [3,] 0.016336398 0.03267280 0.9836636 [4,] 0.006053379 0.01210676 0.9939466 [5,] 0.005140485 0.01028097 0.9948595 [6,] 0.139111180 0.27822236 0.8608888 [7,] 0.091482107 0.18296421 0.9085179 [8,] 0.087107570 0.17421514 0.9128924 [9,] 0.158212515 0.31642503 0.8417875 [10,] 0.122116624 0.24423325 0.8778834 [11,] 0.169047755 0.33809551 0.8309522 [12,] 0.235731316 0.47146263 0.7642687 [13,] 0.208334747 0.41666949 0.7916653 [14,] 0.256393033 0.51278607 0.7436070 [15,] 0.191962711 0.38392542 0.8080373 [16,] 0.150430187 0.30086037 0.8495698 [17,] 0.125460807 0.25092161 0.8745392 [18,] 0.382323428 0.76464686 0.6176766 [19,] 0.468394710 0.93678942 0.5316053 [20,] 0.764225821 0.47154836 0.2357742 [21,] 0.665277536 0.66944493 0.3347225 [22,] 0.674366110 0.65126778 0.3256339 [23,] 0.664693882 0.67061224 0.3353061 [24,] 0.560692153 0.87861569 0.4393078 [25,] 0.436604016 0.87320803 0.5633960 > postscript(file="/var/www/html/rcomp/tmp/1o46p1258479363.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/2npuh1258479363.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/3kb721258479363.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/4lucb1258479363.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/559301258479363.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 = 68 Frequency = 1 1 2 3 4 5 0.0522378625 -0.1045961994 -0.2470581652 0.1371059755 0.0529972242 6 7 8 9 10 0.2977889487 0.0494913261 0.1672645932 -0.0224652676 0.1084877199 11 12 13 14 15 0.1130211242 -0.2134234332 -0.1146289330 -0.0976805505 -0.1611951055 16 17 18 19 20 0.1297690451 -0.2067136480 0.0494379774 0.0006546036 0.0181556639 21 22 23 24 25 -0.0951656544 0.0808934905 0.0208403641 -0.0322520634 0.0295330555 26 27 28 29 30 0.0247864454 0.1239060206 0.0362524515 -0.1191191445 -0.2666439161 31 32 33 34 35 0.1813865470 0.1892935462 -0.0361922819 -0.0291436804 -0.0683302527 36 37 38 39 40 0.1039263908 0.1252891587 0.0260175532 0.3443054242 -0.1449233521 41 42 43 44 45 -0.2183910228 0.0157149486 -0.1337350377 -0.2294504394 0.1630894981 46 47 48 49 50 -0.1077015282 -0.0065854324 -0.0727957944 -0.0292559218 -0.0217889910 51 52 53 54 55 -0.1846827841 -0.1728714131 0.2053309948 0.0332880912 -0.1624259093 56 57 58 59 60 -0.1147436672 -0.0092662942 -0.0525360018 -0.0589458032 0.2145449003 61 62 63 64 65 -0.0631752219 0.1732617424 0.1247246101 0.0146672930 0.2858955962 66 67 68 -0.1295860499 0.0646284702 -0.0305196967 > postscript(file="/var/www/html/rcomp/tmp/67z151258479363.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 = 68 Frequency = 1 lag(myerror, k = 1) myerror 0 0.0522378625 NA 1 -0.1045961994 0.0522378625 2 -0.2470581652 -0.1045961994 3 0.1371059755 -0.2470581652 4 0.0529972242 0.1371059755 5 0.2977889487 0.0529972242 6 0.0494913261 0.2977889487 7 0.1672645932 0.0494913261 8 -0.0224652676 0.1672645932 9 0.1084877199 -0.0224652676 10 0.1130211242 0.1084877199 11 -0.2134234332 0.1130211242 12 -0.1146289330 -0.2134234332 13 -0.0976805505 -0.1146289330 14 -0.1611951055 -0.0976805505 15 0.1297690451 -0.1611951055 16 -0.2067136480 0.1297690451 17 0.0494379774 -0.2067136480 18 0.0006546036 0.0494379774 19 0.0181556639 0.0006546036 20 -0.0951656544 0.0181556639 21 0.0808934905 -0.0951656544 22 0.0208403641 0.0808934905 23 -0.0322520634 0.0208403641 24 0.0295330555 -0.0322520634 25 0.0247864454 0.0295330555 26 0.1239060206 0.0247864454 27 0.0362524515 0.1239060206 28 -0.1191191445 0.0362524515 29 -0.2666439161 -0.1191191445 30 0.1813865470 -0.2666439161 31 0.1892935462 0.1813865470 32 -0.0361922819 0.1892935462 33 -0.0291436804 -0.0361922819 34 -0.0683302527 -0.0291436804 35 0.1039263908 -0.0683302527 36 0.1252891587 0.1039263908 37 0.0260175532 0.1252891587 38 0.3443054242 0.0260175532 39 -0.1449233521 0.3443054242 40 -0.2183910228 -0.1449233521 41 0.0157149486 -0.2183910228 42 -0.1337350377 0.0157149486 43 -0.2294504394 -0.1337350377 44 0.1630894981 -0.2294504394 45 -0.1077015282 0.1630894981 46 -0.0065854324 -0.1077015282 47 -0.0727957944 -0.0065854324 48 -0.0292559218 -0.0727957944 49 -0.0217889910 -0.0292559218 50 -0.1846827841 -0.0217889910 51 -0.1728714131 -0.1846827841 52 0.2053309948 -0.1728714131 53 0.0332880912 0.2053309948 54 -0.1624259093 0.0332880912 55 -0.1147436672 -0.1624259093 56 -0.0092662942 -0.1147436672 57 -0.0525360018 -0.0092662942 58 -0.0589458032 -0.0525360018 59 0.2145449003 -0.0589458032 60 -0.0631752219 0.2145449003 61 0.1732617424 -0.0631752219 62 0.1247246101 0.1732617424 63 0.0146672930 0.1247246101 64 0.2858955962 0.0146672930 65 -0.1295860499 0.2858955962 66 0.0646284702 -0.1295860499 67 -0.0305196967 0.0646284702 68 NA -0.0305196967 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.1045961994 0.0522378625 [2,] -0.2470581652 -0.1045961994 [3,] 0.1371059755 -0.2470581652 [4,] 0.0529972242 0.1371059755 [5,] 0.2977889487 0.0529972242 [6,] 0.0494913261 0.2977889487 [7,] 0.1672645932 0.0494913261 [8,] -0.0224652676 0.1672645932 [9,] 0.1084877199 -0.0224652676 [10,] 0.1130211242 0.1084877199 [11,] -0.2134234332 0.1130211242 [12,] -0.1146289330 -0.2134234332 [13,] -0.0976805505 -0.1146289330 [14,] -0.1611951055 -0.0976805505 [15,] 0.1297690451 -0.1611951055 [16,] -0.2067136480 0.1297690451 [17,] 0.0494379774 -0.2067136480 [18,] 0.0006546036 0.0494379774 [19,] 0.0181556639 0.0006546036 [20,] -0.0951656544 0.0181556639 [21,] 0.0808934905 -0.0951656544 [22,] 0.0208403641 0.0808934905 [23,] -0.0322520634 0.0208403641 [24,] 0.0295330555 -0.0322520634 [25,] 0.0247864454 0.0295330555 [26,] 0.1239060206 0.0247864454 [27,] 0.0362524515 0.1239060206 [28,] -0.1191191445 0.0362524515 [29,] -0.2666439161 -0.1191191445 [30,] 0.1813865470 -0.2666439161 [31,] 0.1892935462 0.1813865470 [32,] -0.0361922819 0.1892935462 [33,] -0.0291436804 -0.0361922819 [34,] -0.0683302527 -0.0291436804 [35,] 0.1039263908 -0.0683302527 [36,] 0.1252891587 0.1039263908 [37,] 0.0260175532 0.1252891587 [38,] 0.3443054242 0.0260175532 [39,] -0.1449233521 0.3443054242 [40,] -0.2183910228 -0.1449233521 [41,] 0.0157149486 -0.2183910228 [42,] -0.1337350377 0.0157149486 [43,] -0.2294504394 -0.1337350377 [44,] 0.1630894981 -0.2294504394 [45,] -0.1077015282 0.1630894981 [46,] -0.0065854324 -0.1077015282 [47,] -0.0727957944 -0.0065854324 [48,] -0.0292559218 -0.0727957944 [49,] -0.0217889910 -0.0292559218 [50,] -0.1846827841 -0.0217889910 [51,] -0.1728714131 -0.1846827841 [52,] 0.2053309948 -0.1728714131 [53,] 0.0332880912 0.2053309948 [54,] -0.1624259093 0.0332880912 [55,] -0.1147436672 -0.1624259093 [56,] -0.0092662942 -0.1147436672 [57,] -0.0525360018 -0.0092662942 [58,] -0.0589458032 -0.0525360018 [59,] 0.2145449003 -0.0589458032 [60,] -0.0631752219 0.2145449003 [61,] 0.1732617424 -0.0631752219 [62,] 0.1247246101 0.1732617424 [63,] 0.0146672930 0.1247246101 [64,] 0.2858955962 0.0146672930 [65,] -0.1295860499 0.2858955962 [66,] 0.0646284702 -0.1295860499 [67,] -0.0305196967 0.0646284702 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.1045961994 0.0522378625 2 -0.2470581652 -0.1045961994 3 0.1371059755 -0.2470581652 4 0.0529972242 0.1371059755 5 0.2977889487 0.0529972242 6 0.0494913261 0.2977889487 7 0.1672645932 0.0494913261 8 -0.0224652676 0.1672645932 9 0.1084877199 -0.0224652676 10 0.1130211242 0.1084877199 11 -0.2134234332 0.1130211242 12 -0.1146289330 -0.2134234332 13 -0.0976805505 -0.1146289330 14 -0.1611951055 -0.0976805505 15 0.1297690451 -0.1611951055 16 -0.2067136480 0.1297690451 17 0.0494379774 -0.2067136480 18 0.0006546036 0.0494379774 19 0.0181556639 0.0006546036 20 -0.0951656544 0.0181556639 21 0.0808934905 -0.0951656544 22 0.0208403641 0.0808934905 23 -0.0322520634 0.0208403641 24 0.0295330555 -0.0322520634 25 0.0247864454 0.0295330555 26 0.1239060206 0.0247864454 27 0.0362524515 0.1239060206 28 -0.1191191445 0.0362524515 29 -0.2666439161 -0.1191191445 30 0.1813865470 -0.2666439161 31 0.1892935462 0.1813865470 32 -0.0361922819 0.1892935462 33 -0.0291436804 -0.0361922819 34 -0.0683302527 -0.0291436804 35 0.1039263908 -0.0683302527 36 0.1252891587 0.1039263908 37 0.0260175532 0.1252891587 38 0.3443054242 0.0260175532 39 -0.1449233521 0.3443054242 40 -0.2183910228 -0.1449233521 41 0.0157149486 -0.2183910228 42 -0.1337350377 0.0157149486 43 -0.2294504394 -0.1337350377 44 0.1630894981 -0.2294504394 45 -0.1077015282 0.1630894981 46 -0.0065854324 -0.1077015282 47 -0.0727957944 -0.0065854324 48 -0.0292559218 -0.0727957944 49 -0.0217889910 -0.0292559218 50 -0.1846827841 -0.0217889910 51 -0.1728714131 -0.1846827841 52 0.2053309948 -0.1728714131 53 0.0332880912 0.2053309948 54 -0.1624259093 0.0332880912 55 -0.1147436672 -0.1624259093 56 -0.0092662942 -0.1147436672 57 -0.0525360018 -0.0092662942 58 -0.0589458032 -0.0525360018 59 0.2145449003 -0.0589458032 60 -0.0631752219 0.2145449003 61 0.1732617424 -0.0631752219 62 0.1247246101 0.1732617424 63 0.0146672930 0.1247246101 64 0.2858955962 0.0146672930 65 -0.1295860499 0.2858955962 66 0.0646284702 -0.1295860499 67 -0.0305196967 0.0646284702 > 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/77c211258479363.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/8smiz1258479363.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/98ucl1258479363.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/10lxzn1258479363.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/11wyk91258479363.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/12rr3z1258479363.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/13bbc21258479363.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/14z5r61258479363.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/15y16r1258479363.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/16tvha1258479363.tab") + } > > system("convert tmp/1o46p1258479363.ps tmp/1o46p1258479363.png") > system("convert tmp/2npuh1258479363.ps tmp/2npuh1258479363.png") > system("convert tmp/3kb721258479363.ps tmp/3kb721258479363.png") > system("convert tmp/4lucb1258479363.ps tmp/4lucb1258479363.png") > system("convert tmp/559301258479363.ps tmp/559301258479363.png") > system("convert tmp/67z151258479363.ps tmp/67z151258479363.png") > system("convert tmp/77c211258479363.ps tmp/77c211258479363.png") > system("convert tmp/8smiz1258479363.ps tmp/8smiz1258479363.png") > system("convert tmp/98ucl1258479363.ps tmp/98ucl1258479363.png") > system("convert tmp/10lxzn1258479363.ps tmp/10lxzn1258479363.png") > > > proc.time() user system elapsed 2.526 1.566 3.966