R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
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(14
+ ,12
+ ,38
+ ,41
+ ,7
+ ,2
+ ,53
+ ,18
+ ,11
+ ,32
+ ,39
+ ,5
+ ,2
+ ,86
+ ,11
+ ,14
+ ,35
+ ,30
+ ,5
+ ,2
+ ,66
+ ,12
+ ,12
+ ,33
+ ,31
+ ,5
+ ,1
+ ,67
+ ,16
+ ,21
+ ,37
+ ,34
+ ,8
+ ,2
+ ,76
+ ,18
+ ,12
+ ,29
+ ,35
+ ,6
+ ,2
+ ,78
+ ,14
+ ,22
+ ,31
+ ,39
+ ,5
+ ,2
+ ,53
+ ,14
+ ,11
+ ,36
+ ,34
+ ,6
+ ,2
+ ,80
+ ,15
+ ,10
+ ,35
+ ,36
+ ,5
+ ,2
+ ,74
+ ,15
+ ,13
+ ,38
+ ,37
+ ,4
+ ,2
+ ,76
+ ,17
+ ,10
+ ,31
+ ,38
+ ,6
+ ,1
+ ,79
+ ,19
+ ,8
+ ,34
+ ,36
+ ,5
+ ,2
+ ,54
+ ,10
+ ,15
+ ,35
+ ,38
+ ,5
+ ,1
+ ,67
+ ,16
+ ,14
+ ,38
+ ,39
+ ,6
+ ,2
+ ,54
+ ,18
+ ,10
+ ,37
+ ,33
+ ,7
+ ,2
+ ,87
+ ,14
+ ,14
+ ,33
+ ,32
+ ,6
+ ,1
+ ,58
+ ,14
+ ,14
+ ,32
+ ,36
+ ,7
+ ,1
+ ,75
+ ,17
+ ,11
+ ,38
+ ,38
+ ,6
+ ,2
+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,'b_6')
+ ,1:162))
> y <- array(NA,dim=c(7,162),dimnames=list(c('Y_t','b_1','b_2','b_3','b_4','b_5','b_6'),1:162))
> 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'
> par3 <- 'Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '1'
> #'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
Y_t b_1 b_2 b_3 b_4 b_5 b_6 t
1 14 12 38 41 7 2 53 1
2 18 11 32 39 5 2 86 2
3 11 14 35 30 5 2 66 3
4 12 12 33 31 5 1 67 4
5 16 21 37 34 8 2 76 5
6 18 12 29 35 6 2 78 6
7 14 22 31 39 5 2 53 7
8 14 11 36 34 6 2 80 8
9 15 10 35 36 5 2 74 9
10 15 13 38 37 4 2 76 10
11 17 10 31 38 6 1 79 11
12 19 8 34 36 5 2 54 12
13 10 15 35 38 5 1 67 13
14 16 14 38 39 6 2 54 14
15 18 10 37 33 7 2 87 15
16 14 14 33 32 6 1 58 16
17 14 14 32 36 7 1 75 17
18 17 11 38 38 6 2 88 18
19 14 10 38 39 8 1 64 19
20 16 13 32 32 7 2 57 20
21 18 7 33 32 5 1 66 21
22 11 14 31 31 5 2 68 22
23 14 12 38 39 7 2 54 23
24 12 14 39 37 7 2 56 24
25 17 11 32 39 5 1 86 25
26 9 9 32 41 4 2 80 26
27 16 11 35 36 10 1 76 27
28 14 15 37 33 6 2 69 28
29 15 14 33 33 5 2 78 29
30 11 13 33 34 5 1 67 30
31 16 9 28 31 5 2 80 31
32 13 15 32 27 5 1 54 32
33 17 10 31 37 6 2 71 33
34 15 11 37 34 5 2 84 34
35 14 13 30 34 5 1 74 35
36 16 8 33 32 5 1 71 36
37 9 20 31 29 5 1 63 37
38 15 12 33 36 5 1 71 38
39 17 10 31 29 5 2 76 39
40 13 10 33 35 5 1 69 40
41 15 9 32 37 5 1 74 41
42 16 14 33 34 7 2 75 42
43 16 8 32 38 5 1 54 43
44 12 14 33 35 6 1 52 44
45 12 11 28 38 7 2 69 45
46 11 13 35 37 7 2 68 46
47 15 9 39 38 5 2 65 47
48 15 11 34 33 5 2 75 48
49 17 15 38 36 4 2 74 49
50 13 11 32 38 5 1 75 50
51 16 10 38 32 4 2 72 51
52 14 14 30 32 5 1 67 52
53 11 18 33 32 5 1 63 53
54 12 14 38 34 7 2 62 54
55 12 11 32 32 5 1 63 55
56 15 12 32 37 5 2 76 56
57 16 13 34 39 6 2 74 57
58 15 9 34 29 4 2 67 58
59 12 10 36 37 6 1 73 59
60 12 15 34 35 6 2 70 60
61 8 20 28 30 5 1 53 61
62 13 12 34 38 7 1 77 62
63 11 12 35 34 6 2 77 63
64 14 14 35 31 8 2 52 64
65 15 13 31 34 7 2 54 65
66 10 11 37 35 5 1 80 66
67 11 17 35 36 6 2 66 67
68 12 12 27 30 6 1 73 68
69 15 13 40 39 5 2 63 69
70 15 14 37 35 5 1 69 70
71 14 13 36 38 5 1 67 71
72 16 15 38 31 5 2 54 72
73 15 13 39 34 4 2 81 73
74 15 10 41 38 6 1 69 74
75 13 11 27 34 6 1 84 75
76 12 19 30 39 6 2 80 76
77 17 13 37 37 6 2 70 77
78 13 17 31 34 7 2 69 78
79 15 13 31 28 5 1 77 79
80 13 9 27 37 7 1 54 80
81 15 11 36 33 6 1 79 81
82 16 10 38 37 5 1 30 82
83 15 9 37 35 5 2 71 83
84 16 12 33 37 4 1 73 84
85 15 12 34 32 8 2 72 85
86 14 13 31 33 8 2 77 86
87 15 13 39 38 5 1 75 87
88 14 12 34 33 5 2 69 88
89 13 15 32 29 6 2 54 89
90 7 22 33 33 4 2 70 90
91 17 13 36 31 5 2 73 91
92 13 15 32 36 5 2 54 92
93 15 13 41 35 5 2 77 93
94 14 15 28 32 5 2 82 94
95 13 10 30 29 6 2 80 95
96 16 11 36 39 6 2 80 96
97 12 16 35 37 5 2 69 97
98 14 11 31 35 6 2 78 98
99 17 11 34 37 5 1 81 99
100 15 10 36 32 7 1 76 100
101 17 10 36 38 5 2 76 101
102 12 16 35 37 6 1 73 102
103 16 12 37 36 6 2 85 103
104 11 11 28 32 6 1 66 104
105 15 16 39 33 4 2 79 105
106 9 19 32 40 5 1 68 106
107 16 11 35 38 5 2 76 107
108 15 16 39 41 7 1 71 108
109 10 15 35 36 6 1 54 109
110 10 24 42 43 9 2 46 110
111 15 14 34 30 6 2 82 111
112 11 15 33 31 6 2 74 112
113 13 11 41 32 5 2 88 113
114 14 15 33 32 6 1 38 114
115 18 12 34 37 5 2 76 115
116 16 10 32 37 8 1 86 116
117 14 14 40 33 7 2 54 117
118 14 13 40 34 5 2 70 118
119 14 9 35 33 7 2 69 119
120 14 15 36 38 6 2 90 120
121 12 15 37 33 6 2 54 121
122 14 14 27 31 9 2 76 122
123 15 11 39 38 7 2 89 123
124 15 8 38 37 6 2 76 124
125 15 11 31 33 5 2 73 125
126 13 11 33 31 5 2 79 126
127 17 8 32 39 6 1 90 127
128 17 10 39 44 6 2 74 128
129 19 11 36 33 7 2 81 129
130 15 13 33 35 5 2 72 130
131 13 11 33 32 5 1 71 131
132 9 20 32 28 5 1 66 132
133 15 10 37 40 6 2 77 133
134 15 15 30 27 4 1 65 134
135 15 12 38 37 5 1 74 135
136 16 14 29 32 7 2 82 136
137 11 23 22 28 5 1 54 137
138 14 14 35 34 7 1 63 138
139 11 16 35 30 7 2 54 139
140 15 11 34 35 6 2 64 140
141 13 12 35 31 5 1 69 141
142 15 10 34 32 8 2 54 142
143 16 14 34 30 5 1 84 143
144 14 12 35 30 5 2 86 144
145 15 12 23 31 5 1 77 145
146 16 11 31 40 6 2 89 146
147 16 12 27 32 4 2 76 147
148 11 13 36 36 5 1 60 148
149 12 11 31 32 5 1 75 149
150 9 19 32 35 7 1 73 150
151 16 12 39 38 6 2 85 151
152 13 17 37 42 7 2 79 152
153 16 9 38 34 10 1 71 153
154 12 12 39 35 6 2 72 154
155 9 19 34 35 8 2 69 155
156 13 18 31 33 4 2 78 156
157 13 15 32 36 5 2 54 157
158 14 14 37 32 6 2 69 158
159 19 11 36 33 7 2 81 159
160 13 9 32 34 7 2 84 160
161 12 18 35 32 6 2 84 161
162 13 16 36 34 6 2 69 162
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) b_1 b_2 b_3 b_4 b_5
13.290728 -0.368426 0.043743 0.017464 0.048110 0.813842
b_6 t
0.029349 -0.003249
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.1743 -1.3222 0.2075 1.1845 4.0071
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.290728 2.390117 5.561 1.16e-07 ***
b_1 -0.368426 0.050782 -7.255 1.84e-11 ***
b_2 0.043743 0.047380 0.923 0.3573
b_3 0.017464 0.049358 0.354 0.7240
b_4 0.048110 0.133285 0.361 0.7186
b_5 0.813842 0.325885 2.497 0.0136 *
b_6 0.029349 0.015242 1.926 0.0560 .
t -0.003249 0.003354 -0.969 0.3342
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.91 on 154 degrees of freedom
Multiple R-squared: 0.3616, Adjusted R-squared: 0.3326
F-statistic: 12.46 on 7 and 154 DF, p-value: 1.357e-12
> 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.19538427 0.390768545 0.804615727
[2,] 0.72007677 0.559846458 0.279923229
[3,] 0.82793843 0.344123141 0.172061570
[4,] 0.75121717 0.497565656 0.248782828
[5,] 0.66044912 0.679101759 0.339550879
[6,] 0.56566404 0.868671923 0.434335961
[7,] 0.58428384 0.831432321 0.415716161
[8,] 0.49946607 0.998932150 0.500533925
[9,] 0.43380643 0.867612853 0.566193573
[10,] 0.46344734 0.926894682 0.536552659
[11,] 0.59174954 0.816500915 0.408250458
[12,] 0.89127608 0.217447838 0.108723919
[13,] 0.88279808 0.234403839 0.117201920
[14,] 0.87719940 0.245601204 0.122800602
[15,] 0.85788890 0.284222204 0.142111102
[16,] 0.99771816 0.004563672 0.002281836
[17,] 0.99709853 0.005802936 0.002901468
[18,] 0.99611862 0.007762756 0.003881378
[19,] 0.99505268 0.009894639 0.004947319
[20,] 0.99394537 0.012109252 0.006054626
[21,] 0.99083431 0.018331383 0.009165691
[22,] 0.98914963 0.021700738 0.010850369
[23,] 0.98711277 0.025774454 0.012887227
[24,] 0.98266980 0.034660399 0.017330200
[25,] 0.97655727 0.046885451 0.023442726
[26,] 0.97342541 0.053149186 0.026574593
[27,] 0.96882456 0.062350872 0.031175436
[28,] 0.96722596 0.065548077 0.032774039
[29,] 0.96404703 0.071905935 0.035952967
[30,] 0.95473171 0.090536587 0.045268294
[31,] 0.94130291 0.117394180 0.058697090
[32,] 0.93652535 0.126949290 0.063474645
[33,] 0.93077084 0.138458313 0.069229157
[34,] 0.91294144 0.174117116 0.087058558
[35,] 0.95716984 0.085660312 0.042830156
[36,] 0.96915564 0.061688718 0.030844359
[37,] 0.96318434 0.073631316 0.036815658
[38,] 0.95314634 0.093707319 0.046853659
[39,] 0.98204476 0.035910470 0.017955235
[40,] 0.97726323 0.045473536 0.022736768
[41,] 0.97194320 0.056113600 0.028056800
[42,] 0.96766305 0.064673906 0.032336953
[43,] 0.95774667 0.084506666 0.042253333
[44,] 0.95331531 0.093369374 0.046684687
[45,] 0.94800675 0.103986507 0.051993254
[46,] 0.93526294 0.129474112 0.064737056
[47,] 0.93361069 0.132778614 0.066389307
[48,] 0.91708705 0.165825896 0.082912948
[49,] 0.92470079 0.150598416 0.075299208
[50,] 0.91392317 0.172153657 0.086076828
[51,] 0.91053226 0.178935480 0.089467740
[52,] 0.89280585 0.214388303 0.107194152
[53,] 0.93361621 0.132767586 0.066383793
[54,] 0.92174297 0.156514068 0.078257034
[55,] 0.91577900 0.168441996 0.084220998
[56,] 0.96383563 0.072328738 0.036164369
[57,] 0.95886505 0.082269904 0.041134952
[58,] 0.95526363 0.089472746 0.044736373
[59,] 0.95411473 0.091770532 0.045885266
[60,] 0.96266681 0.074666371 0.037333185
[61,] 0.95747419 0.085051627 0.042525813
[62,] 0.97265453 0.054690931 0.027345465
[63,] 0.96587498 0.068250045 0.034125023
[64,] 0.95847384 0.083052320 0.041526160
[65,] 0.95382740 0.092345198 0.046172599
[66,] 0.94152187 0.116956267 0.058478134
[67,] 0.95509713 0.089805737 0.044902868
[68,] 0.94398369 0.112032629 0.056016314
[69,] 0.94188464 0.116230721 0.058115360
[70,] 0.93732226 0.125355488 0.062677744
[71,] 0.92398004 0.152039926 0.076019963
[72,] 0.93283440 0.134331202 0.067165601
[73,] 0.91952538 0.160949232 0.080474616
[74,] 0.92471766 0.150564672 0.075282336
[75,] 0.90759164 0.184816712 0.092408356
[76,] 0.88669032 0.226619355 0.113309678
[77,] 0.87175915 0.256481710 0.128240855
[78,] 0.84655851 0.306882975 0.153441488
[79,] 0.81820605 0.363587900 0.181793950
[80,] 0.88697640 0.226047192 0.113023596
[81,] 0.91187916 0.176241674 0.088120837
[82,] 0.89141108 0.217177836 0.108588918
[83,] 0.86890947 0.262181051 0.131090526
[84,] 0.84521760 0.309564799 0.154782400
[85,] 0.85824334 0.283513321 0.141756660
[86,] 0.83264092 0.334718154 0.167359077
[87,] 0.81218402 0.375631954 0.187815977
[88,] 0.79534124 0.409317527 0.204658763
[89,] 0.81380297 0.372394053 0.186197027
[90,] 0.77958030 0.440839397 0.220419699
[91,] 0.76027877 0.479442450 0.239721225
[92,] 0.72386367 0.552272656 0.276136328
[93,] 0.68847254 0.623054928 0.311527464
[94,] 0.75791710 0.484165791 0.242082896
[95,] 0.75269527 0.494609454 0.247304727
[96,] 0.78899772 0.422004562 0.211002281
[97,] 0.75497223 0.490055543 0.245027772
[98,] 0.76624808 0.467503831 0.233751916
[99,] 0.79969042 0.400619169 0.200309584
[100,] 0.76518618 0.469627647 0.234813823
[101,] 0.73532909 0.529341827 0.264670914
[102,] 0.77082676 0.458346483 0.229173241
[103,] 0.80162930 0.396741391 0.198370696
[104,] 0.81563714 0.368725727 0.184362864
[105,] 0.86705225 0.265895504 0.132947752
[106,] 0.83927459 0.321450824 0.160725412
[107,] 0.81861009 0.362779811 0.181389905
[108,] 0.78097484 0.438050317 0.219025159
[109,] 0.77324195 0.453516092 0.226758046
[110,] 0.73009365 0.539812700 0.269906350
[111,] 0.68720294 0.625594117 0.312797058
[112,] 0.64802137 0.703957261 0.351978630
[113,] 0.61023294 0.779534126 0.389767063
[114,] 0.59729662 0.805406750 0.402703375
[115,] 0.55150278 0.896994436 0.448497218
[116,] 0.67069075 0.658618504 0.329309252
[117,] 0.62422974 0.751540523 0.375770262
[118,] 0.58411544 0.831769122 0.415884561
[119,] 0.65391375 0.692172498 0.346086249
[120,] 0.59753804 0.804923920 0.402461960
[121,] 0.58388755 0.832224907 0.416112453
[122,] 0.61121002 0.777579952 0.388789976
[123,] 0.56269356 0.874612881 0.437306440
[124,] 0.55891168 0.882176640 0.441088320
[125,] 0.50447478 0.991050444 0.495525222
[126,] 0.45139436 0.902788724 0.548605638
[127,] 0.46518718 0.930374353 0.534812823
[128,] 0.44810195 0.896203899 0.551898050
[129,] 0.39309348 0.786186967 0.606906517
[130,] 0.32097052 0.641941034 0.679029483
[131,] 0.25899308 0.517986169 0.741006915
[132,] 0.19984821 0.399696426 0.800151787
[133,] 0.25775177 0.515503536 0.742248232
[134,] 0.22010660 0.440213200 0.779893400
[135,] 0.19946276 0.398925523 0.800537238
[136,] 0.14011686 0.280233729 0.859883135
[137,] 0.15329291 0.306585814 0.846707093
[138,] 0.12058681 0.241173611 0.879413194
[139,] 0.08510128 0.170202570 0.914898715
[140,] 0.07004018 0.140080367 0.929959817
[141,] 0.03630916 0.072618315 0.963690842
> postscript(file="/var/fisher/rcomp/tmp/19eyl1351884343.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/2xkqq1351884343.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/300ij1351884343.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/4qlbz1351884343.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/5zz6s1351884343.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 = 162
Frequency = 1
1 2 3 4 5 6
-0.76459695 2.29530109 -2.98323601 -1.86232442 4.00707678 3.06449294
7 8 9 10 11 12
3.37650116 -1.64486915 -0.77702553 0.17221893 1.98850066 3.12660022
13 14 15 16 17 18
-2.93754177 2.06817905 1.72961353 1.11208463 0.54217047 0.99548266
19 20 21 22 23 24
-0.96515040 1.96779497 2.36266370 -2.82269835 -0.68754185 -2.01495470
25 26 27 28 29 30
2.18386824 -7.17429876 1.16447560 0.19037667 0.78413628 -2.46181939
31 32 33 34 35 36
0.14344903 0.82906387 1.49839395 -0.67342800 0.48020790 0.63307625
37 38 39 40 41 42
-1.56789288 1.04342033 1.55896356 -1.61077037 -0.11387964 1.80073680
43 44 45 46 47 48
1.09371596 -0.67324194 -2.96984002 -3.48912569 -0.96774755 -0.21510616
49 50 51 52 53 54
3.11194103 -1.39460149 0.40486565 1.14423922 -0.39263980 -1.99744822
55 56 57 58 59 60
-1.92137929 0.16759043 1.42744022 -0.56670705 -2.88070492 -1.63870736
61 62 63 64 65 66
-2.08266085 -1.22959250 -3.96596212 0.46404599 1.21085878 -4.65568725
67 68 69 70 71 72
-1.82292292 -1.59867884 0.57492331 1.78542883 0.47030107 2.81286492
73 74 75 76 77 78
0.23880340 0.04924818 -1.33706205 -0.30140109 2.51351601 0.28655686
79 80 81 82 83 84
1.59615425 -1.27768963 0.45295733 2.41666770 -0.88700479 2.16481719
85 86 87 88 89 90
0.23471272 -0.42659532 1.15626025 -0.54062751 0.11737195 -3.78736927
91 92 93 94 95 96
2.66759017 0.05297919 0.26811979 0.48252216 -2.38086159 0.55371457
97 98 99 100 101 102
-1.15128382 -1.09251816 2.51847765 0.20366363 1.38450480 -0.48670437
103 104 105 106 107 108
0.80678550 -2.72336906 1.52420883 -2.09473902 0.81616682 2.29855034
109 110 111 112 113 114
-2.25728524 -0.09002959 0.89368985 -2.47356180 -2.67420407 2.38589175
115 116 117 118 119 120
3.27179085 1.00169312 0.37200709 -0.38400466 -1.68515048 -0.17063820
121 122 123 124 125 126
-1.06723343 0.24993061 -0.78458307 -1.39575272 0.22498750 -2.00041715
127 128 129 130 131 132
1.24447322 1.24680119 3.68825473 0.88501899 -0.95299958 -1.37357269
133 134 135 136 137 138
-0.66766011 2.97320532 1.03433882 2.11058872 2.53756969 1.19118179
139 140 141 142 143 144
-1.54855880 0.32359926 -0.56340735 0.21133834 2.80090816 -0.84897805
145 146 147 148 149 150
1.73970684 0.65326573 1.81738627 -2.03915841 -1.92443103 -2.10743217
151 152 153 154 155 156
0.84031951 -0.16868738 0.88743436 -2.71599925 -2.92322743 0.80604677
157 158 159 160 161 162
0.26415870 0.26177413 3.78572220 -2.87842147 -0.60753135 0.02043572
> postscript(file="/var/fisher/rcomp/tmp/606bd1351884343.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.76459695 NA
1 2.29530109 -0.76459695
2 -2.98323601 2.29530109
3 -1.86232442 -2.98323601
4 4.00707678 -1.86232442
5 3.06449294 4.00707678
6 3.37650116 3.06449294
7 -1.64486915 3.37650116
8 -0.77702553 -1.64486915
9 0.17221893 -0.77702553
10 1.98850066 0.17221893
11 3.12660022 1.98850066
12 -2.93754177 3.12660022
13 2.06817905 -2.93754177
14 1.72961353 2.06817905
15 1.11208463 1.72961353
16 0.54217047 1.11208463
17 0.99548266 0.54217047
18 -0.96515040 0.99548266
19 1.96779497 -0.96515040
20 2.36266370 1.96779497
21 -2.82269835 2.36266370
22 -0.68754185 -2.82269835
23 -2.01495470 -0.68754185
24 2.18386824 -2.01495470
25 -7.17429876 2.18386824
26 1.16447560 -7.17429876
27 0.19037667 1.16447560
28 0.78413628 0.19037667
29 -2.46181939 0.78413628
30 0.14344903 -2.46181939
31 0.82906387 0.14344903
32 1.49839395 0.82906387
33 -0.67342800 1.49839395
34 0.48020790 -0.67342800
35 0.63307625 0.48020790
36 -1.56789288 0.63307625
37 1.04342033 -1.56789288
38 1.55896356 1.04342033
39 -1.61077037 1.55896356
40 -0.11387964 -1.61077037
41 1.80073680 -0.11387964
42 1.09371596 1.80073680
43 -0.67324194 1.09371596
44 -2.96984002 -0.67324194
45 -3.48912569 -2.96984002
46 -0.96774755 -3.48912569
47 -0.21510616 -0.96774755
48 3.11194103 -0.21510616
49 -1.39460149 3.11194103
50 0.40486565 -1.39460149
51 1.14423922 0.40486565
52 -0.39263980 1.14423922
53 -1.99744822 -0.39263980
54 -1.92137929 -1.99744822
55 0.16759043 -1.92137929
56 1.42744022 0.16759043
57 -0.56670705 1.42744022
58 -2.88070492 -0.56670705
59 -1.63870736 -2.88070492
60 -2.08266085 -1.63870736
61 -1.22959250 -2.08266085
62 -3.96596212 -1.22959250
63 0.46404599 -3.96596212
64 1.21085878 0.46404599
65 -4.65568725 1.21085878
66 -1.82292292 -4.65568725
67 -1.59867884 -1.82292292
68 0.57492331 -1.59867884
69 1.78542883 0.57492331
70 0.47030107 1.78542883
71 2.81286492 0.47030107
72 0.23880340 2.81286492
73 0.04924818 0.23880340
74 -1.33706205 0.04924818
75 -0.30140109 -1.33706205
76 2.51351601 -0.30140109
77 0.28655686 2.51351601
78 1.59615425 0.28655686
79 -1.27768963 1.59615425
80 0.45295733 -1.27768963
81 2.41666770 0.45295733
82 -0.88700479 2.41666770
83 2.16481719 -0.88700479
84 0.23471272 2.16481719
85 -0.42659532 0.23471272
86 1.15626025 -0.42659532
87 -0.54062751 1.15626025
88 0.11737195 -0.54062751
89 -3.78736927 0.11737195
90 2.66759017 -3.78736927
91 0.05297919 2.66759017
92 0.26811979 0.05297919
93 0.48252216 0.26811979
94 -2.38086159 0.48252216
95 0.55371457 -2.38086159
96 -1.15128382 0.55371457
97 -1.09251816 -1.15128382
98 2.51847765 -1.09251816
99 0.20366363 2.51847765
100 1.38450480 0.20366363
101 -0.48670437 1.38450480
102 0.80678550 -0.48670437
103 -2.72336906 0.80678550
104 1.52420883 -2.72336906
105 -2.09473902 1.52420883
106 0.81616682 -2.09473902
107 2.29855034 0.81616682
108 -2.25728524 2.29855034
109 -0.09002959 -2.25728524
110 0.89368985 -0.09002959
111 -2.47356180 0.89368985
112 -2.67420407 -2.47356180
113 2.38589175 -2.67420407
114 3.27179085 2.38589175
115 1.00169312 3.27179085
116 0.37200709 1.00169312
117 -0.38400466 0.37200709
118 -1.68515048 -0.38400466
119 -0.17063820 -1.68515048
120 -1.06723343 -0.17063820
121 0.24993061 -1.06723343
122 -0.78458307 0.24993061
123 -1.39575272 -0.78458307
124 0.22498750 -1.39575272
125 -2.00041715 0.22498750
126 1.24447322 -2.00041715
127 1.24680119 1.24447322
128 3.68825473 1.24680119
129 0.88501899 3.68825473
130 -0.95299958 0.88501899
131 -1.37357269 -0.95299958
132 -0.66766011 -1.37357269
133 2.97320532 -0.66766011
134 1.03433882 2.97320532
135 2.11058872 1.03433882
136 2.53756969 2.11058872
137 1.19118179 2.53756969
138 -1.54855880 1.19118179
139 0.32359926 -1.54855880
140 -0.56340735 0.32359926
141 0.21133834 -0.56340735
142 2.80090816 0.21133834
143 -0.84897805 2.80090816
144 1.73970684 -0.84897805
145 0.65326573 1.73970684
146 1.81738627 0.65326573
147 -2.03915841 1.81738627
148 -1.92443103 -2.03915841
149 -2.10743217 -1.92443103
150 0.84031951 -2.10743217
151 -0.16868738 0.84031951
152 0.88743436 -0.16868738
153 -2.71599925 0.88743436
154 -2.92322743 -2.71599925
155 0.80604677 -2.92322743
156 0.26415870 0.80604677
157 0.26177413 0.26415870
158 3.78572220 0.26177413
159 -2.87842147 3.78572220
160 -0.60753135 -2.87842147
161 0.02043572 -0.60753135
162 NA 0.02043572
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.29530109 -0.76459695
[2,] -2.98323601 2.29530109
[3,] -1.86232442 -2.98323601
[4,] 4.00707678 -1.86232442
[5,] 3.06449294 4.00707678
[6,] 3.37650116 3.06449294
[7,] -1.64486915 3.37650116
[8,] -0.77702553 -1.64486915
[9,] 0.17221893 -0.77702553
[10,] 1.98850066 0.17221893
[11,] 3.12660022 1.98850066
[12,] -2.93754177 3.12660022
[13,] 2.06817905 -2.93754177
[14,] 1.72961353 2.06817905
[15,] 1.11208463 1.72961353
[16,] 0.54217047 1.11208463
[17,] 0.99548266 0.54217047
[18,] -0.96515040 0.99548266
[19,] 1.96779497 -0.96515040
[20,] 2.36266370 1.96779497
[21,] -2.82269835 2.36266370
[22,] -0.68754185 -2.82269835
[23,] -2.01495470 -0.68754185
[24,] 2.18386824 -2.01495470
[25,] -7.17429876 2.18386824
[26,] 1.16447560 -7.17429876
[27,] 0.19037667 1.16447560
[28,] 0.78413628 0.19037667
[29,] -2.46181939 0.78413628
[30,] 0.14344903 -2.46181939
[31,] 0.82906387 0.14344903
[32,] 1.49839395 0.82906387
[33,] -0.67342800 1.49839395
[34,] 0.48020790 -0.67342800
[35,] 0.63307625 0.48020790
[36,] -1.56789288 0.63307625
[37,] 1.04342033 -1.56789288
[38,] 1.55896356 1.04342033
[39,] -1.61077037 1.55896356
[40,] -0.11387964 -1.61077037
[41,] 1.80073680 -0.11387964
[42,] 1.09371596 1.80073680
[43,] -0.67324194 1.09371596
[44,] -2.96984002 -0.67324194
[45,] -3.48912569 -2.96984002
[46,] -0.96774755 -3.48912569
[47,] -0.21510616 -0.96774755
[48,] 3.11194103 -0.21510616
[49,] -1.39460149 3.11194103
[50,] 0.40486565 -1.39460149
[51,] 1.14423922 0.40486565
[52,] -0.39263980 1.14423922
[53,] -1.99744822 -0.39263980
[54,] -1.92137929 -1.99744822
[55,] 0.16759043 -1.92137929
[56,] 1.42744022 0.16759043
[57,] -0.56670705 1.42744022
[58,] -2.88070492 -0.56670705
[59,] -1.63870736 -2.88070492
[60,] -2.08266085 -1.63870736
[61,] -1.22959250 -2.08266085
[62,] -3.96596212 -1.22959250
[63,] 0.46404599 -3.96596212
[64,] 1.21085878 0.46404599
[65,] -4.65568725 1.21085878
[66,] -1.82292292 -4.65568725
[67,] -1.59867884 -1.82292292
[68,] 0.57492331 -1.59867884
[69,] 1.78542883 0.57492331
[70,] 0.47030107 1.78542883
[71,] 2.81286492 0.47030107
[72,] 0.23880340 2.81286492
[73,] 0.04924818 0.23880340
[74,] -1.33706205 0.04924818
[75,] -0.30140109 -1.33706205
[76,] 2.51351601 -0.30140109
[77,] 0.28655686 2.51351601
[78,] 1.59615425 0.28655686
[79,] -1.27768963 1.59615425
[80,] 0.45295733 -1.27768963
[81,] 2.41666770 0.45295733
[82,] -0.88700479 2.41666770
[83,] 2.16481719 -0.88700479
[84,] 0.23471272 2.16481719
[85,] -0.42659532 0.23471272
[86,] 1.15626025 -0.42659532
[87,] -0.54062751 1.15626025
[88,] 0.11737195 -0.54062751
[89,] -3.78736927 0.11737195
[90,] 2.66759017 -3.78736927
[91,] 0.05297919 2.66759017
[92,] 0.26811979 0.05297919
[93,] 0.48252216 0.26811979
[94,] -2.38086159 0.48252216
[95,] 0.55371457 -2.38086159
[96,] -1.15128382 0.55371457
[97,] -1.09251816 -1.15128382
[98,] 2.51847765 -1.09251816
[99,] 0.20366363 2.51847765
[100,] 1.38450480 0.20366363
[101,] -0.48670437 1.38450480
[102,] 0.80678550 -0.48670437
[103,] -2.72336906 0.80678550
[104,] 1.52420883 -2.72336906
[105,] -2.09473902 1.52420883
[106,] 0.81616682 -2.09473902
[107,] 2.29855034 0.81616682
[108,] -2.25728524 2.29855034
[109,] -0.09002959 -2.25728524
[110,] 0.89368985 -0.09002959
[111,] -2.47356180 0.89368985
[112,] -2.67420407 -2.47356180
[113,] 2.38589175 -2.67420407
[114,] 3.27179085 2.38589175
[115,] 1.00169312 3.27179085
[116,] 0.37200709 1.00169312
[117,] -0.38400466 0.37200709
[118,] -1.68515048 -0.38400466
[119,] -0.17063820 -1.68515048
[120,] -1.06723343 -0.17063820
[121,] 0.24993061 -1.06723343
[122,] -0.78458307 0.24993061
[123,] -1.39575272 -0.78458307
[124,] 0.22498750 -1.39575272
[125,] -2.00041715 0.22498750
[126,] 1.24447322 -2.00041715
[127,] 1.24680119 1.24447322
[128,] 3.68825473 1.24680119
[129,] 0.88501899 3.68825473
[130,] -0.95299958 0.88501899
[131,] -1.37357269 -0.95299958
[132,] -0.66766011 -1.37357269
[133,] 2.97320532 -0.66766011
[134,] 1.03433882 2.97320532
[135,] 2.11058872 1.03433882
[136,] 2.53756969 2.11058872
[137,] 1.19118179 2.53756969
[138,] -1.54855880 1.19118179
[139,] 0.32359926 -1.54855880
[140,] -0.56340735 0.32359926
[141,] 0.21133834 -0.56340735
[142,] 2.80090816 0.21133834
[143,] -0.84897805 2.80090816
[144,] 1.73970684 -0.84897805
[145,] 0.65326573 1.73970684
[146,] 1.81738627 0.65326573
[147,] -2.03915841 1.81738627
[148,] -1.92443103 -2.03915841
[149,] -2.10743217 -1.92443103
[150,] 0.84031951 -2.10743217
[151,] -0.16868738 0.84031951
[152,] 0.88743436 -0.16868738
[153,] -2.71599925 0.88743436
[154,] -2.92322743 -2.71599925
[155,] 0.80604677 -2.92322743
[156,] 0.26415870 0.80604677
[157,] 0.26177413 0.26415870
[158,] 3.78572220 0.26177413
[159,] -2.87842147 3.78572220
[160,] -0.60753135 -2.87842147
[161,] 0.02043572 -0.60753135
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.29530109 -0.76459695
2 -2.98323601 2.29530109
3 -1.86232442 -2.98323601
4 4.00707678 -1.86232442
5 3.06449294 4.00707678
6 3.37650116 3.06449294
7 -1.64486915 3.37650116
8 -0.77702553 -1.64486915
9 0.17221893 -0.77702553
10 1.98850066 0.17221893
11 3.12660022 1.98850066
12 -2.93754177 3.12660022
13 2.06817905 -2.93754177
14 1.72961353 2.06817905
15 1.11208463 1.72961353
16 0.54217047 1.11208463
17 0.99548266 0.54217047
18 -0.96515040 0.99548266
19 1.96779497 -0.96515040
20 2.36266370 1.96779497
21 -2.82269835 2.36266370
22 -0.68754185 -2.82269835
23 -2.01495470 -0.68754185
24 2.18386824 -2.01495470
25 -7.17429876 2.18386824
26 1.16447560 -7.17429876
27 0.19037667 1.16447560
28 0.78413628 0.19037667
29 -2.46181939 0.78413628
30 0.14344903 -2.46181939
31 0.82906387 0.14344903
32 1.49839395 0.82906387
33 -0.67342800 1.49839395
34 0.48020790 -0.67342800
35 0.63307625 0.48020790
36 -1.56789288 0.63307625
37 1.04342033 -1.56789288
38 1.55896356 1.04342033
39 -1.61077037 1.55896356
40 -0.11387964 -1.61077037
41 1.80073680 -0.11387964
42 1.09371596 1.80073680
43 -0.67324194 1.09371596
44 -2.96984002 -0.67324194
45 -3.48912569 -2.96984002
46 -0.96774755 -3.48912569
47 -0.21510616 -0.96774755
48 3.11194103 -0.21510616
49 -1.39460149 3.11194103
50 0.40486565 -1.39460149
51 1.14423922 0.40486565
52 -0.39263980 1.14423922
53 -1.99744822 -0.39263980
54 -1.92137929 -1.99744822
55 0.16759043 -1.92137929
56 1.42744022 0.16759043
57 -0.56670705 1.42744022
58 -2.88070492 -0.56670705
59 -1.63870736 -2.88070492
60 -2.08266085 -1.63870736
61 -1.22959250 -2.08266085
62 -3.96596212 -1.22959250
63 0.46404599 -3.96596212
64 1.21085878 0.46404599
65 -4.65568725 1.21085878
66 -1.82292292 -4.65568725
67 -1.59867884 -1.82292292
68 0.57492331 -1.59867884
69 1.78542883 0.57492331
70 0.47030107 1.78542883
71 2.81286492 0.47030107
72 0.23880340 2.81286492
73 0.04924818 0.23880340
74 -1.33706205 0.04924818
75 -0.30140109 -1.33706205
76 2.51351601 -0.30140109
77 0.28655686 2.51351601
78 1.59615425 0.28655686
79 -1.27768963 1.59615425
80 0.45295733 -1.27768963
81 2.41666770 0.45295733
82 -0.88700479 2.41666770
83 2.16481719 -0.88700479
84 0.23471272 2.16481719
85 -0.42659532 0.23471272
86 1.15626025 -0.42659532
87 -0.54062751 1.15626025
88 0.11737195 -0.54062751
89 -3.78736927 0.11737195
90 2.66759017 -3.78736927
91 0.05297919 2.66759017
92 0.26811979 0.05297919
93 0.48252216 0.26811979
94 -2.38086159 0.48252216
95 0.55371457 -2.38086159
96 -1.15128382 0.55371457
97 -1.09251816 -1.15128382
98 2.51847765 -1.09251816
99 0.20366363 2.51847765
100 1.38450480 0.20366363
101 -0.48670437 1.38450480
102 0.80678550 -0.48670437
103 -2.72336906 0.80678550
104 1.52420883 -2.72336906
105 -2.09473902 1.52420883
106 0.81616682 -2.09473902
107 2.29855034 0.81616682
108 -2.25728524 2.29855034
109 -0.09002959 -2.25728524
110 0.89368985 -0.09002959
111 -2.47356180 0.89368985
112 -2.67420407 -2.47356180
113 2.38589175 -2.67420407
114 3.27179085 2.38589175
115 1.00169312 3.27179085
116 0.37200709 1.00169312
117 -0.38400466 0.37200709
118 -1.68515048 -0.38400466
119 -0.17063820 -1.68515048
120 -1.06723343 -0.17063820
121 0.24993061 -1.06723343
122 -0.78458307 0.24993061
123 -1.39575272 -0.78458307
124 0.22498750 -1.39575272
125 -2.00041715 0.22498750
126 1.24447322 -2.00041715
127 1.24680119 1.24447322
128 3.68825473 1.24680119
129 0.88501899 3.68825473
130 -0.95299958 0.88501899
131 -1.37357269 -0.95299958
132 -0.66766011 -1.37357269
133 2.97320532 -0.66766011
134 1.03433882 2.97320532
135 2.11058872 1.03433882
136 2.53756969 2.11058872
137 1.19118179 2.53756969
138 -1.54855880 1.19118179
139 0.32359926 -1.54855880
140 -0.56340735 0.32359926
141 0.21133834 -0.56340735
142 2.80090816 0.21133834
143 -0.84897805 2.80090816
144 1.73970684 -0.84897805
145 0.65326573 1.73970684
146 1.81738627 0.65326573
147 -2.03915841 1.81738627
148 -1.92443103 -2.03915841
149 -2.10743217 -1.92443103
150 0.84031951 -2.10743217
151 -0.16868738 0.84031951
152 0.88743436 -0.16868738
153 -2.71599925 0.88743436
154 -2.92322743 -2.71599925
155 0.80604677 -2.92322743
156 0.26415870 0.80604677
157 0.26177413 0.26415870
158 3.78572220 0.26177413
159 -2.87842147 3.78572220
160 -0.60753135 -2.87842147
161 0.02043572 -0.60753135
> 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/7qxp11351884343.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/8jpri1351884343.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/9z5mw1351884343.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/10e8ic1351884343.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/119bq01351884343.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/12wy6y1351884343.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/13rdtc1351884343.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/14is131351884343.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/15qizk1351884343.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/16pp2t1351884343.tab")
+ }
>
> try(system("convert tmp/19eyl1351884343.ps tmp/19eyl1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/2xkqq1351884343.ps tmp/2xkqq1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/300ij1351884343.ps tmp/300ij1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/4qlbz1351884343.ps tmp/4qlbz1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zz6s1351884343.ps tmp/5zz6s1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/606bd1351884343.ps tmp/606bd1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/7qxp11351884343.ps tmp/7qxp11351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/8jpri1351884343.ps tmp/8jpri1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/9z5mw1351884343.ps tmp/9z5mw1351884343.png",intern=TRUE))
character(0)
> try(system("convert tmp/10e8ic1351884343.ps tmp/10e8ic1351884343.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.067 1.175 9.242