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
+ ,0
+ ,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
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,1
+ ,0
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,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+ ,0
+ ,2
+ ,0
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,2
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,0
+ ,2
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,2
+ ,1
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0)
+ ,dim=c(7
+ ,154)
+ ,dimnames=list(c('Weeks'
+ ,'UseLimit'
+ ,'Treatment'
+ ,'Used'
+ ,'CorrectAnalysis'
+ ,'Useful'
+ ,'Outcome')
+ ,1:154))
> y <- array(NA,dim=c(7,154),dimnames=list(c('Weeks','UseLimit','Treatment','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 Treatment Used Useful Outcome
1 0 4 1 0 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 0 0 0 0
9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 0 2 1 1 1 1 1
138 0 2 1 0 1 1 1
139 0 2 0 0 0 0 0
140 0 2 0 1 0 0 0
141 1 2 0 1 1 0 1
142 0 2 0 0 1 0 1
143 0 2 1 1 0 0 0
144 0 2 0 1 0 1 1
145 0 2 0 1 0 1 0
146 0 2 0 0 0 0 1
147 0 2 0 0 1 0 0
148 0 2 0 0 0 0 0
149 0 2 1 1 0 0 0
150 0 2 0 1 0 1 1
151 0 2 0 1 0 0 1
152 1 2 1 1 1 0 0
153 1 2 1 1 1 1 0
154 0 2 1 1 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks UseLimit Treatment Used Useful
-0.036634 0.017825 0.002774 -0.023698 0.245491 0.056832
Outcome
-0.028338
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.33976 -0.06664 -0.01097 0.02468 0.80753
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.036634 0.079782 -0.459 0.647
Weeks 0.017825 0.020411 0.873 0.384
UseLimit 0.002774 0.043003 0.065 0.949
Treatment -0.023698 0.046967 -0.505 0.615
Used 0.245491 0.046272 5.305 4.06e-07 ***
Useful 0.056832 0.047115 1.206 0.230
Outcome -0.028338 0.041040 -0.690 0.491
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2421 on 147 degrees of freedom
Multiple R-squared: 0.2212, Adjusted R-squared: 0.1894
F-statistic: 6.959 on 6 and 147 DF, p-value: 1.581e-06
> 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.395288480 0.790576961 0.604711520
[9,] 0.344539865 0.689079731 0.655460135
[10,] 0.309787639 0.619575277 0.690212361
[11,] 0.819097174 0.361805652 0.180902826
[12,] 0.763505717 0.472988566 0.236494283
[13,] 0.751676142 0.496647716 0.248323858
[14,] 0.688417830 0.623164340 0.311582170
[15,] 0.621692346 0.756615307 0.378307654
[16,] 0.610971376 0.778057249 0.389028624
[17,] 0.616136704 0.767726593 0.383863296
[18,] 0.572213868 0.855572264 0.427786132
[19,] 0.519769925 0.960460150 0.480230075
[20,] 0.465429530 0.930859060 0.534570470
[21,] 0.408770847 0.817541694 0.591229153
[22,] 0.350675374 0.701350747 0.649324626
[23,] 0.296531092 0.593062185 0.703468908
[24,] 0.248507185 0.497014369 0.751492815
[25,] 0.207996694 0.415993387 0.792003306
[26,] 0.168464296 0.336928592 0.831535704
[27,] 0.134188756 0.268377513 0.865811244
[28,] 0.177833286 0.355666572 0.822166714
[29,] 0.150187851 0.300375703 0.849812149
[30,] 0.119329464 0.238658928 0.880670536
[31,] 0.109190068 0.218380135 0.890809932
[32,] 0.560072793 0.879854415 0.439927207
[33,] 0.532278332 0.935443337 0.467721668
[34,] 0.479694505 0.959389011 0.520305495
[35,] 0.426651354 0.853302709 0.573348646
[36,] 0.378394543 0.756789087 0.621605457
[37,] 0.331083102 0.662166204 0.668916898
[38,] 0.286320044 0.572640089 0.713679956
[39,] 0.243554893 0.487109786 0.756445107
[40,] 0.206127470 0.412254940 0.793872530
[41,] 0.172206421 0.344412843 0.827793579
[42,] 0.174910518 0.349821035 0.825089482
[43,] 0.453905032 0.907810064 0.546094968
[44,] 0.407376059 0.814752118 0.592623941
[45,] 0.810321290 0.379357419 0.189678710
[46,] 0.775153647 0.449692706 0.224846353
[47,] 0.777325830 0.445348339 0.222674170
[48,] 0.788230003 0.423539995 0.211769997
[49,] 0.753657299 0.492685402 0.246342701
[50,] 0.716083070 0.567833860 0.283916930
[51,] 0.910167143 0.179665715 0.089832857
[52,] 0.889661397 0.220677207 0.110338603
[53,] 0.903177472 0.193645056 0.096822528
[54,] 0.882149004 0.235701992 0.117850996
[55,] 0.858413702 0.283172597 0.141586298
[56,] 0.831380899 0.337238203 0.168619101
[57,] 0.801442369 0.397115261 0.198557631
[58,] 0.948151400 0.103697199 0.051848600
[59,] 0.934090305 0.131819391 0.065909695
[60,] 0.918632940 0.162734119 0.081367060
[61,] 0.922778427 0.154443146 0.077221573
[62,] 0.905365185 0.189269630 0.094634815
[63,] 0.885542346 0.228915309 0.114457654
[64,] 0.891063259 0.217873482 0.108936741
[65,] 0.901780101 0.196439798 0.098219899
[66,] 0.883794450 0.232411100 0.116205550
[67,] 0.866270447 0.267459106 0.133729553
[68,] 0.844881530 0.310236939 0.155118470
[69,] 0.875426884 0.249146232 0.124573116
[70,] 0.984459182 0.031081637 0.015540818
[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.993973848 0.012052304 0.006026152
[80,] 0.991732973 0.016534055 0.008267027
[81,] 0.988770725 0.022458550 0.011229275
[82,] 0.984512310 0.030975379 0.015487690
[83,] 0.980250089 0.039499822 0.019749911
[84,] 0.973389900 0.053220201 0.026610100
[85,] 0.964904262 0.070191477 0.035095738
[86,] 0.957036172 0.085927657 0.042963828
[87,] 0.944970718 0.110058564 0.055029282
[88,] 0.934805148 0.130389704 0.065194852
[89,] 0.917397867 0.165204265 0.082602133
[90,] 0.896614008 0.206771984 0.103385992
[91,] 0.872672557 0.254654886 0.127327443
[92,] 0.845053021 0.309893959 0.154946979
[93,] 0.812587162 0.374825675 0.187412838
[94,] 0.776068623 0.447862753 0.223931377
[95,] 0.735656145 0.528687711 0.264343855
[96,] 0.724026707 0.551946587 0.275973293
[97,] 0.679325348 0.641349304 0.320674652
[98,] 0.631663472 0.736673057 0.368336528
[99,] 0.609223589 0.781552822 0.390776411
[100,] 0.558278531 0.883442938 0.441721469
[101,] 0.505475347 0.989049305 0.494524653
[102,] 0.485875285 0.971750570 0.514124715
[103,] 0.443564535 0.887129071 0.556435465
[104,] 0.485501291 0.971002582 0.514498709
[105,] 0.457325599 0.914651198 0.542674401
[106,] 0.403485310 0.806970619 0.596514690
[107,] 0.352668371 0.705336742 0.647331629
[108,] 0.303379879 0.606759758 0.696620121
[109,] 0.255742738 0.511485477 0.744257262
[110,] 0.213901053 0.427802107 0.786098947
[111,] 0.174307152 0.348614304 0.825692848
[112,] 0.139330173 0.278660347 0.860669827
[113,] 0.110774750 0.221549499 0.889225250
[114,] 0.098721042 0.197442083 0.901278958
[115,] 0.118983667 0.237967333 0.881016333
[116,] 0.091271685 0.182543371 0.908728315
[117,] 0.073898013 0.147796025 0.926101987
[118,] 0.054661548 0.109323096 0.945338452
[119,] 0.039190751 0.078381502 0.960809249
[120,] 0.028014130 0.056028260 0.971985870
[121,] 0.019082466 0.038164931 0.980917534
[122,] 0.012446094 0.024892188 0.987553906
[123,] 0.008036704 0.016073408 0.991963296
[124,] 0.014464848 0.028929696 0.985535152
[125,] 0.009697640 0.019395280 0.990302360
[126,] 0.006494518 0.012989035 0.993505482
[127,] 0.004456045 0.008912090 0.995543955
[128,] 0.007620317 0.015240633 0.992379683
[129,] 0.006715535 0.013431070 0.993284465
[130,] 0.005417705 0.010835411 0.994582295
[131,] 0.002731591 0.005463182 0.997268409
[132,] 0.033031266 0.066062533 0.966968734
[133,] 0.027451948 0.054903897 0.972548052
[134,] 0.015136927 0.030273854 0.984863073
[135,] 0.007203530 0.014407060 0.992796470
> postscript(file="/var/fisher/rcomp/tmp/1zfo21356089675.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/24bba1356089675.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/3zp2h1356089675.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/4dkm21356089675.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/5zixg1356089675.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
-0.0091012198 -0.0109672286 -0.0109672286 -0.0109672286 -0.0109672286
6 7 8 9 10
-0.0422356175 -0.0109672286 -0.0346651147 0.0173704453 -0.0137410075
11 12 13 14 15
-0.0374388936 -0.0109672286 -0.3132900376 -0.0374388936 -0.2849523638
16 17 18 19 20
-0.3086502499 0.6602382974 -0.0374388936 0.0173704453 0.6913497501
21 22 23 24 25
-0.0705732913 -0.2877261427 -0.0394618386 -0.0422356175 -0.2518179661
26 27 28 29 30
-0.3132900376 0.0145966663 -0.2564577538 0.0173704453 -0.0677995124
31 32 33 34 35
-0.0109672286 -0.0137410075 -0.0705732913 -0.0063274409 -0.0109672286
36 37 38 39 40
-0.0109672286 -0.3397617026 -0.2281200800 -0.0394618386 -0.0914973985
41 42 43 44 45
0.7150476362 -0.2281200800 -0.0422356175 -0.0374388936 -0.0677995124
46 47 48 49 50
-0.0394618386 -0.0109672286 0.0173704453 -0.0394618386 -0.0109672286
51 52 53 54 55
-0.2801556399 0.6602382974 0.0173704453 0.7435422462 -0.0109672286
56 57 58 59 60
-0.2518179661 -0.2849523638 0.0173704453 0.0173704453 0.6885759712
61 62 63 64 65
-0.0091012198 -0.3132900376 -0.0109672286 -0.0091012198 -0.0109672286
66 67 68 69 70
-0.0109672286 0.6630120763 -0.0137410075 0.0173704453 -0.2564577538
71 72 73 74 75
-0.0109672286 0.0173704453 -0.2281200800 -0.2592315327 0.0173704453
76 77 78 79 80
-0.0631597247 0.0173704453 -0.2849523638 0.7481820339 -0.0914973985
81 82 83 84 85
-0.0109672286 -0.2308938589 -0.0109672286 0.7435422462 -0.0394618386
86 87 88 89 90
-0.0137410075 0.0502460305 -0.2189423809 0.0246821355 0.0530198094
91 92 93 94 95
-0.0321501483 -0.0017895295 -0.0349239272 0.0246821355 0.0009842494
96 97 98 99 100
0.0530198094 -0.0017895295 0.0246821355 0.0219083566 0.0530198094
101 102 103 104 105
0.0502460305 0.0246821355 0.0246821355 0.0246821355 -0.2445062758
106 107 108 109 110
0.0246821355 0.0246821355 -0.2472800547 0.0246821355 0.0219083566
111 112 113 114 115
-0.3041123385 0.0009842494 -0.2208083897 -0.2472800547 0.0219083566
116 117 118 119 120
0.0246821355 0.0502460305 0.0219083566 0.0246821355 0.0530198094
121 122 123 124 125
0.0219083566 0.0246821355 -0.2472800547 -0.2493029997 0.0530198094
126 127 128 129 130
0.0009842494 -0.0321501483 0.0530198094 0.0246821355 0.0530198094
131 132 133 134 135
0.0219083566 0.0502460305 -0.2235821686 0.0246821355 0.0246821355
136 137 138 139 140
0.0246821355 -0.2520767786 -0.2757746647 0.0009842494 0.0246821355
141 142 143 144 145
0.8075292841 -0.2161686020 0.0219083566 -0.0038124744 -0.0321501483
146 147 148 149 150
0.0293219233 -0.2445062758 0.0009842494 0.0219083566 -0.0038124744
151 152 153 154
0.0530198094 0.7764178314 0.7195855476 -0.2235821686
> postscript(file="/var/fisher/rcomp/tmp/6ehvv1356089675.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.0091012198 NA
1 -0.0109672286 -0.0091012198
2 -0.0109672286 -0.0109672286
3 -0.0109672286 -0.0109672286
4 -0.0109672286 -0.0109672286
5 -0.0422356175 -0.0109672286
6 -0.0109672286 -0.0422356175
7 -0.0346651147 -0.0109672286
8 0.0173704453 -0.0346651147
9 -0.0137410075 0.0173704453
10 -0.0374388936 -0.0137410075
11 -0.0109672286 -0.0374388936
12 -0.3132900376 -0.0109672286
13 -0.0374388936 -0.3132900376
14 -0.2849523638 -0.0374388936
15 -0.3086502499 -0.2849523638
16 0.6602382974 -0.3086502499
17 -0.0374388936 0.6602382974
18 0.0173704453 -0.0374388936
19 0.6913497501 0.0173704453
20 -0.0705732913 0.6913497501
21 -0.2877261427 -0.0705732913
22 -0.0394618386 -0.2877261427
23 -0.0422356175 -0.0394618386
24 -0.2518179661 -0.0422356175
25 -0.3132900376 -0.2518179661
26 0.0145966663 -0.3132900376
27 -0.2564577538 0.0145966663
28 0.0173704453 -0.2564577538
29 -0.0677995124 0.0173704453
30 -0.0109672286 -0.0677995124
31 -0.0137410075 -0.0109672286
32 -0.0705732913 -0.0137410075
33 -0.0063274409 -0.0705732913
34 -0.0109672286 -0.0063274409
35 -0.0109672286 -0.0109672286
36 -0.3397617026 -0.0109672286
37 -0.2281200800 -0.3397617026
38 -0.0394618386 -0.2281200800
39 -0.0914973985 -0.0394618386
40 0.7150476362 -0.0914973985
41 -0.2281200800 0.7150476362
42 -0.0422356175 -0.2281200800
43 -0.0374388936 -0.0422356175
44 -0.0677995124 -0.0374388936
45 -0.0394618386 -0.0677995124
46 -0.0109672286 -0.0394618386
47 0.0173704453 -0.0109672286
48 -0.0394618386 0.0173704453
49 -0.0109672286 -0.0394618386
50 -0.2801556399 -0.0109672286
51 0.6602382974 -0.2801556399
52 0.0173704453 0.6602382974
53 0.7435422462 0.0173704453
54 -0.0109672286 0.7435422462
55 -0.2518179661 -0.0109672286
56 -0.2849523638 -0.2518179661
57 0.0173704453 -0.2849523638
58 0.0173704453 0.0173704453
59 0.6885759712 0.0173704453
60 -0.0091012198 0.6885759712
61 -0.3132900376 -0.0091012198
62 -0.0109672286 -0.3132900376
63 -0.0091012198 -0.0109672286
64 -0.0109672286 -0.0091012198
65 -0.0109672286 -0.0109672286
66 0.6630120763 -0.0109672286
67 -0.0137410075 0.6630120763
68 0.0173704453 -0.0137410075
69 -0.2564577538 0.0173704453
70 -0.0109672286 -0.2564577538
71 0.0173704453 -0.0109672286
72 -0.2281200800 0.0173704453
73 -0.2592315327 -0.2281200800
74 0.0173704453 -0.2592315327
75 -0.0631597247 0.0173704453
76 0.0173704453 -0.0631597247
77 -0.2849523638 0.0173704453
78 0.7481820339 -0.2849523638
79 -0.0914973985 0.7481820339
80 -0.0109672286 -0.0914973985
81 -0.2308938589 -0.0109672286
82 -0.0109672286 -0.2308938589
83 0.7435422462 -0.0109672286
84 -0.0394618386 0.7435422462
85 -0.0137410075 -0.0394618386
86 0.0502460305 -0.0137410075
87 -0.2189423809 0.0502460305
88 0.0246821355 -0.2189423809
89 0.0530198094 0.0246821355
90 -0.0321501483 0.0530198094
91 -0.0017895295 -0.0321501483
92 -0.0349239272 -0.0017895295
93 0.0246821355 -0.0349239272
94 0.0009842494 0.0246821355
95 0.0530198094 0.0009842494
96 -0.0017895295 0.0530198094
97 0.0246821355 -0.0017895295
98 0.0219083566 0.0246821355
99 0.0530198094 0.0219083566
100 0.0502460305 0.0530198094
101 0.0246821355 0.0502460305
102 0.0246821355 0.0246821355
103 0.0246821355 0.0246821355
104 -0.2445062758 0.0246821355
105 0.0246821355 -0.2445062758
106 0.0246821355 0.0246821355
107 -0.2472800547 0.0246821355
108 0.0246821355 -0.2472800547
109 0.0219083566 0.0246821355
110 -0.3041123385 0.0219083566
111 0.0009842494 -0.3041123385
112 -0.2208083897 0.0009842494
113 -0.2472800547 -0.2208083897
114 0.0219083566 -0.2472800547
115 0.0246821355 0.0219083566
116 0.0502460305 0.0246821355
117 0.0219083566 0.0502460305
118 0.0246821355 0.0219083566
119 0.0530198094 0.0246821355
120 0.0219083566 0.0530198094
121 0.0246821355 0.0219083566
122 -0.2472800547 0.0246821355
123 -0.2493029997 -0.2472800547
124 0.0530198094 -0.2493029997
125 0.0009842494 0.0530198094
126 -0.0321501483 0.0009842494
127 0.0530198094 -0.0321501483
128 0.0246821355 0.0530198094
129 0.0530198094 0.0246821355
130 0.0219083566 0.0530198094
131 0.0502460305 0.0219083566
132 -0.2235821686 0.0502460305
133 0.0246821355 -0.2235821686
134 0.0246821355 0.0246821355
135 0.0246821355 0.0246821355
136 -0.2520767786 0.0246821355
137 -0.2757746647 -0.2520767786
138 0.0009842494 -0.2757746647
139 0.0246821355 0.0009842494
140 0.8075292841 0.0246821355
141 -0.2161686020 0.8075292841
142 0.0219083566 -0.2161686020
143 -0.0038124744 0.0219083566
144 -0.0321501483 -0.0038124744
145 0.0293219233 -0.0321501483
146 -0.2445062758 0.0293219233
147 0.0009842494 -0.2445062758
148 0.0219083566 0.0009842494
149 -0.0038124744 0.0219083566
150 0.0530198094 -0.0038124744
151 0.7764178314 0.0530198094
152 0.7195855476 0.7764178314
153 -0.2235821686 0.7195855476
154 NA -0.2235821686
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.0109672286 -0.0091012198
[2,] -0.0109672286 -0.0109672286
[3,] -0.0109672286 -0.0109672286
[4,] -0.0109672286 -0.0109672286
[5,] -0.0422356175 -0.0109672286
[6,] -0.0109672286 -0.0422356175
[7,] -0.0346651147 -0.0109672286
[8,] 0.0173704453 -0.0346651147
[9,] -0.0137410075 0.0173704453
[10,] -0.0374388936 -0.0137410075
[11,] -0.0109672286 -0.0374388936
[12,] -0.3132900376 -0.0109672286
[13,] -0.0374388936 -0.3132900376
[14,] -0.2849523638 -0.0374388936
[15,] -0.3086502499 -0.2849523638
[16,] 0.6602382974 -0.3086502499
[17,] -0.0374388936 0.6602382974
[18,] 0.0173704453 -0.0374388936
[19,] 0.6913497501 0.0173704453
[20,] -0.0705732913 0.6913497501
[21,] -0.2877261427 -0.0705732913
[22,] -0.0394618386 -0.2877261427
[23,] -0.0422356175 -0.0394618386
[24,] -0.2518179661 -0.0422356175
[25,] -0.3132900376 -0.2518179661
[26,] 0.0145966663 -0.3132900376
[27,] -0.2564577538 0.0145966663
[28,] 0.0173704453 -0.2564577538
[29,] -0.0677995124 0.0173704453
[30,] -0.0109672286 -0.0677995124
[31,] -0.0137410075 -0.0109672286
[32,] -0.0705732913 -0.0137410075
[33,] -0.0063274409 -0.0705732913
[34,] -0.0109672286 -0.0063274409
[35,] -0.0109672286 -0.0109672286
[36,] -0.3397617026 -0.0109672286
[37,] -0.2281200800 -0.3397617026
[38,] -0.0394618386 -0.2281200800
[39,] -0.0914973985 -0.0394618386
[40,] 0.7150476362 -0.0914973985
[41,] -0.2281200800 0.7150476362
[42,] -0.0422356175 -0.2281200800
[43,] -0.0374388936 -0.0422356175
[44,] -0.0677995124 -0.0374388936
[45,] -0.0394618386 -0.0677995124
[46,] -0.0109672286 -0.0394618386
[47,] 0.0173704453 -0.0109672286
[48,] -0.0394618386 0.0173704453
[49,] -0.0109672286 -0.0394618386
[50,] -0.2801556399 -0.0109672286
[51,] 0.6602382974 -0.2801556399
[52,] 0.0173704453 0.6602382974
[53,] 0.7435422462 0.0173704453
[54,] -0.0109672286 0.7435422462
[55,] -0.2518179661 -0.0109672286
[56,] -0.2849523638 -0.2518179661
[57,] 0.0173704453 -0.2849523638
[58,] 0.0173704453 0.0173704453
[59,] 0.6885759712 0.0173704453
[60,] -0.0091012198 0.6885759712
[61,] -0.3132900376 -0.0091012198
[62,] -0.0109672286 -0.3132900376
[63,] -0.0091012198 -0.0109672286
[64,] -0.0109672286 -0.0091012198
[65,] -0.0109672286 -0.0109672286
[66,] 0.6630120763 -0.0109672286
[67,] -0.0137410075 0.6630120763
[68,] 0.0173704453 -0.0137410075
[69,] -0.2564577538 0.0173704453
[70,] -0.0109672286 -0.2564577538
[71,] 0.0173704453 -0.0109672286
[72,] -0.2281200800 0.0173704453
[73,] -0.2592315327 -0.2281200800
[74,] 0.0173704453 -0.2592315327
[75,] -0.0631597247 0.0173704453
[76,] 0.0173704453 -0.0631597247
[77,] -0.2849523638 0.0173704453
[78,] 0.7481820339 -0.2849523638
[79,] -0.0914973985 0.7481820339
[80,] -0.0109672286 -0.0914973985
[81,] -0.2308938589 -0.0109672286
[82,] -0.0109672286 -0.2308938589
[83,] 0.7435422462 -0.0109672286
[84,] -0.0394618386 0.7435422462
[85,] -0.0137410075 -0.0394618386
[86,] 0.0502460305 -0.0137410075
[87,] -0.2189423809 0.0502460305
[88,] 0.0246821355 -0.2189423809
[89,] 0.0530198094 0.0246821355
[90,] -0.0321501483 0.0530198094
[91,] -0.0017895295 -0.0321501483
[92,] -0.0349239272 -0.0017895295
[93,] 0.0246821355 -0.0349239272
[94,] 0.0009842494 0.0246821355
[95,] 0.0530198094 0.0009842494
[96,] -0.0017895295 0.0530198094
[97,] 0.0246821355 -0.0017895295
[98,] 0.0219083566 0.0246821355
[99,] 0.0530198094 0.0219083566
[100,] 0.0502460305 0.0530198094
[101,] 0.0246821355 0.0502460305
[102,] 0.0246821355 0.0246821355
[103,] 0.0246821355 0.0246821355
[104,] -0.2445062758 0.0246821355
[105,] 0.0246821355 -0.2445062758
[106,] 0.0246821355 0.0246821355
[107,] -0.2472800547 0.0246821355
[108,] 0.0246821355 -0.2472800547
[109,] 0.0219083566 0.0246821355
[110,] -0.3041123385 0.0219083566
[111,] 0.0009842494 -0.3041123385
[112,] -0.2208083897 0.0009842494
[113,] -0.2472800547 -0.2208083897
[114,] 0.0219083566 -0.2472800547
[115,] 0.0246821355 0.0219083566
[116,] 0.0502460305 0.0246821355
[117,] 0.0219083566 0.0502460305
[118,] 0.0246821355 0.0219083566
[119,] 0.0530198094 0.0246821355
[120,] 0.0219083566 0.0530198094
[121,] 0.0246821355 0.0219083566
[122,] -0.2472800547 0.0246821355
[123,] -0.2493029997 -0.2472800547
[124,] 0.0530198094 -0.2493029997
[125,] 0.0009842494 0.0530198094
[126,] -0.0321501483 0.0009842494
[127,] 0.0530198094 -0.0321501483
[128,] 0.0246821355 0.0530198094
[129,] 0.0530198094 0.0246821355
[130,] 0.0219083566 0.0530198094
[131,] 0.0502460305 0.0219083566
[132,] -0.2235821686 0.0502460305
[133,] 0.0246821355 -0.2235821686
[134,] 0.0246821355 0.0246821355
[135,] 0.0246821355 0.0246821355
[136,] -0.2520767786 0.0246821355
[137,] -0.2757746647 -0.2520767786
[138,] 0.0009842494 -0.2757746647
[139,] 0.0246821355 0.0009842494
[140,] 0.8075292841 0.0246821355
[141,] -0.2161686020 0.8075292841
[142,] 0.0219083566 -0.2161686020
[143,] -0.0038124744 0.0219083566
[144,] -0.0321501483 -0.0038124744
[145,] 0.0293219233 -0.0321501483
[146,] -0.2445062758 0.0293219233
[147,] 0.0009842494 -0.2445062758
[148,] 0.0219083566 0.0009842494
[149,] -0.0038124744 0.0219083566
[150,] 0.0530198094 -0.0038124744
[151,] 0.7764178314 0.0530198094
[152,] 0.7195855476 0.7764178314
[153,] -0.2235821686 0.7195855476
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.0109672286 -0.0091012198
2 -0.0109672286 -0.0109672286
3 -0.0109672286 -0.0109672286
4 -0.0109672286 -0.0109672286
5 -0.0422356175 -0.0109672286
6 -0.0109672286 -0.0422356175
7 -0.0346651147 -0.0109672286
8 0.0173704453 -0.0346651147
9 -0.0137410075 0.0173704453
10 -0.0374388936 -0.0137410075
11 -0.0109672286 -0.0374388936
12 -0.3132900376 -0.0109672286
13 -0.0374388936 -0.3132900376
14 -0.2849523638 -0.0374388936
15 -0.3086502499 -0.2849523638
16 0.6602382974 -0.3086502499
17 -0.0374388936 0.6602382974
18 0.0173704453 -0.0374388936
19 0.6913497501 0.0173704453
20 -0.0705732913 0.6913497501
21 -0.2877261427 -0.0705732913
22 -0.0394618386 -0.2877261427
23 -0.0422356175 -0.0394618386
24 -0.2518179661 -0.0422356175
25 -0.3132900376 -0.2518179661
26 0.0145966663 -0.3132900376
27 -0.2564577538 0.0145966663
28 0.0173704453 -0.2564577538
29 -0.0677995124 0.0173704453
30 -0.0109672286 -0.0677995124
31 -0.0137410075 -0.0109672286
32 -0.0705732913 -0.0137410075
33 -0.0063274409 -0.0705732913
34 -0.0109672286 -0.0063274409
35 -0.0109672286 -0.0109672286
36 -0.3397617026 -0.0109672286
37 -0.2281200800 -0.3397617026
38 -0.0394618386 -0.2281200800
39 -0.0914973985 -0.0394618386
40 0.7150476362 -0.0914973985
41 -0.2281200800 0.7150476362
42 -0.0422356175 -0.2281200800
43 -0.0374388936 -0.0422356175
44 -0.0677995124 -0.0374388936
45 -0.0394618386 -0.0677995124
46 -0.0109672286 -0.0394618386
47 0.0173704453 -0.0109672286
48 -0.0394618386 0.0173704453
49 -0.0109672286 -0.0394618386
50 -0.2801556399 -0.0109672286
51 0.6602382974 -0.2801556399
52 0.0173704453 0.6602382974
53 0.7435422462 0.0173704453
54 -0.0109672286 0.7435422462
55 -0.2518179661 -0.0109672286
56 -0.2849523638 -0.2518179661
57 0.0173704453 -0.2849523638
58 0.0173704453 0.0173704453
59 0.6885759712 0.0173704453
60 -0.0091012198 0.6885759712
61 -0.3132900376 -0.0091012198
62 -0.0109672286 -0.3132900376
63 -0.0091012198 -0.0109672286
64 -0.0109672286 -0.0091012198
65 -0.0109672286 -0.0109672286
66 0.6630120763 -0.0109672286
67 -0.0137410075 0.6630120763
68 0.0173704453 -0.0137410075
69 -0.2564577538 0.0173704453
70 -0.0109672286 -0.2564577538
71 0.0173704453 -0.0109672286
72 -0.2281200800 0.0173704453
73 -0.2592315327 -0.2281200800
74 0.0173704453 -0.2592315327
75 -0.0631597247 0.0173704453
76 0.0173704453 -0.0631597247
77 -0.2849523638 0.0173704453
78 0.7481820339 -0.2849523638
79 -0.0914973985 0.7481820339
80 -0.0109672286 -0.0914973985
81 -0.2308938589 -0.0109672286
82 -0.0109672286 -0.2308938589
83 0.7435422462 -0.0109672286
84 -0.0394618386 0.7435422462
85 -0.0137410075 -0.0394618386
86 0.0502460305 -0.0137410075
87 -0.2189423809 0.0502460305
88 0.0246821355 -0.2189423809
89 0.0530198094 0.0246821355
90 -0.0321501483 0.0530198094
91 -0.0017895295 -0.0321501483
92 -0.0349239272 -0.0017895295
93 0.0246821355 -0.0349239272
94 0.0009842494 0.0246821355
95 0.0530198094 0.0009842494
96 -0.0017895295 0.0530198094
97 0.0246821355 -0.0017895295
98 0.0219083566 0.0246821355
99 0.0530198094 0.0219083566
100 0.0502460305 0.0530198094
101 0.0246821355 0.0502460305
102 0.0246821355 0.0246821355
103 0.0246821355 0.0246821355
104 -0.2445062758 0.0246821355
105 0.0246821355 -0.2445062758
106 0.0246821355 0.0246821355
107 -0.2472800547 0.0246821355
108 0.0246821355 -0.2472800547
109 0.0219083566 0.0246821355
110 -0.3041123385 0.0219083566
111 0.0009842494 -0.3041123385
112 -0.2208083897 0.0009842494
113 -0.2472800547 -0.2208083897
114 0.0219083566 -0.2472800547
115 0.0246821355 0.0219083566
116 0.0502460305 0.0246821355
117 0.0219083566 0.0502460305
118 0.0246821355 0.0219083566
119 0.0530198094 0.0246821355
120 0.0219083566 0.0530198094
121 0.0246821355 0.0219083566
122 -0.2472800547 0.0246821355
123 -0.2493029997 -0.2472800547
124 0.0530198094 -0.2493029997
125 0.0009842494 0.0530198094
126 -0.0321501483 0.0009842494
127 0.0530198094 -0.0321501483
128 0.0246821355 0.0530198094
129 0.0530198094 0.0246821355
130 0.0219083566 0.0530198094
131 0.0502460305 0.0219083566
132 -0.2235821686 0.0502460305
133 0.0246821355 -0.2235821686
134 0.0246821355 0.0246821355
135 0.0246821355 0.0246821355
136 -0.2520767786 0.0246821355
137 -0.2757746647 -0.2520767786
138 0.0009842494 -0.2757746647
139 0.0246821355 0.0009842494
140 0.8075292841 0.0246821355
141 -0.2161686020 0.8075292841
142 0.0219083566 -0.2161686020
143 -0.0038124744 0.0219083566
144 -0.0321501483 -0.0038124744
145 0.0293219233 -0.0321501483
146 -0.2445062758 0.0293219233
147 0.0009842494 -0.2445062758
148 0.0219083566 0.0009842494
149 -0.0038124744 0.0219083566
150 0.0530198094 -0.0038124744
151 0.7764178314 0.0530198094
152 0.7195855476 0.7764178314
153 -0.2235821686 0.7195855476
> 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/7y26s1356089675.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/8gvb81356089675.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/9nh4m1356089675.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/10l67q1356089675.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/11yvpk1356089675.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/12b8so1356089675.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/139q621356089675.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/14hl251356089675.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/150wv81356089675.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/16q0dl1356089675.tab")
+ }
>
> try(system("convert tmp/1zfo21356089675.ps tmp/1zfo21356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/24bba1356089675.ps tmp/24bba1356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/3zp2h1356089675.ps tmp/3zp2h1356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/4dkm21356089675.ps tmp/4dkm21356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zixg1356089675.ps tmp/5zixg1356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ehvv1356089675.ps tmp/6ehvv1356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/7y26s1356089675.ps tmp/7y26s1356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/8gvb81356089675.ps tmp/8gvb81356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/9nh4m1356089675.ps tmp/9nh4m1356089675.png",intern=TRUE))
character(0)
> try(system("convert tmp/10l67q1356089675.ps tmp/10l67q1356089675.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.892 1.744 9.646