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(1
+ ,26
+ ,21
+ ,21
+ ,23
+ ,23
+ ,4
+ ,1
+ ,20
+ ,16
+ ,15
+ ,24
+ ,20
+ ,4
+ ,1
+ ,19
+ ,19
+ ,18
+ ,22
+ ,20
+ ,6
+ ,2
+ ,19
+ ,18
+ ,11
+ ,20
+ ,21
+ ,8
+ ,1
+ ,20
+ ,16
+ ,8
+ ,24
+ ,24
+ ,8
+ ,1
+ ,25
+ ,23
+ ,19
+ ,27
+ ,22
+ ,4
+ ,2
+ ,25
+ ,17
+ ,4
+ ,28
+ ,23
+ ,4
+ ,1
+ ,22
+ ,12
+ ,20
+ ,27
+ ,20
+ ,8
+ ,1
+ ,26
+ ,19
+ ,16
+ ,24
+ ,25
+ ,5
+ ,1
+ ,22
+ ,16
+ ,14
+ ,23
+ ,23
+ ,4
+ ,2
+ ,17
+ ,19
+ ,10
+ ,24
+ ,27
+ ,4
+ ,2
+ ,22
+ ,20
+ ,13
+ ,27
+ ,27
+ ,4
+ ,1
+ ,19
+ ,13
+ ,14
+ ,27
+ ,22
+ ,4
+ ,1
+ ,24
+ ,20
+ ,8
+ ,28
+ ,24
+ ,4
+ ,1
+ ,26
+ ,27
+ ,23
+ ,27
+ ,25
+ ,4
+ ,2
+ ,21
+ ,17
+ ,11
+ ,23
+ ,22
+ ,8
+ ,1
+ ,13
+ ,8
+ ,9
+ ,24
+ ,28
+ ,4
+ ,2
+ ,26
+ ,25
+ ,24
+ ,28
+ ,28
+ ,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162))
> y <- array(NA,dim=c(7,162),dimnames=list(c('G','I1','I2','I3','E1','E3','A'),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 = '7'
> 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
A G I1 I2 I3 E1 E3 t
1 4 1 26 21 21 23 23 1
2 4 1 20 16 15 24 20 2
3 6 1 19 19 18 22 20 3
4 8 2 19 18 11 20 21 4
5 8 1 20 16 8 24 24 5
6 4 1 25 23 19 27 22 6
7 4 2 25 17 4 28 23 7
8 8 1 22 12 20 27 20 8
9 5 1 26 19 16 24 25 9
10 4 1 22 16 14 23 23 10
11 4 2 17 19 10 24 27 11
12 4 2 22 20 13 27 27 12
13 4 1 19 13 14 27 22 13
14 4 1 24 20 8 28 24 14
15 4 1 26 27 23 27 25 15
16 8 2 21 17 11 23 22 16
17 4 1 13 8 9 24 28 17
18 4 2 26 25 24 28 28 18
19 4 2 20 26 5 27 27 19
20 8 1 22 13 15 25 25 20
21 4 2 14 19 5 19 16 21
22 7 1 21 15 19 24 28 22
23 4 1 7 5 6 20 21 23
24 4 2 23 16 13 28 24 24
25 5 1 17 14 11 26 27 25
26 4 1 25 24 17 23 14 26
27 4 1 25 24 17 23 14 27
28 4 1 19 9 5 20 27 28
29 4 2 20 19 9 11 20 29
30 4 1 23 19 15 24 21 30
31 4 2 22 25 17 25 22 31
32 4 1 22 19 17 23 21 32
33 15 1 21 18 20 18 12 33
34 10 2 15 15 12 20 20 34
35 4 2 20 12 7 20 24 35
36 8 2 22 21 16 24 19 36
37 4 1 18 12 7 23 28 37
38 4 2 20 15 14 25 23 38
39 4 2 28 28 24 28 27 39
40 4 1 22 25 15 26 22 40
41 7 1 18 19 15 26 27 41
42 4 1 23 20 10 23 26 42
43 6 1 20 24 14 22 22 43
44 5 2 25 26 18 24 21 44
45 4 2 26 25 12 21 19 45
46 16 1 15 12 9 20 24 46
47 5 2 17 12 9 22 19 47
48 12 2 23 15 8 20 26 48
49 6 1 21 17 18 25 22 49
50 9 2 13 14 10 20 28 50
51 9 1 18 16 17 22 21 51
52 4 1 19 11 14 23 23 52
53 5 1 22 20 16 25 28 53
54 4 1 16 11 10 23 10 54
55 4 2 24 22 19 23 24 55
56 5 1 18 20 10 22 21 56
57 4 1 20 19 14 24 21 57
58 4 1 24 17 10 25 24 58
59 4 2 14 21 4 21 24 59
60 5 2 22 23 19 12 25 60
61 4 1 24 18 9 17 25 61
62 6 1 18 17 12 20 23 62
63 4 1 21 27 16 23 21 63
64 4 2 23 25 11 23 16 64
65 18 1 17 19 18 20 17 65
66 4 2 22 22 11 28 25 66
67 6 2 24 24 24 24 24 67
68 4 2 21 20 17 24 23 68
69 4 1 22 19 18 24 25 69
70 5 1 16 11 9 24 23 70
71 4 1 21 22 19 28 28 71
72 4 2 23 22 18 25 26 72
73 5 2 22 16 12 21 22 73
74 10 1 24 20 23 25 19 74
75 5 1 24 24 22 25 26 75
76 8 1 16 16 14 18 18 76
77 8 1 16 16 14 17 18 77
78 5 2 21 22 16 26 25 78
79 4 2 26 24 23 28 27 79
80 4 2 15 16 7 21 12 80
81 4 2 25 27 10 27 15 81
82 5 1 18 11 12 22 21 82
83 4 0 23 21 12 21 23 83
84 4 1 20 20 12 25 22 84
85 8 2 17 20 17 22 21 85
86 4 2 25 27 21 23 24 86
87 5 1 24 20 16 26 27 87
88 14 1 17 12 11 19 22 88
89 8 1 19 8 14 25 8 89
90 8 1 20 21 13 21 26 90
91 4 1 15 18 9 13 10 91
92 4 2 27 24 19 24 19 92
93 6 1 22 16 13 25 22 93
94 4 1 23 18 19 26 21 94
95 7 1 16 20 13 25 24 95
96 7 1 19 20 13 25 25 96
97 4 2 25 19 13 22 21 97
98 6 1 19 17 14 21 20 98
99 4 2 19 16 12 23 21 99
100 7 2 26 26 22 25 24 100
101 4 1 21 15 11 24 23 101
102 4 2 20 22 5 21 18 102
103 8 1 24 17 18 21 24 103
104 4 1 22 23 19 25 24 104
105 4 2 20 21 14 22 19 105
106 10 1 18 19 15 20 20 106
107 8 2 18 14 12 20 18 107
108 6 1 24 17 19 23 20 108
109 4 1 24 12 15 28 27 109
110 4 1 22 24 17 23 23 110
111 4 1 23 18 8 28 26 111
112 5 1 22 20 10 24 23 112
113 4 1 20 16 12 18 17 113
114 6 1 18 20 12 20 21 114
115 4 1 25 22 20 28 25 115
116 5 2 18 12 12 21 23 116
117 7 1 16 16 12 21 27 117
118 8 1 20 17 14 25 24 118
119 5 2 19 22 6 19 20 119
120 8 1 15 12 10 18 27 120
121 10 1 19 14 18 21 21 121
122 8 1 19 23 18 22 24 122
123 5 1 16 15 7 24 21 123
124 12 1 17 17 18 15 15 124
125 4 1 28 28 9 28 25 125
126 5 2 23 20 17 26 25 126
127 4 1 25 23 22 23 22 127
128 6 1 20 13 11 26 24 128
129 4 2 17 18 15 20 21 129
130 4 2 23 23 17 22 22 130
131 7 1 16 19 15 20 23 131
132 7 2 23 23 22 23 22 132
133 10 2 11 12 9 22 20 133
134 4 2 18 16 13 24 23 134
135 5 2 24 23 20 23 25 135
136 8 1 23 13 14 22 23 136
137 11 1 21 22 14 26 22 137
138 7 2 16 18 12 23 25 138
139 4 2 24 23 20 27 26 139
140 8 1 23 20 20 23 22 140
141 6 1 18 10 8 21 24 141
142 7 1 20 17 17 26 24 142
143 5 1 9 18 9 23 25 143
144 4 2 24 15 18 21 20 144
145 8 1 25 23 22 27 26 145
146 4 1 20 17 10 19 21 146
147 8 2 21 17 13 23 26 147
148 6 2 25 22 15 25 21 148
149 4 2 22 20 18 23 22 149
150 9 2 21 20 18 22 16 150
151 5 1 21 19 12 22 26 151
152 6 1 22 18 12 25 28 152
153 4 1 27 22 20 25 18 153
154 4 2 24 20 12 28 25 154
155 4 2 24 22 16 28 23 155
156 5 2 21 18 16 20 21 156
157 6 1 18 16 18 25 20 157
158 16 1 16 16 16 19 25 158
159 6 1 22 16 13 25 22 159
160 6 1 20 16 17 22 21 160
161 4 2 18 17 13 18 16 161
162 4 1 20 18 17 20 18 162
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) G I1 I2 I3 E1
13.102181 -0.461749 -0.203536 -0.088062 0.195213 -0.169902
E3 t
0.003692 0.002781
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.6901 -1.4763 -0.5413 1.0292 10.1335
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.102181 1.713640 7.646 2.09e-12 ***
G -0.461749 0.389202 -1.186 0.237292
I1 -0.203536 0.073062 -2.786 0.006011 **
I2 -0.088062 0.055151 -1.597 0.112374
I3 0.195213 0.049420 3.950 0.000119 ***
E1 -0.169902 0.070721 -2.402 0.017477 *
E3 0.003692 0.053155 0.069 0.944710
t 0.002781 0.004027 0.691 0.490909
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.357 on 154 degrees of freedom
Multiple R-squared: 0.2295, Adjusted R-squared: 0.1945
F-statistic: 6.553 on 7 and 154 DF, p-value: 8.904e-07
> 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.675003217 0.649993566 0.324996783
[2,] 0.517746121 0.964507758 0.482253879
[3,] 0.430071942 0.860143885 0.569928058
[4,] 0.326198774 0.652397548 0.673801226
[5,] 0.262287098 0.524574195 0.737712902
[6,] 0.204044416 0.408088831 0.795955584
[7,] 0.148841991 0.297683982 0.851158009
[8,] 0.096834944 0.193669888 0.903165056
[9,] 0.060960740 0.121921480 0.939039260
[10,] 0.056075949 0.112151898 0.943924051
[11,] 0.114083984 0.228167968 0.885916016
[12,] 0.083054731 0.166109462 0.916945269
[13,] 0.083148328 0.166296657 0.916851672
[14,] 0.068399297 0.136798593 0.931600703
[15,] 0.047944268 0.095888537 0.952055732
[16,] 0.032697135 0.065394271 0.967302865
[17,] 0.021083038 0.042166077 0.978916962
[18,] 0.023873987 0.047747974 0.976126013
[19,] 0.019958093 0.039916186 0.980041907
[20,] 0.012880419 0.025760837 0.987119581
[21,] 0.008065033 0.016130066 0.991934967
[22,] 0.005233755 0.010467510 0.994766245
[23,] 0.407968218 0.815936436 0.592031782
[24,] 0.459348363 0.918696727 0.540651637
[25,] 0.441838465 0.883676929 0.558161535
[26,] 0.421336887 0.842673775 0.578663113
[27,] 0.374120832 0.748241664 0.625879168
[28,] 0.370876753 0.741753507 0.629123247
[29,] 0.317811821 0.635623642 0.682188179
[30,] 0.269771953 0.539543906 0.730228047
[31,] 0.283413330 0.566826660 0.716586670
[32,] 0.239264047 0.478528094 0.760735953
[33,] 0.206914579 0.413829158 0.793085421
[34,] 0.171507020 0.343014040 0.828492980
[35,] 0.144201115 0.288402229 0.855798885
[36,] 0.800637034 0.398725932 0.199362966
[37,] 0.787231334 0.425537332 0.212768666
[38,] 0.950061655 0.099876690 0.049938345
[39,] 0.937790142 0.124419716 0.062209858
[40,] 0.930511862 0.138976276 0.069488138
[41,] 0.917373914 0.165252173 0.082626086
[42,] 0.935245745 0.129508511 0.064754255
[43,] 0.919523174 0.160953652 0.080476826
[44,] 0.927914096 0.144171808 0.072085904
[45,] 0.923863578 0.152272843 0.076136422
[46,] 0.906192803 0.187614394 0.093807197
[47,] 0.896783982 0.206432036 0.103216018
[48,] 0.874299962 0.251400076 0.125700038
[49,] 0.851567264 0.296865472 0.148432736
[50,] 0.864967865 0.270064270 0.135032135
[51,] 0.845326739 0.309346521 0.154673261
[52,] 0.816260789 0.367478422 0.183739211
[53,] 0.792890376 0.414219248 0.207109624
[54,] 0.758497518 0.483004963 0.241502482
[55,] 0.996369383 0.007261233 0.003630617
[56,] 0.994966190 0.010067619 0.005033810
[57,] 0.993126753 0.013746493 0.006873247
[58,] 0.992090659 0.015818682 0.007909341
[59,] 0.991635682 0.016728635 0.008364318
[60,] 0.989794443 0.020411115 0.010205557
[61,] 0.988449569 0.023100862 0.011550431
[62,] 0.985486873 0.029026254 0.014513127
[63,] 0.980872800 0.038254400 0.019127200
[64,] 0.986097375 0.027805250 0.013902625
[65,] 0.982333578 0.035332845 0.017666422
[66,] 0.976592645 0.046814710 0.023407355
[67,] 0.969381919 0.061236162 0.030618081
[68,] 0.960305961 0.079388079 0.039694039
[69,] 0.951287945 0.097424110 0.048712055
[70,] 0.947077217 0.105845566 0.052922783
[71,] 0.944012969 0.111974062 0.055987031
[72,] 0.940824573 0.118350853 0.059175427
[73,] 0.932964607 0.134070786 0.067035393
[74,] 0.921474289 0.157051423 0.078525711
[75,] 0.906980209 0.186039581 0.093019791
[76,] 0.891423946 0.217152109 0.108576054
[77,] 0.870849008 0.258301984 0.129150992
[78,] 0.973558610 0.052882781 0.026441390
[79,] 0.973915305 0.052169390 0.026084695
[80,] 0.970497012 0.059005976 0.029502988
[81,] 0.977471024 0.045057953 0.022528976
[82,] 0.970836675 0.058326650 0.029163325
[83,] 0.963022582 0.073954836 0.036977418
[84,] 0.959347076 0.081305848 0.040652924
[85,] 0.948880165 0.102239670 0.051119835
[86,] 0.938727051 0.122545897 0.061272949
[87,] 0.923661642 0.152676717 0.076338358
[88,] 0.906190700 0.187618599 0.093809300
[89,] 0.893016503 0.213966994 0.106983497
[90,] 0.887564958 0.224870084 0.112435042
[91,] 0.872336594 0.255326812 0.127663406
[92,] 0.846439678 0.307120644 0.153560322
[93,] 0.828247500 0.343505000 0.171752500
[94,] 0.823483014 0.353033972 0.176516986
[95,] 0.801192224 0.397615552 0.198807776
[96,] 0.815272298 0.369455403 0.184727702
[97,] 0.811092394 0.377815213 0.188907606
[98,] 0.775374461 0.449251079 0.224625539
[99,] 0.749870557 0.500258887 0.250129443
[100,] 0.738714560 0.522570879 0.261285440
[101,] 0.696843554 0.606312893 0.303156446
[102,] 0.650631237 0.698737525 0.349368763
[103,] 0.654586458 0.690827084 0.345413542
[104,] 0.611002818 0.777994364 0.388997182
[105,] 0.598579029 0.802841942 0.401420971
[106,] 0.567064462 0.865871077 0.432935538
[107,] 0.526029388 0.947941225 0.473970612
[108,] 0.490679650 0.981359301 0.509320350
[109,] 0.441635932 0.883271863 0.558364068
[110,] 0.392241719 0.784483437 0.607758281
[111,] 0.364336648 0.728673295 0.635663352
[112,] 0.316403328 0.632806657 0.683596672
[113,] 0.280241870 0.560483740 0.719758130
[114,] 0.356210285 0.712420570 0.643789715
[115,] 0.331171922 0.662343844 0.668828078
[116,] 0.280819745 0.561639490 0.719180255
[117,] 0.275438145 0.550876290 0.724561855
[118,] 0.230277794 0.460555589 0.769722206
[119,] 0.239743733 0.479487466 0.760256267
[120,] 0.208167042 0.416334084 0.791832958
[121,] 0.180350011 0.360700023 0.819649989
[122,] 0.142288021 0.284576042 0.857711979
[123,] 0.170308839 0.340617678 0.829691161
[124,] 0.149783878 0.299567755 0.850216122
[125,] 0.137143063 0.274286126 0.862856937
[126,] 0.113199186 0.226398371 0.886800814
[127,] 0.366333730 0.732667460 0.633666270
[128,] 0.307297251 0.614594503 0.692702749
[129,] 0.326885756 0.653771511 0.673114244
[130,] 0.269360224 0.538720448 0.730639776
[131,] 0.223384262 0.446768524 0.776615738
[132,] 0.171744145 0.343488290 0.828255855
[133,] 0.245831642 0.491663284 0.754168358
[134,] 0.190967509 0.381935018 0.809032491
[135,] 0.144299140 0.288598281 0.855700860
[136,] 0.119513052 0.239026104 0.880486948
[137,] 0.079905090 0.159810179 0.920094910
[138,] 0.067666960 0.135333921 0.932333040
[139,] 0.107113671 0.214227342 0.892886329
[140,] 0.171951866 0.343903732 0.828048134
[141,] 0.139998193 0.279996386 0.860001807
> postscript(file="/var/wessaorg/rcomp/tmp/1smt71353254418.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/wessaorg/rcomp/tmp/2nr4u1353254418.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/wessaorg/rcomp/tmp/3rrle1353254418.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/wessaorg/rcomp/tmp/4wlf41353254418.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/wessaorg/rcomp/tmp/5734k1353254418.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
-1.77863926 -2.09068389 -0.95825899 2.43564312 3.25269751 -0.74622653
7 8 9 10 11 12
2.27877935 1.48109572 0.16157517 -1.69162461 -1.05016312 -0.02313694
13 14 15 16 17 18
-1.89145777 1.07367020 -1.00740019 3.22729823 -3.11989851 -0.76650575
19 20 21 22 23 24
1.64040463 2.15358894 -1.52140586 0.15878304 -4.69010476 -0.02423819
25 26 27 28 29 30
-0.84656008 -0.97342257 -0.97620329 -1.73627448 -2.47727907 -1.29744401
31 32 33 34 35 36
-0.73785703 -2.06686996 7.23683193 3.08237234 -1.20561909 2.93237991
37 38 39 40 41 42
-1.58506301 -1.46306483 -0.14995164 -0.66430323 0.97194026 -0.45504849
43 44 45 46 47 48
0.34782562 0.56323908 0.34488978 8.89393972 -0.88175469 7.43042597
49 50 51 52 53 54
-0.35290279 1.90363516 1.63206586 -2.85933136 -0.52803207 -2.64664540
55 56 57 58 59 60
-1.39932485 -0.66309702 -1.78791707 -0.21300083 -0.94547077 -2.60485535
61 62 63 64 65 66
-1.30097849 -0.68158304 -1.45689947 0.22754425 10.13353749 0.57054145
67 68 69 70 71 72
-0.06273396 -1.65818361 -2.20983730 -1.37402241 -1.68142994 -1.12249966
73 74 75 76 77 78
-0.35074721 3.48738230 -0.99378421 0.07258446 -0.10009856 0.01776606
79 80 81 82 83 84
-0.82528613 -1.78197116 1.64198181 -1.91837959 -1.66189888 -1.21829820
85 86 87 88 89 90
1.14798184 -1.23210877 -0.04191079 6.63127641 1.16878652 1.96348736
91 92 93 94 95 96
-3.84044404 -0.52711679 0.61628558 -2.00452087 0.73437333 1.33850704
97 98 99 100 101 102
-0.56431068 -0.78760065 -1.69015589 1.98902608 -1.48072579 0.07117467
103 104 105 106 107 108
1.42055102 -1.97653364 -1.61593923 2.79762617 1.40930919 -0.43399178
109 110 111 112 113 114
-1.27256407 -1.85084167 0.41689580 0.32774468 -2.82204090 -0.55461019
115 116 117 118 119 120
-1.17377551 -1.64040077 -0.17452322 2.02516010 0.27796410 0.14207112
121 122 123 124 125 126
2.09971140 1.04831294 -0.77134177 2.95122430 2.08474183 -0.07997458
127 128 129 130 131 132
-2.34794318 0.40064744 -3.09987179 -1.49544376 -0.69004030 0.69283057
133 134 135 136 137 138
2.65419702 -2.02371262 -0.73262655 1.72745179 5.79345853 0.75214332
139 140 141 142 143 144
-1.06783267 1.33507709 -0.57063044 0.54268511 -2.56261823 -2.39306434
145 146 147 148 149 150
2.26684340 -2.28018354 2.45782725 1.67733838 -2.04130985 2.60462585
151 152 153 154 155 156
-0.81360941 0.80140567 -1.35623196 0.36157185 -0.23855350 -1.55602220
157 158 159 160 161 162
-1.34450492 7.59819408 0.43275780 -1.26396183 -3.00429729 -3.42212689
> postscript(file="/var/wessaorg/rcomp/tmp/67wvn1353254418.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 -1.77863926 NA
1 -2.09068389 -1.77863926
2 -0.95825899 -2.09068389
3 2.43564312 -0.95825899
4 3.25269751 2.43564312
5 -0.74622653 3.25269751
6 2.27877935 -0.74622653
7 1.48109572 2.27877935
8 0.16157517 1.48109572
9 -1.69162461 0.16157517
10 -1.05016312 -1.69162461
11 -0.02313694 -1.05016312
12 -1.89145777 -0.02313694
13 1.07367020 -1.89145777
14 -1.00740019 1.07367020
15 3.22729823 -1.00740019
16 -3.11989851 3.22729823
17 -0.76650575 -3.11989851
18 1.64040463 -0.76650575
19 2.15358894 1.64040463
20 -1.52140586 2.15358894
21 0.15878304 -1.52140586
22 -4.69010476 0.15878304
23 -0.02423819 -4.69010476
24 -0.84656008 -0.02423819
25 -0.97342257 -0.84656008
26 -0.97620329 -0.97342257
27 -1.73627448 -0.97620329
28 -2.47727907 -1.73627448
29 -1.29744401 -2.47727907
30 -0.73785703 -1.29744401
31 -2.06686996 -0.73785703
32 7.23683193 -2.06686996
33 3.08237234 7.23683193
34 -1.20561909 3.08237234
35 2.93237991 -1.20561909
36 -1.58506301 2.93237991
37 -1.46306483 -1.58506301
38 -0.14995164 -1.46306483
39 -0.66430323 -0.14995164
40 0.97194026 -0.66430323
41 -0.45504849 0.97194026
42 0.34782562 -0.45504849
43 0.56323908 0.34782562
44 0.34488978 0.56323908
45 8.89393972 0.34488978
46 -0.88175469 8.89393972
47 7.43042597 -0.88175469
48 -0.35290279 7.43042597
49 1.90363516 -0.35290279
50 1.63206586 1.90363516
51 -2.85933136 1.63206586
52 -0.52803207 -2.85933136
53 -2.64664540 -0.52803207
54 -1.39932485 -2.64664540
55 -0.66309702 -1.39932485
56 -1.78791707 -0.66309702
57 -0.21300083 -1.78791707
58 -0.94547077 -0.21300083
59 -2.60485535 -0.94547077
60 -1.30097849 -2.60485535
61 -0.68158304 -1.30097849
62 -1.45689947 -0.68158304
63 0.22754425 -1.45689947
64 10.13353749 0.22754425
65 0.57054145 10.13353749
66 -0.06273396 0.57054145
67 -1.65818361 -0.06273396
68 -2.20983730 -1.65818361
69 -1.37402241 -2.20983730
70 -1.68142994 -1.37402241
71 -1.12249966 -1.68142994
72 -0.35074721 -1.12249966
73 3.48738230 -0.35074721
74 -0.99378421 3.48738230
75 0.07258446 -0.99378421
76 -0.10009856 0.07258446
77 0.01776606 -0.10009856
78 -0.82528613 0.01776606
79 -1.78197116 -0.82528613
80 1.64198181 -1.78197116
81 -1.91837959 1.64198181
82 -1.66189888 -1.91837959
83 -1.21829820 -1.66189888
84 1.14798184 -1.21829820
85 -1.23210877 1.14798184
86 -0.04191079 -1.23210877
87 6.63127641 -0.04191079
88 1.16878652 6.63127641
89 1.96348736 1.16878652
90 -3.84044404 1.96348736
91 -0.52711679 -3.84044404
92 0.61628558 -0.52711679
93 -2.00452087 0.61628558
94 0.73437333 -2.00452087
95 1.33850704 0.73437333
96 -0.56431068 1.33850704
97 -0.78760065 -0.56431068
98 -1.69015589 -0.78760065
99 1.98902608 -1.69015589
100 -1.48072579 1.98902608
101 0.07117467 -1.48072579
102 1.42055102 0.07117467
103 -1.97653364 1.42055102
104 -1.61593923 -1.97653364
105 2.79762617 -1.61593923
106 1.40930919 2.79762617
107 -0.43399178 1.40930919
108 -1.27256407 -0.43399178
109 -1.85084167 -1.27256407
110 0.41689580 -1.85084167
111 0.32774468 0.41689580
112 -2.82204090 0.32774468
113 -0.55461019 -2.82204090
114 -1.17377551 -0.55461019
115 -1.64040077 -1.17377551
116 -0.17452322 -1.64040077
117 2.02516010 -0.17452322
118 0.27796410 2.02516010
119 0.14207112 0.27796410
120 2.09971140 0.14207112
121 1.04831294 2.09971140
122 -0.77134177 1.04831294
123 2.95122430 -0.77134177
124 2.08474183 2.95122430
125 -0.07997458 2.08474183
126 -2.34794318 -0.07997458
127 0.40064744 -2.34794318
128 -3.09987179 0.40064744
129 -1.49544376 -3.09987179
130 -0.69004030 -1.49544376
131 0.69283057 -0.69004030
132 2.65419702 0.69283057
133 -2.02371262 2.65419702
134 -0.73262655 -2.02371262
135 1.72745179 -0.73262655
136 5.79345853 1.72745179
137 0.75214332 5.79345853
138 -1.06783267 0.75214332
139 1.33507709 -1.06783267
140 -0.57063044 1.33507709
141 0.54268511 -0.57063044
142 -2.56261823 0.54268511
143 -2.39306434 -2.56261823
144 2.26684340 -2.39306434
145 -2.28018354 2.26684340
146 2.45782725 -2.28018354
147 1.67733838 2.45782725
148 -2.04130985 1.67733838
149 2.60462585 -2.04130985
150 -0.81360941 2.60462585
151 0.80140567 -0.81360941
152 -1.35623196 0.80140567
153 0.36157185 -1.35623196
154 -0.23855350 0.36157185
155 -1.55602220 -0.23855350
156 -1.34450492 -1.55602220
157 7.59819408 -1.34450492
158 0.43275780 7.59819408
159 -1.26396183 0.43275780
160 -3.00429729 -1.26396183
161 -3.42212689 -3.00429729
162 NA -3.42212689
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.09068389 -1.77863926
[2,] -0.95825899 -2.09068389
[3,] 2.43564312 -0.95825899
[4,] 3.25269751 2.43564312
[5,] -0.74622653 3.25269751
[6,] 2.27877935 -0.74622653
[7,] 1.48109572 2.27877935
[8,] 0.16157517 1.48109572
[9,] -1.69162461 0.16157517
[10,] -1.05016312 -1.69162461
[11,] -0.02313694 -1.05016312
[12,] -1.89145777 -0.02313694
[13,] 1.07367020 -1.89145777
[14,] -1.00740019 1.07367020
[15,] 3.22729823 -1.00740019
[16,] -3.11989851 3.22729823
[17,] -0.76650575 -3.11989851
[18,] 1.64040463 -0.76650575
[19,] 2.15358894 1.64040463
[20,] -1.52140586 2.15358894
[21,] 0.15878304 -1.52140586
[22,] -4.69010476 0.15878304
[23,] -0.02423819 -4.69010476
[24,] -0.84656008 -0.02423819
[25,] -0.97342257 -0.84656008
[26,] -0.97620329 -0.97342257
[27,] -1.73627448 -0.97620329
[28,] -2.47727907 -1.73627448
[29,] -1.29744401 -2.47727907
[30,] -0.73785703 -1.29744401
[31,] -2.06686996 -0.73785703
[32,] 7.23683193 -2.06686996
[33,] 3.08237234 7.23683193
[34,] -1.20561909 3.08237234
[35,] 2.93237991 -1.20561909
[36,] -1.58506301 2.93237991
[37,] -1.46306483 -1.58506301
[38,] -0.14995164 -1.46306483
[39,] -0.66430323 -0.14995164
[40,] 0.97194026 -0.66430323
[41,] -0.45504849 0.97194026
[42,] 0.34782562 -0.45504849
[43,] 0.56323908 0.34782562
[44,] 0.34488978 0.56323908
[45,] 8.89393972 0.34488978
[46,] -0.88175469 8.89393972
[47,] 7.43042597 -0.88175469
[48,] -0.35290279 7.43042597
[49,] 1.90363516 -0.35290279
[50,] 1.63206586 1.90363516
[51,] -2.85933136 1.63206586
[52,] -0.52803207 -2.85933136
[53,] -2.64664540 -0.52803207
[54,] -1.39932485 -2.64664540
[55,] -0.66309702 -1.39932485
[56,] -1.78791707 -0.66309702
[57,] -0.21300083 -1.78791707
[58,] -0.94547077 -0.21300083
[59,] -2.60485535 -0.94547077
[60,] -1.30097849 -2.60485535
[61,] -0.68158304 -1.30097849
[62,] -1.45689947 -0.68158304
[63,] 0.22754425 -1.45689947
[64,] 10.13353749 0.22754425
[65,] 0.57054145 10.13353749
[66,] -0.06273396 0.57054145
[67,] -1.65818361 -0.06273396
[68,] -2.20983730 -1.65818361
[69,] -1.37402241 -2.20983730
[70,] -1.68142994 -1.37402241
[71,] -1.12249966 -1.68142994
[72,] -0.35074721 -1.12249966
[73,] 3.48738230 -0.35074721
[74,] -0.99378421 3.48738230
[75,] 0.07258446 -0.99378421
[76,] -0.10009856 0.07258446
[77,] 0.01776606 -0.10009856
[78,] -0.82528613 0.01776606
[79,] -1.78197116 -0.82528613
[80,] 1.64198181 -1.78197116
[81,] -1.91837959 1.64198181
[82,] -1.66189888 -1.91837959
[83,] -1.21829820 -1.66189888
[84,] 1.14798184 -1.21829820
[85,] -1.23210877 1.14798184
[86,] -0.04191079 -1.23210877
[87,] 6.63127641 -0.04191079
[88,] 1.16878652 6.63127641
[89,] 1.96348736 1.16878652
[90,] -3.84044404 1.96348736
[91,] -0.52711679 -3.84044404
[92,] 0.61628558 -0.52711679
[93,] -2.00452087 0.61628558
[94,] 0.73437333 -2.00452087
[95,] 1.33850704 0.73437333
[96,] -0.56431068 1.33850704
[97,] -0.78760065 -0.56431068
[98,] -1.69015589 -0.78760065
[99,] 1.98902608 -1.69015589
[100,] -1.48072579 1.98902608
[101,] 0.07117467 -1.48072579
[102,] 1.42055102 0.07117467
[103,] -1.97653364 1.42055102
[104,] -1.61593923 -1.97653364
[105,] 2.79762617 -1.61593923
[106,] 1.40930919 2.79762617
[107,] -0.43399178 1.40930919
[108,] -1.27256407 -0.43399178
[109,] -1.85084167 -1.27256407
[110,] 0.41689580 -1.85084167
[111,] 0.32774468 0.41689580
[112,] -2.82204090 0.32774468
[113,] -0.55461019 -2.82204090
[114,] -1.17377551 -0.55461019
[115,] -1.64040077 -1.17377551
[116,] -0.17452322 -1.64040077
[117,] 2.02516010 -0.17452322
[118,] 0.27796410 2.02516010
[119,] 0.14207112 0.27796410
[120,] 2.09971140 0.14207112
[121,] 1.04831294 2.09971140
[122,] -0.77134177 1.04831294
[123,] 2.95122430 -0.77134177
[124,] 2.08474183 2.95122430
[125,] -0.07997458 2.08474183
[126,] -2.34794318 -0.07997458
[127,] 0.40064744 -2.34794318
[128,] -3.09987179 0.40064744
[129,] -1.49544376 -3.09987179
[130,] -0.69004030 -1.49544376
[131,] 0.69283057 -0.69004030
[132,] 2.65419702 0.69283057
[133,] -2.02371262 2.65419702
[134,] -0.73262655 -2.02371262
[135,] 1.72745179 -0.73262655
[136,] 5.79345853 1.72745179
[137,] 0.75214332 5.79345853
[138,] -1.06783267 0.75214332
[139,] 1.33507709 -1.06783267
[140,] -0.57063044 1.33507709
[141,] 0.54268511 -0.57063044
[142,] -2.56261823 0.54268511
[143,] -2.39306434 -2.56261823
[144,] 2.26684340 -2.39306434
[145,] -2.28018354 2.26684340
[146,] 2.45782725 -2.28018354
[147,] 1.67733838 2.45782725
[148,] -2.04130985 1.67733838
[149,] 2.60462585 -2.04130985
[150,] -0.81360941 2.60462585
[151,] 0.80140567 -0.81360941
[152,] -1.35623196 0.80140567
[153,] 0.36157185 -1.35623196
[154,] -0.23855350 0.36157185
[155,] -1.55602220 -0.23855350
[156,] -1.34450492 -1.55602220
[157,] 7.59819408 -1.34450492
[158,] 0.43275780 7.59819408
[159,] -1.26396183 0.43275780
[160,] -3.00429729 -1.26396183
[161,] -3.42212689 -3.00429729
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.09068389 -1.77863926
2 -0.95825899 -2.09068389
3 2.43564312 -0.95825899
4 3.25269751 2.43564312
5 -0.74622653 3.25269751
6 2.27877935 -0.74622653
7 1.48109572 2.27877935
8 0.16157517 1.48109572
9 -1.69162461 0.16157517
10 -1.05016312 -1.69162461
11 -0.02313694 -1.05016312
12 -1.89145777 -0.02313694
13 1.07367020 -1.89145777
14 -1.00740019 1.07367020
15 3.22729823 -1.00740019
16 -3.11989851 3.22729823
17 -0.76650575 -3.11989851
18 1.64040463 -0.76650575
19 2.15358894 1.64040463
20 -1.52140586 2.15358894
21 0.15878304 -1.52140586
22 -4.69010476 0.15878304
23 -0.02423819 -4.69010476
24 -0.84656008 -0.02423819
25 -0.97342257 -0.84656008
26 -0.97620329 -0.97342257
27 -1.73627448 -0.97620329
28 -2.47727907 -1.73627448
29 -1.29744401 -2.47727907
30 -0.73785703 -1.29744401
31 -2.06686996 -0.73785703
32 7.23683193 -2.06686996
33 3.08237234 7.23683193
34 -1.20561909 3.08237234
35 2.93237991 -1.20561909
36 -1.58506301 2.93237991
37 -1.46306483 -1.58506301
38 -0.14995164 -1.46306483
39 -0.66430323 -0.14995164
40 0.97194026 -0.66430323
41 -0.45504849 0.97194026
42 0.34782562 -0.45504849
43 0.56323908 0.34782562
44 0.34488978 0.56323908
45 8.89393972 0.34488978
46 -0.88175469 8.89393972
47 7.43042597 -0.88175469
48 -0.35290279 7.43042597
49 1.90363516 -0.35290279
50 1.63206586 1.90363516
51 -2.85933136 1.63206586
52 -0.52803207 -2.85933136
53 -2.64664540 -0.52803207
54 -1.39932485 -2.64664540
55 -0.66309702 -1.39932485
56 -1.78791707 -0.66309702
57 -0.21300083 -1.78791707
58 -0.94547077 -0.21300083
59 -2.60485535 -0.94547077
60 -1.30097849 -2.60485535
61 -0.68158304 -1.30097849
62 -1.45689947 -0.68158304
63 0.22754425 -1.45689947
64 10.13353749 0.22754425
65 0.57054145 10.13353749
66 -0.06273396 0.57054145
67 -1.65818361 -0.06273396
68 -2.20983730 -1.65818361
69 -1.37402241 -2.20983730
70 -1.68142994 -1.37402241
71 -1.12249966 -1.68142994
72 -0.35074721 -1.12249966
73 3.48738230 -0.35074721
74 -0.99378421 3.48738230
75 0.07258446 -0.99378421
76 -0.10009856 0.07258446
77 0.01776606 -0.10009856
78 -0.82528613 0.01776606
79 -1.78197116 -0.82528613
80 1.64198181 -1.78197116
81 -1.91837959 1.64198181
82 -1.66189888 -1.91837959
83 -1.21829820 -1.66189888
84 1.14798184 -1.21829820
85 -1.23210877 1.14798184
86 -0.04191079 -1.23210877
87 6.63127641 -0.04191079
88 1.16878652 6.63127641
89 1.96348736 1.16878652
90 -3.84044404 1.96348736
91 -0.52711679 -3.84044404
92 0.61628558 -0.52711679
93 -2.00452087 0.61628558
94 0.73437333 -2.00452087
95 1.33850704 0.73437333
96 -0.56431068 1.33850704
97 -0.78760065 -0.56431068
98 -1.69015589 -0.78760065
99 1.98902608 -1.69015589
100 -1.48072579 1.98902608
101 0.07117467 -1.48072579
102 1.42055102 0.07117467
103 -1.97653364 1.42055102
104 -1.61593923 -1.97653364
105 2.79762617 -1.61593923
106 1.40930919 2.79762617
107 -0.43399178 1.40930919
108 -1.27256407 -0.43399178
109 -1.85084167 -1.27256407
110 0.41689580 -1.85084167
111 0.32774468 0.41689580
112 -2.82204090 0.32774468
113 -0.55461019 -2.82204090
114 -1.17377551 -0.55461019
115 -1.64040077 -1.17377551
116 -0.17452322 -1.64040077
117 2.02516010 -0.17452322
118 0.27796410 2.02516010
119 0.14207112 0.27796410
120 2.09971140 0.14207112
121 1.04831294 2.09971140
122 -0.77134177 1.04831294
123 2.95122430 -0.77134177
124 2.08474183 2.95122430
125 -0.07997458 2.08474183
126 -2.34794318 -0.07997458
127 0.40064744 -2.34794318
128 -3.09987179 0.40064744
129 -1.49544376 -3.09987179
130 -0.69004030 -1.49544376
131 0.69283057 -0.69004030
132 2.65419702 0.69283057
133 -2.02371262 2.65419702
134 -0.73262655 -2.02371262
135 1.72745179 -0.73262655
136 5.79345853 1.72745179
137 0.75214332 5.79345853
138 -1.06783267 0.75214332
139 1.33507709 -1.06783267
140 -0.57063044 1.33507709
141 0.54268511 -0.57063044
142 -2.56261823 0.54268511
143 -2.39306434 -2.56261823
144 2.26684340 -2.39306434
145 -2.28018354 2.26684340
146 2.45782725 -2.28018354
147 1.67733838 2.45782725
148 -2.04130985 1.67733838
149 2.60462585 -2.04130985
150 -0.81360941 2.60462585
151 0.80140567 -0.81360941
152 -1.35623196 0.80140567
153 0.36157185 -1.35623196
154 -0.23855350 0.36157185
155 -1.55602220 -0.23855350
156 -1.34450492 -1.55602220
157 7.59819408 -1.34450492
158 0.43275780 7.59819408
159 -1.26396183 0.43275780
160 -3.00429729 -1.26396183
161 -3.42212689 -3.00429729
> 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/wessaorg/rcomp/tmp/7hcbi1353254418.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/wessaorg/rcomp/tmp/8s2n61353254418.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/wessaorg/rcomp/tmp/9w0n91353254418.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/wessaorg/rcomp/tmp/10kvus1353254418.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11nrp51353254418.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/wessaorg/rcomp/tmp/12y7vm1353254418.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/wessaorg/rcomp/tmp/13qi571353254418.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/wessaorg/rcomp/tmp/14hu7s1353254418.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/wessaorg/rcomp/tmp/156fw91353254418.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/wessaorg/rcomp/tmp/167cwv1353254418.tab")
+ }
>
> try(system("convert tmp/1smt71353254418.ps tmp/1smt71353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/2nr4u1353254418.ps tmp/2nr4u1353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/3rrle1353254418.ps tmp/3rrle1353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/4wlf41353254418.ps tmp/4wlf41353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/5734k1353254418.ps tmp/5734k1353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/67wvn1353254418.ps tmp/67wvn1353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/7hcbi1353254418.ps tmp/7hcbi1353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/8s2n61353254418.ps tmp/8s2n61353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/9w0n91353254418.ps tmp/9w0n91353254418.png",intern=TRUE))
character(0)
> try(system("convert tmp/10kvus1353254418.ps tmp/10kvus1353254418.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
12.986 1.780 14.879