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(9700,9081,9084,9743,8587,9731,9563,9998,9437,10038,9918,9252,9737,9035,9133,9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556),dim=c(1,75),dimnames=list(c('Y'),1:75))
> y <- array(NA,dim=c(1,75),dimnames=list(c('Y'),1:75))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> 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
Y t
1 9700 1
2 9081 2
3 9084 3
4 9743 4
5 8587 5
6 9731 6
7 9563 7
8 9998 8
9 9437 9
10 10038 10
11 9918 11
12 9252 12
13 9737 13
14 9035 14
15 9133 15
16 9487 16
17 8700 17
18 9627 18
19 8947 19
20 9283 20
21 8829 21
22 9947 22
23 9628 23
24 9318 24
25 9605 25
26 8640 26
27 9214 27
28 9567 28
29 8547 29
30 9185 30
31 9470 31
32 9123 32
33 9278 33
34 10170 34
35 9434 35
36 9655 36
37 9429 37
38 8739 38
39 9552 39
40 9687 40
41 9019 41
42 9672 42
43 9206 43
44 9069 44
45 9788 45
46 10312 46
47 10105 47
48 9863 48
49 9656 49
50 9295 50
51 9946 51
52 9701 52
53 9049 53
54 10190 54
55 9706 55
56 9765 56
57 9893 57
58 9994 58
59 10433 59
60 10073 60
61 10112 61
62 9266 62
63 9820 63
64 10097 64
65 9115 65
66 10411 66
67 9678 67
68 10408 68
69 10153 69
70 10368 70
71 10581 71
72 10597 72
73 10680 73
74 9738 74
75 9556 75
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) t
9164.16 11.61
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-953.98 -277.53 20.04 354.19 757.70
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9164.157 102.104 89.753 < 2e-16 ***
t 11.614 2.335 4.975 4.2e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 437.7 on 73 degrees of freedom
Multiple R-squared: 0.2532, Adjusted R-squared: 0.243
F-statistic: 24.75 on 1 and 73 DF, p-value: 4.204e-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.6886340 0.6227319 0.3113660
[2,] 0.7866610 0.4266781 0.2133390
[3,] 0.7018294 0.5963412 0.2981706
[4,] 0.7136077 0.5727845 0.2863923
[5,] 0.6335179 0.7329642 0.3664821
[6,] 0.6236652 0.7526697 0.3763348
[7,] 0.5706973 0.8586054 0.4293027
[8,] 0.6311510 0.7376979 0.3688490
[9,] 0.5755721 0.8488558 0.4244279
[10,] 0.6669780 0.6660439 0.3330220
[11,] 0.6509414 0.6981172 0.3490586
[12,] 0.5835278 0.8329444 0.4164722
[13,] 0.6912953 0.6174093 0.3087047
[14,] 0.6641456 0.6717087 0.3358544
[15,] 0.6388120 0.7223760 0.3611880
[16,] 0.5649709 0.8700582 0.4350291
[17,] 0.5517974 0.8964052 0.4482026
[18,] 0.6859827 0.6280346 0.3140173
[19,] 0.6688744 0.6622512 0.3311256
[20,] 0.6037717 0.7924567 0.3962283
[21,] 0.5779771 0.8440458 0.4220229
[22,] 0.6618462 0.6763075 0.3381538
[23,] 0.5950237 0.8099526 0.4049763
[24,] 0.5663390 0.8673220 0.4336610
[25,] 0.6788097 0.6423805 0.3211903
[26,] 0.6168734 0.7662532 0.3831266
[27,] 0.5717912 0.8564175 0.4282088
[28,] 0.5131269 0.9737462 0.4868731
[29,] 0.4493071 0.8986141 0.5506929
[30,] 0.6717821 0.6564358 0.3282179
[31,] 0.6133487 0.7733026 0.3866513
[32,] 0.5855228 0.8289545 0.4144772
[33,] 0.5209896 0.9580209 0.4790104
[34,] 0.6019786 0.7960429 0.3980214
[35,] 0.5493623 0.9012754 0.4506377
[36,] 0.5150637 0.9698727 0.4849363
[37,] 0.5141956 0.9716088 0.4858044
[38,] 0.4704734 0.9409467 0.5295266
[39,] 0.4378562 0.8757124 0.5621438
[40,] 0.4622317 0.9244635 0.5377683
[41,] 0.4311263 0.8622526 0.5688737
[42,] 0.5823050 0.8353900 0.4176950
[43,] 0.6231543 0.7536914 0.3768457
[44,] 0.5871413 0.8257173 0.4128587
[45,] 0.5191307 0.9617387 0.4808693
[46,] 0.4895135 0.9790270 0.5104865
[47,] 0.4542838 0.9085677 0.5457162
[48,] 0.3848115 0.7696230 0.6151885
[49,] 0.4915486 0.9830972 0.5084514
[50,] 0.4961138 0.9922276 0.5038862
[51,] 0.4262000 0.8523999 0.5738000
[52,] 0.3575943 0.7151885 0.6424057
[53,] 0.2928776 0.5857551 0.7071224
[54,] 0.2376221 0.4752441 0.7623779
[55,] 0.2926719 0.5853438 0.7073281
[56,] 0.2512380 0.5024759 0.7487620
[57,] 0.2260438 0.4520875 0.7739562
[58,] 0.2492567 0.4985134 0.7507433
[59,] 0.1844969 0.3689939 0.8155031
[60,] 0.1346595 0.2693190 0.8653405
[61,] 0.4251766 0.8503531 0.5748234
[62,] 0.3454108 0.6908216 0.6545892
[63,] 0.5506285 0.8987430 0.4493715
[64,] 0.4583777 0.9167554 0.5416223
[65,] 0.5439411 0.9121178 0.4560589
[66,] 0.6398944 0.7202113 0.3601056
> postscript(file="/var/fisher/rcomp/tmp/1nzuf1355864549.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/2p95q1355864549.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/3upj41355864549.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/45zyj1355864549.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/5t26y1355864549.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 = 75
Frequency = 1
1 2 3 4 5 6 7
524.22807 -106.38638 -115.00083 532.38471 -635.22974 497.15581 317.54136
8 9 10 11 12 13 14
740.92690 168.31245 757.69800 626.08355 -51.53091 421.85464 -291.75981
15 16 17 18 19 20 21
-205.37426 137.01128 -661.60317 253.78238 -437.83207 -113.44652 -579.06098
22 23 24 25 26 27 28
527.32457 196.71012 -124.90433 150.48121 -826.13324 -263.74769 77.63786
29 30 31 32 33 34 35
-953.97660 -327.59105 -54.20550 -412.81995 -269.43440 610.95114 -136.66331
36 37 38 39 40 41 42
72.72224 -164.89221 -866.50667 -65.12112 58.26443 -621.35002 20.03552
43 44 45 46 47 48 49
-457.57893 -606.19338 101.19217 613.57771 394.96326 141.34881 -77.26564
50 51 52 53 54 55 56
-449.88009 189.50545 -67.10900 -730.72345 398.66210 -96.95236 -49.56681
57 58 59 60 61 62 63
66.81874 156.20429 583.58983 211.97538 239.36093 -618.25352 -75.86798
64 65 66 67 68 69 70
189.51757 -804.09688 480.28867 -264.32578 454.05976 187.44531 390.83086
71 72 73 74 75
592.21641 596.60195 667.98750 -285.62695 -479.24140
> postscript(file="/var/fisher/rcomp/tmp/60zar1355864549.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 = 75
Frequency = 1
lag(myerror, k = 1) myerror
0 524.22807 NA
1 -106.38638 524.22807
2 -115.00083 -106.38638
3 532.38471 -115.00083
4 -635.22974 532.38471
5 497.15581 -635.22974
6 317.54136 497.15581
7 740.92690 317.54136
8 168.31245 740.92690
9 757.69800 168.31245
10 626.08355 757.69800
11 -51.53091 626.08355
12 421.85464 -51.53091
13 -291.75981 421.85464
14 -205.37426 -291.75981
15 137.01128 -205.37426
16 -661.60317 137.01128
17 253.78238 -661.60317
18 -437.83207 253.78238
19 -113.44652 -437.83207
20 -579.06098 -113.44652
21 527.32457 -579.06098
22 196.71012 527.32457
23 -124.90433 196.71012
24 150.48121 -124.90433
25 -826.13324 150.48121
26 -263.74769 -826.13324
27 77.63786 -263.74769
28 -953.97660 77.63786
29 -327.59105 -953.97660
30 -54.20550 -327.59105
31 -412.81995 -54.20550
32 -269.43440 -412.81995
33 610.95114 -269.43440
34 -136.66331 610.95114
35 72.72224 -136.66331
36 -164.89221 72.72224
37 -866.50667 -164.89221
38 -65.12112 -866.50667
39 58.26443 -65.12112
40 -621.35002 58.26443
41 20.03552 -621.35002
42 -457.57893 20.03552
43 -606.19338 -457.57893
44 101.19217 -606.19338
45 613.57771 101.19217
46 394.96326 613.57771
47 141.34881 394.96326
48 -77.26564 141.34881
49 -449.88009 -77.26564
50 189.50545 -449.88009
51 -67.10900 189.50545
52 -730.72345 -67.10900
53 398.66210 -730.72345
54 -96.95236 398.66210
55 -49.56681 -96.95236
56 66.81874 -49.56681
57 156.20429 66.81874
58 583.58983 156.20429
59 211.97538 583.58983
60 239.36093 211.97538
61 -618.25352 239.36093
62 -75.86798 -618.25352
63 189.51757 -75.86798
64 -804.09688 189.51757
65 480.28867 -804.09688
66 -264.32578 480.28867
67 454.05976 -264.32578
68 187.44531 454.05976
69 390.83086 187.44531
70 592.21641 390.83086
71 596.60195 592.21641
72 667.98750 596.60195
73 -285.62695 667.98750
74 -479.24140 -285.62695
75 NA -479.24140
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -106.38638 524.22807
[2,] -115.00083 -106.38638
[3,] 532.38471 -115.00083
[4,] -635.22974 532.38471
[5,] 497.15581 -635.22974
[6,] 317.54136 497.15581
[7,] 740.92690 317.54136
[8,] 168.31245 740.92690
[9,] 757.69800 168.31245
[10,] 626.08355 757.69800
[11,] -51.53091 626.08355
[12,] 421.85464 -51.53091
[13,] -291.75981 421.85464
[14,] -205.37426 -291.75981
[15,] 137.01128 -205.37426
[16,] -661.60317 137.01128
[17,] 253.78238 -661.60317
[18,] -437.83207 253.78238
[19,] -113.44652 -437.83207
[20,] -579.06098 -113.44652
[21,] 527.32457 -579.06098
[22,] 196.71012 527.32457
[23,] -124.90433 196.71012
[24,] 150.48121 -124.90433
[25,] -826.13324 150.48121
[26,] -263.74769 -826.13324
[27,] 77.63786 -263.74769
[28,] -953.97660 77.63786
[29,] -327.59105 -953.97660
[30,] -54.20550 -327.59105
[31,] -412.81995 -54.20550
[32,] -269.43440 -412.81995
[33,] 610.95114 -269.43440
[34,] -136.66331 610.95114
[35,] 72.72224 -136.66331
[36,] -164.89221 72.72224
[37,] -866.50667 -164.89221
[38,] -65.12112 -866.50667
[39,] 58.26443 -65.12112
[40,] -621.35002 58.26443
[41,] 20.03552 -621.35002
[42,] -457.57893 20.03552
[43,] -606.19338 -457.57893
[44,] 101.19217 -606.19338
[45,] 613.57771 101.19217
[46,] 394.96326 613.57771
[47,] 141.34881 394.96326
[48,] -77.26564 141.34881
[49,] -449.88009 -77.26564
[50,] 189.50545 -449.88009
[51,] -67.10900 189.50545
[52,] -730.72345 -67.10900
[53,] 398.66210 -730.72345
[54,] -96.95236 398.66210
[55,] -49.56681 -96.95236
[56,] 66.81874 -49.56681
[57,] 156.20429 66.81874
[58,] 583.58983 156.20429
[59,] 211.97538 583.58983
[60,] 239.36093 211.97538
[61,] -618.25352 239.36093
[62,] -75.86798 -618.25352
[63,] 189.51757 -75.86798
[64,] -804.09688 189.51757
[65,] 480.28867 -804.09688
[66,] -264.32578 480.28867
[67,] 454.05976 -264.32578
[68,] 187.44531 454.05976
[69,] 390.83086 187.44531
[70,] 592.21641 390.83086
[71,] 596.60195 592.21641
[72,] 667.98750 596.60195
[73,] -285.62695 667.98750
[74,] -479.24140 -285.62695
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -106.38638 524.22807
2 -115.00083 -106.38638
3 532.38471 -115.00083
4 -635.22974 532.38471
5 497.15581 -635.22974
6 317.54136 497.15581
7 740.92690 317.54136
8 168.31245 740.92690
9 757.69800 168.31245
10 626.08355 757.69800
11 -51.53091 626.08355
12 421.85464 -51.53091
13 -291.75981 421.85464
14 -205.37426 -291.75981
15 137.01128 -205.37426
16 -661.60317 137.01128
17 253.78238 -661.60317
18 -437.83207 253.78238
19 -113.44652 -437.83207
20 -579.06098 -113.44652
21 527.32457 -579.06098
22 196.71012 527.32457
23 -124.90433 196.71012
24 150.48121 -124.90433
25 -826.13324 150.48121
26 -263.74769 -826.13324
27 77.63786 -263.74769
28 -953.97660 77.63786
29 -327.59105 -953.97660
30 -54.20550 -327.59105
31 -412.81995 -54.20550
32 -269.43440 -412.81995
33 610.95114 -269.43440
34 -136.66331 610.95114
35 72.72224 -136.66331
36 -164.89221 72.72224
37 -866.50667 -164.89221
38 -65.12112 -866.50667
39 58.26443 -65.12112
40 -621.35002 58.26443
41 20.03552 -621.35002
42 -457.57893 20.03552
43 -606.19338 -457.57893
44 101.19217 -606.19338
45 613.57771 101.19217
46 394.96326 613.57771
47 141.34881 394.96326
48 -77.26564 141.34881
49 -449.88009 -77.26564
50 189.50545 -449.88009
51 -67.10900 189.50545
52 -730.72345 -67.10900
53 398.66210 -730.72345
54 -96.95236 398.66210
55 -49.56681 -96.95236
56 66.81874 -49.56681
57 156.20429 66.81874
58 583.58983 156.20429
59 211.97538 583.58983
60 239.36093 211.97538
61 -618.25352 239.36093
62 -75.86798 -618.25352
63 189.51757 -75.86798
64 -804.09688 189.51757
65 480.28867 -804.09688
66 -264.32578 480.28867
67 454.05976 -264.32578
68 187.44531 454.05976
69 390.83086 187.44531
70 592.21641 390.83086
71 596.60195 592.21641
72 667.98750 596.60195
73 -285.62695 667.98750
74 -479.24140 -285.62695
> 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/7luu81355864549.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/89vn51355864549.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/99df61355864549.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/10yrcv1355864549.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/11500z1355864549.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/12qnr91355864549.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/13fqvx1355864549.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/14mxna1355864549.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/15h6ds1355864549.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/16yhr71355864549.tab")
+ }
>
> try(system("convert tmp/1nzuf1355864549.ps tmp/1nzuf1355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/2p95q1355864549.ps tmp/2p95q1355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/3upj41355864549.ps tmp/3upj41355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/45zyj1355864549.ps tmp/45zyj1355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/5t26y1355864549.ps tmp/5t26y1355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/60zar1355864549.ps tmp/60zar1355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/7luu81355864549.ps tmp/7luu81355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/89vn51355864549.ps tmp/89vn51355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/99df61355864549.ps tmp/99df61355864549.png",intern=TRUE))
character(0)
> try(system("convert tmp/10yrcv1355864549.ps tmp/10yrcv1355864549.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.236 1.666 7.970