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,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,1,1,0,1,0,1,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,1,1,0,1,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,1,1,0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0),dim=c(2,86),dimnames=list(c('T40','CorrectAnalysis'),1:86)) > y <- array(NA,dim=c(2,86),dimnames=list(c('T40','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 = '2' > par3 <- 'No Linear Trend' > par2 <- 'Do not include Seasonal Dummies' > par1 <- '2' > #'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 CorrectAnalysis T40 1 0 1 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 1 9 0 0 10 0 0 11 0 1 12 0 0 13 0 0 14 0 1 15 0 0 16 0 1 17 1 1 18 0 1 19 0 0 20 1 1 21 1 0 22 1 0 23 1 0 24 1 0 25 0 1 26 1 0 27 0 0 28 0 0 29 0 0 30 1 0 31 0 0 32 0 0 33 1 0 34 0 1 35 0 0 36 0 0 37 1 1 38 0 0 39 1 0 40 1 1 41 1 0 42 0 0 43 1 0 44 0 1 45 1 0 46 1 0 47 0 0 48 0 0 49 1 0 50 0 0 51 0 1 52 1 1 53 0 0 54 0 0 55 0 0 56 0 1 57 1 0 58 0 0 59 0 0 60 1 1 61 0 1 62 1 0 63 0 0 64 0 1 65 0 0 66 0 0 67 1 1 68 0 0 69 0 0 70 0 0 71 0 0 72 0 0 73 0 0 74 0 0 75 0 0 76 1 1 77 0 0 78 1 0 79 0 1 80 1 1 81 0 0 82 0 0 83 0 0 84 0 0 85 1 0 86 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) T40 0.2698 0.1215 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.3913 -0.2698 -0.2698 0.6087 0.7302 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.26984 0.05814 4.641 1.27e-05 *** T40 0.12146 0.11243 1.080 0.283 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4615 on 84 degrees of freedom Multiple R-squared: 0.0137, Adjusted R-squared: 0.001962 F-statistic: 1.167 on 1 and 84 DF, p-value: 0.2831 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.0000000000 0.0000000000 1.00000000 [2,] 0.0000000000 0.0000000000 1.00000000 [3,] 0.0000000000 0.0000000000 1.00000000 [4,] 0.0000000000 0.0000000000 1.00000000 [5,] 0.0000000000 0.0000000000 1.00000000 [6,] 0.0000000000 0.0000000000 1.00000000 [7,] 0.0000000000 0.0000000000 1.00000000 [8,] 0.0000000000 0.0000000000 1.00000000 [9,] 0.0000000000 0.0000000000 1.00000000 [10,] 0.0000000000 0.0000000000 1.00000000 [11,] 0.0000000000 0.0000000000 1.00000000 [12,] 0.0000000000 0.0000000000 1.00000000 [13,] 0.0016743781 0.0033487562 0.99832562 [14,] 0.0009878773 0.0019757546 0.99901212 [15,] 0.0004610512 0.0009221024 0.99953895 [16,] 0.0083648463 0.0167296926 0.99163515 [17,] 0.0735232781 0.1470465561 0.92647672 [18,] 0.1937015295 0.3874030591 0.80629847 [19,] 0.3259965367 0.6519930734 0.67400346 [20,] 0.4458337205 0.8916674409 0.55416628 [21,] 0.4089761985 0.8179523970 0.59102380 [22,] 0.5114277425 0.9771445151 0.48857226 [23,] 0.4673889928 0.9347779857 0.53261101 [24,] 0.4227110002 0.8454220003 0.57728900 [25,] 0.3782973132 0.7565946265 0.62170269 [26,] 0.4768000410 0.9536000819 0.52319996 [27,] 0.4339750246 0.8679500493 0.56602498 [28,] 0.3913176782 0.7826353563 0.60868232 [29,] 0.4855507084 0.9711014169 0.51444929 [30,] 0.4598642340 0.9197284680 0.54013577 [31,] 0.4190030624 0.8380061249 0.58099694 [32,] 0.3785012983 0.7570025967 0.62149870 [33,] 0.4441555521 0.8883111042 0.55584445 [34,] 0.4024442367 0.8048884734 0.59755576 [35,] 0.4933012844 0.9866025689 0.50669872 [36,] 0.5415788651 0.9168422697 0.45842113 [37,] 0.6277490524 0.7445018952 0.37225095 [38,] 0.5877917285 0.8244165431 0.41220827 [39,] 0.6735571952 0.6528856096 0.32644280 [40,] 0.6611155513 0.6777688975 0.33888445 [41,] 0.7461542556 0.5076914887 0.25384574 [42,] 0.8250736768 0.3498526464 0.17492632 [43,] 0.7960230066 0.4079539868 0.20397699 [44,] 0.7636188264 0.4727623472 0.23638117 [45,] 0.8470977512 0.3058044976 0.15290225 [46,] 0.8184358456 0.3631283088 0.18156415 [47,] 0.8208754142 0.3582491716 0.17912459 [48,] 0.8419971027 0.3160057947 0.15800290 [49,] 0.8112118672 0.3775762655 0.18878813 [50,] 0.7764509504 0.4470980991 0.22354905 [51,] 0.7378132390 0.5243735220 0.26218676 [52,] 0.7445440936 0.5109118127 0.25545591 [53,] 0.8494576322 0.3010847356 0.15054237 [54,] 0.8158349250 0.3683301499 0.18416507 [55,] 0.7773528421 0.4452943158 0.22264716 [56,] 0.7953731186 0.4092537628 0.20462688 [57,] 0.8106990127 0.3786019746 0.18930099 [58,] 0.9163383402 0.1673233196 0.08366166 [59,] 0.8894669617 0.2210660767 0.11053304 [60,] 0.9277527984 0.1444944033 0.07224720 [61,] 0.9022202335 0.1955595331 0.09777977 [62,] 0.8700576483 0.2598847035 0.12994235 [63,] 0.8590446396 0.2819107208 0.14095536 [64,] 0.8160352299 0.3679295403 0.18396477 [65,] 0.7648174210 0.4703651580 0.23518258 [66,] 0.7056619934 0.5886760132 0.29433801 [67,] 0.6395271554 0.7209456893 0.36047284 [68,] 0.5681131740 0.8637736520 0.43188683 [69,] 0.4938160519 0.9876321039 0.50618395 [70,] 0.4195679910 0.8391359820 0.58043201 [71,] 0.3485835164 0.6971670329 0.65141648 [72,] 0.3309043072 0.6618086145 0.66909569 [73,] 0.2636948210 0.5273896420 0.73630518 [74,] 0.4150935261 0.8301870521 0.58490647 [75,] 0.5720489065 0.8559021870 0.42795109 [76,] 0.4361766101 0.8723532203 0.56382339 [77,] 0.3027933165 0.6055866331 0.69720668 > postscript(file="/var/wessaorg/rcomp/tmp/1ongt1354718140.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/2lu5c1354718140.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/3nx861354718140.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/4tyow1354718140.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/56e2j1354718140.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 6 7 -0.3913043 -0.2698413 -0.2698413 -0.2698413 -0.2698413 -0.2698413 -0.2698413 8 9 10 11 12 13 14 -0.3913043 -0.2698413 -0.2698413 -0.3913043 -0.2698413 -0.2698413 -0.3913043 15 16 17 18 19 20 21 -0.2698413 -0.3913043 0.6086957 -0.3913043 -0.2698413 0.6086957 0.7301587 22 23 24 25 26 27 28 0.7301587 0.7301587 0.7301587 -0.3913043 0.7301587 -0.2698413 -0.2698413 29 30 31 32 33 34 35 -0.2698413 0.7301587 -0.2698413 -0.2698413 0.7301587 -0.3913043 -0.2698413 36 37 38 39 40 41 42 -0.2698413 0.6086957 -0.2698413 0.7301587 0.6086957 0.7301587 -0.2698413 43 44 45 46 47 48 49 0.7301587 -0.3913043 0.7301587 0.7301587 -0.2698413 -0.2698413 0.7301587 50 51 52 53 54 55 56 -0.2698413 -0.3913043 0.6086957 -0.2698413 -0.2698413 -0.2698413 -0.3913043 57 58 59 60 61 62 63 0.7301587 -0.2698413 -0.2698413 0.6086957 -0.3913043 0.7301587 -0.2698413 64 65 66 67 68 69 70 -0.3913043 -0.2698413 -0.2698413 0.6086957 -0.2698413 -0.2698413 -0.2698413 71 72 73 74 75 76 77 -0.2698413 -0.2698413 -0.2698413 -0.2698413 -0.2698413 0.6086957 -0.2698413 78 79 80 81 82 83 84 0.7301587 -0.3913043 0.6086957 -0.2698413 -0.2698413 -0.2698413 -0.2698413 85 86 0.7301587 -0.2698413 > postscript(file="/var/wessaorg/rcomp/tmp/6p3j51354718140.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 -0.3913043 NA 1 -0.2698413 -0.3913043 2 -0.2698413 -0.2698413 3 -0.2698413 -0.2698413 4 -0.2698413 -0.2698413 5 -0.2698413 -0.2698413 6 -0.2698413 -0.2698413 7 -0.3913043 -0.2698413 8 -0.2698413 -0.3913043 9 -0.2698413 -0.2698413 10 -0.3913043 -0.2698413 11 -0.2698413 -0.3913043 12 -0.2698413 -0.2698413 13 -0.3913043 -0.2698413 14 -0.2698413 -0.3913043 15 -0.3913043 -0.2698413 16 0.6086957 -0.3913043 17 -0.3913043 0.6086957 18 -0.2698413 -0.3913043 19 0.6086957 -0.2698413 20 0.7301587 0.6086957 21 0.7301587 0.7301587 22 0.7301587 0.7301587 23 0.7301587 0.7301587 24 -0.3913043 0.7301587 25 0.7301587 -0.3913043 26 -0.2698413 0.7301587 27 -0.2698413 -0.2698413 28 -0.2698413 -0.2698413 29 0.7301587 -0.2698413 30 -0.2698413 0.7301587 31 -0.2698413 -0.2698413 32 0.7301587 -0.2698413 33 -0.3913043 0.7301587 34 -0.2698413 -0.3913043 35 -0.2698413 -0.2698413 36 0.6086957 -0.2698413 37 -0.2698413 0.6086957 38 0.7301587 -0.2698413 39 0.6086957 0.7301587 40 0.7301587 0.6086957 41 -0.2698413 0.7301587 42 0.7301587 -0.2698413 43 -0.3913043 0.7301587 44 0.7301587 -0.3913043 45 0.7301587 0.7301587 46 -0.2698413 0.7301587 47 -0.2698413 -0.2698413 48 0.7301587 -0.2698413 49 -0.2698413 0.7301587 50 -0.3913043 -0.2698413 51 0.6086957 -0.3913043 52 -0.2698413 0.6086957 53 -0.2698413 -0.2698413 54 -0.2698413 -0.2698413 55 -0.3913043 -0.2698413 56 0.7301587 -0.3913043 57 -0.2698413 0.7301587 58 -0.2698413 -0.2698413 59 0.6086957 -0.2698413 60 -0.3913043 0.6086957 61 0.7301587 -0.3913043 62 -0.2698413 0.7301587 63 -0.3913043 -0.2698413 64 -0.2698413 -0.3913043 65 -0.2698413 -0.2698413 66 0.6086957 -0.2698413 67 -0.2698413 0.6086957 68 -0.2698413 -0.2698413 69 -0.2698413 -0.2698413 70 -0.2698413 -0.2698413 71 -0.2698413 -0.2698413 72 -0.2698413 -0.2698413 73 -0.2698413 -0.2698413 74 -0.2698413 -0.2698413 75 0.6086957 -0.2698413 76 -0.2698413 0.6086957 77 0.7301587 -0.2698413 78 -0.3913043 0.7301587 79 0.6086957 -0.3913043 80 -0.2698413 0.6086957 81 -0.2698413 -0.2698413 82 -0.2698413 -0.2698413 83 -0.2698413 -0.2698413 84 0.7301587 -0.2698413 85 -0.2698413 0.7301587 86 NA -0.2698413 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.2698413 -0.3913043 [2,] -0.2698413 -0.2698413 [3,] -0.2698413 -0.2698413 [4,] -0.2698413 -0.2698413 [5,] -0.2698413 -0.2698413 [6,] -0.2698413 -0.2698413 [7,] -0.3913043 -0.2698413 [8,] -0.2698413 -0.3913043 [9,] -0.2698413 -0.2698413 [10,] -0.3913043 -0.2698413 [11,] -0.2698413 -0.3913043 [12,] -0.2698413 -0.2698413 [13,] -0.3913043 -0.2698413 [14,] -0.2698413 -0.3913043 [15,] -0.3913043 -0.2698413 [16,] 0.6086957 -0.3913043 [17,] -0.3913043 0.6086957 [18,] -0.2698413 -0.3913043 [19,] 0.6086957 -0.2698413 [20,] 0.7301587 0.6086957 [21,] 0.7301587 0.7301587 [22,] 0.7301587 0.7301587 [23,] 0.7301587 0.7301587 [24,] -0.3913043 0.7301587 [25,] 0.7301587 -0.3913043 [26,] -0.2698413 0.7301587 [27,] -0.2698413 -0.2698413 [28,] -0.2698413 -0.2698413 [29,] 0.7301587 -0.2698413 [30,] -0.2698413 0.7301587 [31,] -0.2698413 -0.2698413 [32,] 0.7301587 -0.2698413 [33,] -0.3913043 0.7301587 [34,] -0.2698413 -0.3913043 [35,] -0.2698413 -0.2698413 [36,] 0.6086957 -0.2698413 [37,] -0.2698413 0.6086957 [38,] 0.7301587 -0.2698413 [39,] 0.6086957 0.7301587 [40,] 0.7301587 0.6086957 [41,] -0.2698413 0.7301587 [42,] 0.7301587 -0.2698413 [43,] -0.3913043 0.7301587 [44,] 0.7301587 -0.3913043 [45,] 0.7301587 0.7301587 [46,] -0.2698413 0.7301587 [47,] -0.2698413 -0.2698413 [48,] 0.7301587 -0.2698413 [49,] -0.2698413 0.7301587 [50,] -0.3913043 -0.2698413 [51,] 0.6086957 -0.3913043 [52,] -0.2698413 0.6086957 [53,] -0.2698413 -0.2698413 [54,] -0.2698413 -0.2698413 [55,] -0.3913043 -0.2698413 [56,] 0.7301587 -0.3913043 [57,] -0.2698413 0.7301587 [58,] -0.2698413 -0.2698413 [59,] 0.6086957 -0.2698413 [60,] -0.3913043 0.6086957 [61,] 0.7301587 -0.3913043 [62,] -0.2698413 0.7301587 [63,] -0.3913043 -0.2698413 [64,] -0.2698413 -0.3913043 [65,] -0.2698413 -0.2698413 [66,] 0.6086957 -0.2698413 [67,] -0.2698413 0.6086957 [68,] -0.2698413 -0.2698413 [69,] -0.2698413 -0.2698413 [70,] -0.2698413 -0.2698413 [71,] -0.2698413 -0.2698413 [72,] -0.2698413 -0.2698413 [73,] -0.2698413 -0.2698413 [74,] -0.2698413 -0.2698413 [75,] 0.6086957 -0.2698413 [76,] -0.2698413 0.6086957 [77,] 0.7301587 -0.2698413 [78,] -0.3913043 0.7301587 [79,] 0.6086957 -0.3913043 [80,] -0.2698413 0.6086957 [81,] -0.2698413 -0.2698413 [82,] -0.2698413 -0.2698413 [83,] -0.2698413 -0.2698413 [84,] 0.7301587 -0.2698413 [85,] -0.2698413 0.7301587 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.2698413 -0.3913043 2 -0.2698413 -0.2698413 3 -0.2698413 -0.2698413 4 -0.2698413 -0.2698413 5 -0.2698413 -0.2698413 6 -0.2698413 -0.2698413 7 -0.3913043 -0.2698413 8 -0.2698413 -0.3913043 9 -0.2698413 -0.2698413 10 -0.3913043 -0.2698413 11 -0.2698413 -0.3913043 12 -0.2698413 -0.2698413 13 -0.3913043 -0.2698413 14 -0.2698413 -0.3913043 15 -0.3913043 -0.2698413 16 0.6086957 -0.3913043 17 -0.3913043 0.6086957 18 -0.2698413 -0.3913043 19 0.6086957 -0.2698413 20 0.7301587 0.6086957 21 0.7301587 0.7301587 22 0.7301587 0.7301587 23 0.7301587 0.7301587 24 -0.3913043 0.7301587 25 0.7301587 -0.3913043 26 -0.2698413 0.7301587 27 -0.2698413 -0.2698413 28 -0.2698413 -0.2698413 29 0.7301587 -0.2698413 30 -0.2698413 0.7301587 31 -0.2698413 -0.2698413 32 0.7301587 -0.2698413 33 -0.3913043 0.7301587 34 -0.2698413 -0.3913043 35 -0.2698413 -0.2698413 36 0.6086957 -0.2698413 37 -0.2698413 0.6086957 38 0.7301587 -0.2698413 39 0.6086957 0.7301587 40 0.7301587 0.6086957 41 -0.2698413 0.7301587 42 0.7301587 -0.2698413 43 -0.3913043 0.7301587 44 0.7301587 -0.3913043 45 0.7301587 0.7301587 46 -0.2698413 0.7301587 47 -0.2698413 -0.2698413 48 0.7301587 -0.2698413 49 -0.2698413 0.7301587 50 -0.3913043 -0.2698413 51 0.6086957 -0.3913043 52 -0.2698413 0.6086957 53 -0.2698413 -0.2698413 54 -0.2698413 -0.2698413 55 -0.3913043 -0.2698413 56 0.7301587 -0.3913043 57 -0.2698413 0.7301587 58 -0.2698413 -0.2698413 59 0.6086957 -0.2698413 60 -0.3913043 0.6086957 61 0.7301587 -0.3913043 62 -0.2698413 0.7301587 63 -0.3913043 -0.2698413 64 -0.2698413 -0.3913043 65 -0.2698413 -0.2698413 66 0.6086957 -0.2698413 67 -0.2698413 0.6086957 68 -0.2698413 -0.2698413 69 -0.2698413 -0.2698413 70 -0.2698413 -0.2698413 71 -0.2698413 -0.2698413 72 -0.2698413 -0.2698413 73 -0.2698413 -0.2698413 74 -0.2698413 -0.2698413 75 0.6086957 -0.2698413 76 -0.2698413 0.6086957 77 0.7301587 -0.2698413 78 -0.3913043 0.7301587 79 0.6086957 -0.3913043 80 -0.2698413 0.6086957 81 -0.2698413 -0.2698413 82 -0.2698413 -0.2698413 83 -0.2698413 -0.2698413 84 0.7301587 -0.2698413 85 -0.2698413 0.7301587 > 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/7xv4y1354718140.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/8a7jg1354718140.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/91ztf1354718140.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/10vklr1354718140.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/11uw9r1354718140.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/12a0yg1354718140.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/13qjkq1354718140.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/146xhe1354718140.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/15limo1354718140.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/16ljmf1354718140.tab") + } > > try(system("convert tmp/1ongt1354718140.ps tmp/1ongt1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/2lu5c1354718140.ps tmp/2lu5c1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/3nx861354718140.ps tmp/3nx861354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/4tyow1354718140.ps tmp/4tyow1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/56e2j1354718140.ps tmp/56e2j1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/6p3j51354718140.ps tmp/6p3j51354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/7xv4y1354718140.ps tmp/7xv4y1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/8a7jg1354718140.ps tmp/8a7jg1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/91ztf1354718140.ps tmp/91ztf1354718140.png",intern=TRUE)) character(0) > try(system("convert tmp/10vklr1354718140.ps tmp/10vklr1354718140.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.288 1.163 7.839