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(100.00,100.00,94.97,106.73,107.50,104.81,124.27,96.15,107.06,88.46,79.71,88.46,163.41,91.35,144.83,92.31,166.82,91.35,154.26,87.50,132.60,85.58,157.51,86.54,104.02,97.12,106.03,99.04,113.23,98.08,117.64,92.31,113.34,88.46,66.62,89.42,185.99,90.38,174.57,90.38,208.19,88.46,163.81,86.54,162.46,86.54,148.16,86.54,113.41,94.23,105.63,96.15,111.79,94.23,132.36,89.42,110.75,86.54,67.37,86.54,178.29,87.50,156.38,87.50,189.71,87.50,152.80,88.46,150.80,84.62,160.40,79.81,127.25,80.77,108.47,77.88,117.09,74.04,147.25,75.96,116.19,75.96,75.83,76.92,181.94,75.96,179.12,73.08,183.15,68.27,197.90,65.38,155.42,62.50,162.54,66.35,125.90,78.85,105.50,83.65,121.11,79.81,137.51,75.96,97.20,72.12,69.74,75.00,152.58,79.81,146.59,80.77,161.16,78.85,152.84,74.04,121.95,69.23,140.12,70.19),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 100.00 100.00 1 0 0 0 0 0 0 0 0 0 0 1 2 94.97 106.73 0 1 0 0 0 0 0 0 0 0 0 2 3 107.50 104.81 0 0 1 0 0 0 0 0 0 0 0 3 4 124.27 96.15 0 0 0 1 0 0 0 0 0 0 0 4 5 107.06 88.46 0 0 0 0 1 0 0 0 0 0 0 5 6 79.71 88.46 0 0 0 0 0 1 0 0 0 0 0 6 7 163.41 91.35 0 0 0 0 0 0 1 0 0 0 0 7 8 144.83 92.31 0 0 0 0 0 0 0 1 0 0 0 8 9 166.82 91.35 0 0 0 0 0 0 0 0 1 0 0 9 10 154.26 87.50 0 0 0 0 0 0 0 0 0 1 0 10 11 132.60 85.58 0 0 0 0 0 0 0 0 0 0 1 11 12 157.51 86.54 0 0 0 0 0 0 0 0 0 0 0 12 13 104.02 97.12 1 0 0 0 0 0 0 0 0 0 0 13 14 106.03 99.04 0 1 0 0 0 0 0 0 0 0 0 14 15 113.23 98.08 0 0 1 0 0 0 0 0 0 0 0 15 16 117.64 92.31 0 0 0 1 0 0 0 0 0 0 0 16 17 113.34 88.46 0 0 0 0 1 0 0 0 0 0 0 17 18 66.62 89.42 0 0 0 0 0 1 0 0 0 0 0 18 19 185.99 90.38 0 0 0 0 0 0 1 0 0 0 0 19 20 174.57 90.38 0 0 0 0 0 0 0 1 0 0 0 20 21 208.19 88.46 0 0 0 0 0 0 0 0 1 0 0 21 22 163.81 86.54 0 0 0 0 0 0 0 0 0 1 0 22 23 162.46 86.54 0 0 0 0 0 0 0 0 0 0 1 23 24 148.16 86.54 0 0 0 0 0 0 0 0 0 0 0 24 25 113.41 94.23 1 0 0 0 0 0 0 0 0 0 0 25 26 105.63 96.15 0 1 0 0 0 0 0 0 0 0 0 26 27 111.79 94.23 0 0 1 0 0 0 0 0 0 0 0 27 28 132.36 89.42 0 0 0 1 0 0 0 0 0 0 0 28 29 110.75 86.54 0 0 0 0 1 0 0 0 0 0 0 29 30 67.37 86.54 0 0 0 0 0 1 0 0 0 0 0 30 31 178.29 87.50 0 0 0 0 0 0 1 0 0 0 0 31 32 156.38 87.50 0 0 0 0 0 0 0 1 0 0 0 32 33 189.71 87.50 0 0 0 0 0 0 0 0 1 0 0 33 34 152.80 88.46 0 0 0 0 0 0 0 0 0 1 0 34 35 150.80 84.62 0 0 0 0 0 0 0 0 0 0 1 35 36 160.40 79.81 0 0 0 0 0 0 0 0 0 0 0 36 37 127.25 80.77 1 0 0 0 0 0 0 0 0 0 0 37 38 108.47 77.88 0 1 0 0 0 0 0 0 0 0 0 38 39 117.09 74.04 0 0 1 0 0 0 0 0 0 0 0 39 40 147.25 75.96 0 0 0 1 0 0 0 0 0 0 0 40 41 116.19 75.96 0 0 0 0 1 0 0 0 0 0 0 41 42 75.83 76.92 0 0 0 0 0 1 0 0 0 0 0 42 43 181.94 75.96 0 0 0 0 0 0 1 0 0 0 0 43 44 179.12 73.08 0 0 0 0 0 0 0 1 0 0 0 44 45 183.15 68.27 0 0 0 0 0 0 0 0 1 0 0 45 46 197.90 65.38 0 0 0 0 0 0 0 0 0 1 0 46 47 155.42 62.50 0 0 0 0 0 0 0 0 0 0 1 47 48 162.54 66.35 0 0 0 0 0 0 0 0 0 0 0 48 49 125.90 78.85 1 0 0 0 0 0 0 0 0 0 0 49 50 105.50 83.65 0 1 0 0 0 0 0 0 0 0 0 50 51 121.11 79.81 0 0 1 0 0 0 0 0 0 0 0 51 52 137.51 75.96 0 0 0 1 0 0 0 0 0 0 0 52 53 97.20 72.12 0 0 0 0 1 0 0 0 0 0 0 53 54 69.74 75.00 0 0 0 0 0 1 0 0 0 0 0 54 55 152.58 79.81 0 0 0 0 0 0 1 0 0 0 0 55 56 146.59 80.77 0 0 0 0 0 0 0 1 0 0 0 56 57 161.16 78.85 0 0 0 0 0 0 0 0 1 0 0 57 58 152.84 74.04 0 0 0 0 0 0 0 0 0 1 0 58 59 121.95 69.23 0 0 0 0 0 0 0 0 0 0 1 59 60 140.12 70.19 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 249.7438 -1.0506 -31.0307 -38.0108 -30.2153 -16.6076 M5 M6 M7 M8 M9 M10 -42.9485 -78.6002 24.2010 12.2491 32.1316 12.4128 M11 t -9.6954 -0.3937 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -22.139 -8.550 1.281 5.672 27.515 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 249.7438 32.8970 7.592 1.19e-09 *** X -1.0506 0.3457 -3.039 0.003905 ** M1 -31.0307 8.0263 -3.866 0.000345 *** M2 -38.0108 8.4001 -4.525 4.24e-05 *** M3 -30.2153 8.1082 -3.726 0.000530 *** M4 -16.6076 7.7253 -2.150 0.036867 * M5 -42.9485 7.5659 -5.677 8.82e-07 *** M6 -78.6002 7.6048 -10.336 1.41e-13 *** M7 24.2010 7.7295 3.131 0.003025 ** M8 12.2491 7.7436 1.582 0.120540 M9 32.1316 7.6369 4.207 0.000118 *** M10 12.4128 7.5472 1.645 0.106851 M11 -9.6954 7.5275 -1.288 0.204188 t -0.3937 0.1746 -2.255 0.028956 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.9 on 46 degrees of freedom Multiple R-squared: 0.9044, Adjusted R-squared: 0.8773 F-statistic: 33.46 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.1507184 0.3014369 0.8492816 [2,] 0.1530249 0.3060497 0.8469751 [3,] 0.4251495 0.8502990 0.5748505 [4,] 0.6182496 0.7635008 0.3817504 [5,] 0.8684916 0.2630167 0.1315084 [6,] 0.8265690 0.3468620 0.1734310 [7,] 0.8533640 0.2932721 0.1466360 [8,] 0.8744501 0.2510998 0.1255499 [9,] 0.8398844 0.3202313 0.1601156 [10,] 0.7875316 0.4249369 0.2124684 [11,] 0.7324033 0.5351934 0.2675967 [12,] 0.6765432 0.6469136 0.3234568 [13,] 0.6195159 0.7609681 0.3804841 [14,] 0.6295096 0.7409808 0.3704904 [15,] 0.5383717 0.9232566 0.4616283 [16,] 0.5356809 0.9286382 0.4643191 [17,] 0.5080378 0.9839244 0.4919622 [18,] 0.6344642 0.7310716 0.3655358 [19,] 0.5787465 0.8425069 0.4212535 [20,] 0.4817638 0.9635275 0.5182362 [21,] 0.4051059 0.8102117 0.5948941 [22,] 0.4869284 0.9738569 0.5130716 [23,] 0.8585473 0.2829054 0.1414527 [24,] 0.8309626 0.3380748 0.1690374 [25,] 0.7718752 0.4562496 0.2281248 [26,] 0.7409245 0.5181510 0.2590755 [27,] 0.5736013 0.8527974 0.4263987 > postscript(file="/var/www/html/rcomp/tmp/1typ41259349814.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/2ivlg1259349814.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/33wka1259349814.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/4wrls1259349814.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/5n00z1259349814.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 -13.2636135 -3.8495543 -0.7384333 -6.2801996 -4.8343496 3.8611155 7 8 9 10 11 12 -11.8103393 -17.0360974 -15.5434613 -12.0356124 -13.2106834 3.4061446 13 14 15 16 17 18 -7.5445295 3.8563495 2.6460054 -12.2196505 6.1703392 -3.4956608 19 20 21 22 23 24 14.4753090 15.4010160 27.5151171 1.2305414 22.3825403 -1.2191666 25 26 27 28 29 30 3.5340489 5.1449280 1.8860489 4.1889280 6.2879581 -1.0465768 31 32 33 34 35 36 8.4743930 -1.0899000 12.7512710 -3.0376999 13.4301593 8.6752721 37 38 39 40 41 42 7.9582376 -6.4840636 -9.3000125 9.6631166 5.3377516 2.0317516 43 44 45 46 47 48 4.7256516 11.2257537 -9.2862555 22.5401283 -0.4634776 1.3994607 49 50 51 52 53 54 9.3158565 1.3323404 5.5063915 4.6478054 -12.9616993 -1.3506295 55 56 57 58 59 60 -15.8650144 -8.5007724 -15.4366713 -8.6973574 -22.1385387 -12.2617107 > postscript(file="/var/www/html/rcomp/tmp/6id2n1259349814.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 -13.2636135 NA 1 -3.8495543 -13.2636135 2 -0.7384333 -3.8495543 3 -6.2801996 -0.7384333 4 -4.8343496 -6.2801996 5 3.8611155 -4.8343496 6 -11.8103393 3.8611155 7 -17.0360974 -11.8103393 8 -15.5434613 -17.0360974 9 -12.0356124 -15.5434613 10 -13.2106834 -12.0356124 11 3.4061446 -13.2106834 12 -7.5445295 3.4061446 13 3.8563495 -7.5445295 14 2.6460054 3.8563495 15 -12.2196505 2.6460054 16 6.1703392 -12.2196505 17 -3.4956608 6.1703392 18 14.4753090 -3.4956608 19 15.4010160 14.4753090 20 27.5151171 15.4010160 21 1.2305414 27.5151171 22 22.3825403 1.2305414 23 -1.2191666 22.3825403 24 3.5340489 -1.2191666 25 5.1449280 3.5340489 26 1.8860489 5.1449280 27 4.1889280 1.8860489 28 6.2879581 4.1889280 29 -1.0465768 6.2879581 30 8.4743930 -1.0465768 31 -1.0899000 8.4743930 32 12.7512710 -1.0899000 33 -3.0376999 12.7512710 34 13.4301593 -3.0376999 35 8.6752721 13.4301593 36 7.9582376 8.6752721 37 -6.4840636 7.9582376 38 -9.3000125 -6.4840636 39 9.6631166 -9.3000125 40 5.3377516 9.6631166 41 2.0317516 5.3377516 42 4.7256516 2.0317516 43 11.2257537 4.7256516 44 -9.2862555 11.2257537 45 22.5401283 -9.2862555 46 -0.4634776 22.5401283 47 1.3994607 -0.4634776 48 9.3158565 1.3994607 49 1.3323404 9.3158565 50 5.5063915 1.3323404 51 4.6478054 5.5063915 52 -12.9616993 4.6478054 53 -1.3506295 -12.9616993 54 -15.8650144 -1.3506295 55 -8.5007724 -15.8650144 56 -15.4366713 -8.5007724 57 -8.6973574 -15.4366713 58 -22.1385387 -8.6973574 59 -12.2617107 -22.1385387 60 NA -12.2617107 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.8495543 -13.2636135 [2,] -0.7384333 -3.8495543 [3,] -6.2801996 -0.7384333 [4,] -4.8343496 -6.2801996 [5,] 3.8611155 -4.8343496 [6,] -11.8103393 3.8611155 [7,] -17.0360974 -11.8103393 [8,] -15.5434613 -17.0360974 [9,] -12.0356124 -15.5434613 [10,] -13.2106834 -12.0356124 [11,] 3.4061446 -13.2106834 [12,] -7.5445295 3.4061446 [13,] 3.8563495 -7.5445295 [14,] 2.6460054 3.8563495 [15,] -12.2196505 2.6460054 [16,] 6.1703392 -12.2196505 [17,] -3.4956608 6.1703392 [18,] 14.4753090 -3.4956608 [19,] 15.4010160 14.4753090 [20,] 27.5151171 15.4010160 [21,] 1.2305414 27.5151171 [22,] 22.3825403 1.2305414 [23,] -1.2191666 22.3825403 [24,] 3.5340489 -1.2191666 [25,] 5.1449280 3.5340489 [26,] 1.8860489 5.1449280 [27,] 4.1889280 1.8860489 [28,] 6.2879581 4.1889280 [29,] -1.0465768 6.2879581 [30,] 8.4743930 -1.0465768 [31,] -1.0899000 8.4743930 [32,] 12.7512710 -1.0899000 [33,] -3.0376999 12.7512710 [34,] 13.4301593 -3.0376999 [35,] 8.6752721 13.4301593 [36,] 7.9582376 8.6752721 [37,] -6.4840636 7.9582376 [38,] -9.3000125 -6.4840636 [39,] 9.6631166 -9.3000125 [40,] 5.3377516 9.6631166 [41,] 2.0317516 5.3377516 [42,] 4.7256516 2.0317516 [43,] 11.2257537 4.7256516 [44,] -9.2862555 11.2257537 [45,] 22.5401283 -9.2862555 [46,] -0.4634776 22.5401283 [47,] 1.3994607 -0.4634776 [48,] 9.3158565 1.3994607 [49,] 1.3323404 9.3158565 [50,] 5.5063915 1.3323404 [51,] 4.6478054 5.5063915 [52,] -12.9616993 4.6478054 [53,] -1.3506295 -12.9616993 [54,] -15.8650144 -1.3506295 [55,] -8.5007724 -15.8650144 [56,] -15.4366713 -8.5007724 [57,] -8.6973574 -15.4366713 [58,] -22.1385387 -8.6973574 [59,] -12.2617107 -22.1385387 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.8495543 -13.2636135 2 -0.7384333 -3.8495543 3 -6.2801996 -0.7384333 4 -4.8343496 -6.2801996 5 3.8611155 -4.8343496 6 -11.8103393 3.8611155 7 -17.0360974 -11.8103393 8 -15.5434613 -17.0360974 9 -12.0356124 -15.5434613 10 -13.2106834 -12.0356124 11 3.4061446 -13.2106834 12 -7.5445295 3.4061446 13 3.8563495 -7.5445295 14 2.6460054 3.8563495 15 -12.2196505 2.6460054 16 6.1703392 -12.2196505 17 -3.4956608 6.1703392 18 14.4753090 -3.4956608 19 15.4010160 14.4753090 20 27.5151171 15.4010160 21 1.2305414 27.5151171 22 22.3825403 1.2305414 23 -1.2191666 22.3825403 24 3.5340489 -1.2191666 25 5.1449280 3.5340489 26 1.8860489 5.1449280 27 4.1889280 1.8860489 28 6.2879581 4.1889280 29 -1.0465768 6.2879581 30 8.4743930 -1.0465768 31 -1.0899000 8.4743930 32 12.7512710 -1.0899000 33 -3.0376999 12.7512710 34 13.4301593 -3.0376999 35 8.6752721 13.4301593 36 7.9582376 8.6752721 37 -6.4840636 7.9582376 38 -9.3000125 -6.4840636 39 9.6631166 -9.3000125 40 5.3377516 9.6631166 41 2.0317516 5.3377516 42 4.7256516 2.0317516 43 11.2257537 4.7256516 44 -9.2862555 11.2257537 45 22.5401283 -9.2862555 46 -0.4634776 22.5401283 47 1.3994607 -0.4634776 48 9.3158565 1.3994607 49 1.3323404 9.3158565 50 5.5063915 1.3323404 51 4.6478054 5.5063915 52 -12.9616993 4.6478054 53 -1.3506295 -12.9616993 54 -15.8650144 -1.3506295 55 -8.5007724 -15.8650144 56 -15.4366713 -8.5007724 57 -8.6973574 -15.4366713 58 -22.1385387 -8.6973574 59 -12.2617107 -22.1385387 > 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/7x4rl1259349814.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/899mu1259349814.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/97uxk1259349814.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/10osob1259349814.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/11z7bu1259349814.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/12f1ik1259349814.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/13hoxh1259349814.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/14pjom1259349814.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/15ge7q1259349814.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/16shj21259349814.tab") + } > > system("convert tmp/1typ41259349814.ps tmp/1typ41259349814.png") > system("convert tmp/2ivlg1259349814.ps tmp/2ivlg1259349814.png") > system("convert tmp/33wka1259349814.ps tmp/33wka1259349814.png") > system("convert tmp/4wrls1259349814.ps tmp/4wrls1259349814.png") > system("convert tmp/5n00z1259349814.ps tmp/5n00z1259349814.png") > system("convert tmp/6id2n1259349814.ps tmp/6id2n1259349814.png") > system("convert tmp/7x4rl1259349814.ps tmp/7x4rl1259349814.png") > system("convert tmp/899mu1259349814.ps tmp/899mu1259349814.png") > system("convert tmp/97uxk1259349814.ps tmp/97uxk1259349814.png") > system("convert tmp/10osob1259349814.ps tmp/10osob1259349814.png") > > > proc.time() user system elapsed 2.387 1.567 3.278