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(7.55,42.97,7.55,42.98,7.59,43.01,7.59,43.09,7.59,43.14,7.57,43.39,7.57,43.46,7.59,43.54,7.6,43.62,7.64,44.01,7.64,44.5,7.76,44.73,7.76,44.89,7.76,45.09,7.77,45.17,7.83,45.24,7.94,45.42,7.94,45.67,7.94,45.68,8.09,46.56,8.18,46.72,8.26,47.01,8.28,47.26,8.28,47.49,8.28,47.51,8.29,47.52,8.3,47.66,8.3,47.71,8.31,47.87,8.33,48,8.33,48,8.34,48.05,8.48,48.25,8.59,48.72,8.67,48.94,8.67,49.16,8.67,49.18,8.71,49.25,8.72,49.34,8.72,49.49,8.72,49.57,8.74,49.63,8.74,49.67,8.74,49.7,8.74,49.8,8.79,50.09,8.85,50.49,8.86,50.73,8.87,51.12,8.92,51.15,8.96,51.41,8.97,51.61,8.99,52.06,8.98,52.17,8.98,52.18,9.01,52.19,9.01,52.74,9.03,53.05,9.05,53.38,9.05,53.78),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 7.55 42.97 1 0 0 0 0 0 0 0 0 0 0 1 2 7.55 42.98 0 1 0 0 0 0 0 0 0 0 0 2 3 7.59 43.01 0 0 1 0 0 0 0 0 0 0 0 3 4 7.59 43.09 0 0 0 1 0 0 0 0 0 0 0 4 5 7.59 43.14 0 0 0 0 1 0 0 0 0 0 0 5 6 7.57 43.39 0 0 0 0 0 1 0 0 0 0 0 6 7 7.57 43.46 0 0 0 0 0 0 1 0 0 0 0 7 8 7.59 43.54 0 0 0 0 0 0 0 1 0 0 0 8 9 7.60 43.62 0 0 0 0 0 0 0 0 1 0 0 9 10 7.64 44.01 0 0 0 0 0 0 0 0 0 1 0 10 11 7.64 44.50 0 0 0 0 0 0 0 0 0 0 1 11 12 7.76 44.73 0 0 0 0 0 0 0 0 0 0 0 12 13 7.76 44.89 1 0 0 0 0 0 0 0 0 0 0 13 14 7.76 45.09 0 1 0 0 0 0 0 0 0 0 0 14 15 7.77 45.17 0 0 1 0 0 0 0 0 0 0 0 15 16 7.83 45.24 0 0 0 1 0 0 0 0 0 0 0 16 17 7.94 45.42 0 0 0 0 1 0 0 0 0 0 0 17 18 7.94 45.67 0 0 0 0 0 1 0 0 0 0 0 18 19 7.94 45.68 0 0 0 0 0 0 1 0 0 0 0 19 20 8.09 46.56 0 0 0 0 0 0 0 1 0 0 0 20 21 8.18 46.72 0 0 0 0 0 0 0 0 1 0 0 21 22 8.26 47.01 0 0 0 0 0 0 0 0 0 1 0 22 23 8.28 47.26 0 0 0 0 0 0 0 0 0 0 1 23 24 8.28 47.49 0 0 0 0 0 0 0 0 0 0 0 24 25 8.28 47.51 1 0 0 0 0 0 0 0 0 0 0 25 26 8.29 47.52 0 1 0 0 0 0 0 0 0 0 0 26 27 8.30 47.66 0 0 1 0 0 0 0 0 0 0 0 27 28 8.30 47.71 0 0 0 1 0 0 0 0 0 0 0 28 29 8.31 47.87 0 0 0 0 1 0 0 0 0 0 0 29 30 8.33 48.00 0 0 0 0 0 1 0 0 0 0 0 30 31 8.33 48.00 0 0 0 0 0 0 1 0 0 0 0 31 32 8.34 48.05 0 0 0 0 0 0 0 1 0 0 0 32 33 8.48 48.25 0 0 0 0 0 0 0 0 1 0 0 33 34 8.59 48.72 0 0 0 0 0 0 0 0 0 1 0 34 35 8.67 48.94 0 0 0 0 0 0 0 0 0 0 1 35 36 8.67 49.16 0 0 0 0 0 0 0 0 0 0 0 36 37 8.67 49.18 1 0 0 0 0 0 0 0 0 0 0 37 38 8.71 49.25 0 1 0 0 0 0 0 0 0 0 0 38 39 8.72 49.34 0 0 1 0 0 0 0 0 0 0 0 39 40 8.72 49.49 0 0 0 1 0 0 0 0 0 0 0 40 41 8.72 49.57 0 0 0 0 1 0 0 0 0 0 0 41 42 8.74 49.63 0 0 0 0 0 1 0 0 0 0 0 42 43 8.74 49.67 0 0 0 0 0 0 1 0 0 0 0 43 44 8.74 49.70 0 0 0 0 0 0 0 1 0 0 0 44 45 8.74 49.80 0 0 0 0 0 0 0 0 1 0 0 45 46 8.79 50.09 0 0 0 0 0 0 0 0 0 1 0 46 47 8.85 50.49 0 0 0 0 0 0 0 0 0 0 1 47 48 8.86 50.73 0 0 0 0 0 0 0 0 0 0 0 48 49 8.87 51.12 1 0 0 0 0 0 0 0 0 0 0 49 50 8.92 51.15 0 1 0 0 0 0 0 0 0 0 0 50 51 8.96 51.41 0 0 1 0 0 0 0 0 0 0 0 51 52 8.97 51.61 0 0 0 1 0 0 0 0 0 0 0 52 53 8.99 52.06 0 0 0 0 1 0 0 0 0 0 0 53 54 8.98 52.17 0 0 0 0 0 1 0 0 0 0 0 54 55 8.98 52.18 0 0 0 0 0 0 1 0 0 0 0 55 56 9.01 52.19 0 0 0 0 0 0 0 1 0 0 0 56 57 9.01 52.74 0 0 0 0 0 0 0 0 1 0 0 57 58 9.03 53.05 0 0 0 0 0 0 0 0 0 1 0 58 59 9.05 53.38 0 0 0 0 0 0 0 0 0 0 1 59 60 9.05 53.78 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) X M1 M2 M3 M4 4.221162 0.075855 0.031961 0.031205 0.028201 0.017956 M5 M6 M7 M8 M9 M10 0.016097 -0.009941 -0.027814 -0.017645 -0.002082 0.015467 M11 t 0.009927 0.015901 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.2047134 -0.0430035 0.0007787 0.0677946 0.1700278 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.221162 1.809593 2.333 0.0241 * X 0.075855 0.042226 1.796 0.0790 . M1 0.031961 0.059665 0.536 0.5948 M2 0.031205 0.060122 0.519 0.6062 M3 0.028201 0.060453 0.466 0.6431 M4 0.017956 0.060981 0.294 0.7697 M5 0.016097 0.060840 0.265 0.7925 M6 -0.009941 0.060947 -0.163 0.8712 M7 -0.027814 0.062740 -0.443 0.6596 M8 -0.017645 0.062236 -0.284 0.7781 M9 -0.002082 0.061671 -0.034 0.9732 M10 0.015467 0.059932 0.258 0.7975 M11 0.009927 0.059100 0.168 0.8673 t 0.015901 0.007468 2.129 0.0386 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.09325 on 46 degrees of freedom Multiple R-squared: 0.9746, Adjusted R-squared: 0.9675 F-statistic: 135.9 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.2179804 0.4359608587 0.7820195707 [2,] 0.2151328 0.4302656475 0.7848671763 [3,] 0.2728138 0.5456275904 0.7271862048 [4,] 0.2321168 0.4642336139 0.7678831931 [5,] 0.1523806 0.3047612592 0.8476193704 [6,] 0.1542385 0.3084769501 0.8457615249 [7,] 0.3385580 0.6771160880 0.6614419560 [8,] 0.2478141 0.4956282334 0.7521858833 [9,] 0.2220255 0.4440509324 0.7779745338 [10,] 0.2541353 0.5082706655 0.7458646672 [11,] 0.2196071 0.4392141398 0.7803929301 [12,] 0.2037050 0.4074099520 0.7962950240 [13,] 0.2466891 0.4933781551 0.7533109224 [14,] 0.3050371 0.6100741018 0.6949629491 [15,] 0.5093243 0.9813513375 0.4906756687 [16,] 0.9854569 0.0290861091 0.0145430546 [17,] 0.9981857 0.0036285844 0.0018142922 [18,] 0.9981078 0.0037843662 0.0018921831 [19,] 0.9995133 0.0009733485 0.0004866743 [20,] 0.9997981 0.0004037220 0.0002018610 [21,] 0.9997310 0.0005379421 0.0002689710 [22,] 0.9997383 0.0005234973 0.0002617486 [23,] 0.9993307 0.0013385050 0.0006692525 [24,] 0.9981298 0.0037403856 0.0018701928 [25,] 0.9934651 0.0130698640 0.0065349320 [26,] 0.9781913 0.0436174879 0.0218087440 [27,] 0.9396164 0.1207671555 0.0603835777 > postscript(file="/var/www/html/rcomp/tmp/13xma1258559591.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/2e49x1258559591.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/3jztx1258559591.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/4xjv31258559591.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/5c62d1258559591.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 2.148894e-02 5.585112e-03 3.041206e-02 1.868771e-02 8.522704e-04 6 7 8 9 10 -2.797468e-02 -3.131229e-02 -4.345115e-02 -7.098317e-02 -9.401736e-02 11 12 13 14 15 -1.415473e-01 -4.496825e-02 -1.049670e-01 -1.352833e-01 -1.442491e-01 16 17 18 19 20 -9.521490e-02 -1.291148e-02 -2.173843e-02 -2.052475e-02 3.665243e-02 21 22 23 24 25 8.305202e-02 1.076033e-01 9.827855e-02 7.485762e-02 2.547854e-02 26 27 28 29 30 1.957470e-02 6.057606e-03 -3.391097e-03 -1.957058e-02 7.050704e-04 31 32 33 34 35 2.677299e-03 -1.718591e-02 7.617948e-02 1.170769e-01 1.700278e-01 36 37 38 39 40 1.473654e-01 9.798631e-02 1.175312e-01 1.078068e-01 9.077263e-02 41 42 43 44 45 7.066154e-02 9.624704e-02 9.518507e-02 6.683896e-02 2.778984e-02 46 47 48 49 50 2.234114e-02 4.163813e-02 2.745865e-02 -3.998676e-02 -7.407694e-03 51 52 53 54 55 -2.738779e-05 -1.085433e-02 -3.903175e-02 -4.723900e-02 -4.602532e-02 56 57 58 59 60 -4.285433e-02 -1.160382e-01 -1.530040e-01 -1.683971e-01 -2.047134e-01 > postscript(file="/var/www/html/rcomp/tmp/6glh41258559591.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 2.148894e-02 NA 1 5.585112e-03 2.148894e-02 2 3.041206e-02 5.585112e-03 3 1.868771e-02 3.041206e-02 4 8.522704e-04 1.868771e-02 5 -2.797468e-02 8.522704e-04 6 -3.131229e-02 -2.797468e-02 7 -4.345115e-02 -3.131229e-02 8 -7.098317e-02 -4.345115e-02 9 -9.401736e-02 -7.098317e-02 10 -1.415473e-01 -9.401736e-02 11 -4.496825e-02 -1.415473e-01 12 -1.049670e-01 -4.496825e-02 13 -1.352833e-01 -1.049670e-01 14 -1.442491e-01 -1.352833e-01 15 -9.521490e-02 -1.442491e-01 16 -1.291148e-02 -9.521490e-02 17 -2.173843e-02 -1.291148e-02 18 -2.052475e-02 -2.173843e-02 19 3.665243e-02 -2.052475e-02 20 8.305202e-02 3.665243e-02 21 1.076033e-01 8.305202e-02 22 9.827855e-02 1.076033e-01 23 7.485762e-02 9.827855e-02 24 2.547854e-02 7.485762e-02 25 1.957470e-02 2.547854e-02 26 6.057606e-03 1.957470e-02 27 -3.391097e-03 6.057606e-03 28 -1.957058e-02 -3.391097e-03 29 7.050704e-04 -1.957058e-02 30 2.677299e-03 7.050704e-04 31 -1.718591e-02 2.677299e-03 32 7.617948e-02 -1.718591e-02 33 1.170769e-01 7.617948e-02 34 1.700278e-01 1.170769e-01 35 1.473654e-01 1.700278e-01 36 9.798631e-02 1.473654e-01 37 1.175312e-01 9.798631e-02 38 1.078068e-01 1.175312e-01 39 9.077263e-02 1.078068e-01 40 7.066154e-02 9.077263e-02 41 9.624704e-02 7.066154e-02 42 9.518507e-02 9.624704e-02 43 6.683896e-02 9.518507e-02 44 2.778984e-02 6.683896e-02 45 2.234114e-02 2.778984e-02 46 4.163813e-02 2.234114e-02 47 2.745865e-02 4.163813e-02 48 -3.998676e-02 2.745865e-02 49 -7.407694e-03 -3.998676e-02 50 -2.738779e-05 -7.407694e-03 51 -1.085433e-02 -2.738779e-05 52 -3.903175e-02 -1.085433e-02 53 -4.723900e-02 -3.903175e-02 54 -4.602532e-02 -4.723900e-02 55 -4.285433e-02 -4.602532e-02 56 -1.160382e-01 -4.285433e-02 57 -1.530040e-01 -1.160382e-01 58 -1.683971e-01 -1.530040e-01 59 -2.047134e-01 -1.683971e-01 60 NA -2.047134e-01 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.585112e-03 2.148894e-02 [2,] 3.041206e-02 5.585112e-03 [3,] 1.868771e-02 3.041206e-02 [4,] 8.522704e-04 1.868771e-02 [5,] -2.797468e-02 8.522704e-04 [6,] -3.131229e-02 -2.797468e-02 [7,] -4.345115e-02 -3.131229e-02 [8,] -7.098317e-02 -4.345115e-02 [9,] -9.401736e-02 -7.098317e-02 [10,] -1.415473e-01 -9.401736e-02 [11,] -4.496825e-02 -1.415473e-01 [12,] -1.049670e-01 -4.496825e-02 [13,] -1.352833e-01 -1.049670e-01 [14,] -1.442491e-01 -1.352833e-01 [15,] -9.521490e-02 -1.442491e-01 [16,] -1.291148e-02 -9.521490e-02 [17,] -2.173843e-02 -1.291148e-02 [18,] -2.052475e-02 -2.173843e-02 [19,] 3.665243e-02 -2.052475e-02 [20,] 8.305202e-02 3.665243e-02 [21,] 1.076033e-01 8.305202e-02 [22,] 9.827855e-02 1.076033e-01 [23,] 7.485762e-02 9.827855e-02 [24,] 2.547854e-02 7.485762e-02 [25,] 1.957470e-02 2.547854e-02 [26,] 6.057606e-03 1.957470e-02 [27,] -3.391097e-03 6.057606e-03 [28,] -1.957058e-02 -3.391097e-03 [29,] 7.050704e-04 -1.957058e-02 [30,] 2.677299e-03 7.050704e-04 [31,] -1.718591e-02 2.677299e-03 [32,] 7.617948e-02 -1.718591e-02 [33,] 1.170769e-01 7.617948e-02 [34,] 1.700278e-01 1.170769e-01 [35,] 1.473654e-01 1.700278e-01 [36,] 9.798631e-02 1.473654e-01 [37,] 1.175312e-01 9.798631e-02 [38,] 1.078068e-01 1.175312e-01 [39,] 9.077263e-02 1.078068e-01 [40,] 7.066154e-02 9.077263e-02 [41,] 9.624704e-02 7.066154e-02 [42,] 9.518507e-02 9.624704e-02 [43,] 6.683896e-02 9.518507e-02 [44,] 2.778984e-02 6.683896e-02 [45,] 2.234114e-02 2.778984e-02 [46,] 4.163813e-02 2.234114e-02 [47,] 2.745865e-02 4.163813e-02 [48,] -3.998676e-02 2.745865e-02 [49,] -7.407694e-03 -3.998676e-02 [50,] -2.738779e-05 -7.407694e-03 [51,] -1.085433e-02 -2.738779e-05 [52,] -3.903175e-02 -1.085433e-02 [53,] -4.723900e-02 -3.903175e-02 [54,] -4.602532e-02 -4.723900e-02 [55,] -4.285433e-02 -4.602532e-02 [56,] -1.160382e-01 -4.285433e-02 [57,] -1.530040e-01 -1.160382e-01 [58,] -1.683971e-01 -1.530040e-01 [59,] -2.047134e-01 -1.683971e-01 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.585112e-03 2.148894e-02 2 3.041206e-02 5.585112e-03 3 1.868771e-02 3.041206e-02 4 8.522704e-04 1.868771e-02 5 -2.797468e-02 8.522704e-04 6 -3.131229e-02 -2.797468e-02 7 -4.345115e-02 -3.131229e-02 8 -7.098317e-02 -4.345115e-02 9 -9.401736e-02 -7.098317e-02 10 -1.415473e-01 -9.401736e-02 11 -4.496825e-02 -1.415473e-01 12 -1.049670e-01 -4.496825e-02 13 -1.352833e-01 -1.049670e-01 14 -1.442491e-01 -1.352833e-01 15 -9.521490e-02 -1.442491e-01 16 -1.291148e-02 -9.521490e-02 17 -2.173843e-02 -1.291148e-02 18 -2.052475e-02 -2.173843e-02 19 3.665243e-02 -2.052475e-02 20 8.305202e-02 3.665243e-02 21 1.076033e-01 8.305202e-02 22 9.827855e-02 1.076033e-01 23 7.485762e-02 9.827855e-02 24 2.547854e-02 7.485762e-02 25 1.957470e-02 2.547854e-02 26 6.057606e-03 1.957470e-02 27 -3.391097e-03 6.057606e-03 28 -1.957058e-02 -3.391097e-03 29 7.050704e-04 -1.957058e-02 30 2.677299e-03 7.050704e-04 31 -1.718591e-02 2.677299e-03 32 7.617948e-02 -1.718591e-02 33 1.170769e-01 7.617948e-02 34 1.700278e-01 1.170769e-01 35 1.473654e-01 1.700278e-01 36 9.798631e-02 1.473654e-01 37 1.175312e-01 9.798631e-02 38 1.078068e-01 1.175312e-01 39 9.077263e-02 1.078068e-01 40 7.066154e-02 9.077263e-02 41 9.624704e-02 7.066154e-02 42 9.518507e-02 9.624704e-02 43 6.683896e-02 9.518507e-02 44 2.778984e-02 6.683896e-02 45 2.234114e-02 2.778984e-02 46 4.163813e-02 2.234114e-02 47 2.745865e-02 4.163813e-02 48 -3.998676e-02 2.745865e-02 49 -7.407694e-03 -3.998676e-02 50 -2.738779e-05 -7.407694e-03 51 -1.085433e-02 -2.738779e-05 52 -3.903175e-02 -1.085433e-02 53 -4.723900e-02 -3.903175e-02 54 -4.602532e-02 -4.723900e-02 55 -4.285433e-02 -4.602532e-02 56 -1.160382e-01 -4.285433e-02 57 -1.530040e-01 -1.160382e-01 58 -1.683971e-01 -1.530040e-01 59 -2.047134e-01 -1.683971e-01 > 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/7gyzc1258559591.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/8sj991258559591.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/9w5pk1258559591.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/10w49c1258559591.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/11ebys1258559591.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/12828a1258559591.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/131jdp1258559591.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/140zfd1258559591.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/15ee631258559591.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/16odzq1258559591.tab") + } > > system("convert tmp/13xma1258559591.ps tmp/13xma1258559591.png") > system("convert tmp/2e49x1258559591.ps tmp/2e49x1258559591.png") > system("convert tmp/3jztx1258559591.ps tmp/3jztx1258559591.png") > system("convert tmp/4xjv31258559591.ps tmp/4xjv31258559591.png") > system("convert tmp/5c62d1258559591.ps tmp/5c62d1258559591.png") > system("convert tmp/6glh41258559591.ps tmp/6glh41258559591.png") > system("convert tmp/7gyzc1258559591.ps tmp/7gyzc1258559591.png") > system("convert tmp/8sj991258559591.ps tmp/8sj991258559591.png") > system("convert tmp/9w5pk1258559591.ps tmp/9w5pk1258559591.png") > system("convert tmp/10w49c1258559591.ps tmp/10w49c1258559591.png") > > > proc.time() user system elapsed 2.414 1.578 5.765