R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,1,0,0,1,0),dim=c(3,86),dimnames=list(c('Treatment4weken','treatment2weken','CorrectAnalysis'),1:86)) > y <- array(NA,dim=c(3,86),dimnames=list(c('Treatment4weken','treatment2weken','CorrectAnalysis'),1:86)) > 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' > 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, 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 Treatment4weken treatment2weken CorrectAnalysis 1 1 0 0 2 0 1 0 3 0 1 0 4 0 1 0 5 0 1 0 6 0 1 0 7 0 1 0 8 1 0 0 9 0 1 0 10 0 1 0 11 1 0 0 12 0 1 0 13 0 1 0 14 1 0 0 15 0 1 0 16 1 0 0 17 1 0 1 18 1 0 0 19 0 1 0 20 1 0 1 21 0 1 0 22 0 1 0 23 0 1 0 24 0 1 0 25 1 0 0 26 0 1 0 27 0 1 0 28 0 1 0 29 0 1 0 30 0 1 0 31 0 1 0 32 0 1 0 33 0 1 0 34 1 0 0 35 0 1 0 36 0 1 0 37 1 0 0 38 0 1 0 39 0 1 0 40 1 0 0 41 0 1 1 42 0 1 0 43 0 1 0 44 1 0 0 45 0 1 0 46 0 1 0 47 0 1 0 48 0 1 0 49 0 1 0 50 0 1 0 51 1 0 0 52 1 0 1 53 0 1 0 54 0 1 1 55 0 1 0 56 1 0 0 57 0 1 0 58 0 1 0 59 0 1 0 60 1 0 1 61 1 0 0 62 0 1 0 63 0 1 0 64 1 0 0 65 0 1 0 66 0 1 0 67 1 0 1 68 0 1 0 69 0 1 0 70 0 1 0 71 0 1 0 72 0 1 0 73 0 1 0 74 0 1 0 75 0 1 0 76 1 0 0 77 0 1 0 78 0 1 0 79 1 0 1 80 1 0 0 81 0 1 0 82 0 1 0 83 0 1 0 84 0 1 1 85 0 1 0 86 0 1 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) treatment2weken CorrectAnalysis 1.000e+00 -1.000e+00 2.461e-18 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.749e-16 -9.860e-18 -9.860e-18 6.160e-18 6.189e-16 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.000e+00 1.637e-17 6.108e+16 <2e-16 *** treatment2weken -1.000e+00 1.824e-17 -5.481e+16 <2e-16 *** CorrectAnalysis 2.461e-18 2.638e-17 9.300e-02 0.926 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.124e-17 on 83 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 1.66e+33 on 2 and 83 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,] 3.381890e-04 6.763780e-04 9.996618e-01 [2,] 9.966435e-01 6.713004e-03 3.356502e-03 [3,] 9.992772e-01 1.445618e-03 7.228089e-04 [4,] 1.000000e+00 4.532244e-22 2.266122e-22 [5,] 4.538112e-02 9.076224e-02 9.546189e-01 [6,] 1.688164e-02 3.376327e-02 9.831184e-01 [7,] 8.867185e-01 2.265631e-01 1.132815e-01 [8,] 1.198418e-01 2.396837e-01 8.801582e-01 [9,] 4.419392e-01 8.838784e-01 5.580608e-01 [10,] 1.000000e+00 1.244751e-13 6.223753e-14 [11,] 2.901653e-01 5.803305e-01 7.098347e-01 [12,] 9.854073e-01 2.918536e-02 1.459268e-02 [13,] 9.700956e-01 5.980880e-02 2.990440e-02 [14,] 7.332412e-03 1.466482e-02 9.926676e-01 [15,] 1.000000e+00 3.660279e-11 1.830139e-11 [16,] 2.294286e-01 4.588571e-01 7.705714e-01 [17,] 8.996202e-01 2.007596e-01 1.003798e-01 [18,] 7.716528e-01 4.566943e-01 2.283472e-01 [19,] 4.197135e-01 8.394270e-01 5.802865e-01 [20,] 9.999996e-01 8.772542e-07 4.386271e-07 [21,] 1.930514e-15 3.861028e-15 1.000000e+00 [22,] 5.062027e-03 1.012405e-02 9.949380e-01 [23,] 2.835734e-03 5.671467e-03 9.971643e-01 [24,] 1.000000e+00 6.499800e-10 3.249900e-10 [25,] 1.000000e+00 5.143790e-12 2.571895e-12 [26,] 8.060612e-06 1.612122e-05 9.999919e-01 [27,] 7.556725e-01 4.886550e-01 2.443275e-01 [28,] 6.561023e-01 6.877953e-01 3.438977e-01 [29,] 8.719753e-01 2.560495e-01 1.280247e-01 [30,] 9.941476e-01 1.170476e-02 5.852378e-03 [31,] 9.452685e-01 1.094630e-01 5.473150e-02 [32,] 3.313840e-05 6.627679e-05 9.999669e-01 [33,] 8.261956e-02 1.652391e-01 9.173804e-01 [34,] 4.272890e-14 8.545781e-14 1.000000e+00 [35,] 4.852066e-05 9.704131e-05 9.999515e-01 [36,] 8.461329e-01 3.077342e-01 1.538671e-01 [37,] 1.000000e+00 8.773652e-08 4.386826e-08 [38,] 9.999988e-01 2.374879e-06 1.187440e-06 [39,] 1.247891e-01 2.495782e-01 8.752109e-01 [40,] 1.000000e+00 8.550193e-13 4.275097e-13 [41,] 9.999407e-01 1.186298e-04 5.931491e-05 [42,] 1.000000e+00 1.371088e-17 6.855440e-18 [43,] 9.064619e-01 1.870761e-01 9.353806e-02 [44,] 8.692742e-01 2.614516e-01 1.307258e-01 [45,] 7.422776e-02 1.484555e-01 9.257722e-01 [46,] 2.150216e-05 4.300432e-05 9.999785e-01 [47,] 4.598103e-10 9.196206e-10 1.000000e+00 [48,] 3.588490e-01 7.176980e-01 6.411510e-01 [49,] 6.913293e-01 6.173414e-01 3.086707e-01 [50,] 9.998370e-01 3.259774e-04 1.629887e-04 [51,] 7.648654e-03 1.529731e-02 9.923513e-01 [52,] 1.017943e-01 2.035886e-01 8.982057e-01 [53,] 9.976133e-01 4.773388e-03 2.386694e-03 [54,] 1.000000e+00 2.299299e-10 1.149649e-10 [55,] 1.000000e+00 5.641338e-13 2.820669e-13 [56,] 4.674394e-01 9.348788e-01 5.325606e-01 [57,] 1.000000e+00 2.784518e-08 1.392259e-08 [58,] 6.033042e-02 1.206608e-01 9.396696e-01 [59,] 3.055352e-22 6.110705e-22 1.000000e+00 [60,] 9.865272e-01 2.694550e-02 1.347275e-02 [61,] 3.175335e-03 6.350669e-03 9.968247e-01 [62,] 9.999473e-01 1.054467e-04 5.272336e-05 [63,] 3.841152e-01 7.682305e-01 6.158848e-01 [64,] 5.942886e-01 8.114227e-01 4.057114e-01 [65,] 3.930572e-01 7.861144e-01 6.069428e-01 [66,] 5.515847e-03 1.103169e-02 9.944842e-01 [67,] 5.105458e-01 9.789085e-01 4.894542e-01 [68,] 1.081626e-10 2.163251e-10 1.000000e+00 [69,] 4.069946e-03 8.139891e-03 9.959301e-01 [70,] 9.730258e-01 5.394848e-02 2.697424e-02 [71,] 9.999997e-01 5.227415e-07 2.613707e-07 [72,] 7.318886e-01 5.362228e-01 2.681114e-01 [73,] 6.033482e-01 7.933036e-01 3.966518e-01 [74,] 4.303448e-03 8.606895e-03 9.956966e-01 [75,] 1.000000e+00 0.000000e+00 0.000000e+00 > postscript(file="/var/wessaorg/rcomp/tmp/1fuvt1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2w88v1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3lzjt1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4ygzn1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/52g9r1356095216.ps",horizontal=F,onefile=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 = 86 Frequency = 1 1 2 3 4 5 -1.749470e-16 6.188744e-16 -9.862748e-18 -9.862748e-18 -9.862748e-18 6 7 8 9 10 -9.862748e-18 -9.862748e-18 8.623414e-18 -9.862748e-18 -9.862748e-18 11 12 13 14 15 8.623414e-18 -9.862748e-18 -9.862748e-18 8.623414e-18 -9.862748e-18 16 17 18 19 20 8.623414e-18 6.162054e-18 8.623414e-18 -9.862748e-18 6.162054e-18 21 22 23 24 25 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 8.623414e-18 26 27 28 29 30 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 31 32 33 34 35 -9.862748e-18 -9.862748e-18 -9.862748e-18 8.623414e-18 -9.862748e-18 36 37 38 39 40 -9.862748e-18 8.623414e-18 -9.862748e-18 -9.862748e-18 8.623414e-18 41 42 43 44 45 -1.232411e-17 -9.862748e-18 -9.862748e-18 8.623414e-18 -9.862748e-18 46 47 48 49 50 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 51 52 53 54 55 8.623414e-18 6.162054e-18 -9.862748e-18 -1.232411e-17 -9.862748e-18 56 57 58 59 60 8.623414e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 6.162054e-18 61 62 63 64 65 8.623414e-18 -9.862748e-18 -9.862748e-18 8.623414e-18 -9.862748e-18 66 67 68 69 70 -9.862748e-18 6.162054e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 71 72 73 74 75 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 -9.862748e-18 76 77 78 79 80 8.623414e-18 -9.862748e-18 -9.862748e-18 6.162054e-18 8.623414e-18 81 82 83 84 85 -9.862748e-18 -9.862748e-18 -9.862748e-18 -1.232411e-17 -9.862748e-18 86 -9.862748e-18 > postscript(file="/var/wessaorg/rcomp/tmp/6rjy11356095216.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 86 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.749470e-16 NA 1 6.188744e-16 -1.749470e-16 2 -9.862748e-18 6.188744e-16 3 -9.862748e-18 -9.862748e-18 4 -9.862748e-18 -9.862748e-18 5 -9.862748e-18 -9.862748e-18 6 -9.862748e-18 -9.862748e-18 7 8.623414e-18 -9.862748e-18 8 -9.862748e-18 8.623414e-18 9 -9.862748e-18 -9.862748e-18 10 8.623414e-18 -9.862748e-18 11 -9.862748e-18 8.623414e-18 12 -9.862748e-18 -9.862748e-18 13 8.623414e-18 -9.862748e-18 14 -9.862748e-18 8.623414e-18 15 8.623414e-18 -9.862748e-18 16 6.162054e-18 8.623414e-18 17 8.623414e-18 6.162054e-18 18 -9.862748e-18 8.623414e-18 19 6.162054e-18 -9.862748e-18 20 -9.862748e-18 6.162054e-18 21 -9.862748e-18 -9.862748e-18 22 -9.862748e-18 -9.862748e-18 23 -9.862748e-18 -9.862748e-18 24 8.623414e-18 -9.862748e-18 25 -9.862748e-18 8.623414e-18 26 -9.862748e-18 -9.862748e-18 27 -9.862748e-18 -9.862748e-18 28 -9.862748e-18 -9.862748e-18 29 -9.862748e-18 -9.862748e-18 30 -9.862748e-18 -9.862748e-18 31 -9.862748e-18 -9.862748e-18 32 -9.862748e-18 -9.862748e-18 33 8.623414e-18 -9.862748e-18 34 -9.862748e-18 8.623414e-18 35 -9.862748e-18 -9.862748e-18 36 8.623414e-18 -9.862748e-18 37 -9.862748e-18 8.623414e-18 38 -9.862748e-18 -9.862748e-18 39 8.623414e-18 -9.862748e-18 40 -1.232411e-17 8.623414e-18 41 -9.862748e-18 -1.232411e-17 42 -9.862748e-18 -9.862748e-18 43 8.623414e-18 -9.862748e-18 44 -9.862748e-18 8.623414e-18 45 -9.862748e-18 -9.862748e-18 46 -9.862748e-18 -9.862748e-18 47 -9.862748e-18 -9.862748e-18 48 -9.862748e-18 -9.862748e-18 49 -9.862748e-18 -9.862748e-18 50 8.623414e-18 -9.862748e-18 51 6.162054e-18 8.623414e-18 52 -9.862748e-18 6.162054e-18 53 -1.232411e-17 -9.862748e-18 54 -9.862748e-18 -1.232411e-17 55 8.623414e-18 -9.862748e-18 56 -9.862748e-18 8.623414e-18 57 -9.862748e-18 -9.862748e-18 58 -9.862748e-18 -9.862748e-18 59 6.162054e-18 -9.862748e-18 60 8.623414e-18 6.162054e-18 61 -9.862748e-18 8.623414e-18 62 -9.862748e-18 -9.862748e-18 63 8.623414e-18 -9.862748e-18 64 -9.862748e-18 8.623414e-18 65 -9.862748e-18 -9.862748e-18 66 6.162054e-18 -9.862748e-18 67 -9.862748e-18 6.162054e-18 68 -9.862748e-18 -9.862748e-18 69 -9.862748e-18 -9.862748e-18 70 -9.862748e-18 -9.862748e-18 71 -9.862748e-18 -9.862748e-18 72 -9.862748e-18 -9.862748e-18 73 -9.862748e-18 -9.862748e-18 74 -9.862748e-18 -9.862748e-18 75 8.623414e-18 -9.862748e-18 76 -9.862748e-18 8.623414e-18 77 -9.862748e-18 -9.862748e-18 78 6.162054e-18 -9.862748e-18 79 8.623414e-18 6.162054e-18 80 -9.862748e-18 8.623414e-18 81 -9.862748e-18 -9.862748e-18 82 -9.862748e-18 -9.862748e-18 83 -1.232411e-17 -9.862748e-18 84 -9.862748e-18 -1.232411e-17 85 -9.862748e-18 -9.862748e-18 86 NA -9.862748e-18 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.188744e-16 -1.749470e-16 [2,] -9.862748e-18 6.188744e-16 [3,] -9.862748e-18 -9.862748e-18 [4,] -9.862748e-18 -9.862748e-18 [5,] -9.862748e-18 -9.862748e-18 [6,] -9.862748e-18 -9.862748e-18 [7,] 8.623414e-18 -9.862748e-18 [8,] -9.862748e-18 8.623414e-18 [9,] -9.862748e-18 -9.862748e-18 [10,] 8.623414e-18 -9.862748e-18 [11,] -9.862748e-18 8.623414e-18 [12,] -9.862748e-18 -9.862748e-18 [13,] 8.623414e-18 -9.862748e-18 [14,] -9.862748e-18 8.623414e-18 [15,] 8.623414e-18 -9.862748e-18 [16,] 6.162054e-18 8.623414e-18 [17,] 8.623414e-18 6.162054e-18 [18,] -9.862748e-18 8.623414e-18 [19,] 6.162054e-18 -9.862748e-18 [20,] -9.862748e-18 6.162054e-18 [21,] -9.862748e-18 -9.862748e-18 [22,] -9.862748e-18 -9.862748e-18 [23,] -9.862748e-18 -9.862748e-18 [24,] 8.623414e-18 -9.862748e-18 [25,] -9.862748e-18 8.623414e-18 [26,] -9.862748e-18 -9.862748e-18 [27,] -9.862748e-18 -9.862748e-18 [28,] -9.862748e-18 -9.862748e-18 [29,] -9.862748e-18 -9.862748e-18 [30,] -9.862748e-18 -9.862748e-18 [31,] -9.862748e-18 -9.862748e-18 [32,] -9.862748e-18 -9.862748e-18 [33,] 8.623414e-18 -9.862748e-18 [34,] -9.862748e-18 8.623414e-18 [35,] -9.862748e-18 -9.862748e-18 [36,] 8.623414e-18 -9.862748e-18 [37,] -9.862748e-18 8.623414e-18 [38,] -9.862748e-18 -9.862748e-18 [39,] 8.623414e-18 -9.862748e-18 [40,] -1.232411e-17 8.623414e-18 [41,] -9.862748e-18 -1.232411e-17 [42,] -9.862748e-18 -9.862748e-18 [43,] 8.623414e-18 -9.862748e-18 [44,] -9.862748e-18 8.623414e-18 [45,] -9.862748e-18 -9.862748e-18 [46,] -9.862748e-18 -9.862748e-18 [47,] -9.862748e-18 -9.862748e-18 [48,] -9.862748e-18 -9.862748e-18 [49,] -9.862748e-18 -9.862748e-18 [50,] 8.623414e-18 -9.862748e-18 [51,] 6.162054e-18 8.623414e-18 [52,] -9.862748e-18 6.162054e-18 [53,] -1.232411e-17 -9.862748e-18 [54,] -9.862748e-18 -1.232411e-17 [55,] 8.623414e-18 -9.862748e-18 [56,] -9.862748e-18 8.623414e-18 [57,] -9.862748e-18 -9.862748e-18 [58,] -9.862748e-18 -9.862748e-18 [59,] 6.162054e-18 -9.862748e-18 [60,] 8.623414e-18 6.162054e-18 [61,] -9.862748e-18 8.623414e-18 [62,] -9.862748e-18 -9.862748e-18 [63,] 8.623414e-18 -9.862748e-18 [64,] -9.862748e-18 8.623414e-18 [65,] -9.862748e-18 -9.862748e-18 [66,] 6.162054e-18 -9.862748e-18 [67,] -9.862748e-18 6.162054e-18 [68,] -9.862748e-18 -9.862748e-18 [69,] -9.862748e-18 -9.862748e-18 [70,] -9.862748e-18 -9.862748e-18 [71,] -9.862748e-18 -9.862748e-18 [72,] -9.862748e-18 -9.862748e-18 [73,] -9.862748e-18 -9.862748e-18 [74,] -9.862748e-18 -9.862748e-18 [75,] 8.623414e-18 -9.862748e-18 [76,] -9.862748e-18 8.623414e-18 [77,] -9.862748e-18 -9.862748e-18 [78,] 6.162054e-18 -9.862748e-18 [79,] 8.623414e-18 6.162054e-18 [80,] -9.862748e-18 8.623414e-18 [81,] -9.862748e-18 -9.862748e-18 [82,] -9.862748e-18 -9.862748e-18 [83,] -1.232411e-17 -9.862748e-18 [84,] -9.862748e-18 -1.232411e-17 [85,] -9.862748e-18 -9.862748e-18 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.188744e-16 -1.749470e-16 2 -9.862748e-18 6.188744e-16 3 -9.862748e-18 -9.862748e-18 4 -9.862748e-18 -9.862748e-18 5 -9.862748e-18 -9.862748e-18 6 -9.862748e-18 -9.862748e-18 7 8.623414e-18 -9.862748e-18 8 -9.862748e-18 8.623414e-18 9 -9.862748e-18 -9.862748e-18 10 8.623414e-18 -9.862748e-18 11 -9.862748e-18 8.623414e-18 12 -9.862748e-18 -9.862748e-18 13 8.623414e-18 -9.862748e-18 14 -9.862748e-18 8.623414e-18 15 8.623414e-18 -9.862748e-18 16 6.162054e-18 8.623414e-18 17 8.623414e-18 6.162054e-18 18 -9.862748e-18 8.623414e-18 19 6.162054e-18 -9.862748e-18 20 -9.862748e-18 6.162054e-18 21 -9.862748e-18 -9.862748e-18 22 -9.862748e-18 -9.862748e-18 23 -9.862748e-18 -9.862748e-18 24 8.623414e-18 -9.862748e-18 25 -9.862748e-18 8.623414e-18 26 -9.862748e-18 -9.862748e-18 27 -9.862748e-18 -9.862748e-18 28 -9.862748e-18 -9.862748e-18 29 -9.862748e-18 -9.862748e-18 30 -9.862748e-18 -9.862748e-18 31 -9.862748e-18 -9.862748e-18 32 -9.862748e-18 -9.862748e-18 33 8.623414e-18 -9.862748e-18 34 -9.862748e-18 8.623414e-18 35 -9.862748e-18 -9.862748e-18 36 8.623414e-18 -9.862748e-18 37 -9.862748e-18 8.623414e-18 38 -9.862748e-18 -9.862748e-18 39 8.623414e-18 -9.862748e-18 40 -1.232411e-17 8.623414e-18 41 -9.862748e-18 -1.232411e-17 42 -9.862748e-18 -9.862748e-18 43 8.623414e-18 -9.862748e-18 44 -9.862748e-18 8.623414e-18 45 -9.862748e-18 -9.862748e-18 46 -9.862748e-18 -9.862748e-18 47 -9.862748e-18 -9.862748e-18 48 -9.862748e-18 -9.862748e-18 49 -9.862748e-18 -9.862748e-18 50 8.623414e-18 -9.862748e-18 51 6.162054e-18 8.623414e-18 52 -9.862748e-18 6.162054e-18 53 -1.232411e-17 -9.862748e-18 54 -9.862748e-18 -1.232411e-17 55 8.623414e-18 -9.862748e-18 56 -9.862748e-18 8.623414e-18 57 -9.862748e-18 -9.862748e-18 58 -9.862748e-18 -9.862748e-18 59 6.162054e-18 -9.862748e-18 60 8.623414e-18 6.162054e-18 61 -9.862748e-18 8.623414e-18 62 -9.862748e-18 -9.862748e-18 63 8.623414e-18 -9.862748e-18 64 -9.862748e-18 8.623414e-18 65 -9.862748e-18 -9.862748e-18 66 6.162054e-18 -9.862748e-18 67 -9.862748e-18 6.162054e-18 68 -9.862748e-18 -9.862748e-18 69 -9.862748e-18 -9.862748e-18 70 -9.862748e-18 -9.862748e-18 71 -9.862748e-18 -9.862748e-18 72 -9.862748e-18 -9.862748e-18 73 -9.862748e-18 -9.862748e-18 74 -9.862748e-18 -9.862748e-18 75 8.623414e-18 -9.862748e-18 76 -9.862748e-18 8.623414e-18 77 -9.862748e-18 -9.862748e-18 78 6.162054e-18 -9.862748e-18 79 8.623414e-18 6.162054e-18 80 -9.862748e-18 8.623414e-18 81 -9.862748e-18 -9.862748e-18 82 -9.862748e-18 -9.862748e-18 83 -1.232411e-17 -9.862748e-18 84 -9.862748e-18 -1.232411e-17 85 -9.862748e-18 -9.862748e-18 > 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/wessaorg/rcomp/tmp/7ctc61356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/8qx6j1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/9sxhx1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/10wddv1356095216.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/114xvs1356095216.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/wessaorg/rcomp/tmp/12ul9d1356095216.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/wessaorg/rcomp/tmp/1364vf1356095216.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/wessaorg/rcomp/tmp/14489j1356095216.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/wessaorg/rcomp/tmp/15ufvd1356095216.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/wessaorg/rcomp/tmp/164pjy1356095216.tab") + } > > try(system("convert tmp/1fuvt1356095216.ps tmp/1fuvt1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/2w88v1356095216.ps tmp/2w88v1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/3lzjt1356095216.ps tmp/3lzjt1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/4ygzn1356095216.ps tmp/4ygzn1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/52g9r1356095216.ps tmp/52g9r1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/6rjy11356095216.ps tmp/6rjy11356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/7ctc61356095216.ps tmp/7ctc61356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/8qx6j1356095216.ps tmp/8qx6j1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/9sxhx1356095216.ps tmp/9sxhx1356095216.png",intern=TRUE)) character(0) > try(system("convert tmp/10wddv1356095216.ps tmp/10wddv1356095216.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.309 1.015 8.425