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(4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,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+ ,0
+ ,2
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,0
+ ,2
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,2
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,2
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,2
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,2
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0)
+ ,dim=c(7
+ ,154)
+ ,dimnames=list(c('Weeks'
+ ,'UseLimit'
+ ,'T40enT20'
+ ,'Used'
+ ,'CorrectAnalysis'
+ ,'Useful'
+ ,'Outcome')
+ ,1:154))
> y <- array(NA,dim=c(7,154),dimnames=list(c('Weeks','UseLimit','T40enT20','Used','CorrectAnalysis','Useful','Outcome'),1:154))
> 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 = '5'
> 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 Weeks UseLimit T40enT20 Used Useful Outcome
1 0 4 1 1 0 1 0
2 0 4 0 0 0 0 0
3 0 4 0 0 0 0 0
4 0 4 0 0 0 0 0
5 0 4 0 0 0 0 0
6 1 4 1 0 0 1 0
7 0 4 0 0 0 0 0
8 0 4 0 1 0 0 0
9 0 4 0 0 0 1 0
10 0 4 1 0 0 0 0
11 0 4 1 1 0 0 0
12 0 4 0 0 0 0 0
13 1 4 0 0 1 0 0
14 0 4 1 1 0 0 0
15 1 4 0 0 1 1 0
16 1 4 0 1 1 1 0
17 1 4 1 1 1 0 1
18 0 4 1 1 0 0 0
19 0 4 0 0 0 1 0
20 1 4 0 1 1 1 1
21 1 4 1 0 0 0 0
22 1 4 1 0 1 1 0
23 1 4 0 0 0 1 0
24 1 4 1 0 0 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1 0
89 0 2 0 0 0 0 0
90 0 2 0 0 0 1 0
91 1 2 0 0 0 0 0
92 0 2 1 1 0 0 0
93 1 2 1 0 0 0 0
94 0 2 0 0 0 0 0
95 0 2 0 1 0 0 0
96 0 2 0 0 0 1 0
97 0 2 1 1 0 0 0
98 0 2 0 0 0 0 0
99 0 2 1 0 0 0 0
100 0 2 0 0 0 1 0
101 0 2 1 0 0 1 0
102 0 2 0 0 0 0 0
103 0 2 0 0 0 0 0
104 0 2 0 0 0 0 0
105 0 2 0 1 1 0 0
106 0 2 0 0 0 0 0
107 0 2 0 0 0 0 0
108 0 2 1 1 1 0 0
109 0 2 0 0 0 0 0
110 0 2 1 0 0 0 0
111 1 2 1 1 1 0 0
112 0 2 0 1 0 0 0
113 0 2 0 0 1 0 0
114 0 2 1 1 1 0 0
115 0 2 1 0 0 0 0
116 0 2 0 0 0 0 0
117 0 2 1 0 0 1 0
118 0 2 1 0 0 0 0
119 0 2 0 0 0 0 0
120 0 2 0 0 0 1 0
121 0 2 1 0 0 0 0
122 0 2 0 0 0 0 0
123 0 2 1 1 1 0 0
124 1 2 0 0 1 1 0
125 0 2 0 0 0 1 0
126 0 2 0 1 0 0 0
127 1 2 0 0 0 0 0
128 0 2 0 0 0 1 0
129 0 2 0 0 0 0 0
130 0 2 0 0 0 1 0
131 0 2 1 0 0 0 0
132 0 2 1 0 0 1 0
133 0 2 1 0 1 0 0
134 0 2 0 0 0 0 0
135 0 2 0 0 0 0 0
136 0 2 0 0 0 0 0
137 1 2 1 0 1 1 0
138 1 2 1 1 1 1 0
139 0 2 0 1 0 0 0
140 0 2 0 0 0 0 0
141 0 2 0 0 1 1 1
142 0 2 0 1 1 1 0
143 0 2 1 0 0 0 0
144 1 2 0 0 0 1 0
145 1 2 0 0 0 0 0
146 0 2 0 1 0 1 0
147 0 2 0 1 1 0 0
148 0 2 0 1 0 0 0
149 0 2 1 0 0 0 0
150 1 2 0 0 0 1 0
151 0 2 0 0 0 1 0
152 0 2 1 0 1 0 1
153 1 2 1 0 1 0 1
154 0 2 1 0 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks UseLimit T40enT20 Used Useful
-0.09340 0.07549 0.05957 -0.03464 0.18304 0.11884
Outcome
0.17246
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.6483 -0.2675 -0.1764 0.3431 0.9424
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.09340 0.11921 -0.784 0.4346
Weeks 0.07549 0.03510 2.151 0.0331 *
UseLimit 0.05957 0.07475 0.797 0.4268
T40enT20 -0.03464 0.08184 -0.423 0.6727
Used 0.18304 0.08668 2.112 0.0364 *
Useful 0.11884 0.07093 1.675 0.0960 .
Outcome 0.17246 0.14297 1.206 0.2297
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4218 on 147 degrees of freedom
Multiple R-squared: 0.1308, Adjusted R-squared: 0.09532
F-statistic: 3.687 on 6 and 147 DF, p-value: 0.001926
> 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.560759916 0.878480167 0.439240084
[2,] 0.391490062 0.782980123 0.608509938
[3,] 0.254032645 0.508065290 0.745967355
[4,] 0.158105350 0.316210699 0.841894650
[5,] 0.091181061 0.182362121 0.908818939
[6,] 0.058798055 0.117596111 0.941201945
[7,] 0.034797564 0.069595128 0.965202436
[8,] 0.018213975 0.036427949 0.981786025
[9,] 0.009112559 0.018225119 0.990887441
[10,] 0.005916675 0.011833350 0.994083325
[11,] 0.002952677 0.005905354 0.997047323
[12,] 0.027357727 0.054715455 0.972642273
[13,] 0.035907700 0.071815400 0.964092300
[14,] 0.131563864 0.263127728 0.868436136
[15,] 0.137670169 0.275340337 0.862329831
[16,] 0.210526070 0.421052140 0.789473930
[17,] 0.193915713 0.387831425 0.806084287
[18,] 0.268306385 0.536612770 0.731693615
[19,] 0.389161269 0.778322538 0.610838731
[20,] 0.357794285 0.715588570 0.642205715
[21,] 0.575784311 0.848431378 0.424215689
[22,] 0.521491868 0.957016264 0.478508132
[23,] 0.505895142 0.988209717 0.494104858
[24,] 0.585117731 0.829764539 0.414882269
[25,] 0.534383185 0.931233629 0.465616815
[26,] 0.482524783 0.965049565 0.517475217
[27,] 0.430904580 0.861809161 0.569095420
[28,] 0.436026555 0.872053110 0.563973445
[29,] 0.559244532 0.881510935 0.440755468
[30,] 0.666382644 0.667234712 0.333617356
[31,] 0.854111913 0.291776173 0.145888087
[32,] 0.831235412 0.337529175 0.168764588
[33,] 0.861348855 0.277302289 0.138651145
[34,] 0.879828216 0.240343567 0.120171784
[35,] 0.860433683 0.279132633 0.139566317
[36,] 0.920596943 0.158806114 0.079403057
[37,] 0.946284794 0.107430413 0.053715206
[38,] 0.934551632 0.130896736 0.065448368
[39,] 0.926600442 0.146799117 0.073399558
[40,] 0.950991353 0.098017294 0.049008647
[41,] 0.939923939 0.120152121 0.060076061
[42,] 0.931847765 0.136304471 0.068152235
[43,] 0.929016167 0.141967666 0.070983833
[44,] 0.921504769 0.156990462 0.078495231
[45,] 0.946744128 0.106511744 0.053255872
[46,] 0.934128862 0.131742277 0.065871138
[47,] 0.934933862 0.130132277 0.065066138
[48,] 0.939034620 0.121930760 0.060965380
[49,] 0.931373232 0.137253536 0.068626768
[50,] 0.922479362 0.155041276 0.077520638
[51,] 0.919158375 0.161683249 0.080841625
[52,] 0.910573615 0.178852771 0.089426385
[53,] 0.929877472 0.140245057 0.070122528
[54,] 0.914736552 0.170526896 0.085263448
[55,] 0.904435425 0.191129149 0.095564575
[56,] 0.885677126 0.228645747 0.114322874
[57,] 0.864422860 0.271154281 0.135577140
[58,] 0.888345994 0.223308013 0.111654006
[59,] 0.877636463 0.244727074 0.122363537
[60,] 0.862827812 0.274344376 0.137172188
[61,] 0.861974334 0.276051333 0.138025666
[62,] 0.837981269 0.324037461 0.162018731
[63,] 0.821784503 0.356430993 0.178215497
[64,] 0.839515181 0.320969638 0.160484819
[65,] 0.855036974 0.289926051 0.144963026
[66,] 0.845147568 0.309704864 0.154852432
[67,] 0.901299287 0.197401427 0.098700713
[68,] 0.892638210 0.214723581 0.107361790
[69,] 0.898719153 0.202561693 0.101280847
[70,] 0.913556196 0.172887607 0.086443804
[71,] 0.965420822 0.069158356 0.034579178
[72,] 0.956139511 0.087720977 0.043860489
[73,] 0.963119269 0.073761462 0.036880731
[74,] 0.955223399 0.089553202 0.044776601
[75,] 0.961651602 0.076696796 0.038348398
[76,] 0.974545306 0.050909388 0.025454694
[77,] 0.967731322 0.064537357 0.032268678
[78,] 0.959721312 0.080557375 0.040278688
[79,] 0.953553599 0.092892802 0.046446401
[80,] 0.942643663 0.114712675 0.057356337
[81,] 0.930412484 0.139175031 0.069587516
[82,] 0.977816115 0.044367770 0.022183885
[83,] 0.970504513 0.058990973 0.029495487
[84,] 0.990598068 0.018803865 0.009401932
[85,] 0.987110800 0.025778401 0.012889200
[86,] 0.982351144 0.035297711 0.017648856
[87,] 0.978132376 0.043735248 0.021867624
[88,] 0.970948190 0.058103619 0.029051810
[89,] 0.961615119 0.076769762 0.038384881
[90,] 0.950372635 0.099254731 0.049627365
[91,] 0.940504288 0.118991424 0.059495712
[92,] 0.930534598 0.138930805 0.069465402
[93,] 0.911672420 0.176655160 0.088327580
[94,] 0.889151461 0.221697077 0.110848539
[95,] 0.862698018 0.274603965 0.137301982
[96,] 0.839353939 0.321292123 0.160646061
[97,] 0.805513824 0.388972352 0.194486176
[98,] 0.767571469 0.464857062 0.232428531
[99,] 0.738275006 0.523449987 0.261724994
[100,] 0.693531574 0.612936851 0.306468426
[101,] 0.646006500 0.707986999 0.353993500
[102,] 0.766798533 0.466402934 0.233201467
[103,] 0.722385606 0.555228788 0.277614394
[104,] 0.707940749 0.584118501 0.292059251
[105,] 0.666817817 0.666364366 0.333182183
[106,] 0.614475138 0.771049725 0.385524862
[107,] 0.562412128 0.875175743 0.437587872
[108,] 0.521714888 0.956570223 0.478285112
[109,] 0.465395615 0.930791230 0.534604385
[110,] 0.411369007 0.822738015 0.588630993
[111,] 0.381753067 0.763506135 0.618246933
[112,] 0.328378319 0.656756638 0.671621681
[113,] 0.280457278 0.560914555 0.719542722
[114,] 0.238751828 0.477503656 0.761248172
[115,] 0.255782043 0.511564085 0.744217957
[116,] 0.228960039 0.457920079 0.771039961
[117,] 0.182576332 0.365152665 0.817423668
[118,] 0.347669191 0.695338382 0.652330809
[119,] 0.317908827 0.635817654 0.682091173
[120,] 0.259966446 0.519932892 0.740033554
[121,] 0.243370887 0.486741773 0.756629113
[122,] 0.196680365 0.393360730 0.803319635
[123,] 0.233855550 0.467711100 0.766144450
[124,] 0.204873008 0.409746016 0.795126992
[125,] 0.156449087 0.312898174 0.843550913
[126,] 0.116273364 0.232546729 0.883726636
[127,] 0.084525759 0.169051517 0.915474241
[128,] 0.070239980 0.140479961 0.929760020
[129,] 0.168952320 0.337904640 0.831047680
[130,] 0.115337465 0.230674930 0.884662535
[131,] 0.146164695 0.292329390 0.853835305
[132,] 0.319978499 0.639956997 0.680021501
[133,] 0.224906780 0.449813560 0.775093220
[134,] 0.137843417 0.275686834 0.862156583
[135,] 0.107935526 0.215871052 0.892064474
> postscript(file="/var/wessaorg/rcomp/tmp/1fy6j1356101860.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/2bvzy1356101860.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/3221o1356101860.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/4lsyo1356101860.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/5vr2d1356101860.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 = 154
Frequency = 1
1 2 3 4 5 6
-0.35232259 -0.20856202 -0.20856202 -0.20856202 -0.20856202 0.61303331
7 8 9 10 11 12
-0.20856202 -0.17391791 -0.32740046 -0.26812825 -0.23348415 -0.20856202
13 14 15 16 17 18
0.60839465 -0.23348415 0.48955621 0.52420031 0.41101250 -0.23348415
19 20 21 22 23 24
-0.32740046 0.35174028 0.73187175 0.42998998 0.67259954 0.61303331
25 26 27 28 29 30
-0.47579969 0.60839465 -0.38696669 -0.39160535 -0.32740046 0.79143798
31 32 33 34 35 36
-0.20856202 -0.26812825 0.73187175 -0.29275636 -0.20856202 -0.20856202
37 38 39 40 41 42
0.58347253 -0.51044379 0.67259954 0.82608209 0.31709618 -0.51044379
43 44 45 46 47 48
0.61303331 -0.23348415 0.79143798 0.67259954 -0.20856202 -0.32740046
49 50 51 52 53 54
0.67259954 -0.20856202 -0.35696124 0.41101250 -0.32740046 -0.56406537
55 56 57 58 59 60
-0.20856202 -0.47579969 0.48955621 -0.32740046 -0.32740046 0.29217405
61 62 63 64 65 66
-0.35232259 0.60839465 -0.20856202 -0.35232259 -0.20856202 -0.20856202
67 68 69 70 71 72
0.47057873 -0.26812825 -0.32740046 -0.39160535 -0.20856202 -0.32740046
73 74 75 76 77 78
-0.51044379 -0.45117158 -0.32740046 0.70724364 -0.32740046 0.48955621
79 80 81 82 83 84
-0.64825972 0.82608209 -0.20856202 -0.57001002 -0.20856202 -0.56406537
85 86 87 88 89 90
0.67259954 -0.26812825 -0.23598561 -0.38438484 -0.05758094 -0.17641938
91 92 93 94 95 96
0.94241906 -0.08250306 0.88285283 -0.05758094 -0.02293683 -0.17641938
97 98 99 100 101 102
-0.08250306 -0.05758094 -0.11714717 -0.17641938 -0.23598561 -0.05758094
103 104 105 106 107 108
-0.05758094 -0.05758094 -0.20598016 -0.05758094 -0.05758094 -0.26554639
109 110 111 112 113 114
-0.05758094 -0.11714717 0.73445361 -0.02293683 -0.24062427 -0.26554639
115 116 117 118 119 120
-0.11714717 -0.05758094 -0.23598561 -0.11714717 -0.05758094 -0.17641938
121 122 123 124 125 126
-0.11714717 -0.05758094 -0.26554639 0.64053729 -0.17641938 -0.02293683
127 128 129 130 131 132
0.94241906 -0.17641938 -0.05758094 -0.17641938 -0.11714717 -0.23598561
133 134 135 136 137 138
-0.30019050 -0.05758094 -0.05758094 -0.05758094 0.58097106 0.61561516
139 140 141 142 143 144
-0.02293683 -0.05758094 -0.53192274 -0.32481861 -0.11714717 0.82358062
145 146 147 148 149 150
0.94241906 -0.14177528 -0.20598016 -0.02293683 -0.11714717 0.82358062
151 152 153 154
-0.17641938 -0.47265052 0.52734948 -0.30019050
> postscript(file="/var/wessaorg/rcomp/tmp/6ed9a1356101860.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 = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.35232259 NA
1 -0.20856202 -0.35232259
2 -0.20856202 -0.20856202
3 -0.20856202 -0.20856202
4 -0.20856202 -0.20856202
5 0.61303331 -0.20856202
6 -0.20856202 0.61303331
7 -0.17391791 -0.20856202
8 -0.32740046 -0.17391791
9 -0.26812825 -0.32740046
10 -0.23348415 -0.26812825
11 -0.20856202 -0.23348415
12 0.60839465 -0.20856202
13 -0.23348415 0.60839465
14 0.48955621 -0.23348415
15 0.52420031 0.48955621
16 0.41101250 0.52420031
17 -0.23348415 0.41101250
18 -0.32740046 -0.23348415
19 0.35174028 -0.32740046
20 0.73187175 0.35174028
21 0.42998998 0.73187175
22 0.67259954 0.42998998
23 0.61303331 0.67259954
24 -0.47579969 0.61303331
25 0.60839465 -0.47579969
26 -0.38696669 0.60839465
27 -0.39160535 -0.38696669
28 -0.32740046 -0.39160535
29 0.79143798 -0.32740046
30 -0.20856202 0.79143798
31 -0.26812825 -0.20856202
32 0.73187175 -0.26812825
33 -0.29275636 0.73187175
34 -0.20856202 -0.29275636
35 -0.20856202 -0.20856202
36 0.58347253 -0.20856202
37 -0.51044379 0.58347253
38 0.67259954 -0.51044379
39 0.82608209 0.67259954
40 0.31709618 0.82608209
41 -0.51044379 0.31709618
42 0.61303331 -0.51044379
43 -0.23348415 0.61303331
44 0.79143798 -0.23348415
45 0.67259954 0.79143798
46 -0.20856202 0.67259954
47 -0.32740046 -0.20856202
48 0.67259954 -0.32740046
49 -0.20856202 0.67259954
50 -0.35696124 -0.20856202
51 0.41101250 -0.35696124
52 -0.32740046 0.41101250
53 -0.56406537 -0.32740046
54 -0.20856202 -0.56406537
55 -0.47579969 -0.20856202
56 0.48955621 -0.47579969
57 -0.32740046 0.48955621
58 -0.32740046 -0.32740046
59 0.29217405 -0.32740046
60 -0.35232259 0.29217405
61 0.60839465 -0.35232259
62 -0.20856202 0.60839465
63 -0.35232259 -0.20856202
64 -0.20856202 -0.35232259
65 -0.20856202 -0.20856202
66 0.47057873 -0.20856202
67 -0.26812825 0.47057873
68 -0.32740046 -0.26812825
69 -0.39160535 -0.32740046
70 -0.20856202 -0.39160535
71 -0.32740046 -0.20856202
72 -0.51044379 -0.32740046
73 -0.45117158 -0.51044379
74 -0.32740046 -0.45117158
75 0.70724364 -0.32740046
76 -0.32740046 0.70724364
77 0.48955621 -0.32740046
78 -0.64825972 0.48955621
79 0.82608209 -0.64825972
80 -0.20856202 0.82608209
81 -0.57001002 -0.20856202
82 -0.20856202 -0.57001002
83 -0.56406537 -0.20856202
84 0.67259954 -0.56406537
85 -0.26812825 0.67259954
86 -0.23598561 -0.26812825
87 -0.38438484 -0.23598561
88 -0.05758094 -0.38438484
89 -0.17641938 -0.05758094
90 0.94241906 -0.17641938
91 -0.08250306 0.94241906
92 0.88285283 -0.08250306
93 -0.05758094 0.88285283
94 -0.02293683 -0.05758094
95 -0.17641938 -0.02293683
96 -0.08250306 -0.17641938
97 -0.05758094 -0.08250306
98 -0.11714717 -0.05758094
99 -0.17641938 -0.11714717
100 -0.23598561 -0.17641938
101 -0.05758094 -0.23598561
102 -0.05758094 -0.05758094
103 -0.05758094 -0.05758094
104 -0.20598016 -0.05758094
105 -0.05758094 -0.20598016
106 -0.05758094 -0.05758094
107 -0.26554639 -0.05758094
108 -0.05758094 -0.26554639
109 -0.11714717 -0.05758094
110 0.73445361 -0.11714717
111 -0.02293683 0.73445361
112 -0.24062427 -0.02293683
113 -0.26554639 -0.24062427
114 -0.11714717 -0.26554639
115 -0.05758094 -0.11714717
116 -0.23598561 -0.05758094
117 -0.11714717 -0.23598561
118 -0.05758094 -0.11714717
119 -0.17641938 -0.05758094
120 -0.11714717 -0.17641938
121 -0.05758094 -0.11714717
122 -0.26554639 -0.05758094
123 0.64053729 -0.26554639
124 -0.17641938 0.64053729
125 -0.02293683 -0.17641938
126 0.94241906 -0.02293683
127 -0.17641938 0.94241906
128 -0.05758094 -0.17641938
129 -0.17641938 -0.05758094
130 -0.11714717 -0.17641938
131 -0.23598561 -0.11714717
132 -0.30019050 -0.23598561
133 -0.05758094 -0.30019050
134 -0.05758094 -0.05758094
135 -0.05758094 -0.05758094
136 0.58097106 -0.05758094
137 0.61561516 0.58097106
138 -0.02293683 0.61561516
139 -0.05758094 -0.02293683
140 -0.53192274 -0.05758094
141 -0.32481861 -0.53192274
142 -0.11714717 -0.32481861
143 0.82358062 -0.11714717
144 0.94241906 0.82358062
145 -0.14177528 0.94241906
146 -0.20598016 -0.14177528
147 -0.02293683 -0.20598016
148 -0.11714717 -0.02293683
149 0.82358062 -0.11714717
150 -0.17641938 0.82358062
151 -0.47265052 -0.17641938
152 0.52734948 -0.47265052
153 -0.30019050 0.52734948
154 NA -0.30019050
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.20856202 -0.35232259
[2,] -0.20856202 -0.20856202
[3,] -0.20856202 -0.20856202
[4,] -0.20856202 -0.20856202
[5,] 0.61303331 -0.20856202
[6,] -0.20856202 0.61303331
[7,] -0.17391791 -0.20856202
[8,] -0.32740046 -0.17391791
[9,] -0.26812825 -0.32740046
[10,] -0.23348415 -0.26812825
[11,] -0.20856202 -0.23348415
[12,] 0.60839465 -0.20856202
[13,] -0.23348415 0.60839465
[14,] 0.48955621 -0.23348415
[15,] 0.52420031 0.48955621
[16,] 0.41101250 0.52420031
[17,] -0.23348415 0.41101250
[18,] -0.32740046 -0.23348415
[19,] 0.35174028 -0.32740046
[20,] 0.73187175 0.35174028
[21,] 0.42998998 0.73187175
[22,] 0.67259954 0.42998998
[23,] 0.61303331 0.67259954
[24,] -0.47579969 0.61303331
[25,] 0.60839465 -0.47579969
[26,] -0.38696669 0.60839465
[27,] -0.39160535 -0.38696669
[28,] -0.32740046 -0.39160535
[29,] 0.79143798 -0.32740046
[30,] -0.20856202 0.79143798
[31,] -0.26812825 -0.20856202
[32,] 0.73187175 -0.26812825
[33,] -0.29275636 0.73187175
[34,] -0.20856202 -0.29275636
[35,] -0.20856202 -0.20856202
[36,] 0.58347253 -0.20856202
[37,] -0.51044379 0.58347253
[38,] 0.67259954 -0.51044379
[39,] 0.82608209 0.67259954
[40,] 0.31709618 0.82608209
[41,] -0.51044379 0.31709618
[42,] 0.61303331 -0.51044379
[43,] -0.23348415 0.61303331
[44,] 0.79143798 -0.23348415
[45,] 0.67259954 0.79143798
[46,] -0.20856202 0.67259954
[47,] -0.32740046 -0.20856202
[48,] 0.67259954 -0.32740046
[49,] -0.20856202 0.67259954
[50,] -0.35696124 -0.20856202
[51,] 0.41101250 -0.35696124
[52,] -0.32740046 0.41101250
[53,] -0.56406537 -0.32740046
[54,] -0.20856202 -0.56406537
[55,] -0.47579969 -0.20856202
[56,] 0.48955621 -0.47579969
[57,] -0.32740046 0.48955621
[58,] -0.32740046 -0.32740046
[59,] 0.29217405 -0.32740046
[60,] -0.35232259 0.29217405
[61,] 0.60839465 -0.35232259
[62,] -0.20856202 0.60839465
[63,] -0.35232259 -0.20856202
[64,] -0.20856202 -0.35232259
[65,] -0.20856202 -0.20856202
[66,] 0.47057873 -0.20856202
[67,] -0.26812825 0.47057873
[68,] -0.32740046 -0.26812825
[69,] -0.39160535 -0.32740046
[70,] -0.20856202 -0.39160535
[71,] -0.32740046 -0.20856202
[72,] -0.51044379 -0.32740046
[73,] -0.45117158 -0.51044379
[74,] -0.32740046 -0.45117158
[75,] 0.70724364 -0.32740046
[76,] -0.32740046 0.70724364
[77,] 0.48955621 -0.32740046
[78,] -0.64825972 0.48955621
[79,] 0.82608209 -0.64825972
[80,] -0.20856202 0.82608209
[81,] -0.57001002 -0.20856202
[82,] -0.20856202 -0.57001002
[83,] -0.56406537 -0.20856202
[84,] 0.67259954 -0.56406537
[85,] -0.26812825 0.67259954
[86,] -0.23598561 -0.26812825
[87,] -0.38438484 -0.23598561
[88,] -0.05758094 -0.38438484
[89,] -0.17641938 -0.05758094
[90,] 0.94241906 -0.17641938
[91,] -0.08250306 0.94241906
[92,] 0.88285283 -0.08250306
[93,] -0.05758094 0.88285283
[94,] -0.02293683 -0.05758094
[95,] -0.17641938 -0.02293683
[96,] -0.08250306 -0.17641938
[97,] -0.05758094 -0.08250306
[98,] -0.11714717 -0.05758094
[99,] -0.17641938 -0.11714717
[100,] -0.23598561 -0.17641938
[101,] -0.05758094 -0.23598561
[102,] -0.05758094 -0.05758094
[103,] -0.05758094 -0.05758094
[104,] -0.20598016 -0.05758094
[105,] -0.05758094 -0.20598016
[106,] -0.05758094 -0.05758094
[107,] -0.26554639 -0.05758094
[108,] -0.05758094 -0.26554639
[109,] -0.11714717 -0.05758094
[110,] 0.73445361 -0.11714717
[111,] -0.02293683 0.73445361
[112,] -0.24062427 -0.02293683
[113,] -0.26554639 -0.24062427
[114,] -0.11714717 -0.26554639
[115,] -0.05758094 -0.11714717
[116,] -0.23598561 -0.05758094
[117,] -0.11714717 -0.23598561
[118,] -0.05758094 -0.11714717
[119,] -0.17641938 -0.05758094
[120,] -0.11714717 -0.17641938
[121,] -0.05758094 -0.11714717
[122,] -0.26554639 -0.05758094
[123,] 0.64053729 -0.26554639
[124,] -0.17641938 0.64053729
[125,] -0.02293683 -0.17641938
[126,] 0.94241906 -0.02293683
[127,] -0.17641938 0.94241906
[128,] -0.05758094 -0.17641938
[129,] -0.17641938 -0.05758094
[130,] -0.11714717 -0.17641938
[131,] -0.23598561 -0.11714717
[132,] -0.30019050 -0.23598561
[133,] -0.05758094 -0.30019050
[134,] -0.05758094 -0.05758094
[135,] -0.05758094 -0.05758094
[136,] 0.58097106 -0.05758094
[137,] 0.61561516 0.58097106
[138,] -0.02293683 0.61561516
[139,] -0.05758094 -0.02293683
[140,] -0.53192274 -0.05758094
[141,] -0.32481861 -0.53192274
[142,] -0.11714717 -0.32481861
[143,] 0.82358062 -0.11714717
[144,] 0.94241906 0.82358062
[145,] -0.14177528 0.94241906
[146,] -0.20598016 -0.14177528
[147,] -0.02293683 -0.20598016
[148,] -0.11714717 -0.02293683
[149,] 0.82358062 -0.11714717
[150,] -0.17641938 0.82358062
[151,] -0.47265052 -0.17641938
[152,] 0.52734948 -0.47265052
[153,] -0.30019050 0.52734948
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.20856202 -0.35232259
2 -0.20856202 -0.20856202
3 -0.20856202 -0.20856202
4 -0.20856202 -0.20856202
5 0.61303331 -0.20856202
6 -0.20856202 0.61303331
7 -0.17391791 -0.20856202
8 -0.32740046 -0.17391791
9 -0.26812825 -0.32740046
10 -0.23348415 -0.26812825
11 -0.20856202 -0.23348415
12 0.60839465 -0.20856202
13 -0.23348415 0.60839465
14 0.48955621 -0.23348415
15 0.52420031 0.48955621
16 0.41101250 0.52420031
17 -0.23348415 0.41101250
18 -0.32740046 -0.23348415
19 0.35174028 -0.32740046
20 0.73187175 0.35174028
21 0.42998998 0.73187175
22 0.67259954 0.42998998
23 0.61303331 0.67259954
24 -0.47579969 0.61303331
25 0.60839465 -0.47579969
26 -0.38696669 0.60839465
27 -0.39160535 -0.38696669
28 -0.32740046 -0.39160535
29 0.79143798 -0.32740046
30 -0.20856202 0.79143798
31 -0.26812825 -0.20856202
32 0.73187175 -0.26812825
33 -0.29275636 0.73187175
34 -0.20856202 -0.29275636
35 -0.20856202 -0.20856202
36 0.58347253 -0.20856202
37 -0.51044379 0.58347253
38 0.67259954 -0.51044379
39 0.82608209 0.67259954
40 0.31709618 0.82608209
41 -0.51044379 0.31709618
42 0.61303331 -0.51044379
43 -0.23348415 0.61303331
44 0.79143798 -0.23348415
45 0.67259954 0.79143798
46 -0.20856202 0.67259954
47 -0.32740046 -0.20856202
48 0.67259954 -0.32740046
49 -0.20856202 0.67259954
50 -0.35696124 -0.20856202
51 0.41101250 -0.35696124
52 -0.32740046 0.41101250
53 -0.56406537 -0.32740046
54 -0.20856202 -0.56406537
55 -0.47579969 -0.20856202
56 0.48955621 -0.47579969
57 -0.32740046 0.48955621
58 -0.32740046 -0.32740046
59 0.29217405 -0.32740046
60 -0.35232259 0.29217405
61 0.60839465 -0.35232259
62 -0.20856202 0.60839465
63 -0.35232259 -0.20856202
64 -0.20856202 -0.35232259
65 -0.20856202 -0.20856202
66 0.47057873 -0.20856202
67 -0.26812825 0.47057873
68 -0.32740046 -0.26812825
69 -0.39160535 -0.32740046
70 -0.20856202 -0.39160535
71 -0.32740046 -0.20856202
72 -0.51044379 -0.32740046
73 -0.45117158 -0.51044379
74 -0.32740046 -0.45117158
75 0.70724364 -0.32740046
76 -0.32740046 0.70724364
77 0.48955621 -0.32740046
78 -0.64825972 0.48955621
79 0.82608209 -0.64825972
80 -0.20856202 0.82608209
81 -0.57001002 -0.20856202
82 -0.20856202 -0.57001002
83 -0.56406537 -0.20856202
84 0.67259954 -0.56406537
85 -0.26812825 0.67259954
86 -0.23598561 -0.26812825
87 -0.38438484 -0.23598561
88 -0.05758094 -0.38438484
89 -0.17641938 -0.05758094
90 0.94241906 -0.17641938
91 -0.08250306 0.94241906
92 0.88285283 -0.08250306
93 -0.05758094 0.88285283
94 -0.02293683 -0.05758094
95 -0.17641938 -0.02293683
96 -0.08250306 -0.17641938
97 -0.05758094 -0.08250306
98 -0.11714717 -0.05758094
99 -0.17641938 -0.11714717
100 -0.23598561 -0.17641938
101 -0.05758094 -0.23598561
102 -0.05758094 -0.05758094
103 -0.05758094 -0.05758094
104 -0.20598016 -0.05758094
105 -0.05758094 -0.20598016
106 -0.05758094 -0.05758094
107 -0.26554639 -0.05758094
108 -0.05758094 -0.26554639
109 -0.11714717 -0.05758094
110 0.73445361 -0.11714717
111 -0.02293683 0.73445361
112 -0.24062427 -0.02293683
113 -0.26554639 -0.24062427
114 -0.11714717 -0.26554639
115 -0.05758094 -0.11714717
116 -0.23598561 -0.05758094
117 -0.11714717 -0.23598561
118 -0.05758094 -0.11714717
119 -0.17641938 -0.05758094
120 -0.11714717 -0.17641938
121 -0.05758094 -0.11714717
122 -0.26554639 -0.05758094
123 0.64053729 -0.26554639
124 -0.17641938 0.64053729
125 -0.02293683 -0.17641938
126 0.94241906 -0.02293683
127 -0.17641938 0.94241906
128 -0.05758094 -0.17641938
129 -0.17641938 -0.05758094
130 -0.11714717 -0.17641938
131 -0.23598561 -0.11714717
132 -0.30019050 -0.23598561
133 -0.05758094 -0.30019050
134 -0.05758094 -0.05758094
135 -0.05758094 -0.05758094
136 0.58097106 -0.05758094
137 0.61561516 0.58097106
138 -0.02293683 0.61561516
139 -0.05758094 -0.02293683
140 -0.53192274 -0.05758094
141 -0.32481861 -0.53192274
142 -0.11714717 -0.32481861
143 0.82358062 -0.11714717
144 0.94241906 0.82358062
145 -0.14177528 0.94241906
146 -0.20598016 -0.14177528
147 -0.02293683 -0.20598016
148 -0.11714717 -0.02293683
149 0.82358062 -0.11714717
150 -0.17641938 0.82358062
151 -0.47265052 -0.17641938
152 0.52734948 -0.47265052
153 -0.30019050 0.52734948
> 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/7mzdg1356101860.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/8ryrb1356101860.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/9v2bt1356101860.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/106xln1356101860.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/11x6rf1356101860.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/12ncc51356101860.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/13z1hs1356101860.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/14lm8a1356101860.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/15o80x1356101860.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/164olk1356101860.tab")
+ }
>
> try(system("convert tmp/1fy6j1356101860.ps tmp/1fy6j1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/2bvzy1356101860.ps tmp/2bvzy1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/3221o1356101860.ps tmp/3221o1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/4lsyo1356101860.ps tmp/4lsyo1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/5vr2d1356101860.ps tmp/5vr2d1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ed9a1356101860.ps tmp/6ed9a1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mzdg1356101860.ps tmp/7mzdg1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ryrb1356101860.ps tmp/8ryrb1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/9v2bt1356101860.ps tmp/9v2bt1356101860.png",intern=TRUE))
character(0)
> try(system("convert tmp/106xln1356101860.ps tmp/106xln1356101860.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.792 0.930 8.718