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(161,0,149,0,139,0,135,0,130,0,127,0,122,0,117,0,112,0,113,0,149,0,157,0,157,0,147,0,137,0,132,0,125,0,123,0,117,0,114,0,111,0,112,0,144,0,150,0,149,0,134,0,123,0,116,0,117,0,111,0,105,0,102,0,95,0,93,0,124,0,130,0,124,0,115,0,106,0,105,0,105,1,101,1,95,1,93,1,84,1,87,1,116,1,120,1,117,1,109,1,105,1,107,1,109,1,109,1,108,1,107,1,99,1,103,1,131,1,137,1),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 161 0 1 0 0 0 0 0 0 0 0 0 0 1 2 149 0 0 1 0 0 0 0 0 0 0 0 0 2 3 139 0 0 0 1 0 0 0 0 0 0 0 0 3 4 135 0 0 0 0 1 0 0 0 0 0 0 0 4 5 130 0 0 0 0 0 1 0 0 0 0 0 0 5 6 127 0 0 0 0 0 0 1 0 0 0 0 0 6 7 122 0 0 0 0 0 0 0 1 0 0 0 0 7 8 117 0 0 0 0 0 0 0 0 1 0 0 0 8 9 112 0 0 0 0 0 0 0 0 0 1 0 0 9 10 113 0 0 0 0 0 0 0 0 0 0 1 0 10 11 149 0 0 0 0 0 0 0 0 0 0 0 1 11 12 157 0 0 0 0 0 0 0 0 0 0 0 0 12 13 157 0 1 0 0 0 0 0 0 0 0 0 0 13 14 147 0 0 1 0 0 0 0 0 0 0 0 0 14 15 137 0 0 0 1 0 0 0 0 0 0 0 0 15 16 132 0 0 0 0 1 0 0 0 0 0 0 0 16 17 125 0 0 0 0 0 1 0 0 0 0 0 0 17 18 123 0 0 0 0 0 0 1 0 0 0 0 0 18 19 117 0 0 0 0 0 0 0 1 0 0 0 0 19 20 114 0 0 0 0 0 0 0 0 1 0 0 0 20 21 111 0 0 0 0 0 0 0 0 0 1 0 0 21 22 112 0 0 0 0 0 0 0 0 0 0 1 0 22 23 144 0 0 0 0 0 0 0 0 0 0 0 1 23 24 150 0 0 0 0 0 0 0 0 0 0 0 0 24 25 149 0 1 0 0 0 0 0 0 0 0 0 0 25 26 134 0 0 1 0 0 0 0 0 0 0 0 0 26 27 123 0 0 0 1 0 0 0 0 0 0 0 0 27 28 116 0 0 0 0 1 0 0 0 0 0 0 0 28 29 117 0 0 0 0 0 1 0 0 0 0 0 0 29 30 111 0 0 0 0 0 0 1 0 0 0 0 0 30 31 105 0 0 0 0 0 0 0 1 0 0 0 0 31 32 102 0 0 0 0 0 0 0 0 1 0 0 0 32 33 95 0 0 0 0 0 0 0 0 0 1 0 0 33 34 93 0 0 0 0 0 0 0 0 0 0 1 0 34 35 124 0 0 0 0 0 0 0 0 0 0 0 1 35 36 130 0 0 0 0 0 0 0 0 0 0 0 0 36 37 124 0 1 0 0 0 0 0 0 0 0 0 0 37 38 115 0 0 1 0 0 0 0 0 0 0 0 0 38 39 106 0 0 0 1 0 0 0 0 0 0 0 0 39 40 105 0 0 0 0 1 0 0 0 0 0 0 0 40 41 105 1 0 0 0 0 1 0 0 0 0 0 0 41 42 101 1 0 0 0 0 0 1 0 0 0 0 0 42 43 95 1 0 0 0 0 0 0 1 0 0 0 0 43 44 93 1 0 0 0 0 0 0 0 1 0 0 0 44 45 84 1 0 0 0 0 0 0 0 0 1 0 0 45 46 87 1 0 0 0 0 0 0 0 0 0 1 0 46 47 116 1 0 0 0 0 0 0 0 0 0 0 1 47 48 120 1 0 0 0 0 0 0 0 0 0 0 0 48 49 117 1 1 0 0 0 0 0 0 0 0 0 0 49 50 109 1 0 1 0 0 0 0 0 0 0 0 0 50 51 105 1 0 0 1 0 0 0 0 0 0 0 0 51 52 107 1 0 0 0 1 0 0 0 0 0 0 0 52 53 109 1 0 0 0 0 1 0 0 0 0 0 0 53 54 109 1 0 0 0 0 0 1 0 0 0 0 0 54 55 108 1 0 0 0 0 0 0 1 0 0 0 0 55 56 107 1 0 0 0 0 0 0 0 1 0 0 0 56 57 99 1 0 0 0 0 0 0 0 0 1 0 0 57 58 103 1 0 0 0 0 0 0 0 0 0 1 0 58 59 131 1 0 0 0 0 0 0 0 0 0 0 1 59 60 137 1 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 161.7313 3.7031 -3.9187 -14.0406 -22.1625 -24.4844 M5 M6 M7 M8 M9 M10 -26.3469 -28.6687 -32.7906 -34.9125 -40.6344 -38.5562 M11 t -6.6781 -0.6781 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -12.8844 -6.4438 0.6047 4.2438 15.4531 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 161.7313 4.4967 35.967 < 2e-16 *** X 3.7031 3.8942 0.951 0.34661 M1 -3.9187 5.1347 -0.763 0.44924 M2 -14.0406 5.1248 -2.740 0.00872 ** M3 -22.1625 5.1171 -4.331 7.96e-05 *** M4 -24.4844 5.1116 -4.790 1.77e-05 *** M5 -26.3469 5.1412 -5.125 5.78e-06 *** M6 -28.6687 5.1270 -5.592 1.18e-06 *** M7 -32.7906 5.1149 -6.411 7.00e-08 *** M8 -34.9125 5.1050 -6.839 1.59e-08 *** M9 -40.6344 5.0973 -7.972 3.26e-10 *** M10 -38.5562 5.0918 -7.572 1.27e-09 *** M11 -6.6781 5.0885 -1.312 0.19590 t -0.6781 0.1060 -6.398 7.31e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.044 on 46 degrees of freedom Multiple R-squared: 0.8512, Adjusted R-squared: 0.8092 F-statistic: 20.24 on 13 and 46 DF, p-value: 8.795e-15 > 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,] 2.359998e-03 4.719995e-03 0.997640002 [2,] 2.649287e-04 5.298574e-04 0.999735071 [3,] 4.754985e-05 9.509970e-05 0.999952450 [4,] 4.829996e-06 9.659991e-06 0.999995170 [5,] 2.141774e-06 4.283548e-06 0.999997858 [6,] 6.711335e-07 1.342267e-06 0.999999329 [7,] 2.164648e-07 4.329296e-07 0.999999784 [8,] 4.197360e-07 8.394720e-07 0.999999580 [9,] 6.411187e-06 1.282237e-05 0.999993589 [10,] 7.020976e-04 1.404195e-03 0.999297902 [11,] 2.779057e-02 5.558114e-02 0.972209430 [12,] 3.883482e-01 7.766964e-01 0.611651816 [13,] 5.072734e-01 9.854533e-01 0.492726640 [14,] 5.729163e-01 8.541674e-01 0.427083695 [15,] 5.786359e-01 8.427282e-01 0.421364116 [16,] 5.281548e-01 9.436905e-01 0.471845236 [17,] 6.025878e-01 7.948245e-01 0.397412231 [18,] 6.456312e-01 7.087375e-01 0.354368765 [19,] 7.394456e-01 5.211088e-01 0.260554424 [20,] 8.250876e-01 3.498248e-01 0.174912381 [21,] 9.031966e-01 1.936069e-01 0.096803434 [22,] 9.191795e-01 1.616410e-01 0.080820486 [23,] 8.819767e-01 2.360467e-01 0.118023332 [24,] 7.989434e-01 4.021131e-01 0.201056574 [25,] 9.439093e-01 1.121814e-01 0.056090724 [26,] 9.932963e-01 1.340750e-02 0.006703748 [27,] 9.883084e-01 2.338313e-02 0.011691567 > postscript(file="/var/www/html/rcomp/tmp/1hcep1258710109.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/2hcbm1258710109.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/3gmmp1258710109.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/4a17f1258710109.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/56ip11258710109.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 7 3.865625 2.665625 1.465625 0.465625 -1.993750 -1.993750 -2.193750 8 9 10 11 12 13 14 -4.393750 -2.993750 -3.393750 1.406250 3.406250 8.003125 8.803125 15 16 17 18 19 20 21 7.603125 5.603125 1.143750 2.143750 0.943750 0.743750 4.143750 22 23 24 25 26 27 28 3.743750 4.543750 4.543750 8.140625 3.940625 1.740625 -2.259375 29 30 31 32 33 34 35 1.281250 -1.718750 -2.918750 -3.118750 -3.718750 -7.118750 -7.318750 36 37 38 39 40 41 42 -7.318750 -8.721875 -6.921875 -7.121875 -5.121875 -6.284375 -7.284375 43 44 45 46 47 48 49 -8.484375 -7.684375 -10.284375 -8.684375 -10.884375 -12.884375 -11.287500 50 51 52 53 54 55 56 -8.487500 -3.687500 1.312500 5.853125 8.853125 12.653125 14.453125 57 58 59 60 12.853125 15.453125 12.253125 12.253125 > postscript(file="/var/www/html/rcomp/tmp/6n9ix1258710109.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 3.865625 NA 1 2.665625 3.865625 2 1.465625 2.665625 3 0.465625 1.465625 4 -1.993750 0.465625 5 -1.993750 -1.993750 6 -2.193750 -1.993750 7 -4.393750 -2.193750 8 -2.993750 -4.393750 9 -3.393750 -2.993750 10 1.406250 -3.393750 11 3.406250 1.406250 12 8.003125 3.406250 13 8.803125 8.003125 14 7.603125 8.803125 15 5.603125 7.603125 16 1.143750 5.603125 17 2.143750 1.143750 18 0.943750 2.143750 19 0.743750 0.943750 20 4.143750 0.743750 21 3.743750 4.143750 22 4.543750 3.743750 23 4.543750 4.543750 24 8.140625 4.543750 25 3.940625 8.140625 26 1.740625 3.940625 27 -2.259375 1.740625 28 1.281250 -2.259375 29 -1.718750 1.281250 30 -2.918750 -1.718750 31 -3.118750 -2.918750 32 -3.718750 -3.118750 33 -7.118750 -3.718750 34 -7.318750 -7.118750 35 -7.318750 -7.318750 36 -8.721875 -7.318750 37 -6.921875 -8.721875 38 -7.121875 -6.921875 39 -5.121875 -7.121875 40 -6.284375 -5.121875 41 -7.284375 -6.284375 42 -8.484375 -7.284375 43 -7.684375 -8.484375 44 -10.284375 -7.684375 45 -8.684375 -10.284375 46 -10.884375 -8.684375 47 -12.884375 -10.884375 48 -11.287500 -12.884375 49 -8.487500 -11.287500 50 -3.687500 -8.487500 51 1.312500 -3.687500 52 5.853125 1.312500 53 8.853125 5.853125 54 12.653125 8.853125 55 14.453125 12.653125 56 12.853125 14.453125 57 15.453125 12.853125 58 12.253125 15.453125 59 12.253125 12.253125 60 NA 12.253125 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.665625 3.865625 [2,] 1.465625 2.665625 [3,] 0.465625 1.465625 [4,] -1.993750 0.465625 [5,] -1.993750 -1.993750 [6,] -2.193750 -1.993750 [7,] -4.393750 -2.193750 [8,] -2.993750 -4.393750 [9,] -3.393750 -2.993750 [10,] 1.406250 -3.393750 [11,] 3.406250 1.406250 [12,] 8.003125 3.406250 [13,] 8.803125 8.003125 [14,] 7.603125 8.803125 [15,] 5.603125 7.603125 [16,] 1.143750 5.603125 [17,] 2.143750 1.143750 [18,] 0.943750 2.143750 [19,] 0.743750 0.943750 [20,] 4.143750 0.743750 [21,] 3.743750 4.143750 [22,] 4.543750 3.743750 [23,] 4.543750 4.543750 [24,] 8.140625 4.543750 [25,] 3.940625 8.140625 [26,] 1.740625 3.940625 [27,] -2.259375 1.740625 [28,] 1.281250 -2.259375 [29,] -1.718750 1.281250 [30,] -2.918750 -1.718750 [31,] -3.118750 -2.918750 [32,] -3.718750 -3.118750 [33,] -7.118750 -3.718750 [34,] -7.318750 -7.118750 [35,] -7.318750 -7.318750 [36,] -8.721875 -7.318750 [37,] -6.921875 -8.721875 [38,] -7.121875 -6.921875 [39,] -5.121875 -7.121875 [40,] -6.284375 -5.121875 [41,] -7.284375 -6.284375 [42,] -8.484375 -7.284375 [43,] -7.684375 -8.484375 [44,] -10.284375 -7.684375 [45,] -8.684375 -10.284375 [46,] -10.884375 -8.684375 [47,] -12.884375 -10.884375 [48,] -11.287500 -12.884375 [49,] -8.487500 -11.287500 [50,] -3.687500 -8.487500 [51,] 1.312500 -3.687500 [52,] 5.853125 1.312500 [53,] 8.853125 5.853125 [54,] 12.653125 8.853125 [55,] 14.453125 12.653125 [56,] 12.853125 14.453125 [57,] 15.453125 12.853125 [58,] 12.253125 15.453125 [59,] 12.253125 12.253125 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.665625 3.865625 2 1.465625 2.665625 3 0.465625 1.465625 4 -1.993750 0.465625 5 -1.993750 -1.993750 6 -2.193750 -1.993750 7 -4.393750 -2.193750 8 -2.993750 -4.393750 9 -3.393750 -2.993750 10 1.406250 -3.393750 11 3.406250 1.406250 12 8.003125 3.406250 13 8.803125 8.003125 14 7.603125 8.803125 15 5.603125 7.603125 16 1.143750 5.603125 17 2.143750 1.143750 18 0.943750 2.143750 19 0.743750 0.943750 20 4.143750 0.743750 21 3.743750 4.143750 22 4.543750 3.743750 23 4.543750 4.543750 24 8.140625 4.543750 25 3.940625 8.140625 26 1.740625 3.940625 27 -2.259375 1.740625 28 1.281250 -2.259375 29 -1.718750 1.281250 30 -2.918750 -1.718750 31 -3.118750 -2.918750 32 -3.718750 -3.118750 33 -7.118750 -3.718750 34 -7.318750 -7.118750 35 -7.318750 -7.318750 36 -8.721875 -7.318750 37 -6.921875 -8.721875 38 -7.121875 -6.921875 39 -5.121875 -7.121875 40 -6.284375 -5.121875 41 -7.284375 -6.284375 42 -8.484375 -7.284375 43 -7.684375 -8.484375 44 -10.284375 -7.684375 45 -8.684375 -10.284375 46 -10.884375 -8.684375 47 -12.884375 -10.884375 48 -11.287500 -12.884375 49 -8.487500 -11.287500 50 -3.687500 -8.487500 51 1.312500 -3.687500 52 5.853125 1.312500 53 8.853125 5.853125 54 12.653125 8.853125 55 14.453125 12.653125 56 12.853125 14.453125 57 15.453125 12.853125 58 12.253125 15.453125 59 12.253125 12.253125 > 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/7b31a1258710109.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/8n0zz1258710109.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/9tedl1258710109.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/10jxgl1258710109.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/11pro61258710110.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/12fmbr1258710110.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/13r4jb1258710110.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/14mf7s1258710110.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/153ufg1258710110.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/160wcr1258710110.tab") + } > > system("convert tmp/1hcep1258710109.ps tmp/1hcep1258710109.png") > system("convert tmp/2hcbm1258710109.ps tmp/2hcbm1258710109.png") > system("convert tmp/3gmmp1258710109.ps tmp/3gmmp1258710109.png") > system("convert tmp/4a17f1258710109.ps tmp/4a17f1258710109.png") > system("convert tmp/56ip11258710109.ps tmp/56ip11258710109.png") > system("convert tmp/6n9ix1258710109.ps tmp/6n9ix1258710109.png") > system("convert tmp/7b31a1258710109.ps tmp/7b31a1258710109.png") > system("convert tmp/8n0zz1258710109.ps tmp/8n0zz1258710109.png") > system("convert tmp/9tedl1258710109.ps tmp/9tedl1258710109.png") > system("convert tmp/10jxgl1258710109.ps tmp/10jxgl1258710109.png") > > > proc.time() user system elapsed 2.384 1.551 3.525