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
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,2
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,1
+ ,2
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,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+ ,0
+ ,2
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,1
+ ,2
+ ,0
+ ,3
+ ,1
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,0
+ ,2
+ ,0
+ ,3
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,3
+ ,1
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,3
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,1
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,2
+ ,1
+ ,4
+ ,1
+ ,1
+ ,1
+ ,0
+ ,2
+ ,1
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0)
+ ,dim=c(7
+ ,154)
+ ,dimnames=list(c('Weeks'
+ ,'Uselimit'
+ ,'T'
+ ,'used'
+ ,'Correctanalysis'
+ ,'Useful'
+ ,'Outcome')
+ ,1:154))
> y <- array(NA,dim=c(7,154),dimnames=list(c('Weeks','Uselimit','T','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'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '5'
> #'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 Weeks Uselimit T used Useful Outcome
1 0 4 1 2 0 0 1
2 0 4 0 1 0 0 0
3 0 4 0 1 0 0 0
4 0 4 0 1 0 0 0
5 0 4 0 1 0 0 0
6 0 4 1 1 0 1 1
7 0 4 0 1 0 0 0
8 0 4 0 2 0 0 0
9 0 4 0 1 0 0 1
10 0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 4 1 1 1 0 0
75 0 4 0 1 0 0 1
76 0 4 0 2 0 1 1
77 0 4 0 1 0 0 1
78 0 4 0 1 1 1 1
79 1 4 0 2 1 0 1
80 0 4 0 2 0 1 0
81 0 4 0 1 0 0 0
82 0 4 1 1 1 0 1
83 0 4 0 1 0 0 0
84 1 4 0 1 1 0 0
85 0 4 0 1 0 1 1
86 0 4 1 1 0 0 0
87 0 2 1 4 0 0 1
88 0 2 1 3 1 0 1
89 0 2 0 4 0 0 0
90 0 2 0 4 0 0 1
91 0 2 0 4 0 1 0
92 0 2 1 3 0 0 0
93 0 2 1 4 0 1 0
94 0 2 0 4 0 0 0
95 0 2 0 3 0 0 0
96 0 2 0 4 0 0 1
97 0 2 1 3 0 0 0
98 0 2 0 4 0 0 0
99 0 2 1 4 0 0 0
100 0 2 0 4 0 0 1
101 0 2 1 4 0 0 1
102 0 2 0 4 0 0 0
103 0 2 0 4 0 0 0
104 0 2 0 4 0 0 0
105 0 2 0 3 1 0 0
106 0 2 0 4 0 0 0
107 0 2 0 4 0 0 0
108 0 2 1 3 1 0 0
109 0 2 0 4 0 0 0
110 0 2 1 4 0 0 0
111 0 2 1 3 1 1 0
112 0 2 0 3 0 0 0
113 0 2 0 4 1 0 0
114 0 2 1 3 1 0 0
115 0 2 1 4 0 0 0
116 0 2 0 4 0 0 0
117 0 2 1 4 0 0 1
118 0 2 1 4 0 0 0
119 0 2 0 4 0 0 0
120 0 2 0 4 0 0 1
121 0 2 1 4 0 0 0
122 0 2 0 4 0 0 0
123 0 2 1 3 1 0 0
124 0 2 0 4 1 1 1
125 0 2 0 4 0 0 1
126 0 2 0 3 0 0 0
127 0 2 0 4 0 1 0
128 0 2 0 4 0 0 1
129 0 2 0 4 0 0 0
130 0 2 0 4 0 0 1
131 0 2 1 4 0 0 0
132 0 2 1 4 0 0 1
133 0 2 1 4 1 0 0
134 0 2 0 4 0 0 0
135 0 2 0 4 0 0 0
136 0 2 0 4 0 0 0
137 0 2 1 4 1 1 1
138 0 2 1 3 1 1 1
139 0 2 0 3 0 0 0
140 0 2 0 4 0 0 0
141 1 2 0 4 1 0 1
142 0 2 0 3 1 0 1
143 0 2 1 4 0 0 0
144 0 2 0 4 0 1 1
145 0 2 0 4 0 1 0
146 0 2 0 3 0 0 1
147 0 2 0 3 1 0 0
148 0 2 0 3 0 0 0
149 0 2 1 4 0 0 0
150 0 2 0 4 0 1 1
151 0 2 0 4 0 0 1
152 1 2 1 4 1 0 0
153 1 2 1 4 1 1 0
154 0 2 1 4 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks Uselimit T used Useful
-1.02909 0.21352 -0.00869 0.15682 0.26368 0.04040
Outcome
-0.03569
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.43400 -0.11827 -0.01652 0.02143 0.75452
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.02909 0.27556 -3.735 0.000268 ***
Weeks 0.21352 0.05728 3.727 0.000275 ***
Uselimit -0.00869 0.04085 -0.213 0.831847
T 0.15682 0.04321 3.629 0.000391 ***
used 0.26368 0.04301 6.131 7.65e-09 ***
Useful 0.04040 0.04536 0.891 0.374617
Outcome -0.03569 0.03936 -0.907 0.366023
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2321 on 147 degrees of freedom
Multiple R-squared: 0.284, Adjusted R-squared: 0.2548
F-statistic: 9.719 on 6 and 147 DF, p-value: 5.253e-09
> 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.000000000 0.000000000 1.000000000
[2,] 0.000000000 0.000000000 1.000000000
[3,] 0.000000000 0.000000000 1.000000000
[4,] 0.000000000 0.000000000 1.000000000
[5,] 0.000000000 0.000000000 1.000000000
[6,] 0.000000000 0.000000000 1.000000000
[7,] 0.000000000 0.000000000 1.000000000
[8,] 0.466622464 0.933244927 0.533377536
[9,] 0.417745999 0.835491999 0.582254001
[10,] 0.383170323 0.766340645 0.616829677
[11,] 0.867089004 0.265821991 0.132910996
[12,] 0.820991007 0.358017985 0.179008993
[13,] 0.810001091 0.379997817 0.189998909
[14,] 0.754999208 0.490001585 0.245000792
[15,] 0.694788000 0.610424000 0.305212000
[16,] 0.700508359 0.598983283 0.299491641
[17,] 0.704748507 0.590502985 0.295251493
[18,] 0.666079497 0.667841006 0.333920503
[19,] 0.617186403 0.765627194 0.382813597
[20,] 0.565405686 0.869188627 0.434594314
[21,] 0.507724220 0.984551560 0.492275780
[22,] 0.447356543 0.894713086 0.552643457
[23,] 0.389066560 0.778133120 0.610933440
[24,] 0.334035136 0.668070273 0.665964864
[25,] 0.289832341 0.579664682 0.710167659
[26,] 0.241966388 0.483932776 0.758033612
[27,] 0.198794323 0.397588645 0.801205677
[28,] 0.276004716 0.552009433 0.723995284
[29,] 0.239912832 0.479825665 0.760087168
[30,] 0.197453749 0.394907498 0.802546251
[31,] 0.190621762 0.381243525 0.809378238
[32,] 0.730185260 0.539629480 0.269814740
[33,] 0.706617240 0.586765520 0.293382760
[34,] 0.659768207 0.680463586 0.340231793
[35,] 0.619962949 0.760074102 0.380037051
[36,] 0.569696687 0.860606625 0.430303313
[37,] 0.518949514 0.962100972 0.481050486
[38,] 0.467953592 0.935907185 0.532046408
[39,] 0.417344351 0.834688703 0.582655649
[40,] 0.368728781 0.737457562 0.631271219
[41,] 0.322029687 0.644059374 0.677970313
[42,] 0.382611376 0.765222752 0.617388624
[43,] 0.671475379 0.657049241 0.328524621
[44,] 0.628262434 0.743475131 0.371737566
[45,] 0.934698601 0.130602799 0.065301399
[46,] 0.917429237 0.165141525 0.082570763
[47,] 0.940382446 0.119235108 0.059617554
[48,] 0.942753769 0.114492463 0.057246231
[49,] 0.928493595 0.143012810 0.071506405
[50,] 0.911552452 0.176895096 0.088447548
[51,] 0.977413949 0.045172103 0.022586051
[52,] 0.971463168 0.057073664 0.028536832
[53,] 0.975187799 0.049624403 0.024812201
[54,] 0.967492206 0.065015589 0.032507794
[55,] 0.960100277 0.079799446 0.039899723
[56,] 0.948872854 0.102254293 0.051127146
[57,] 0.935265242 0.129469516 0.064734758
[58,] 0.980845582 0.038308836 0.019154418
[59,] 0.974532220 0.050935559 0.025467780
[60,] 0.967133190 0.065733619 0.032866810
[61,] 0.969283337 0.061433325 0.030716663
[62,] 0.960189852 0.079620295 0.039810148
[63,] 0.949487793 0.101024414 0.050512207
[64,] 0.950868538 0.098262924 0.049131462
[65,] 0.955725738 0.088548525 0.044274262
[66,] 0.944191626 0.111616748 0.055808374
[67,] 0.937555755 0.124888491 0.062444245
[68,] 0.922837707 0.154324586 0.077162293
[69,] 0.933356966 0.133286067 0.066643034
[70,] 0.981886302 0.036227397 0.018113698
[71,] 0.981015383 0.037969234 0.018984617
[72,] 0.975873601 0.048252797 0.024126399
[73,] 0.981737456 0.036525088 0.018262544
[74,] 0.980049789 0.039900422 0.019950211
[75,] 0.998275794 0.003448413 0.001724206
[76,] 0.997458350 0.005083300 0.002541650
[77,] 0.996303488 0.007393024 0.003696512
[78,] 0.994685971 0.010628057 0.005314029
[79,] 0.992964390 0.014071219 0.007035610
[80,] 0.990148492 0.019703016 0.009851508
[81,] 0.986397042 0.027205915 0.013602958
[82,] 0.981522983 0.036954034 0.018477017
[83,] 0.977327649 0.045344702 0.022672351
[84,] 0.969862818 0.060274364 0.030137182
[85,] 0.960269998 0.079460004 0.039730002
[86,] 0.952417976 0.095164048 0.047582024
[87,] 0.938497587 0.123004826 0.061502413
[88,] 0.928423960 0.143152080 0.071576040
[89,] 0.909550880 0.180898240 0.090449120
[90,] 0.886904531 0.226190939 0.113095469
[91,] 0.860368880 0.279262241 0.139631120
[92,] 0.829611316 0.340777368 0.170388684
[93,] 0.795183142 0.409633716 0.204816858
[94,] 0.756776777 0.486446445 0.243223223
[95,] 0.714627068 0.570745864 0.285372932
[96,] 0.682750459 0.634499082 0.317249541
[97,] 0.635111649 0.729776702 0.364888351
[98,] 0.585148799 0.829702402 0.414851201
[99,] 0.545774161 0.908451679 0.454225839
[100,] 0.493304741 0.986609481 0.506695259
[101,] 0.439714295 0.879428590 0.560285705
[102,] 0.401491344 0.802982687 0.598508656
[103,] 0.365737538 0.731475075 0.634262462
[104,] 0.417034963 0.834069925 0.582965037
[105,] 0.380414286 0.760828571 0.619585714
[106,] 0.328015015 0.656030029 0.671984985
[107,] 0.280679115 0.561358230 0.719320885
[108,] 0.235114078 0.470228156 0.764885922
[109,] 0.193123401 0.386246801 0.806876599
[110,] 0.157725059 0.315450117 0.842274941
[111,] 0.125026507 0.250053015 0.874973493
[112,] 0.097132038 0.194264076 0.902867962
[113,] 0.075278869 0.150557739 0.924721131
[114,] 0.063576569 0.127153138 0.936423431
[115,] 0.081559580 0.163119161 0.918440420
[116,] 0.060692919 0.121385839 0.939307081
[117,] 0.049518584 0.099037168 0.950481416
[118,] 0.035866411 0.071732823 0.964133589
[119,] 0.024943197 0.049886394 0.975056803
[120,] 0.017356316 0.034712632 0.982643684
[121,] 0.011462539 0.022925077 0.988537461
[122,] 0.007226843 0.014453686 0.992773157
[123,] 0.004510036 0.009020073 0.995489964
[124,] 0.009036534 0.018073069 0.990963466
[125,] 0.005920796 0.011841592 0.994079204
[126,] 0.003883751 0.007767502 0.996116249
[127,] 0.002620684 0.005241367 0.997379316
[128,] 0.004884305 0.009768610 0.995115695
[129,] 0.004067610 0.008135220 0.995932390
[130,] 0.003375991 0.006751982 0.996624009
[131,] 0.001652064 0.003304128 0.998347936
[132,] 0.023132622 0.046265243 0.976867378
[133,] 0.018722515 0.037445030 0.981277485
[134,] 0.010076608 0.020153217 0.989923392
[135,] 0.004692206 0.009384412 0.995307794
> postscript(file="/var/fisher/rcomp/tmp/1l9mq1356109641.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/fisher/rcomp/tmp/26fzl1356109641.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/fisher/rcomp/tmp/3psow1356109641.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/fisher/rcomp/tmp/4xtmp1356109641.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/fisher/rcomp/tmp/5d4od1356109641.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.09423128 0.01820060 0.01820060 0.01820060 0.01820060 0.02218933
7 8 9 10 11 12
0.01820060 -0.13861605 0.05389521 0.02689076 -0.12992589 0.01820060
13 14 15 16 17 18
-0.28587171 -0.12992589 -0.25017710 -0.40699375 0.56600180 -0.12992589
19 20 21 22 23 24
0.05389521 0.59300625 -0.01350528 -0.24148694 0.01349916 0.02218933
25 26 27 28 29 30
-0.36659771 -0.28587171 0.06258537 -0.24547567 0.05389521 -0.02219545
31 32 33 34 35 36
0.01820060 0.02689076 -0.01350528 -0.10292144 0.01820060 0.01820060
37 38 39 40 41 42
-0.43399820 -0.20978106 0.01349916 -0.17901209 0.74982290 -0.20978106
43 44 45 46 47 48
0.02218933 -0.12992589 -0.02219545 0.01349916 0.01820060 0.05389521
49 50 51 52 53 54
0.01349916 0.01820060 -0.40229232 0.56600180 0.05389521 0.75452433
55 56 57 58 59 60
0.01820060 -0.36659771 -0.25017710 0.05389521 0.05389521 0.60169641
61 62 63 64 65 66
-0.09423128 -0.28587171 0.01820060 -0.09423128 0.01820060 0.01820060
67 68 69 70 71 72
0.55731164 0.02689076 0.05389521 -0.24547567 0.01820060 0.05389521
73 74 75 76 77 78
-0.20978106 -0.23678551 0.05389521 -0.14331748 0.05389521 -0.25017710
79 80 81 82 83 84
0.63340229 -0.17901209 0.01820060 -0.20109090 0.01820060 0.75452433
85 86 87 88 89 90
0.01349916 0.02689076 0.01917064 -0.08768898 -0.02521413 0.01048048
91 92 93 94 95 96
-0.06561018 0.14029268 -0.05692001 -0.02521413 0.13160251 0.01048048
97 98 99 100 101 102
0.14029268 -0.02521413 -0.01652397 0.01048048 0.01917064 -0.02521413
103 104 105 106 107 108
-0.02521413 -0.02521413 -0.13207375 -0.02521413 -0.02521413 -0.12338359
109 110 111 112 113 114
-0.02521413 -0.01652397 -0.16377963 0.13160251 -0.28889040 -0.12338359
115 116 117 118 119 120
-0.01652397 -0.02521413 0.01917064 -0.01652397 -0.02521413 0.01048048
121 122 123 124 125 126
-0.01652397 -0.02521413 -0.12338359 -0.29359183 0.01048048 0.13160251
127 128 129 130 131 132
-0.06561018 0.01048048 -0.02521413 0.01048048 -0.01652397 0.01917064
133 134 135 136 137 138
-0.28020024 -0.02521413 -0.02521413 -0.02521413 -0.28490167 -0.12808502
139 140 141 142 143 144
0.13160251 -0.02521413 0.74680421 -0.09637914 -0.01652397 -0.02991557
145 146 147 148 149 150
-0.06561018 0.16729712 -0.13207375 0.13160251 -0.01652397 -0.02991557
151 152 153 154
0.01048048 0.71979976 0.67940372 -0.28020024
> postscript(file="/var/fisher/rcomp/tmp/6eefd1356109641.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.09423128 NA
1 0.01820060 -0.09423128
2 0.01820060 0.01820060
3 0.01820060 0.01820060
4 0.01820060 0.01820060
5 0.02218933 0.01820060
6 0.01820060 0.02218933
7 -0.13861605 0.01820060
8 0.05389521 -0.13861605
9 0.02689076 0.05389521
10 -0.12992589 0.02689076
11 0.01820060 -0.12992589
12 -0.28587171 0.01820060
13 -0.12992589 -0.28587171
14 -0.25017710 -0.12992589
15 -0.40699375 -0.25017710
16 0.56600180 -0.40699375
17 -0.12992589 0.56600180
18 0.05389521 -0.12992589
19 0.59300625 0.05389521
20 -0.01350528 0.59300625
21 -0.24148694 -0.01350528
22 0.01349916 -0.24148694
23 0.02218933 0.01349916
24 -0.36659771 0.02218933
25 -0.28587171 -0.36659771
26 0.06258537 -0.28587171
27 -0.24547567 0.06258537
28 0.05389521 -0.24547567
29 -0.02219545 0.05389521
30 0.01820060 -0.02219545
31 0.02689076 0.01820060
32 -0.01350528 0.02689076
33 -0.10292144 -0.01350528
34 0.01820060 -0.10292144
35 0.01820060 0.01820060
36 -0.43399820 0.01820060
37 -0.20978106 -0.43399820
38 0.01349916 -0.20978106
39 -0.17901209 0.01349916
40 0.74982290 -0.17901209
41 -0.20978106 0.74982290
42 0.02218933 -0.20978106
43 -0.12992589 0.02218933
44 -0.02219545 -0.12992589
45 0.01349916 -0.02219545
46 0.01820060 0.01349916
47 0.05389521 0.01820060
48 0.01349916 0.05389521
49 0.01820060 0.01349916
50 -0.40229232 0.01820060
51 0.56600180 -0.40229232
52 0.05389521 0.56600180
53 0.75452433 0.05389521
54 0.01820060 0.75452433
55 -0.36659771 0.01820060
56 -0.25017710 -0.36659771
57 0.05389521 -0.25017710
58 0.05389521 0.05389521
59 0.60169641 0.05389521
60 -0.09423128 0.60169641
61 -0.28587171 -0.09423128
62 0.01820060 -0.28587171
63 -0.09423128 0.01820060
64 0.01820060 -0.09423128
65 0.01820060 0.01820060
66 0.55731164 0.01820060
67 0.02689076 0.55731164
68 0.05389521 0.02689076
69 -0.24547567 0.05389521
70 0.01820060 -0.24547567
71 0.05389521 0.01820060
72 -0.20978106 0.05389521
73 -0.23678551 -0.20978106
74 0.05389521 -0.23678551
75 -0.14331748 0.05389521
76 0.05389521 -0.14331748
77 -0.25017710 0.05389521
78 0.63340229 -0.25017710
79 -0.17901209 0.63340229
80 0.01820060 -0.17901209
81 -0.20109090 0.01820060
82 0.01820060 -0.20109090
83 0.75452433 0.01820060
84 0.01349916 0.75452433
85 0.02689076 0.01349916
86 0.01917064 0.02689076
87 -0.08768898 0.01917064
88 -0.02521413 -0.08768898
89 0.01048048 -0.02521413
90 -0.06561018 0.01048048
91 0.14029268 -0.06561018
92 -0.05692001 0.14029268
93 -0.02521413 -0.05692001
94 0.13160251 -0.02521413
95 0.01048048 0.13160251
96 0.14029268 0.01048048
97 -0.02521413 0.14029268
98 -0.01652397 -0.02521413
99 0.01048048 -0.01652397
100 0.01917064 0.01048048
101 -0.02521413 0.01917064
102 -0.02521413 -0.02521413
103 -0.02521413 -0.02521413
104 -0.13207375 -0.02521413
105 -0.02521413 -0.13207375
106 -0.02521413 -0.02521413
107 -0.12338359 -0.02521413
108 -0.02521413 -0.12338359
109 -0.01652397 -0.02521413
110 -0.16377963 -0.01652397
111 0.13160251 -0.16377963
112 -0.28889040 0.13160251
113 -0.12338359 -0.28889040
114 -0.01652397 -0.12338359
115 -0.02521413 -0.01652397
116 0.01917064 -0.02521413
117 -0.01652397 0.01917064
118 -0.02521413 -0.01652397
119 0.01048048 -0.02521413
120 -0.01652397 0.01048048
121 -0.02521413 -0.01652397
122 -0.12338359 -0.02521413
123 -0.29359183 -0.12338359
124 0.01048048 -0.29359183
125 0.13160251 0.01048048
126 -0.06561018 0.13160251
127 0.01048048 -0.06561018
128 -0.02521413 0.01048048
129 0.01048048 -0.02521413
130 -0.01652397 0.01048048
131 0.01917064 -0.01652397
132 -0.28020024 0.01917064
133 -0.02521413 -0.28020024
134 -0.02521413 -0.02521413
135 -0.02521413 -0.02521413
136 -0.28490167 -0.02521413
137 -0.12808502 -0.28490167
138 0.13160251 -0.12808502
139 -0.02521413 0.13160251
140 0.74680421 -0.02521413
141 -0.09637914 0.74680421
142 -0.01652397 -0.09637914
143 -0.02991557 -0.01652397
144 -0.06561018 -0.02991557
145 0.16729712 -0.06561018
146 -0.13207375 0.16729712
147 0.13160251 -0.13207375
148 -0.01652397 0.13160251
149 -0.02991557 -0.01652397
150 0.01048048 -0.02991557
151 0.71979976 0.01048048
152 0.67940372 0.71979976
153 -0.28020024 0.67940372
154 NA -0.28020024
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.01820060 -0.09423128
[2,] 0.01820060 0.01820060
[3,] 0.01820060 0.01820060
[4,] 0.01820060 0.01820060
[5,] 0.02218933 0.01820060
[6,] 0.01820060 0.02218933
[7,] -0.13861605 0.01820060
[8,] 0.05389521 -0.13861605
[9,] 0.02689076 0.05389521
[10,] -0.12992589 0.02689076
[11,] 0.01820060 -0.12992589
[12,] -0.28587171 0.01820060
[13,] -0.12992589 -0.28587171
[14,] -0.25017710 -0.12992589
[15,] -0.40699375 -0.25017710
[16,] 0.56600180 -0.40699375
[17,] -0.12992589 0.56600180
[18,] 0.05389521 -0.12992589
[19,] 0.59300625 0.05389521
[20,] -0.01350528 0.59300625
[21,] -0.24148694 -0.01350528
[22,] 0.01349916 -0.24148694
[23,] 0.02218933 0.01349916
[24,] -0.36659771 0.02218933
[25,] -0.28587171 -0.36659771
[26,] 0.06258537 -0.28587171
[27,] -0.24547567 0.06258537
[28,] 0.05389521 -0.24547567
[29,] -0.02219545 0.05389521
[30,] 0.01820060 -0.02219545
[31,] 0.02689076 0.01820060
[32,] -0.01350528 0.02689076
[33,] -0.10292144 -0.01350528
[34,] 0.01820060 -0.10292144
[35,] 0.01820060 0.01820060
[36,] -0.43399820 0.01820060
[37,] -0.20978106 -0.43399820
[38,] 0.01349916 -0.20978106
[39,] -0.17901209 0.01349916
[40,] 0.74982290 -0.17901209
[41,] -0.20978106 0.74982290
[42,] 0.02218933 -0.20978106
[43,] -0.12992589 0.02218933
[44,] -0.02219545 -0.12992589
[45,] 0.01349916 -0.02219545
[46,] 0.01820060 0.01349916
[47,] 0.05389521 0.01820060
[48,] 0.01349916 0.05389521
[49,] 0.01820060 0.01349916
[50,] -0.40229232 0.01820060
[51,] 0.56600180 -0.40229232
[52,] 0.05389521 0.56600180
[53,] 0.75452433 0.05389521
[54,] 0.01820060 0.75452433
[55,] -0.36659771 0.01820060
[56,] -0.25017710 -0.36659771
[57,] 0.05389521 -0.25017710
[58,] 0.05389521 0.05389521
[59,] 0.60169641 0.05389521
[60,] -0.09423128 0.60169641
[61,] -0.28587171 -0.09423128
[62,] 0.01820060 -0.28587171
[63,] -0.09423128 0.01820060
[64,] 0.01820060 -0.09423128
[65,] 0.01820060 0.01820060
[66,] 0.55731164 0.01820060
[67,] 0.02689076 0.55731164
[68,] 0.05389521 0.02689076
[69,] -0.24547567 0.05389521
[70,] 0.01820060 -0.24547567
[71,] 0.05389521 0.01820060
[72,] -0.20978106 0.05389521
[73,] -0.23678551 -0.20978106
[74,] 0.05389521 -0.23678551
[75,] -0.14331748 0.05389521
[76,] 0.05389521 -0.14331748
[77,] -0.25017710 0.05389521
[78,] 0.63340229 -0.25017710
[79,] -0.17901209 0.63340229
[80,] 0.01820060 -0.17901209
[81,] -0.20109090 0.01820060
[82,] 0.01820060 -0.20109090
[83,] 0.75452433 0.01820060
[84,] 0.01349916 0.75452433
[85,] 0.02689076 0.01349916
[86,] 0.01917064 0.02689076
[87,] -0.08768898 0.01917064
[88,] -0.02521413 -0.08768898
[89,] 0.01048048 -0.02521413
[90,] -0.06561018 0.01048048
[91,] 0.14029268 -0.06561018
[92,] -0.05692001 0.14029268
[93,] -0.02521413 -0.05692001
[94,] 0.13160251 -0.02521413
[95,] 0.01048048 0.13160251
[96,] 0.14029268 0.01048048
[97,] -0.02521413 0.14029268
[98,] -0.01652397 -0.02521413
[99,] 0.01048048 -0.01652397
[100,] 0.01917064 0.01048048
[101,] -0.02521413 0.01917064
[102,] -0.02521413 -0.02521413
[103,] -0.02521413 -0.02521413
[104,] -0.13207375 -0.02521413
[105,] -0.02521413 -0.13207375
[106,] -0.02521413 -0.02521413
[107,] -0.12338359 -0.02521413
[108,] -0.02521413 -0.12338359
[109,] -0.01652397 -0.02521413
[110,] -0.16377963 -0.01652397
[111,] 0.13160251 -0.16377963
[112,] -0.28889040 0.13160251
[113,] -0.12338359 -0.28889040
[114,] -0.01652397 -0.12338359
[115,] -0.02521413 -0.01652397
[116,] 0.01917064 -0.02521413
[117,] -0.01652397 0.01917064
[118,] -0.02521413 -0.01652397
[119,] 0.01048048 -0.02521413
[120,] -0.01652397 0.01048048
[121,] -0.02521413 -0.01652397
[122,] -0.12338359 -0.02521413
[123,] -0.29359183 -0.12338359
[124,] 0.01048048 -0.29359183
[125,] 0.13160251 0.01048048
[126,] -0.06561018 0.13160251
[127,] 0.01048048 -0.06561018
[128,] -0.02521413 0.01048048
[129,] 0.01048048 -0.02521413
[130,] -0.01652397 0.01048048
[131,] 0.01917064 -0.01652397
[132,] -0.28020024 0.01917064
[133,] -0.02521413 -0.28020024
[134,] -0.02521413 -0.02521413
[135,] -0.02521413 -0.02521413
[136,] -0.28490167 -0.02521413
[137,] -0.12808502 -0.28490167
[138,] 0.13160251 -0.12808502
[139,] -0.02521413 0.13160251
[140,] 0.74680421 -0.02521413
[141,] -0.09637914 0.74680421
[142,] -0.01652397 -0.09637914
[143,] -0.02991557 -0.01652397
[144,] -0.06561018 -0.02991557
[145,] 0.16729712 -0.06561018
[146,] -0.13207375 0.16729712
[147,] 0.13160251 -0.13207375
[148,] -0.01652397 0.13160251
[149,] -0.02991557 -0.01652397
[150,] 0.01048048 -0.02991557
[151,] 0.71979976 0.01048048
[152,] 0.67940372 0.71979976
[153,] -0.28020024 0.67940372
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.01820060 -0.09423128
2 0.01820060 0.01820060
3 0.01820060 0.01820060
4 0.01820060 0.01820060
5 0.02218933 0.01820060
6 0.01820060 0.02218933
7 -0.13861605 0.01820060
8 0.05389521 -0.13861605
9 0.02689076 0.05389521
10 -0.12992589 0.02689076
11 0.01820060 -0.12992589
12 -0.28587171 0.01820060
13 -0.12992589 -0.28587171
14 -0.25017710 -0.12992589
15 -0.40699375 -0.25017710
16 0.56600180 -0.40699375
17 -0.12992589 0.56600180
18 0.05389521 -0.12992589
19 0.59300625 0.05389521
20 -0.01350528 0.59300625
21 -0.24148694 -0.01350528
22 0.01349916 -0.24148694
23 0.02218933 0.01349916
24 -0.36659771 0.02218933
25 -0.28587171 -0.36659771
26 0.06258537 -0.28587171
27 -0.24547567 0.06258537
28 0.05389521 -0.24547567
29 -0.02219545 0.05389521
30 0.01820060 -0.02219545
31 0.02689076 0.01820060
32 -0.01350528 0.02689076
33 -0.10292144 -0.01350528
34 0.01820060 -0.10292144
35 0.01820060 0.01820060
36 -0.43399820 0.01820060
37 -0.20978106 -0.43399820
38 0.01349916 -0.20978106
39 -0.17901209 0.01349916
40 0.74982290 -0.17901209
41 -0.20978106 0.74982290
42 0.02218933 -0.20978106
43 -0.12992589 0.02218933
44 -0.02219545 -0.12992589
45 0.01349916 -0.02219545
46 0.01820060 0.01349916
47 0.05389521 0.01820060
48 0.01349916 0.05389521
49 0.01820060 0.01349916
50 -0.40229232 0.01820060
51 0.56600180 -0.40229232
52 0.05389521 0.56600180
53 0.75452433 0.05389521
54 0.01820060 0.75452433
55 -0.36659771 0.01820060
56 -0.25017710 -0.36659771
57 0.05389521 -0.25017710
58 0.05389521 0.05389521
59 0.60169641 0.05389521
60 -0.09423128 0.60169641
61 -0.28587171 -0.09423128
62 0.01820060 -0.28587171
63 -0.09423128 0.01820060
64 0.01820060 -0.09423128
65 0.01820060 0.01820060
66 0.55731164 0.01820060
67 0.02689076 0.55731164
68 0.05389521 0.02689076
69 -0.24547567 0.05389521
70 0.01820060 -0.24547567
71 0.05389521 0.01820060
72 -0.20978106 0.05389521
73 -0.23678551 -0.20978106
74 0.05389521 -0.23678551
75 -0.14331748 0.05389521
76 0.05389521 -0.14331748
77 -0.25017710 0.05389521
78 0.63340229 -0.25017710
79 -0.17901209 0.63340229
80 0.01820060 -0.17901209
81 -0.20109090 0.01820060
82 0.01820060 -0.20109090
83 0.75452433 0.01820060
84 0.01349916 0.75452433
85 0.02689076 0.01349916
86 0.01917064 0.02689076
87 -0.08768898 0.01917064
88 -0.02521413 -0.08768898
89 0.01048048 -0.02521413
90 -0.06561018 0.01048048
91 0.14029268 -0.06561018
92 -0.05692001 0.14029268
93 -0.02521413 -0.05692001
94 0.13160251 -0.02521413
95 0.01048048 0.13160251
96 0.14029268 0.01048048
97 -0.02521413 0.14029268
98 -0.01652397 -0.02521413
99 0.01048048 -0.01652397
100 0.01917064 0.01048048
101 -0.02521413 0.01917064
102 -0.02521413 -0.02521413
103 -0.02521413 -0.02521413
104 -0.13207375 -0.02521413
105 -0.02521413 -0.13207375
106 -0.02521413 -0.02521413
107 -0.12338359 -0.02521413
108 -0.02521413 -0.12338359
109 -0.01652397 -0.02521413
110 -0.16377963 -0.01652397
111 0.13160251 -0.16377963
112 -0.28889040 0.13160251
113 -0.12338359 -0.28889040
114 -0.01652397 -0.12338359
115 -0.02521413 -0.01652397
116 0.01917064 -0.02521413
117 -0.01652397 0.01917064
118 -0.02521413 -0.01652397
119 0.01048048 -0.02521413
120 -0.01652397 0.01048048
121 -0.02521413 -0.01652397
122 -0.12338359 -0.02521413
123 -0.29359183 -0.12338359
124 0.01048048 -0.29359183
125 0.13160251 0.01048048
126 -0.06561018 0.13160251
127 0.01048048 -0.06561018
128 -0.02521413 0.01048048
129 0.01048048 -0.02521413
130 -0.01652397 0.01048048
131 0.01917064 -0.01652397
132 -0.28020024 0.01917064
133 -0.02521413 -0.28020024
134 -0.02521413 -0.02521413
135 -0.02521413 -0.02521413
136 -0.28490167 -0.02521413
137 -0.12808502 -0.28490167
138 0.13160251 -0.12808502
139 -0.02521413 0.13160251
140 0.74680421 -0.02521413
141 -0.09637914 0.74680421
142 -0.01652397 -0.09637914
143 -0.02991557 -0.01652397
144 -0.06561018 -0.02991557
145 0.16729712 -0.06561018
146 -0.13207375 0.16729712
147 0.13160251 -0.13207375
148 -0.01652397 0.13160251
149 -0.02991557 -0.01652397
150 0.01048048 -0.02991557
151 0.71979976 0.01048048
152 0.67940372 0.71979976
153 -0.28020024 0.67940372
> 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/fisher/rcomp/tmp/7he4v1356109641.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/fisher/rcomp/tmp/8nzwq1356109641.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/fisher/rcomp/tmp/96vhj1356109641.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/fisher/rcomp/tmp/108mpq1356109641.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/114cqf1356109641.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/fisher/rcomp/tmp/127gna1356109641.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/fisher/rcomp/tmp/13g3n21356109642.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/fisher/rcomp/tmp/14ktw91356109642.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/fisher/rcomp/tmp/15xukq1356109642.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/fisher/rcomp/tmp/16kcdb1356109642.tab")
+ }
>
> try(system("convert tmp/1l9mq1356109641.ps tmp/1l9mq1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/26fzl1356109641.ps tmp/26fzl1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/3psow1356109641.ps tmp/3psow1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/4xtmp1356109641.ps tmp/4xtmp1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/5d4od1356109641.ps tmp/5d4od1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/6eefd1356109641.ps tmp/6eefd1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/7he4v1356109641.ps tmp/7he4v1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/8nzwq1356109641.ps tmp/8nzwq1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/96vhj1356109641.ps tmp/96vhj1356109641.png",intern=TRUE))
character(0)
> try(system("convert tmp/108mpq1356109641.ps tmp/108mpq1356109641.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.149 1.836 9.988