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,2,1.2,2,1,2,1.7,2,2.4,2,2,2,2.1,2,2,2,1.8,2,2.7,2,2.3,2,1.9,2,2,2,2.3,2,2.8,2,2.4,2,2.3,2,2.7,2,2.7,2,2.9,2,3,2,2.2,2,2.3,2,2.8,2.21,2.8,2.25,2.8,2.25,2.2,2.45,2.6,2.5,2.8,2.5,2.5,2.64,2.4,2.75,2.3,2.93,1.9,3,1.7,3.17,2,3.25,2.1,3.39,1.7,3.5,1.8,3.5,1.8,3.65,1.8,3.75,1.3,3.75,1.3,3.9,1.3,4,1.2,4,1.4,4,2.2,4,2.9,4,3.1,4,3.5,4,3.6,4,4.4,4,4.1,4,5.1,4,5.8,4,5.9,4.18,5.4,4.25,5.5,4.25,4.8,3.97,3.2,3.42,2.7,2.75,2.1,2.31,1.9,2,0.6,1.66,0.7,1.31,-0.2,1.09,-1,1,-1.7,1,-0.7,1,-1,1),dim=c(2,69),dimnames=list(c('Y','X'),1:69)) > y <- array(NA,dim=c(2,69),dimnames=list(c('Y','X'),1:69)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal 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 1 1.4 2.00 2 1.2 2.00 3 1.0 2.00 4 1.7 2.00 5 2.4 2.00 6 2.0 2.00 7 2.1 2.00 8 2.0 2.00 9 1.8 2.00 10 2.7 2.00 11 2.3 2.00 12 1.9 2.00 13 2.0 2.00 14 2.3 2.00 15 2.8 2.00 16 2.4 2.00 17 2.3 2.00 18 2.7 2.00 19 2.7 2.00 20 2.9 2.00 21 3.0 2.00 22 2.2 2.00 23 2.3 2.00 24 2.8 2.21 25 2.8 2.25 26 2.8 2.25 27 2.2 2.45 28 2.6 2.50 29 2.8 2.50 30 2.5 2.64 31 2.4 2.75 32 2.3 2.93 33 1.9 3.00 34 1.7 3.17 35 2.0 3.25 36 2.1 3.39 37 1.7 3.50 38 1.8 3.50 39 1.8 3.65 40 1.8 3.75 41 1.3 3.75 42 1.3 3.90 43 1.3 4.00 44 1.2 4.00 45 1.4 4.00 46 2.2 4.00 47 2.9 4.00 48 3.1 4.00 49 3.5 4.00 50 3.6 4.00 51 4.4 4.00 52 4.1 4.00 53 5.1 4.00 54 5.8 4.00 55 5.9 4.18 56 5.4 4.25 57 5.5 4.25 58 4.8 3.97 59 3.2 3.42 60 2.7 2.75 61 2.1 2.31 62 1.9 2.00 63 0.6 1.66 64 0.7 1.31 65 -0.2 1.09 66 -1.0 1.00 67 -1.7 1.00 68 -0.7 1.00 69 -1.0 1.00 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X -0.2074 0.9211 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.4137 -0.7861 0.2573 0.7652 2.3230 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.2074 0.4065 -0.510 0.611 X 0.9211 0.1414 6.516 1.1e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.151 on 67 degrees of freedom Multiple R-squared: 0.3879, Adjusted R-squared: 0.3788 F-statistic: 42.46 on 1 and 67 DF, p-value: 1.101e-08 > 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,] 1.615945e-01 3.231890e-01 0.838405476 [2,] 8.477746e-02 1.695549e-01 0.915222541 [3,] 4.566541e-02 9.133083e-02 0.954334587 [4,] 2.069905e-02 4.139810e-02 0.979300950 [5,] 7.837241e-03 1.567448e-02 0.992162759 [6,] 1.167521e-02 2.335042e-02 0.988324789 [7,] 6.458034e-03 1.291607e-02 0.993541966 [8,] 2.593122e-03 5.186244e-03 0.997406878 [9,] 1.018801e-03 2.037602e-03 0.998981199 [10,] 5.132215e-04 1.026443e-03 0.999486778 [11,] 7.077065e-04 1.415413e-03 0.999292293 [12,] 3.795823e-04 7.591645e-04 0.999620418 [13,] 1.756234e-04 3.512469e-04 0.999824377 [14,] 1.532946e-04 3.065892e-04 0.999846705 [15,] 1.260897e-04 2.521794e-04 0.999873910 [16,] 1.539314e-04 3.078628e-04 0.999846069 [17,] 2.199933e-04 4.399866e-04 0.999780007 [18,] 1.048736e-04 2.097473e-04 0.999895126 [19,] 5.211182e-05 1.042236e-04 0.999947888 [20,] 2.788847e-05 5.577695e-05 0.999972112 [21,] 1.520776e-05 3.041552e-05 0.999984792 [22,] 8.556362e-06 1.711272e-05 0.999991444 [23,] 8.950872e-06 1.790174e-05 0.999991049 [24,] 4.441123e-06 8.882247e-06 0.999995559 [25,] 2.395678e-06 4.791357e-06 0.999997604 [26,] 1.243554e-06 2.487109e-06 0.999998756 [27,] 6.415598e-07 1.283120e-06 0.999999358 [28,] 3.305203e-07 6.610406e-07 0.999999669 [29,] 2.489090e-07 4.978181e-07 0.999999751 [30,] 2.013828e-07 4.027657e-07 0.999999799 [31,] 8.270615e-08 1.654123e-07 0.999999917 [32,] 3.123974e-08 6.247948e-08 0.999999969 [33,] 1.881204e-08 3.762408e-08 0.999999981 [34,] 9.067901e-09 1.813580e-08 0.999999991 [35,] 4.791800e-09 9.583600e-09 0.999999995 [36,] 2.873889e-09 5.747778e-09 0.999999997 [37,] 5.562874e-09 1.112575e-08 0.999999994 [38,] 1.576855e-08 3.153710e-08 0.999999984 [39,] 8.807501e-08 1.761500e-07 0.999999912 [40,] 1.675737e-06 3.351474e-06 0.999998324 [41,] 6.214673e-05 1.242935e-04 0.999937853 [42,] 1.093785e-03 2.187571e-03 0.998906215 [43,] 1.283297e-02 2.566594e-02 0.987167031 [44,] 9.178370e-02 1.835674e-01 0.908216299 [45,] 3.173804e-01 6.347608e-01 0.682619576 [46,] 6.583571e-01 6.832858e-01 0.341642913 [47,] 8.272309e-01 3.455382e-01 0.172769081 [48,] 9.345397e-01 1.309205e-01 0.065460262 [49,] 9.609885e-01 7.802292e-02 0.039011459 [50,] 9.877799e-01 2.444021e-02 0.012220107 [51,] 9.933642e-01 1.327151e-02 0.006635757 [52,] 9.908665e-01 1.826696e-02 0.009133479 [53,] 9.864983e-01 2.700332e-02 0.013501659 [54,] 9.759596e-01 4.808070e-02 0.024040351 [55,] 9.844407e-01 3.111862e-02 0.015559309 [56,] 9.783054e-01 4.338912e-02 0.021694560 [57,] 9.645437e-01 7.091265e-02 0.035456324 [58,] 9.209381e-01 1.581237e-01 0.079061863 [59,] 9.631038e-01 7.379239e-02 0.036896194 [60,] 9.209028e-01 1.581944e-01 0.079097184 > postscript(file="/var/www/html/rcomp/tmp/1p58a1258652961.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/26t6b1258652961.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/3pn4w1258652961.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/4indi1258652961.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/5k9yz1258652961.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 = 69 Frequency = 1 1 2 3 4 5 6 -0.23476638 -0.43476638 -0.63476638 0.06523362 0.76523362 0.36523362 7 8 9 10 11 12 0.46523362 0.36523362 0.16523362 1.06523362 0.66523362 0.26523362 13 14 15 16 17 18 0.36523362 0.66523362 1.16523362 0.76523362 0.66523362 1.06523362 19 20 21 22 23 24 1.06523362 1.26523362 1.36523362 0.56523362 0.66523362 0.97180203 25 26 27 28 29 30 0.93495791 0.93495791 0.15073735 0.50468221 0.70468221 0.27572782 31 32 33 34 35 36 0.07440651 -0.19139200 -0.65586920 -1.01245668 -0.78614490 -0.81509929 37 38 39 40 41 42 -1.31642060 -1.21642060 -1.35458603 -1.44669631 -1.94669631 -2.08486173 43 44 45 46 47 48 -2.17697201 -2.27697201 -2.07697201 -1.27697201 -0.57697201 -0.37697201 49 50 51 52 53 54 0.02302799 0.12302799 0.92302799 0.62302799 1.62302799 2.32302799 55 56 57 58 59 60 2.25722948 1.69275229 1.79275229 1.35066107 0.25726762 0.37440651 61 62 63 64 65 66 0.17969174 0.26523362 -0.72159143 -0.29920544 -0.99656282 -1.71366357 67 68 69 -2.41366357 -1.41366357 -1.71366357 > postscript(file="/var/www/html/rcomp/tmp/6zxlh1258652961.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 = 69 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.23476638 NA 1 -0.43476638 -0.23476638 2 -0.63476638 -0.43476638 3 0.06523362 -0.63476638 4 0.76523362 0.06523362 5 0.36523362 0.76523362 6 0.46523362 0.36523362 7 0.36523362 0.46523362 8 0.16523362 0.36523362 9 1.06523362 0.16523362 10 0.66523362 1.06523362 11 0.26523362 0.66523362 12 0.36523362 0.26523362 13 0.66523362 0.36523362 14 1.16523362 0.66523362 15 0.76523362 1.16523362 16 0.66523362 0.76523362 17 1.06523362 0.66523362 18 1.06523362 1.06523362 19 1.26523362 1.06523362 20 1.36523362 1.26523362 21 0.56523362 1.36523362 22 0.66523362 0.56523362 23 0.97180203 0.66523362 24 0.93495791 0.97180203 25 0.93495791 0.93495791 26 0.15073735 0.93495791 27 0.50468221 0.15073735 28 0.70468221 0.50468221 29 0.27572782 0.70468221 30 0.07440651 0.27572782 31 -0.19139200 0.07440651 32 -0.65586920 -0.19139200 33 -1.01245668 -0.65586920 34 -0.78614490 -1.01245668 35 -0.81509929 -0.78614490 36 -1.31642060 -0.81509929 37 -1.21642060 -1.31642060 38 -1.35458603 -1.21642060 39 -1.44669631 -1.35458603 40 -1.94669631 -1.44669631 41 -2.08486173 -1.94669631 42 -2.17697201 -2.08486173 43 -2.27697201 -2.17697201 44 -2.07697201 -2.27697201 45 -1.27697201 -2.07697201 46 -0.57697201 -1.27697201 47 -0.37697201 -0.57697201 48 0.02302799 -0.37697201 49 0.12302799 0.02302799 50 0.92302799 0.12302799 51 0.62302799 0.92302799 52 1.62302799 0.62302799 53 2.32302799 1.62302799 54 2.25722948 2.32302799 55 1.69275229 2.25722948 56 1.79275229 1.69275229 57 1.35066107 1.79275229 58 0.25726762 1.35066107 59 0.37440651 0.25726762 60 0.17969174 0.37440651 61 0.26523362 0.17969174 62 -0.72159143 0.26523362 63 -0.29920544 -0.72159143 64 -0.99656282 -0.29920544 65 -1.71366357 -0.99656282 66 -2.41366357 -1.71366357 67 -1.41366357 -2.41366357 68 -1.71366357 -1.41366357 69 NA -1.71366357 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.43476638 -0.23476638 [2,] -0.63476638 -0.43476638 [3,] 0.06523362 -0.63476638 [4,] 0.76523362 0.06523362 [5,] 0.36523362 0.76523362 [6,] 0.46523362 0.36523362 [7,] 0.36523362 0.46523362 [8,] 0.16523362 0.36523362 [9,] 1.06523362 0.16523362 [10,] 0.66523362 1.06523362 [11,] 0.26523362 0.66523362 [12,] 0.36523362 0.26523362 [13,] 0.66523362 0.36523362 [14,] 1.16523362 0.66523362 [15,] 0.76523362 1.16523362 [16,] 0.66523362 0.76523362 [17,] 1.06523362 0.66523362 [18,] 1.06523362 1.06523362 [19,] 1.26523362 1.06523362 [20,] 1.36523362 1.26523362 [21,] 0.56523362 1.36523362 [22,] 0.66523362 0.56523362 [23,] 0.97180203 0.66523362 [24,] 0.93495791 0.97180203 [25,] 0.93495791 0.93495791 [26,] 0.15073735 0.93495791 [27,] 0.50468221 0.15073735 [28,] 0.70468221 0.50468221 [29,] 0.27572782 0.70468221 [30,] 0.07440651 0.27572782 [31,] -0.19139200 0.07440651 [32,] -0.65586920 -0.19139200 [33,] -1.01245668 -0.65586920 [34,] -0.78614490 -1.01245668 [35,] -0.81509929 -0.78614490 [36,] -1.31642060 -0.81509929 [37,] -1.21642060 -1.31642060 [38,] -1.35458603 -1.21642060 [39,] -1.44669631 -1.35458603 [40,] -1.94669631 -1.44669631 [41,] -2.08486173 -1.94669631 [42,] -2.17697201 -2.08486173 [43,] -2.27697201 -2.17697201 [44,] -2.07697201 -2.27697201 [45,] -1.27697201 -2.07697201 [46,] -0.57697201 -1.27697201 [47,] -0.37697201 -0.57697201 [48,] 0.02302799 -0.37697201 [49,] 0.12302799 0.02302799 [50,] 0.92302799 0.12302799 [51,] 0.62302799 0.92302799 [52,] 1.62302799 0.62302799 [53,] 2.32302799 1.62302799 [54,] 2.25722948 2.32302799 [55,] 1.69275229 2.25722948 [56,] 1.79275229 1.69275229 [57,] 1.35066107 1.79275229 [58,] 0.25726762 1.35066107 [59,] 0.37440651 0.25726762 [60,] 0.17969174 0.37440651 [61,] 0.26523362 0.17969174 [62,] -0.72159143 0.26523362 [63,] -0.29920544 -0.72159143 [64,] -0.99656282 -0.29920544 [65,] -1.71366357 -0.99656282 [66,] -2.41366357 -1.71366357 [67,] -1.41366357 -2.41366357 [68,] -1.71366357 -1.41366357 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.43476638 -0.23476638 2 -0.63476638 -0.43476638 3 0.06523362 -0.63476638 4 0.76523362 0.06523362 5 0.36523362 0.76523362 6 0.46523362 0.36523362 7 0.36523362 0.46523362 8 0.16523362 0.36523362 9 1.06523362 0.16523362 10 0.66523362 1.06523362 11 0.26523362 0.66523362 12 0.36523362 0.26523362 13 0.66523362 0.36523362 14 1.16523362 0.66523362 15 0.76523362 1.16523362 16 0.66523362 0.76523362 17 1.06523362 0.66523362 18 1.06523362 1.06523362 19 1.26523362 1.06523362 20 1.36523362 1.26523362 21 0.56523362 1.36523362 22 0.66523362 0.56523362 23 0.97180203 0.66523362 24 0.93495791 0.97180203 25 0.93495791 0.93495791 26 0.15073735 0.93495791 27 0.50468221 0.15073735 28 0.70468221 0.50468221 29 0.27572782 0.70468221 30 0.07440651 0.27572782 31 -0.19139200 0.07440651 32 -0.65586920 -0.19139200 33 -1.01245668 -0.65586920 34 -0.78614490 -1.01245668 35 -0.81509929 -0.78614490 36 -1.31642060 -0.81509929 37 -1.21642060 -1.31642060 38 -1.35458603 -1.21642060 39 -1.44669631 -1.35458603 40 -1.94669631 -1.44669631 41 -2.08486173 -1.94669631 42 -2.17697201 -2.08486173 43 -2.27697201 -2.17697201 44 -2.07697201 -2.27697201 45 -1.27697201 -2.07697201 46 -0.57697201 -1.27697201 47 -0.37697201 -0.57697201 48 0.02302799 -0.37697201 49 0.12302799 0.02302799 50 0.92302799 0.12302799 51 0.62302799 0.92302799 52 1.62302799 0.62302799 53 2.32302799 1.62302799 54 2.25722948 2.32302799 55 1.69275229 2.25722948 56 1.79275229 1.69275229 57 1.35066107 1.79275229 58 0.25726762 1.35066107 59 0.37440651 0.25726762 60 0.17969174 0.37440651 61 0.26523362 0.17969174 62 -0.72159143 0.26523362 63 -0.29920544 -0.72159143 64 -0.99656282 -0.29920544 65 -1.71366357 -0.99656282 66 -2.41366357 -1.71366357 67 -1.41366357 -2.41366357 68 -1.71366357 -1.41366357 > 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/7l48q1258652961.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/8hzuv1258652961.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/94ft31258652961.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/107n8z1258652961.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/11s83b1258652961.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/12rxji1258652961.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/1349nl1258652961.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/141h1d1258652962.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/15z4if1258652962.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/166ogj1258652962.tab") + } > > system("convert tmp/1p58a1258652961.ps tmp/1p58a1258652961.png") > system("convert tmp/26t6b1258652961.ps tmp/26t6b1258652961.png") > system("convert tmp/3pn4w1258652961.ps tmp/3pn4w1258652961.png") > system("convert tmp/4indi1258652961.ps tmp/4indi1258652961.png") > system("convert tmp/5k9yz1258652961.ps tmp/5k9yz1258652961.png") > system("convert tmp/6zxlh1258652961.ps tmp/6zxlh1258652961.png") > system("convert tmp/7l48q1258652961.ps tmp/7l48q1258652961.png") > system("convert tmp/8hzuv1258652961.ps tmp/8hzuv1258652961.png") > system("convert tmp/94ft31258652961.ps tmp/94ft31258652961.png") > system("convert tmp/107n8z1258652961.ps tmp/107n8z1258652961.png") > > > proc.time() user system elapsed 2.509 1.571 3.228