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
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,1
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,1
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,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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 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> 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*t Useful Outcome t
1 0 4 0 1 1
2 0 0 0 0 2
3 0 0 0 0 3
4 0 0 0 0 4
5 0 0 0 0 5
6 0 0 1 1 6
7 0 0 0 0 7
8 0 4 0 0 8
9 0 0 0 1 9
10 0 0 0 0 10
11 0 4 0 0 11
12 0 0 0 0 12
13 0 0 1 0 13
14 0 4 0 0 14
15 0 0 1 1 15
16 0 4 1 1 16
17 1 4 1 0 17
18 0 4 0 0 18
19 0 0 0 1 19
20 1 4 1 1 20
21 0 0 1 0 21
22 0 0 1 1 22
23 0 0 1 1 23
24 0 0 1 1 24
25 0 4 0 1 25
26 0 0 1 0 26
27 0 0 0 1 27
28 0 0 0 0 28
29 0 0 0 1 29
30 0 0 1 0 30
31 0 0 0 0 31
32 0 0 0 0 32
33 0 0 1 0 33
34 0 4 0 1 34
35 0 0 0 0 35
36 0 0 0 0 36
37 0 4 1 0 37
38 0 0 0 1 38
39 0 0 1 1 39
40 0 4 1 0 40
41 1 0 1 1 41
42 0 0 0 1 42
43 0 0 1 1 43
44 0 4 0 0 44
45 0 0 1 0 45
46 0 0 1 1 46
47 0 0 0 0 47
48 0 0 0 1 48
49 0 0 1 1 49
50 0 0 0 0 50
51 0 4 0 0 51
52 1 4 1 0 52
53 0 0 0 1 53
54 1 0 0 0 54
55 0 0 0 0 55
56 0 4 0 1 56
57 0 0 1 1 57
58 0 0 0 1 58
59 0 0 0 1 59
60 1 4 1 1 60
61 0 4 0 1 61
62 0 0 1 0 62
63 0 0 0 0 63
64 0 4 0 1 64
65 0 0 0 0 65
66 0 0 0 0 66
67 1 4 1 0 67
68 0 0 0 0 68
69 0 0 0 1 69
70 0 0 0 0 70
71 0 0 0 0 71
72 0 0 0 1 72
73 0 0 0 1 73
74 0 0 0 0 74
75 0 0 0 1 75
76 0 4 1 1 76
77 0 0 0 1 77
78 0 0 1 1 78
79 1 4 0 1 79
80 0 4 1 0 80
81 0 0 0 0 81
82 0 0 0 1 82
83 0 0 0 0 83
84 1 0 0 0 84
85 0 0 1 1 85
86 0 0 0 0 86
87 0 0 0 1 87
88 0 2 0 1 88
89 0 0 0 0 89
90 0 0 0 1 90
91 0 0 1 0 91
92 0 2 0 0 92
93 0 0 1 0 93
94 0 0 0 0 94
95 0 2 0 0 95
96 0 0 0 1 96
97 0 2 0 0 97
98 0 0 0 0 98
99 0 0 0 0 99
100 0 0 0 1 100
101 0 0 0 1 101
102 0 0 0 0 102
103 0 0 0 0 103
104 0 0 0 0 104
105 0 2 0 0 105
106 0 0 0 0 106
107 0 0 0 0 107
108 0 2 0 0 108
109 0 0 0 0 109
110 0 0 0 0 110
111 0 2 1 0 111
112 0 2 0 0 112
113 0 0 0 0 113
114 0 2 0 0 114
115 0 0 0 0 115
116 0 0 0 0 116
117 0 0 0 1 117
118 0 0 0 0 118
119 0 0 0 0 119
120 0 0 0 1 120
121 0 0 0 0 121
122 0 0 0 0 122
123 0 2 0 0 123
124 0 0 1 1 124
125 0 0 0 1 125
126 0 2 0 0 126
127 0 0 1 0 127
128 0 0 0 1 128
129 0 0 0 0 129
130 0 0 0 1 130
131 0 0 0 0 131
132 0 0 0 1 132
133 0 0 0 0 133
134 0 0 0 0 134
135 0 0 0 0 135
136 0 0 0 0 136
137 0 0 1 1 137
138 0 2 1 1 138
139 0 2 0 0 139
140 0 0 0 0 140
141 1 0 0 1 141
142 0 2 0 1 142
143 0 0 0 0 143
144 0 0 1 1 144
145 0 0 1 0 145
146 0 2 0 1 146
147 0 2 0 0 147
148 0 2 0 0 148
149 0 0 0 0 149
150 0 0 1 1 150
151 0 0 0 1 151
152 1 0 0 0 152
153 1 0 1 0 153
154 0 0 0 0 154
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Weeks*t` Useful Outcome t
-0.0184517 0.0414689 0.1222127 -0.0112666 0.0004435
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.30512 -0.11760 -0.03277 -0.00359 0.99450
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0184517 0.0525576 -0.351 0.72603
`Weeks*t` 0.0414689 0.0145332 2.853 0.00494 **
Useful 0.1222127 0.0488134 2.504 0.01337 *
Outcome -0.0112666 0.0434525 -0.259 0.79577
t 0.0004435 0.0004867 0.911 0.36364
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2593 on 149 degrees of freedom
Multiple R-squared: 0.09453, Adjusted R-squared: 0.07022
F-statistic: 3.889 on 4 and 149 DF, p-value: 0.004927
> 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.000000e+00 0.0000000000 1.0000000000
[2,] 0.000000e+00 0.0000000000 1.0000000000
[3,] 0.000000e+00 0.0000000000 1.0000000000
[4,] 0.000000e+00 0.0000000000 1.0000000000
[5,] 0.000000e+00 0.0000000000 1.0000000000
[6,] 0.000000e+00 0.0000000000 1.0000000000
[7,] 0.000000e+00 0.0000000000 1.0000000000
[8,] 0.000000e+00 0.0000000000 1.0000000000
[9,] 0.000000e+00 0.0000000000 1.0000000000
[10,] 2.294448e-01 0.4588896333 0.7705551833
[11,] 1.818746e-01 0.3637492885 0.8181253557
[12,] 1.587934e-01 0.3175868300 0.8412065850
[13,] 5.786855e-01 0.8426290157 0.4213145079
[14,] 5.897706e-01 0.8204587086 0.4102293543
[15,] 5.457763e-01 0.9084474436 0.4542237218
[16,] 4.908836e-01 0.9817671641 0.5091164179
[17,] 4.314686e-01 0.8629371372 0.5685314314
[18,] 3.716081e-01 0.7432162567 0.6283918717
[19,] 3.277409e-01 0.6554817245 0.6722591377
[20,] 2.914972e-01 0.5829943355 0.7085028323
[21,] 2.405275e-01 0.4810549480 0.7594725260
[22,] 1.990446e-01 0.3980892397 0.8009553801
[23,] 1.694961e-01 0.3389921087 0.8305039457
[24,] 1.334509e-01 0.2669018591 0.8665490705
[25,] 1.028478e-01 0.2056955435 0.8971522282
[26,] 8.413743e-02 0.1682748631 0.9158625685
[27,] 6.879671e-02 0.1375934236 0.9312032882
[28,] 5.162318e-02 0.1032463578 0.9483768211
[29,] 3.793304e-02 0.0758660724 0.9620669638
[30,] 4.618108e-02 0.0923621656 0.9538189172
[31,] 3.468080e-02 0.0693616033 0.9653191984
[32,] 2.577622e-02 0.0515524478 0.9742237761
[33,] 2.659797e-02 0.0531959391 0.9734020305
[34,] 3.834185e-01 0.7668370307 0.6165814847
[35,] 3.320251e-01 0.6640502069 0.6679748966
[36,] 2.994190e-01 0.5988379171 0.7005810414
[37,] 2.666317e-01 0.5332633753 0.7333683123
[38,] 2.323754e-01 0.4647508192 0.7676245904
[39,] 2.029080e-01 0.4058160800 0.7970919600
[40,] 1.695463e-01 0.3390925284 0.8304537358
[41,] 1.383608e-01 0.2767215904 0.8616392048
[42,] 1.174841e-01 0.2349681160 0.8825159420
[43,] 9.498759e-02 0.1899751834 0.9050124083
[44,] 8.109603e-02 0.1621920548 0.9189039726
[45,] 2.948156e-01 0.5896311798 0.7051844101
[46,] 2.528520e-01 0.5057039726 0.7471480137
[47,] 8.135086e-01 0.3729828072 0.1864914036
[48,] 7.811336e-01 0.4377327476 0.2188663738
[49,] 7.643651e-01 0.4712698546 0.2356349273
[50,] 7.392685e-01 0.5214629435 0.2607314717
[51,] 6.983350e-01 0.6033300277 0.3016650138
[52,] 6.548420e-01 0.6903159298 0.3451579649
[53,] 8.618211e-01 0.2763578719 0.1381789359
[54,] 8.496831e-01 0.3006337168 0.1503168584
[55,] 8.358398e-01 0.3283203201 0.1641601600
[56,] 8.054024e-01 0.3891951622 0.1945975811
[57,] 7.888885e-01 0.4222230788 0.2111115394
[58,] 7.534971e-01 0.4930058477 0.2465029239
[59,] 7.151341e-01 0.5697318843 0.2848659421
[60,] 9.091773e-01 0.1816454763 0.0908227381
[61,] 8.890958e-01 0.2218083754 0.1109041877
[62,] 8.651417e-01 0.2697165623 0.1348582811
[63,] 8.388088e-01 0.3223823575 0.1611911788
[64,] 8.092396e-01 0.3815208444 0.1907604222
[65,] 7.755826e-01 0.4488347404 0.2244173702
[66,] 7.388499e-01 0.5223002335 0.2611501167
[67,] 7.003656e-01 0.5992687964 0.2996343982
[68,] 6.584209e-01 0.6831582494 0.3415791247
[69,] 6.739467e-01 0.6521065126 0.3260532563
[70,] 6.306489e-01 0.7387021596 0.3693510798
[71,] 5.990342e-01 0.8019315530 0.4009657765
[72,] 9.495161e-01 0.1009677842 0.0504838921
[73,] 9.540481e-01 0.0919037782 0.0459518891
[74,] 9.416624e-01 0.1166752903 0.0583376452
[75,] 9.266013e-01 0.1467973282 0.0733986641
[76,] 9.088953e-01 0.1822093588 0.0911046794
[77,] 9.991397e-01 0.0017206873 0.0008603436
[78,] 9.988303e-01 0.0023393527 0.0011696764
[79,] 9.983181e-01 0.0033638803 0.0016819402
[80,] 9.975912e-01 0.0048176639 0.0024088320
[81,] 9.969091e-01 0.0061818685 0.0030909342
[82,] 9.956671e-01 0.0086658962 0.0043329481
[83,] 9.940144e-01 0.0119712283 0.0059856142
[84,] 9.922937e-01 0.0154126244 0.0077063122
[85,] 9.903104e-01 0.0193792001 0.0096896000
[86,] 9.874448e-01 0.0251104725 0.0125552362
[87,] 9.830393e-01 0.0339213130 0.0169606565
[88,] 9.789570e-01 0.0420860377 0.0210430189
[89,] 9.724281e-01 0.0551437723 0.0275718862
[90,] 9.664267e-01 0.0671466013 0.0335733006
[91,] 9.563384e-01 0.0873231941 0.0436615971
[92,] 9.438587e-01 0.1122825860 0.0561412930
[93,] 9.295533e-01 0.1408933215 0.0704466608
[94,] 9.129191e-01 0.1741618020 0.0870809010
[95,] 8.917562e-01 0.2164875763 0.1082437882
[96,] 8.669564e-01 0.2660872292 0.1330436146
[97,] 8.383077e-01 0.3233846682 0.1616923341
[98,] 8.142255e-01 0.3715489479 0.1857744739
[99,] 7.786138e-01 0.4427723980 0.2213861990
[100,] 7.391066e-01 0.5217868803 0.2608934402
[101,] 7.074942e-01 0.5850115859 0.2925057930
[102,] 6.619098e-01 0.6761804712 0.3380902356
[103,] 6.134442e-01 0.7731115076 0.3865557538
[104,] 5.843777e-01 0.8312445945 0.4156222973
[105,] 5.498363e-01 0.9003274918 0.4501637459
[106,] 4.975355e-01 0.9950710136 0.5024644932
[107,] 4.672744e-01 0.9345488528 0.5327255736
[108,] 4.152487e-01 0.8304973682 0.5847513159
[109,] 3.641944e-01 0.7283888679 0.6358055661
[110,] 3.162742e-01 0.6325484457 0.6837257772
[111,] 2.694754e-01 0.5389508500 0.7305245750
[112,] 2.259700e-01 0.4519400858 0.7740299571
[113,] 1.872371e-01 0.3744741108 0.8127629446
[114,] 1.516442e-01 0.3032883663 0.8483558168
[115,] 1.204995e-01 0.2409989919 0.8795005041
[116,] 1.043594e-01 0.2087187783 0.8956406108
[117,] 8.183890e-02 0.1636777981 0.9181611010
[118,] 6.189502e-02 0.1237900327 0.9381049837
[119,] 5.395674e-02 0.1079134786 0.9460432607
[120,] 4.036676e-02 0.0807335225 0.9596332387
[121,] 2.866763e-02 0.0573352654 0.9713323673
[122,] 1.987955e-02 0.0397591046 0.9801204477
[123,] 1.331818e-02 0.0266363617 0.9866818192
[124,] 8.667477e-03 0.0173349541 0.9913325229
[125,] 5.449939e-03 0.0108998787 0.9945500606
[126,] 3.314779e-03 0.0066295571 0.9966852215
[127,] 1.951928e-03 0.0039038555 0.9980480722
[128,] 1.120056e-03 0.0022401125 0.9988799438
[129,] 6.407532e-04 0.0012815063 0.9993592468
[130,] 3.705062e-04 0.0007410124 0.9996294938
[131,] 2.069430e-04 0.0004138860 0.9997930570
[132,] 1.033850e-04 0.0002067701 0.9998966150
[133,] 6.497748e-05 0.0001299550 0.9999350225
[134,] 2.532494e-02 0.0506498832 0.9746750584
[135,] 2.622321e-02 0.0524464251 0.9737767875
[136,] 1.703412e-02 0.0340682477 0.9829658762
[137,] 1.067354e-02 0.0213470701 0.9893264650
[138,] 5.327487e-03 0.0106549748 0.9946725126
[139,] 6.229888e-03 0.0124597751 0.9937701125
> postscript(file="/var/fisher/rcomp/tmp/1wxmb1356170620.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/20ejq1356170620.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/3lybj1356170620.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/4343j1356170620.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/5vnze1356170620.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.1366006449 0.0175647052 0.0171212177 0.0166777302 0.0162342427
6 7 8 9 10
-0.0951553662 0.0153472676 -0.1509716434 0.0257268783 0.0140168050
11 12 13 14 15
-0.1523021060 0.0131298299 -0.1095263647 -0.1536325686 -0.0991467540
16 17 18 19 20
-0.2654656650 0.7228242617 -0.1554065187 0.0212920030 0.7327603849
21 22 23 24 25
-0.1130742650 -0.1022511667 -0.1026946542 -0.1031381418 -0.1472443456
26 27 28 29 30
-0.1152917026 0.0177441028 0.0060340295 0.0168571277 -0.1170656527
31 32 33 34 35
0.0047035669 0.0042600793 -0.1183961153 -0.1512357334 0.0029296168
36 37 38 39 40
0.0024861292 -0.2860454889 0.0128657400 -0.1097904547 -0.2873759515
41 42 43 44 45
0.8893225702 0.0110917898 -0.1115644048 -0.1669371945 -0.1237179657
46 47 48 49 50
-0.1128948674 -0.0023922336 0.0084308647 -0.1142253300 -0.0037226962
51 52 53 54 55
-0.1700416072 0.7073021981 0.0062134270 0.9945033537 -0.0059401338
56 57 58 59 60
-0.1609924590 -0.1177732303 0.0039959894 0.0035525018 0.7150208837
61 62 63 64 65
-0.1632098967 -0.1312572537 -0.0094880341 -0.1645403593 -0.0103750091
66 67 68 69 70
-0.0108184967 0.7006498852 -0.0117054717 -0.0008823735 -0.0125924468
71 72 73 74 75
-0.0130359343 -0.0022128360 -0.0026563236 -0.0143663969 -0.0035432986
76 77 78 79 80
-0.2920749168 -0.0044302737 -0.1270864684 0.8288073278 -0.3051154527
81 82 83 84 85
-0.0174708096 -0.0066477113 -0.0183577847 0.9811987278 -0.1301908811
86 87 88 89 90
-0.0196882473 -0.0088651490 -0.0922463483 -0.0210187098 -0.0101956116
91 92 93 94 95
-0.1441183921 -0.1052868842 -0.1450053671 -0.0232361475 -0.1066173468
96 97 98 99 100
-0.0128565368 -0.1075043218 -0.0250100976 -0.0254535851 -0.0146304869
101 102 103 104 105
-0.0150739744 -0.0267840477 -0.0272275353 -0.0276710228 -0.1110522221
106 107 108 109 110
-0.0285579978 -0.0290014854 -0.1123826846 -0.0298884604 -0.0303319480
111 112 113 114 115
-0.2359258544 -0.1141566348 -0.0316624106 -0.1150436098 -0.0325493856
116 117 118 119 120
-0.0329928731 -0.0221697749 -0.0338798482 -0.0343233357 -0.0235002375
121 122 123 124 125
-0.0352103108 -0.0356537983 -0.1190349976 -0.1474868947 -0.0257176751
126 127 128 129 130
-0.1203654602 -0.1600839431 -0.0270481377 -0.0387582110 -0.0279351128
131 132 133 134 135
-0.0396451861 -0.0288220878 -0.0405321612 -0.0409756487 -0.0414191362
136 137 138 139 140
-0.0418626237 -0.1532522326 -0.2366334319 -0.1261307981 -0.0436365739
141 142 143 144 145
0.9671865244 -0.1161946749 -0.0449670364 -0.1563566453 -0.1680667187
146 147 148 149 150
-0.1179686250 -0.1296786983 -0.1301221858 -0.0476279616 -0.1590175705
151 152 153 154
-0.0372483509 0.9510415758 0.8283853811 -0.0498453993
> postscript(file="/var/fisher/rcomp/tmp/6qd501356170620.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.1366006449 NA
1 0.0175647052 -0.1366006449
2 0.0171212177 0.0175647052
3 0.0166777302 0.0171212177
4 0.0162342427 0.0166777302
5 -0.0951553662 0.0162342427
6 0.0153472676 -0.0951553662
7 -0.1509716434 0.0153472676
8 0.0257268783 -0.1509716434
9 0.0140168050 0.0257268783
10 -0.1523021060 0.0140168050
11 0.0131298299 -0.1523021060
12 -0.1095263647 0.0131298299
13 -0.1536325686 -0.1095263647
14 -0.0991467540 -0.1536325686
15 -0.2654656650 -0.0991467540
16 0.7228242617 -0.2654656650
17 -0.1554065187 0.7228242617
18 0.0212920030 -0.1554065187
19 0.7327603849 0.0212920030
20 -0.1130742650 0.7327603849
21 -0.1022511667 -0.1130742650
22 -0.1026946542 -0.1022511667
23 -0.1031381418 -0.1026946542
24 -0.1472443456 -0.1031381418
25 -0.1152917026 -0.1472443456
26 0.0177441028 -0.1152917026
27 0.0060340295 0.0177441028
28 0.0168571277 0.0060340295
29 -0.1170656527 0.0168571277
30 0.0047035669 -0.1170656527
31 0.0042600793 0.0047035669
32 -0.1183961153 0.0042600793
33 -0.1512357334 -0.1183961153
34 0.0029296168 -0.1512357334
35 0.0024861292 0.0029296168
36 -0.2860454889 0.0024861292
37 0.0128657400 -0.2860454889
38 -0.1097904547 0.0128657400
39 -0.2873759515 -0.1097904547
40 0.8893225702 -0.2873759515
41 0.0110917898 0.8893225702
42 -0.1115644048 0.0110917898
43 -0.1669371945 -0.1115644048
44 -0.1237179657 -0.1669371945
45 -0.1128948674 -0.1237179657
46 -0.0023922336 -0.1128948674
47 0.0084308647 -0.0023922336
48 -0.1142253300 0.0084308647
49 -0.0037226962 -0.1142253300
50 -0.1700416072 -0.0037226962
51 0.7073021981 -0.1700416072
52 0.0062134270 0.7073021981
53 0.9945033537 0.0062134270
54 -0.0059401338 0.9945033537
55 -0.1609924590 -0.0059401338
56 -0.1177732303 -0.1609924590
57 0.0039959894 -0.1177732303
58 0.0035525018 0.0039959894
59 0.7150208837 0.0035525018
60 -0.1632098967 0.7150208837
61 -0.1312572537 -0.1632098967
62 -0.0094880341 -0.1312572537
63 -0.1645403593 -0.0094880341
64 -0.0103750091 -0.1645403593
65 -0.0108184967 -0.0103750091
66 0.7006498852 -0.0108184967
67 -0.0117054717 0.7006498852
68 -0.0008823735 -0.0117054717
69 -0.0125924468 -0.0008823735
70 -0.0130359343 -0.0125924468
71 -0.0022128360 -0.0130359343
72 -0.0026563236 -0.0022128360
73 -0.0143663969 -0.0026563236
74 -0.0035432986 -0.0143663969
75 -0.2920749168 -0.0035432986
76 -0.0044302737 -0.2920749168
77 -0.1270864684 -0.0044302737
78 0.8288073278 -0.1270864684
79 -0.3051154527 0.8288073278
80 -0.0174708096 -0.3051154527
81 -0.0066477113 -0.0174708096
82 -0.0183577847 -0.0066477113
83 0.9811987278 -0.0183577847
84 -0.1301908811 0.9811987278
85 -0.0196882473 -0.1301908811
86 -0.0088651490 -0.0196882473
87 -0.0922463483 -0.0088651490
88 -0.0210187098 -0.0922463483
89 -0.0101956116 -0.0210187098
90 -0.1441183921 -0.0101956116
91 -0.1052868842 -0.1441183921
92 -0.1450053671 -0.1052868842
93 -0.0232361475 -0.1450053671
94 -0.1066173468 -0.0232361475
95 -0.0128565368 -0.1066173468
96 -0.1075043218 -0.0128565368
97 -0.0250100976 -0.1075043218
98 -0.0254535851 -0.0250100976
99 -0.0146304869 -0.0254535851
100 -0.0150739744 -0.0146304869
101 -0.0267840477 -0.0150739744
102 -0.0272275353 -0.0267840477
103 -0.0276710228 -0.0272275353
104 -0.1110522221 -0.0276710228
105 -0.0285579978 -0.1110522221
106 -0.0290014854 -0.0285579978
107 -0.1123826846 -0.0290014854
108 -0.0298884604 -0.1123826846
109 -0.0303319480 -0.0298884604
110 -0.2359258544 -0.0303319480
111 -0.1141566348 -0.2359258544
112 -0.0316624106 -0.1141566348
113 -0.1150436098 -0.0316624106
114 -0.0325493856 -0.1150436098
115 -0.0329928731 -0.0325493856
116 -0.0221697749 -0.0329928731
117 -0.0338798482 -0.0221697749
118 -0.0343233357 -0.0338798482
119 -0.0235002375 -0.0343233357
120 -0.0352103108 -0.0235002375
121 -0.0356537983 -0.0352103108
122 -0.1190349976 -0.0356537983
123 -0.1474868947 -0.1190349976
124 -0.0257176751 -0.1474868947
125 -0.1203654602 -0.0257176751
126 -0.1600839431 -0.1203654602
127 -0.0270481377 -0.1600839431
128 -0.0387582110 -0.0270481377
129 -0.0279351128 -0.0387582110
130 -0.0396451861 -0.0279351128
131 -0.0288220878 -0.0396451861
132 -0.0405321612 -0.0288220878
133 -0.0409756487 -0.0405321612
134 -0.0414191362 -0.0409756487
135 -0.0418626237 -0.0414191362
136 -0.1532522326 -0.0418626237
137 -0.2366334319 -0.1532522326
138 -0.1261307981 -0.2366334319
139 -0.0436365739 -0.1261307981
140 0.9671865244 -0.0436365739
141 -0.1161946749 0.9671865244
142 -0.0449670364 -0.1161946749
143 -0.1563566453 -0.0449670364
144 -0.1680667187 -0.1563566453
145 -0.1179686250 -0.1680667187
146 -0.1296786983 -0.1179686250
147 -0.1301221858 -0.1296786983
148 -0.0476279616 -0.1301221858
149 -0.1590175705 -0.0476279616
150 -0.0372483509 -0.1590175705
151 0.9510415758 -0.0372483509
152 0.8283853811 0.9510415758
153 -0.0498453993 0.8283853811
154 NA -0.0498453993
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.0175647052 -0.1366006449
[2,] 0.0171212177 0.0175647052
[3,] 0.0166777302 0.0171212177
[4,] 0.0162342427 0.0166777302
[5,] -0.0951553662 0.0162342427
[6,] 0.0153472676 -0.0951553662
[7,] -0.1509716434 0.0153472676
[8,] 0.0257268783 -0.1509716434
[9,] 0.0140168050 0.0257268783
[10,] -0.1523021060 0.0140168050
[11,] 0.0131298299 -0.1523021060
[12,] -0.1095263647 0.0131298299
[13,] -0.1536325686 -0.1095263647
[14,] -0.0991467540 -0.1536325686
[15,] -0.2654656650 -0.0991467540
[16,] 0.7228242617 -0.2654656650
[17,] -0.1554065187 0.7228242617
[18,] 0.0212920030 -0.1554065187
[19,] 0.7327603849 0.0212920030
[20,] -0.1130742650 0.7327603849
[21,] -0.1022511667 -0.1130742650
[22,] -0.1026946542 -0.1022511667
[23,] -0.1031381418 -0.1026946542
[24,] -0.1472443456 -0.1031381418
[25,] -0.1152917026 -0.1472443456
[26,] 0.0177441028 -0.1152917026
[27,] 0.0060340295 0.0177441028
[28,] 0.0168571277 0.0060340295
[29,] -0.1170656527 0.0168571277
[30,] 0.0047035669 -0.1170656527
[31,] 0.0042600793 0.0047035669
[32,] -0.1183961153 0.0042600793
[33,] -0.1512357334 -0.1183961153
[34,] 0.0029296168 -0.1512357334
[35,] 0.0024861292 0.0029296168
[36,] -0.2860454889 0.0024861292
[37,] 0.0128657400 -0.2860454889
[38,] -0.1097904547 0.0128657400
[39,] -0.2873759515 -0.1097904547
[40,] 0.8893225702 -0.2873759515
[41,] 0.0110917898 0.8893225702
[42,] -0.1115644048 0.0110917898
[43,] -0.1669371945 -0.1115644048
[44,] -0.1237179657 -0.1669371945
[45,] -0.1128948674 -0.1237179657
[46,] -0.0023922336 -0.1128948674
[47,] 0.0084308647 -0.0023922336
[48,] -0.1142253300 0.0084308647
[49,] -0.0037226962 -0.1142253300
[50,] -0.1700416072 -0.0037226962
[51,] 0.7073021981 -0.1700416072
[52,] 0.0062134270 0.7073021981
[53,] 0.9945033537 0.0062134270
[54,] -0.0059401338 0.9945033537
[55,] -0.1609924590 -0.0059401338
[56,] -0.1177732303 -0.1609924590
[57,] 0.0039959894 -0.1177732303
[58,] 0.0035525018 0.0039959894
[59,] 0.7150208837 0.0035525018
[60,] -0.1632098967 0.7150208837
[61,] -0.1312572537 -0.1632098967
[62,] -0.0094880341 -0.1312572537
[63,] -0.1645403593 -0.0094880341
[64,] -0.0103750091 -0.1645403593
[65,] -0.0108184967 -0.0103750091
[66,] 0.7006498852 -0.0108184967
[67,] -0.0117054717 0.7006498852
[68,] -0.0008823735 -0.0117054717
[69,] -0.0125924468 -0.0008823735
[70,] -0.0130359343 -0.0125924468
[71,] -0.0022128360 -0.0130359343
[72,] -0.0026563236 -0.0022128360
[73,] -0.0143663969 -0.0026563236
[74,] -0.0035432986 -0.0143663969
[75,] -0.2920749168 -0.0035432986
[76,] -0.0044302737 -0.2920749168
[77,] -0.1270864684 -0.0044302737
[78,] 0.8288073278 -0.1270864684
[79,] -0.3051154527 0.8288073278
[80,] -0.0174708096 -0.3051154527
[81,] -0.0066477113 -0.0174708096
[82,] -0.0183577847 -0.0066477113
[83,] 0.9811987278 -0.0183577847
[84,] -0.1301908811 0.9811987278
[85,] -0.0196882473 -0.1301908811
[86,] -0.0088651490 -0.0196882473
[87,] -0.0922463483 -0.0088651490
[88,] -0.0210187098 -0.0922463483
[89,] -0.0101956116 -0.0210187098
[90,] -0.1441183921 -0.0101956116
[91,] -0.1052868842 -0.1441183921
[92,] -0.1450053671 -0.1052868842
[93,] -0.0232361475 -0.1450053671
[94,] -0.1066173468 -0.0232361475
[95,] -0.0128565368 -0.1066173468
[96,] -0.1075043218 -0.0128565368
[97,] -0.0250100976 -0.1075043218
[98,] -0.0254535851 -0.0250100976
[99,] -0.0146304869 -0.0254535851
[100,] -0.0150739744 -0.0146304869
[101,] -0.0267840477 -0.0150739744
[102,] -0.0272275353 -0.0267840477
[103,] -0.0276710228 -0.0272275353
[104,] -0.1110522221 -0.0276710228
[105,] -0.0285579978 -0.1110522221
[106,] -0.0290014854 -0.0285579978
[107,] -0.1123826846 -0.0290014854
[108,] -0.0298884604 -0.1123826846
[109,] -0.0303319480 -0.0298884604
[110,] -0.2359258544 -0.0303319480
[111,] -0.1141566348 -0.2359258544
[112,] -0.0316624106 -0.1141566348
[113,] -0.1150436098 -0.0316624106
[114,] -0.0325493856 -0.1150436098
[115,] -0.0329928731 -0.0325493856
[116,] -0.0221697749 -0.0329928731
[117,] -0.0338798482 -0.0221697749
[118,] -0.0343233357 -0.0338798482
[119,] -0.0235002375 -0.0343233357
[120,] -0.0352103108 -0.0235002375
[121,] -0.0356537983 -0.0352103108
[122,] -0.1190349976 -0.0356537983
[123,] -0.1474868947 -0.1190349976
[124,] -0.0257176751 -0.1474868947
[125,] -0.1203654602 -0.0257176751
[126,] -0.1600839431 -0.1203654602
[127,] -0.0270481377 -0.1600839431
[128,] -0.0387582110 -0.0270481377
[129,] -0.0279351128 -0.0387582110
[130,] -0.0396451861 -0.0279351128
[131,] -0.0288220878 -0.0396451861
[132,] -0.0405321612 -0.0288220878
[133,] -0.0409756487 -0.0405321612
[134,] -0.0414191362 -0.0409756487
[135,] -0.0418626237 -0.0414191362
[136,] -0.1532522326 -0.0418626237
[137,] -0.2366334319 -0.1532522326
[138,] -0.1261307981 -0.2366334319
[139,] -0.0436365739 -0.1261307981
[140,] 0.9671865244 -0.0436365739
[141,] -0.1161946749 0.9671865244
[142,] -0.0449670364 -0.1161946749
[143,] -0.1563566453 -0.0449670364
[144,] -0.1680667187 -0.1563566453
[145,] -0.1179686250 -0.1680667187
[146,] -0.1296786983 -0.1179686250
[147,] -0.1301221858 -0.1296786983
[148,] -0.0476279616 -0.1301221858
[149,] -0.1590175705 -0.0476279616
[150,] -0.0372483509 -0.1590175705
[151,] 0.9510415758 -0.0372483509
[152,] 0.8283853811 0.9510415758
[153,] -0.0498453993 0.8283853811
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.0175647052 -0.1366006449
2 0.0171212177 0.0175647052
3 0.0166777302 0.0171212177
4 0.0162342427 0.0166777302
5 -0.0951553662 0.0162342427
6 0.0153472676 -0.0951553662
7 -0.1509716434 0.0153472676
8 0.0257268783 -0.1509716434
9 0.0140168050 0.0257268783
10 -0.1523021060 0.0140168050
11 0.0131298299 -0.1523021060
12 -0.1095263647 0.0131298299
13 -0.1536325686 -0.1095263647
14 -0.0991467540 -0.1536325686
15 -0.2654656650 -0.0991467540
16 0.7228242617 -0.2654656650
17 -0.1554065187 0.7228242617
18 0.0212920030 -0.1554065187
19 0.7327603849 0.0212920030
20 -0.1130742650 0.7327603849
21 -0.1022511667 -0.1130742650
22 -0.1026946542 -0.1022511667
23 -0.1031381418 -0.1026946542
24 -0.1472443456 -0.1031381418
25 -0.1152917026 -0.1472443456
26 0.0177441028 -0.1152917026
27 0.0060340295 0.0177441028
28 0.0168571277 0.0060340295
29 -0.1170656527 0.0168571277
30 0.0047035669 -0.1170656527
31 0.0042600793 0.0047035669
32 -0.1183961153 0.0042600793
33 -0.1512357334 -0.1183961153
34 0.0029296168 -0.1512357334
35 0.0024861292 0.0029296168
36 -0.2860454889 0.0024861292
37 0.0128657400 -0.2860454889
38 -0.1097904547 0.0128657400
39 -0.2873759515 -0.1097904547
40 0.8893225702 -0.2873759515
41 0.0110917898 0.8893225702
42 -0.1115644048 0.0110917898
43 -0.1669371945 -0.1115644048
44 -0.1237179657 -0.1669371945
45 -0.1128948674 -0.1237179657
46 -0.0023922336 -0.1128948674
47 0.0084308647 -0.0023922336
48 -0.1142253300 0.0084308647
49 -0.0037226962 -0.1142253300
50 -0.1700416072 -0.0037226962
51 0.7073021981 -0.1700416072
52 0.0062134270 0.7073021981
53 0.9945033537 0.0062134270
54 -0.0059401338 0.9945033537
55 -0.1609924590 -0.0059401338
56 -0.1177732303 -0.1609924590
57 0.0039959894 -0.1177732303
58 0.0035525018 0.0039959894
59 0.7150208837 0.0035525018
60 -0.1632098967 0.7150208837
61 -0.1312572537 -0.1632098967
62 -0.0094880341 -0.1312572537
63 -0.1645403593 -0.0094880341
64 -0.0103750091 -0.1645403593
65 -0.0108184967 -0.0103750091
66 0.7006498852 -0.0108184967
67 -0.0117054717 0.7006498852
68 -0.0008823735 -0.0117054717
69 -0.0125924468 -0.0008823735
70 -0.0130359343 -0.0125924468
71 -0.0022128360 -0.0130359343
72 -0.0026563236 -0.0022128360
73 -0.0143663969 -0.0026563236
74 -0.0035432986 -0.0143663969
75 -0.2920749168 -0.0035432986
76 -0.0044302737 -0.2920749168
77 -0.1270864684 -0.0044302737
78 0.8288073278 -0.1270864684
79 -0.3051154527 0.8288073278
80 -0.0174708096 -0.3051154527
81 -0.0066477113 -0.0174708096
82 -0.0183577847 -0.0066477113
83 0.9811987278 -0.0183577847
84 -0.1301908811 0.9811987278
85 -0.0196882473 -0.1301908811
86 -0.0088651490 -0.0196882473
87 -0.0922463483 -0.0088651490
88 -0.0210187098 -0.0922463483
89 -0.0101956116 -0.0210187098
90 -0.1441183921 -0.0101956116
91 -0.1052868842 -0.1441183921
92 -0.1450053671 -0.1052868842
93 -0.0232361475 -0.1450053671
94 -0.1066173468 -0.0232361475
95 -0.0128565368 -0.1066173468
96 -0.1075043218 -0.0128565368
97 -0.0250100976 -0.1075043218
98 -0.0254535851 -0.0250100976
99 -0.0146304869 -0.0254535851
100 -0.0150739744 -0.0146304869
101 -0.0267840477 -0.0150739744
102 -0.0272275353 -0.0267840477
103 -0.0276710228 -0.0272275353
104 -0.1110522221 -0.0276710228
105 -0.0285579978 -0.1110522221
106 -0.0290014854 -0.0285579978
107 -0.1123826846 -0.0290014854
108 -0.0298884604 -0.1123826846
109 -0.0303319480 -0.0298884604
110 -0.2359258544 -0.0303319480
111 -0.1141566348 -0.2359258544
112 -0.0316624106 -0.1141566348
113 -0.1150436098 -0.0316624106
114 -0.0325493856 -0.1150436098
115 -0.0329928731 -0.0325493856
116 -0.0221697749 -0.0329928731
117 -0.0338798482 -0.0221697749
118 -0.0343233357 -0.0338798482
119 -0.0235002375 -0.0343233357
120 -0.0352103108 -0.0235002375
121 -0.0356537983 -0.0352103108
122 -0.1190349976 -0.0356537983
123 -0.1474868947 -0.1190349976
124 -0.0257176751 -0.1474868947
125 -0.1203654602 -0.0257176751
126 -0.1600839431 -0.1203654602
127 -0.0270481377 -0.1600839431
128 -0.0387582110 -0.0270481377
129 -0.0279351128 -0.0387582110
130 -0.0396451861 -0.0279351128
131 -0.0288220878 -0.0396451861
132 -0.0405321612 -0.0288220878
133 -0.0409756487 -0.0405321612
134 -0.0414191362 -0.0409756487
135 -0.0418626237 -0.0414191362
136 -0.1532522326 -0.0418626237
137 -0.2366334319 -0.1532522326
138 -0.1261307981 -0.2366334319
139 -0.0436365739 -0.1261307981
140 0.9671865244 -0.0436365739
141 -0.1161946749 0.9671865244
142 -0.0449670364 -0.1161946749
143 -0.1563566453 -0.0449670364
144 -0.1680667187 -0.1563566453
145 -0.1179686250 -0.1680667187
146 -0.1296786983 -0.1179686250
147 -0.1301221858 -0.1296786983
148 -0.0476279616 -0.1301221858
149 -0.1590175705 -0.0476279616
150 -0.0372483509 -0.1590175705
151 0.9510415758 -0.0372483509
152 0.8283853811 0.9510415758
153 -0.0498453993 0.8283853811
> 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/7bihz1356170620.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/8lh591356170620.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/9jszb1356170620.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/105z7p1356170620.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/11q8pg1356170620.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/123un61356170620.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/13mkat1356170620.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/14wfrr1356170620.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/15zf691356170620.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/161bae1356170620.tab")
+ }
>
> try(system("convert tmp/1wxmb1356170620.ps tmp/1wxmb1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/20ejq1356170620.ps tmp/20ejq1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/3lybj1356170620.ps tmp/3lybj1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/4343j1356170620.ps tmp/4343j1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/5vnze1356170620.ps tmp/5vnze1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/6qd501356170620.ps tmp/6qd501356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bihz1356170620.ps tmp/7bihz1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/8lh591356170620.ps tmp/8lh591356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jszb1356170620.ps tmp/9jszb1356170620.png",intern=TRUE))
character(0)
> try(system("convert tmp/105z7p1356170620.ps tmp/105z7p1356170620.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.818 1.810 9.634