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(1.4 + ,8.2 + ,1.2 + ,1.4 + ,1.2 + ,8.0 + ,1 + ,1.2 + ,1.0 + ,7.5 + ,1.7 + ,1 + ,1.7 + ,6.8 + ,7.5 + ,1.7 + ,2.4 + ,6.5 + ,6.8 + ,7.5 + ,2.0 + ,6.6 + ,6.5 + ,6.8 + ,2.1 + ,7.6 + ,6.6 + ,6.5 + ,2.0 + ,8.0 + ,7.6 + ,6.6 + ,1.8 + ,8.1 + ,8.0 + ,7.6 + ,2.7 + ,7.7 + ,8.1 + ,8.0 + ,2.3 + ,7.5 + ,7.7 + ,8.1 + ,1.9 + ,7.6 + ,7.5 + ,7.7 + ,2.0 + ,7.8 + ,7.6 + ,7.5 + ,2.3 + ,7.8 + ,7.8 + ,7.6 + ,2.8 + ,7.8 + ,7.8 + ,7.8 + ,2.4 + ,7.5 + ,7.8 + ,7.8 + ,2.3 + ,7.5 + ,7.5 + ,7.8 + ,2.7 + ,7.1 + ,7.5 + ,7.5 + ,2.7 + ,7.5 + ,7.1 + ,7.5 + ,2.9 + ,7.5 + ,7.5 + ,7.1 + ,3.0 + ,7.6 + ,7.5 + ,7.5 + ,2.2 + ,7.7 + ,7.6 + ,7.5 + ,2.3 + ,7.7 + ,7.7 + ,7.6 + ,2.8 + ,7.9 + ,7.7 + ,7.7 + ,2.8 + ,8.1 + ,7.9 + ,7.7 + ,2.8 + ,8.2 + ,8.1 + ,7.9 + ,2.2 + ,8.2 + ,8.2 + ,8.1 + ,2.6 + ,8.2 + ,8.2 + ,8.2 + ,2.8 + ,7.9 + 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,'X' + ,'Y1' + ,'Y2') + ,1:64)) > y <- array(NA,dim=c(4,64),dimnames=list(c('Y','X','Y1','Y2'),1:64)) > 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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 3.1 6.5 6.2 6.3 0 0 0 0 0 0 0 0 0 0 0 48 49 3.5 6.8 6.5 6.2 1 0 0 0 0 0 0 0 0 0 0 49 50 3.6 6.8 6.8 6.5 0 1 0 0 0 0 0 0 0 0 0 50 51 4.4 6.4 6.8 6.8 0 0 1 0 0 0 0 0 0 0 0 51 52 4.1 6.1 6.4 6.8 0 0 0 1 0 0 0 0 0 0 0 52 53 5.1 5.8 6.1 6.4 0 0 0 0 1 0 0 0 0 0 0 53 54 5.8 6.1 5.8 6.1 0 0 0 0 0 1 0 0 0 0 0 54 55 5.9 7.2 6.1 5.8 0 0 0 0 0 0 1 0 0 0 0 55 56 5.4 7.3 7.2 6.1 0 0 0 0 0 0 0 1 0 0 0 56 57 5.5 6.9 7.3 7.2 0 0 0 0 0 0 0 0 1 0 0 57 58 4.8 6.1 6.9 7.3 0 0 0 0 0 0 0 0 0 1 0 58 59 3.2 5.8 6.1 6.9 0 0 0 0 0 0 0 0 0 0 1 59 60 2.7 6.2 5.8 6.1 0 0 0 0 0 0 0 0 0 0 0 60 61 2.1 7.1 6.2 5.8 1 0 0 0 0 0 0 0 0 0 0 61 62 1.9 7.7 7.1 6.2 0 1 0 0 0 0 0 0 0 0 0 62 63 0.6 7.9 7.7 7.1 0 0 1 0 0 0 0 0 0 0 0 63 64 0.7 7.7 7.9 7.7 0 0 0 1 0 0 0 0 0 0 0 64 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 M1 M2 3.308214 -0.272803 0.070240 -0.001572 0.003504 0.002471 M3 M4 M5 M6 M7 M8 -0.205171 -0.266930 0.327279 0.349232 0.495318 0.328182 M9 M10 M11 t 0.252601 0.183724 -0.028164 0.018562 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.04701 -0.59849 -0.02734 0.58101 2.62038 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.308214 2.519453 1.313 0.1954 X -0.272803 0.340819 -0.800 0.4274 Y1 0.070240 0.232244 0.302 0.7636 Y2 -0.001572 0.211320 -0.007 0.9941 M1 0.003504 0.758324 0.005 0.9963 M2 0.002471 0.761527 0.003 0.9974 M3 -0.205171 0.747499 -0.274 0.7849 M4 -0.266930 0.762942 -0.350 0.7280 M5 0.327279 0.777999 0.421 0.6759 M6 0.349232 0.785483 0.445 0.6586 M7 0.495318 0.766220 0.646 0.5211 M8 0.328182 0.774618 0.424 0.6737 M9 0.252601 0.766335 0.330 0.7431 M10 0.183724 0.768576 0.239 0.8121 M11 -0.028164 0.770074 -0.037 0.9710 t 0.018562 0.010941 1.697 0.0963 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.209 on 48 degrees of freedom Multiple R-squared: 0.2069, Adjusted R-squared: -0.04097 F-statistic: 0.8347 on 15 and 48 DF, p-value: 0.636 > 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.665771e-02 5.331541e-02 0.9733423 [2,] 7.460719e-03 1.492144e-02 0.9925393 [3,] 2.299849e-03 4.599697e-03 0.9977002 [4,] 2.087341e-03 4.174681e-03 0.9979127 [5,] 5.531626e-04 1.106325e-03 0.9994468 [6,] 2.243776e-04 4.487552e-04 0.9997756 [7,] 5.872278e-05 1.174456e-04 0.9999413 [8,] 1.584711e-05 3.169422e-05 0.9999842 [9,] 8.424003e-06 1.684801e-05 0.9999916 [10,] 3.232454e-06 6.464908e-06 0.9999968 [11,] 1.519741e-06 3.039481e-06 0.9999985 [12,] 7.679215e-07 1.535843e-06 0.9999992 [13,] 6.816586e-07 1.363317e-06 0.9999993 [14,] 5.426889e-07 1.085378e-06 0.9999995 [15,] 2.414769e-07 4.829538e-07 0.9999998 [16,] 1.110685e-07 2.221370e-07 0.9999999 [17,] 2.688332e-08 5.376665e-08 1.0000000 [18,] 8.201777e-09 1.640355e-08 1.0000000 [19,] 7.448225e-09 1.489645e-08 1.0000000 [20,] 6.593886e-09 1.318777e-08 1.0000000 [21,] 4.899320e-09 9.798640e-09 1.0000000 [22,] 7.049519e-08 1.409904e-07 0.9999999 [23,] 1.828377e-07 3.656754e-07 0.9999998 [24,] 2.231982e-06 4.463964e-06 0.9999978 [25,] 2.381404e-05 4.762807e-05 0.9999762 [26,] 3.031078e-05 6.062156e-05 0.9999697 [27,] 2.338797e-01 4.677594e-01 0.7661203 > postscript(file="/var/www/html/rcomp/tmp/1gyi31258718651.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/2umi31258718651.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/36mxq1258718651.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/499cn1258718651.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/5xyy81258718651.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 = 64 Frequency = 1 1 2 3 4 5 6 0.224614616 -0.033741338 -0.230545827 -0.084605913 -0.020933408 -0.414196313 7 8 9 10 11 12 -0.213536743 -0.125925225 -0.268150878 0.566647331 0.333666623 -0.072360004 13 14 15 16 17 18 0.052796369 0.321376289 1.010770231 0.572125956 -0.119572800 0.130319428 19 20 21 22 23 24 0.102889079 0.422737921 0.607665442 -0.121763631 0.164695973 0.672687379 25 26 27 28 29 30 0.691134045 0.687151415 0.269521308 0.712875043 0.218263298 -0.264861373 31 32 33 34 35 36 -0.596957375 -0.603071317 -0.898329012 -1.000949318 -0.494233483 -0.420389236 37 38 39 40 41 42 -0.822041630 -0.773717941 -0.632017680 -0.547649906 -1.722319763 -1.857750752 43 44 45 46 47 48 -1.912775723 -1.913183111 -1.703229551 -0.866304206 0.006451705 0.248433100 49 50 51 52 53 54 0.686978825 0.748849036 1.629279029 1.318730953 1.644562674 2.406489011 55 56 57 58 59 60 2.620380763 2.219441732 2.262043998 1.422369823 -0.010580819 -0.428371239 61 62 63 64 -0.833482225 -0.949917461 -2.047007062 -1.971476133 > postscript(file="/var/www/html/rcomp/tmp/69i7o1258718651.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 = 64 Frequency = 1 lag(myerror, k = 1) myerror 0 0.224614616 NA 1 -0.033741338 0.224614616 2 -0.230545827 -0.033741338 3 -0.084605913 -0.230545827 4 -0.020933408 -0.084605913 5 -0.414196313 -0.020933408 6 -0.213536743 -0.414196313 7 -0.125925225 -0.213536743 8 -0.268150878 -0.125925225 9 0.566647331 -0.268150878 10 0.333666623 0.566647331 11 -0.072360004 0.333666623 12 0.052796369 -0.072360004 13 0.321376289 0.052796369 14 1.010770231 0.321376289 15 0.572125956 1.010770231 16 -0.119572800 0.572125956 17 0.130319428 -0.119572800 18 0.102889079 0.130319428 19 0.422737921 0.102889079 20 0.607665442 0.422737921 21 -0.121763631 0.607665442 22 0.164695973 -0.121763631 23 0.672687379 0.164695973 24 0.691134045 0.672687379 25 0.687151415 0.691134045 26 0.269521308 0.687151415 27 0.712875043 0.269521308 28 0.218263298 0.712875043 29 -0.264861373 0.218263298 30 -0.596957375 -0.264861373 31 -0.603071317 -0.596957375 32 -0.898329012 -0.603071317 33 -1.000949318 -0.898329012 34 -0.494233483 -1.000949318 35 -0.420389236 -0.494233483 36 -0.822041630 -0.420389236 37 -0.773717941 -0.822041630 38 -0.632017680 -0.773717941 39 -0.547649906 -0.632017680 40 -1.722319763 -0.547649906 41 -1.857750752 -1.722319763 42 -1.912775723 -1.857750752 43 -1.913183111 -1.912775723 44 -1.703229551 -1.913183111 45 -0.866304206 -1.703229551 46 0.006451705 -0.866304206 47 0.248433100 0.006451705 48 0.686978825 0.248433100 49 0.748849036 0.686978825 50 1.629279029 0.748849036 51 1.318730953 1.629279029 52 1.644562674 1.318730953 53 2.406489011 1.644562674 54 2.620380763 2.406489011 55 2.219441732 2.620380763 56 2.262043998 2.219441732 57 1.422369823 2.262043998 58 -0.010580819 1.422369823 59 -0.428371239 -0.010580819 60 -0.833482225 -0.428371239 61 -0.949917461 -0.833482225 62 -2.047007062 -0.949917461 63 -1.971476133 -2.047007062 64 NA -1.971476133 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.033741338 0.224614616 [2,] -0.230545827 -0.033741338 [3,] -0.084605913 -0.230545827 [4,] -0.020933408 -0.084605913 [5,] -0.414196313 -0.020933408 [6,] -0.213536743 -0.414196313 [7,] -0.125925225 -0.213536743 [8,] -0.268150878 -0.125925225 [9,] 0.566647331 -0.268150878 [10,] 0.333666623 0.566647331 [11,] -0.072360004 0.333666623 [12,] 0.052796369 -0.072360004 [13,] 0.321376289 0.052796369 [14,] 1.010770231 0.321376289 [15,] 0.572125956 1.010770231 [16,] -0.119572800 0.572125956 [17,] 0.130319428 -0.119572800 [18,] 0.102889079 0.130319428 [19,] 0.422737921 0.102889079 [20,] 0.607665442 0.422737921 [21,] -0.121763631 0.607665442 [22,] 0.164695973 -0.121763631 [23,] 0.672687379 0.164695973 [24,] 0.691134045 0.672687379 [25,] 0.687151415 0.691134045 [26,] 0.269521308 0.687151415 [27,] 0.712875043 0.269521308 [28,] 0.218263298 0.712875043 [29,] -0.264861373 0.218263298 [30,] -0.596957375 -0.264861373 [31,] -0.603071317 -0.596957375 [32,] -0.898329012 -0.603071317 [33,] -1.000949318 -0.898329012 [34,] -0.494233483 -1.000949318 [35,] -0.420389236 -0.494233483 [36,] -0.822041630 -0.420389236 [37,] -0.773717941 -0.822041630 [38,] -0.632017680 -0.773717941 [39,] -0.547649906 -0.632017680 [40,] -1.722319763 -0.547649906 [41,] -1.857750752 -1.722319763 [42,] -1.912775723 -1.857750752 [43,] -1.913183111 -1.912775723 [44,] -1.703229551 -1.913183111 [45,] -0.866304206 -1.703229551 [46,] 0.006451705 -0.866304206 [47,] 0.248433100 0.006451705 [48,] 0.686978825 0.248433100 [49,] 0.748849036 0.686978825 [50,] 1.629279029 0.748849036 [51,] 1.318730953 1.629279029 [52,] 1.644562674 1.318730953 [53,] 2.406489011 1.644562674 [54,] 2.620380763 2.406489011 [55,] 2.219441732 2.620380763 [56,] 2.262043998 2.219441732 [57,] 1.422369823 2.262043998 [58,] -0.010580819 1.422369823 [59,] -0.428371239 -0.010580819 [60,] -0.833482225 -0.428371239 [61,] -0.949917461 -0.833482225 [62,] -2.047007062 -0.949917461 [63,] -1.971476133 -2.047007062 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.033741338 0.224614616 2 -0.230545827 -0.033741338 3 -0.084605913 -0.230545827 4 -0.020933408 -0.084605913 5 -0.414196313 -0.020933408 6 -0.213536743 -0.414196313 7 -0.125925225 -0.213536743 8 -0.268150878 -0.125925225 9 0.566647331 -0.268150878 10 0.333666623 0.566647331 11 -0.072360004 0.333666623 12 0.052796369 -0.072360004 13 0.321376289 0.052796369 14 1.010770231 0.321376289 15 0.572125956 1.010770231 16 -0.119572800 0.572125956 17 0.130319428 -0.119572800 18 0.102889079 0.130319428 19 0.422737921 0.102889079 20 0.607665442 0.422737921 21 -0.121763631 0.607665442 22 0.164695973 -0.121763631 23 0.672687379 0.164695973 24 0.691134045 0.672687379 25 0.687151415 0.691134045 26 0.269521308 0.687151415 27 0.712875043 0.269521308 28 0.218263298 0.712875043 29 -0.264861373 0.218263298 30 -0.596957375 -0.264861373 31 -0.603071317 -0.596957375 32 -0.898329012 -0.603071317 33 -1.000949318 -0.898329012 34 -0.494233483 -1.000949318 35 -0.420389236 -0.494233483 36 -0.822041630 -0.420389236 37 -0.773717941 -0.822041630 38 -0.632017680 -0.773717941 39 -0.547649906 -0.632017680 40 -1.722319763 -0.547649906 41 -1.857750752 -1.722319763 42 -1.912775723 -1.857750752 43 -1.913183111 -1.912775723 44 -1.703229551 -1.913183111 45 -0.866304206 -1.703229551 46 0.006451705 -0.866304206 47 0.248433100 0.006451705 48 0.686978825 0.248433100 49 0.748849036 0.686978825 50 1.629279029 0.748849036 51 1.318730953 1.629279029 52 1.644562674 1.318730953 53 2.406489011 1.644562674 54 2.620380763 2.406489011 55 2.219441732 2.620380763 56 2.262043998 2.219441732 57 1.422369823 2.262043998 58 -0.010580819 1.422369823 59 -0.428371239 -0.010580819 60 -0.833482225 -0.428371239 61 -0.949917461 -0.833482225 62 -2.047007062 -0.949917461 63 -1.971476133 -2.047007062 > 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/7x6h71258718651.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/8na481258718651.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/913fh1258718651.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/109j1y1258718651.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/11arq71258718651.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/12ce9j1258718651.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/132thu1258718652.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/1429j61258718652.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/158m4l1258718652.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/16v4c41258718652.tab") + } > > system("convert tmp/1gyi31258718651.ps tmp/1gyi31258718651.png") > system("convert tmp/2umi31258718651.ps tmp/2umi31258718651.png") > system("convert tmp/36mxq1258718651.ps tmp/36mxq1258718651.png") > system("convert tmp/499cn1258718651.ps tmp/499cn1258718651.png") > system("convert tmp/5xyy81258718651.ps tmp/5xyy81258718651.png") > system("convert tmp/69i7o1258718651.ps tmp/69i7o1258718651.png") > system("convert tmp/7x6h71258718651.ps tmp/7x6h71258718651.png") > system("convert tmp/8na481258718651.ps tmp/8na481258718651.png") > system("convert tmp/913fh1258718651.ps tmp/913fh1258718651.png") > system("convert tmp/109j1y1258718651.ps tmp/109j1y1258718651.png") > > > proc.time() user system elapsed 2.415 1.538 2.822