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(5
+ ,7
+ ,0
+ ,12
+ ,14
+ ,16
+ ,17
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,5
+ ,8
+ ,0
+ ,12
+ ,14
+ ,15
+ ,17
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,7
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,17
+ ,5
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,5
+ ,7
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,11
+ ,14
+ ,15
+ ,18
+ ,5
+ ,7
+ ,0
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,8
+ ,0
+ ,11
+ ,14
+ ,15
+ ,17
+ ,6
+ ,7
+ ,0
+ ,11
+ ,14
+ ,15
+ ,17
+ ,5
+ ,7
+ ,0
+ ,11
+ ,13
+ ,15
+ ,18
+ ,5
+ ,7
+ ,0
+ ,12
+ ,14
+ ,16
+ ,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+ ,18
+ ,6
+ ,0
+ ,10
+ ,11
+ ,13
+ ,16
+ ,17
+ ,6
+ ,0
+ ,9
+ ,11
+ ,14
+ ,16
+ ,17
+ ,5
+ ,0
+ ,10
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,0
+ ,10
+ ,12
+ ,14
+ ,15
+ ,17
+ ,6
+ ,0
+ ,10
+ ,12
+ ,14
+ ,15
+ ,18
+ ,6
+ ,0
+ ,9
+ ,12
+ ,14
+ ,16
+ ,17
+ ,6
+ ,0
+ ,9
+ ,11
+ ,14
+ ,16
+ ,18
+ ,6
+ ,0
+ ,9
+ ,12
+ ,14
+ ,16
+ ,18
+ ,5
+ ,0
+ ,10
+ ,12
+ ,14
+ ,16
+ ,18
+ ,6
+ ,0
+ ,10
+ ,12
+ ,14
+ ,15
+ ,17
+ ,6
+ ,0
+ ,10
+ ,12
+ ,14
+ ,16
+ ,17
+ ,5
+ ,0
+ ,10
+ ,11
+ ,13
+ ,16
+ ,18
+ ,5
+ ,0
+ ,10
+ ,11
+ ,13
+ ,15
+ ,18
+ ,5
+ ,0
+ ,10
+ ,11
+ ,14
+ ,16
+ ,18)
+ ,dim=c(7
+ ,154)
+ ,dimnames=list(c('Uselimit'
+ ,'T40'
+ ,'T20'
+ ,'Used'
+ ,'CorrectAnalysis'
+ ,'Useful'
+ ,'Outcome')
+ ,1:154))
> y <- array(NA,dim=c(7,154),dimnames=list(c('Uselimit','T40','T20','Used','CorrectAnalysis','Useful','Outcome'),1:154))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '5'
> 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 Uselimit T40 T20 Used Useful Outcome
1 14 5 7 0 12 16 17
2 14 6 8 0 12 16 18
3 14 6 8 0 12 16 18
4 14 6 8 0 12 16 18
5 14 6 8 0 12 16 18
6 14 5 8 0 12 15 17
7 14 6 8 0 12 16 18
8 14 6 7 0 12 16 18
9 14 6 8 0 12 16 17
10 14 5 8 0 12 16 18
11 14 5 7 0 12 16 18
12 14 6 8 0 12 16 18
13 14 6 8 0 11 15 18
14 14 5 7 0 12 16 18
15 14 6 8 0 11 15 17
16 14 6 7 0 11 15 17
17 13 5 7 0 11 15 18
18 14 5 7 0 12 16 18
19 14 6 8 0 12 16 17
20 13 6 7 0 11 15 17
21 14 5 8 0 12 15 18
22 14 5 8 0 11 15 17
23 14 6 8 0 12 15 17
24 14 5 8 0 12 15 17
25 14 6 7 0 11 16 17
26 14 6 8 0 11 15 18
27 14 5 8 0 12 16 17
28 14 6 8 0 11 16 18
29 14 6 8 0 12 16 17
30 14 6 8 0 12 15 18
31 14 6 8 0 12 16 18
32 14 5 8 0 12 16 18
33 14 5 8 0 12 15 18
34 14 6 7 0 12 16 17
35 14 6 8 0 12 16 18
36 14 6 8 0 12 16 18
37 14 5 7 0 11 15 18
38 14 6 8 0 11 16 17
39 14 6 8 0 12 15 17
40 14 6 7 0 12 15 18
41 13 6 8 0 11 15 17
42 14 6 8 0 11 16 17
43 14 5 8 0 12 15 17
44 14 5 7 0 12 16 18
45 14 6 8 0 12 15 18
46 14 6 8 0 12 15 17
47 14 6 8 0 12 16 18
48 14 6 8 0 12 16 17
49 14 6 8 0 12 15 17
50 14 6 8 0 12 16 18
51 14 6 7 0 11 16 18
52 13 5 7 0 11 15 18
53 14 6 8 0 12 16 17
54 13 6 8 0 11 16 18
55 14 6 8 0 12 16 18
56 14 6 7 0 11 16 17
57 14 6 8 0 11 15 17
58 14 6 8 0 12 16 17
59 14 6 8 0 12 16 17
60 13 5 7 0 11 15 17
61 14 5 7 0 12 16 17
62 14 6 8 0 11 15 18
63 14 6 8 0 12 16 18
64 14 5 7 0 12 16 17
65 14 6 8 0 12 16 18
66 14 6 8 0 12 16 18
67 13 6 7 0 11 15 18
68 14 5 8 0 12 16 18
69 14 6 8 0 12 16 17
70 14 6 8 0 11 16 18
71 14 6 8 0 12 16 18
72 14 6 8 0 12 16 17
73 14 6 8 0 11 16 17
74 14 5 8 0 11 16 18
75 14 6 8 0 12 16 17
76 14 6 7 0 12 15 17
77 14 6 8 0 12 16 17
78 14 6 8 0 11 15 17
79 13 6 7 0 11 16 17
80 14 6 7 0 12 15 18
81 14 6 8 0 12 16 18
82 14 5 8 0 11 16 17
83 14 6 8 0 12 16 18
84 13 6 8 0 11 16 18
85 14 6 8 0 12 15 17
86 14 5 8 0 12 16 18
87 14 5 0 10 12 16 17
88 14 5 0 9 11 16 17
89 14 6 0 10 12 16 18
90 14 6 0 10 12 16 17
91 14 6 0 10 12 15 18
92 14 5 0 9 12 16 18
93 14 5 0 10 12 15 18
94 14 6 0 10 12 16 18
95 14 6 0 9 12 16 18
96 14 6 0 10 12 16 17
97 14 5 0 9 12 16 18
98 14 6 0 10 12 16 18
99 14 5 0 10 12 16 18
100 14 6 0 10 12 16 17
101 14 5 0 10 12 16 17
102 14 6 0 10 12 16 18
103 14 6 0 10 12 16 18
104 14 6 0 10 12 16 18
105 14 6 0 9 11 16 18
106 14 6 0 10 12 16 18
107 14 6 0 10 12 16 18
108 14 5 0 9 11 16 18
109 14 6 0 10 12 16 18
110 14 5 0 10 12 16 18
111 14 5 0 9 11 15 18
112 14 6 0 9 12 16 18
113 14 6 0 10 11 16 18
114 14 5 0 9 11 16 18
115 14 5 0 10 12 16 18
116 14 6 0 10 12 16 18
117 14 5 0 10 12 16 17
118 14 5 0 10 12 16 18
119 14 6 0 10 12 16 18
120 14 6 0 10 12 16 17
121 14 5 0 10 12 16 18
122 14 6 0 10 12 16 18
123 14 5 0 9 11 16 18
124 14 6 0 10 11 15 17
125 14 6 0 10 12 16 17
126 14 6 0 9 12 16 18
127 14 6 0 10 12 15 18
128 14 6 0 10 12 16 17
129 14 6 0 10 12 16 18
130 14 6 0 10 12 16 17
131 14 5 0 10 12 16 18
132 14 5 0 10 12 16 17
133 14 5 0 10 11 16 18
134 14 6 0 10 12 16 18
135 14 6 0 10 12 16 18
136 14 6 0 10 12 16 18
137 14 5 0 10 11 15 17
138 14 5 0 9 11 15 17
139 14 6 0 9 12 16 18
140 14 6 0 10 12 16 18
141 13 6 0 10 11 16 17
142 14 6 0 9 11 16 17
143 14 5 0 10 12 16 18
144 14 6 0 10 12 15 17
145 14 6 0 10 12 15 18
146 14 6 0 9 12 16 17
147 14 6 0 9 11 16 18
148 14 6 0 9 12 16 18
149 14 5 0 10 12 16 18
150 14 6 0 10 12 15 17
151 14 6 0 10 12 16 17
152 13 5 0 10 11 16 18
153 13 5 0 10 11 15 18
154 14 5 0 10 11 16 18
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Uselimit T40 T20 Used Useful
10.297598 -0.001164 0.044958 0.038633 0.241419 0.058536
Outcome
-0.027087
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.80864 -0.02339 0.00369 0.06107 0.34744
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.297598 1.039098 9.910 < 2e-16 ***
Uselimit -0.001164 0.043032 -0.027 0.978
T40 0.044958 0.051117 0.880 0.381
T20 0.038633 0.040590 0.952 0.343
Used 0.241419 0.046064 5.241 5.45e-07 ***
Useful 0.058536 0.047008 1.245 0.215
Outcome -0.027087 0.040977 -0.661 0.510
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2419 on 147 degrees of freedom
Multiple R-squared: 0.2227, Adjusted R-squared: 0.191
F-statistic: 7.021 on 6 and 147 DF, p-value: 1.387e-06
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 4.501192e-46 9.002385e-46 1.000000000
[2,] 3.240892e-58 6.481785e-58 1.000000000
[3,] 3.006314e-72 6.012628e-72 1.000000000
[4,] 1.073555e-87 2.147110e-87 1.000000000
[5,] 3.005791e-98 6.011582e-98 1.000000000
[6,] 5.001799e-112 1.000360e-111 1.000000000
[7,] 0.000000e+00 0.000000e+00 1.000000000
[8,] 3.957201e-01 7.914402e-01 0.604279910
[9,] 3.450001e-01 6.900002e-01 0.654999888
[10,] 3.102486e-01 6.204973e-01 0.689751354
[11,] 8.179977e-01 3.640046e-01 0.182002299
[12,] 7.621045e-01 4.757909e-01 0.237895457
[13,] 7.494994e-01 5.010012e-01 0.250500601
[14,] 6.859246e-01 6.281509e-01 0.314075428
[15,] 6.188901e-01 7.622199e-01 0.381109929
[16,] 6.086877e-01 7.826245e-01 0.391312265
[17,] 6.127549e-01 7.744902e-01 0.387245105
[18,] 5.687182e-01 8.625635e-01 0.431281754
[19,] 5.150521e-01 9.698957e-01 0.484947866
[20,] 4.606832e-01 9.213664e-01 0.539316822
[21,] 4.039260e-01 8.078520e-01 0.596074000
[22,] 3.459484e-01 6.918968e-01 0.654051580
[23,] 2.920171e-01 5.840342e-01 0.707982916
[24,] 2.441044e-01 4.882087e-01 0.755895636
[25,] 2.039490e-01 4.078979e-01 0.796051035
[26,] 1.648309e-01 3.296618e-01 0.835169106
[27,] 1.309936e-01 2.619872e-01 0.869006424
[28,] 1.739988e-01 3.479977e-01 0.826001170
[29,] 1.460745e-01 2.921489e-01 0.853925530
[30,] 1.157430e-01 2.314859e-01 0.884257034
[31,] 1.060086e-01 2.120171e-01 0.893991450
[32,] 5.551854e-01 8.896292e-01 0.444814608
[33,] 5.257296e-01 9.485407e-01 0.474270352
[34,] 4.728487e-01 9.456974e-01 0.527151295
[35,] 4.201178e-01 8.402355e-01 0.579882236
[36,] 3.716494e-01 7.432987e-01 0.628350636
[37,] 3.244494e-01 6.488989e-01 0.675550565
[38,] 2.798624e-01 5.597249e-01 0.720137562
[39,] 2.375601e-01 4.751202e-01 0.762439877
[40,] 2.004830e-01 4.009660e-01 0.799517002
[41,] 1.669560e-01 3.339121e-01 0.833043952
[42,] 1.701768e-01 3.403537e-01 0.829823152
[43,] 4.446220e-01 8.892441e-01 0.555377966
[44,] 3.981586e-01 7.963171e-01 0.601841441
[45,] 8.074212e-01 3.851575e-01 0.192578761
[46,] 7.717439e-01 4.565121e-01 0.228256052
[47,] 7.752807e-01 4.494386e-01 0.224719322
[48,] 7.839548e-01 4.320903e-01 0.216045164
[49,] 7.488015e-01 5.023969e-01 0.251198454
[50,] 7.106212e-01 5.787576e-01 0.289378798
[51,] 9.061180e-01 1.877640e-01 0.093881992
[52,] 8.848571e-01 2.302857e-01 0.115142866
[53,] 8.971583e-01 2.056835e-01 0.102841739
[54,] 8.749707e-01 2.500586e-01 0.125029315
[55,] 8.501160e-01 2.997681e-01 0.149884045
[56,] 8.217462e-01 3.565075e-01 0.178253763
[57,] 7.903696e-01 4.192608e-01 0.209630395
[58,] 9.439945e-01 1.120110e-01 0.056005477
[59,] 9.290631e-01 1.418738e-01 0.070936898
[60,] 9.126884e-01 1.746232e-01 0.087311576
[61,] 9.157483e-01 1.685034e-01 0.084251685
[62,] 8.969754e-01 2.060492e-01 0.103024606
[63,] 8.758239e-01 2.483521e-01 0.124176067
[64,] 8.799984e-01 2.400033e-01 0.120001640
[65,] 8.890719e-01 2.218562e-01 0.110928106
[66,] 8.692768e-01 2.614464e-01 0.130723177
[67,] 8.507268e-01 2.985465e-01 0.149273226
[68,] 8.274139e-01 3.451722e-01 0.172586108
[69,] 8.587952e-01 2.824096e-01 0.141204814
[70,] 9.840463e-01 3.190745e-02 0.015953725
[71,] 9.810154e-01 3.796923e-02 0.018984617
[72,] 9.758736e-01 4.825280e-02 0.024126399
[73,] 9.817375e-01 3.652509e-02 0.018262544
[74,] 9.800498e-01 3.990042e-02 0.019950211
[75,] 9.982758e-01 3.448413e-03 0.001724206
[76,] 9.974584e-01 5.083300e-03 0.002541650
[77,] 9.963035e-01 7.393024e-03 0.003696512
[78,] 9.946860e-01 1.062806e-02 0.005314029
[79,] 9.938971e-01 1.220583e-02 0.006102913
[80,] 9.915707e-01 1.685866e-02 0.008429331
[81,] 9.884941e-01 2.301186e-02 0.011505931
[82,] 9.841577e-01 3.168462e-02 0.015842312
[83,] 9.797830e-01 4.043399e-02 0.020216996
[84,] 9.727834e-01 5.443319e-02 0.027216594
[85,] 9.640843e-01 7.183149e-02 0.035915745
[86,] 9.560058e-01 8.798849e-02 0.043994246
[87,] 9.435655e-01 1.128690e-01 0.056434491
[88,] 9.331390e-01 1.337220e-01 0.066860979
[89,] 9.153013e-01 1.693975e-01 0.084698726
[90,] 8.940211e-01 2.119577e-01 0.105978853
[91,] 8.694697e-01 2.610605e-01 0.130530264
[92,] 8.412074e-01 3.175851e-01 0.158792567
[93,] 8.081671e-01 3.836658e-01 0.191832894
[94,] 7.710857e-01 4.578286e-01 0.228914302
[95,] 7.301436e-01 5.397128e-01 0.269856378
[96,] 7.176660e-01 5.646679e-01 0.282333974
[97,] 6.723998e-01 6.552003e-01 0.327600165
[98,] 6.242662e-01 7.514677e-01 0.375733833
[99,] 6.012411e-01 7.975178e-01 0.398758915
[100,] 5.499533e-01 9.000935e-01 0.450046746
[101,] 4.969873e-01 9.939747e-01 0.503012657
[102,] 4.773845e-01 9.547689e-01 0.522615535
[103,] 4.352951e-01 8.705902e-01 0.564704901
[104,] 4.776565e-01 9.553130e-01 0.522343513
[105,] 4.496396e-01 8.992792e-01 0.550360414
[106,] 3.959506e-01 7.919013e-01 0.604049353
[107,] 3.453336e-01 6.906673e-01 0.654666357
[108,] 2.964140e-01 5.928281e-01 0.703585963
[109,] 2.493310e-01 4.986619e-01 0.750669041
[110,] 2.080313e-01 4.160627e-01 0.791968656
[111,] 1.690235e-01 3.380471e-01 0.830976469
[112,] 1.347815e-01 2.695631e-01 0.865218462
[113,] 1.068745e-01 2.137491e-01 0.893125454
[114,] 9.524383e-02 1.904877e-01 0.904756174
[115,] 1.152843e-01 2.305686e-01 0.884715701
[116,] 8.816549e-02 1.763310e-01 0.911834509
[117,] 7.131070e-02 1.426214e-01 0.928689298
[118,] 5.263669e-02 1.052734e-01 0.947363312
[119,] 3.761986e-02 7.523972e-02 0.962380140
[120,] 2.681964e-02 5.363928e-02 0.973180360
[121,] 1.820960e-02 3.641921e-02 0.981790397
[122,] 1.184658e-02 2.369316e-02 0.988153421
[123,] 7.629973e-03 1.525995e-02 0.992370027
[124,] 1.380196e-02 2.760393e-02 0.986198037
[125,] 9.230209e-03 1.846042e-02 0.990769791
[126,] 6.167452e-03 1.233490e-02 0.993832548
[127,] 4.223769e-03 8.447537e-03 0.995776231
[128,] 7.262503e-03 1.452501e-02 0.992737497
[129,] 6.418977e-03 1.283795e-02 0.993581023
[130,] 5.183675e-03 1.036735e-02 0.994816325
[131,] 2.605878e-03 5.211756e-03 0.997394122
[132,] 3.211632e-02 6.423263e-02 0.967883683
[133,] 2.679235e-02 5.358470e-02 0.973207651
[134,] 1.475469e-02 2.950937e-02 0.985245313
[135,] 7.011272e-03 1.402254e-02 0.992988728
> postscript(file="/var/wessaorg/rcomp/tmp/1i1dq1356006121.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/2sm1k1356006121.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/3vzxp1356006121.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/4u6sw1356006121.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/5rnrd1356006121.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 6
0.020401761 0.003694685 0.003694685 0.003694685 0.003694685 0.033979324
7 8 9 10 11 12
0.003694685 0.048652871 -0.023392543 0.002530802 0.047488988 0.003694685
13 14 15 16 17 18
0.303649028 0.047488988 0.276561800 0.321519987 -0.652556668 0.047488988
19 20 21 22 23 24
-0.023392543 -0.678480013 0.061066552 0.275397917 0.035143207 0.033979324
25 26 27 28 29 30
0.262984237 0.303649028 -0.024556426 0.245113278 -0.023392543 0.062230435
31 32 33 34 35 36
0.003694685 0.002530802 0.061066552 0.021565643 0.003694685 0.003694685
37 38 39 40 41 42
0.347443332 0.218026050 0.035143207 0.107188621 -0.723438200 0.218026050
43 44 45 46 47 48
0.033979324 0.047488988 0.062230435 0.035143207 0.003694685 -0.023392543
49 50 51 52 53 54
0.035143207 0.003694685 0.290071464 -0.652556668 -0.023392543 -0.754886722
55 56 57 58 59 60
0.003694685 0.262984237 0.276561800 -0.023392543 -0.023392543 -0.679643896
61 62 63 64 65 66
0.020401761 0.303649028 0.003694685 0.020401761 0.003694685 0.003694685
67 68 69 70 71 72
-0.651392786 0.002530802 -0.023392543 0.245113278 0.003694685 -0.023392543
73 74 75 76 77 78
0.218026050 0.243949395 -0.023392543 0.080101393 -0.023392543 0.276561800
79 80 81 82 83 84
-0.737015763 0.107188621 0.003694685 0.216862167 0.003694685 -0.754886722
85 86 87 88 89 90
0.035143207 0.002530802 -0.051219148 0.228832267 -0.022968037 -0.050055265
91 92 93 94 95 96
0.035567713 0.014500901 0.034403830 -0.022968037 0.015664784 -0.050055265
97 98 99 100 101 102
0.014500901 -0.022968037 -0.024131920 -0.050055265 -0.051219148 -0.022968037
103 104 105 106 107 108
-0.022968037 -0.022968037 0.257083377 -0.022968037 -0.022968037 0.255919494
109 110 111 112 113 114
-0.022968037 -0.024131920 0.314455244 0.015664784 0.218450556 0.255919494
115 116 117 118 119 120
-0.024131920 -0.022968037 -0.051219148 -0.024131920 -0.022968037 -0.050055265
121 122 123 124 125 126
-0.024131920 -0.022968037 0.255919494 0.249899078 -0.050055265 0.015664784
127 128 129 130 131 132
0.035567713 -0.050055265 -0.022968037 -0.050055265 -0.024131920 -0.051219148
133 134 135 136 137 138
0.217286673 -0.022968037 -0.022968037 -0.022968037 0.248735195 0.287368017
139 140 141 142 143 144
0.015664784 -0.022968037 -0.808636672 0.229996150 -0.024131920 0.008480485
145 146 147 148 149 150
0.035567713 -0.011422444 0.257083377 0.015664784 -0.024131920 0.008480485
151 152 153 154
-0.050055265 -0.782713327 -0.724177577 0.217286673
> postscript(file="/var/wessaorg/rcomp/tmp/6j6mt1356006121.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.020401761 NA
1 0.003694685 0.020401761
2 0.003694685 0.003694685
3 0.003694685 0.003694685
4 0.003694685 0.003694685
5 0.033979324 0.003694685
6 0.003694685 0.033979324
7 0.048652871 0.003694685
8 -0.023392543 0.048652871
9 0.002530802 -0.023392543
10 0.047488988 0.002530802
11 0.003694685 0.047488988
12 0.303649028 0.003694685
13 0.047488988 0.303649028
14 0.276561800 0.047488988
15 0.321519987 0.276561800
16 -0.652556668 0.321519987
17 0.047488988 -0.652556668
18 -0.023392543 0.047488988
19 -0.678480013 -0.023392543
20 0.061066552 -0.678480013
21 0.275397917 0.061066552
22 0.035143207 0.275397917
23 0.033979324 0.035143207
24 0.262984237 0.033979324
25 0.303649028 0.262984237
26 -0.024556426 0.303649028
27 0.245113278 -0.024556426
28 -0.023392543 0.245113278
29 0.062230435 -0.023392543
30 0.003694685 0.062230435
31 0.002530802 0.003694685
32 0.061066552 0.002530802
33 0.021565643 0.061066552
34 0.003694685 0.021565643
35 0.003694685 0.003694685
36 0.347443332 0.003694685
37 0.218026050 0.347443332
38 0.035143207 0.218026050
39 0.107188621 0.035143207
40 -0.723438200 0.107188621
41 0.218026050 -0.723438200
42 0.033979324 0.218026050
43 0.047488988 0.033979324
44 0.062230435 0.047488988
45 0.035143207 0.062230435
46 0.003694685 0.035143207
47 -0.023392543 0.003694685
48 0.035143207 -0.023392543
49 0.003694685 0.035143207
50 0.290071464 0.003694685
51 -0.652556668 0.290071464
52 -0.023392543 -0.652556668
53 -0.754886722 -0.023392543
54 0.003694685 -0.754886722
55 0.262984237 0.003694685
56 0.276561800 0.262984237
57 -0.023392543 0.276561800
58 -0.023392543 -0.023392543
59 -0.679643896 -0.023392543
60 0.020401761 -0.679643896
61 0.303649028 0.020401761
62 0.003694685 0.303649028
63 0.020401761 0.003694685
64 0.003694685 0.020401761
65 0.003694685 0.003694685
66 -0.651392786 0.003694685
67 0.002530802 -0.651392786
68 -0.023392543 0.002530802
69 0.245113278 -0.023392543
70 0.003694685 0.245113278
71 -0.023392543 0.003694685
72 0.218026050 -0.023392543
73 0.243949395 0.218026050
74 -0.023392543 0.243949395
75 0.080101393 -0.023392543
76 -0.023392543 0.080101393
77 0.276561800 -0.023392543
78 -0.737015763 0.276561800
79 0.107188621 -0.737015763
80 0.003694685 0.107188621
81 0.216862167 0.003694685
82 0.003694685 0.216862167
83 -0.754886722 0.003694685
84 0.035143207 -0.754886722
85 0.002530802 0.035143207
86 -0.051219148 0.002530802
87 0.228832267 -0.051219148
88 -0.022968037 0.228832267
89 -0.050055265 -0.022968037
90 0.035567713 -0.050055265
91 0.014500901 0.035567713
92 0.034403830 0.014500901
93 -0.022968037 0.034403830
94 0.015664784 -0.022968037
95 -0.050055265 0.015664784
96 0.014500901 -0.050055265
97 -0.022968037 0.014500901
98 -0.024131920 -0.022968037
99 -0.050055265 -0.024131920
100 -0.051219148 -0.050055265
101 -0.022968037 -0.051219148
102 -0.022968037 -0.022968037
103 -0.022968037 -0.022968037
104 0.257083377 -0.022968037
105 -0.022968037 0.257083377
106 -0.022968037 -0.022968037
107 0.255919494 -0.022968037
108 -0.022968037 0.255919494
109 -0.024131920 -0.022968037
110 0.314455244 -0.024131920
111 0.015664784 0.314455244
112 0.218450556 0.015664784
113 0.255919494 0.218450556
114 -0.024131920 0.255919494
115 -0.022968037 -0.024131920
116 -0.051219148 -0.022968037
117 -0.024131920 -0.051219148
118 -0.022968037 -0.024131920
119 -0.050055265 -0.022968037
120 -0.024131920 -0.050055265
121 -0.022968037 -0.024131920
122 0.255919494 -0.022968037
123 0.249899078 0.255919494
124 -0.050055265 0.249899078
125 0.015664784 -0.050055265
126 0.035567713 0.015664784
127 -0.050055265 0.035567713
128 -0.022968037 -0.050055265
129 -0.050055265 -0.022968037
130 -0.024131920 -0.050055265
131 -0.051219148 -0.024131920
132 0.217286673 -0.051219148
133 -0.022968037 0.217286673
134 -0.022968037 -0.022968037
135 -0.022968037 -0.022968037
136 0.248735195 -0.022968037
137 0.287368017 0.248735195
138 0.015664784 0.287368017
139 -0.022968037 0.015664784
140 -0.808636672 -0.022968037
141 0.229996150 -0.808636672
142 -0.024131920 0.229996150
143 0.008480485 -0.024131920
144 0.035567713 0.008480485
145 -0.011422444 0.035567713
146 0.257083377 -0.011422444
147 0.015664784 0.257083377
148 -0.024131920 0.015664784
149 0.008480485 -0.024131920
150 -0.050055265 0.008480485
151 -0.782713327 -0.050055265
152 -0.724177577 -0.782713327
153 0.217286673 -0.724177577
154 NA 0.217286673
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.003694685 0.020401761
[2,] 0.003694685 0.003694685
[3,] 0.003694685 0.003694685
[4,] 0.003694685 0.003694685
[5,] 0.033979324 0.003694685
[6,] 0.003694685 0.033979324
[7,] 0.048652871 0.003694685
[8,] -0.023392543 0.048652871
[9,] 0.002530802 -0.023392543
[10,] 0.047488988 0.002530802
[11,] 0.003694685 0.047488988
[12,] 0.303649028 0.003694685
[13,] 0.047488988 0.303649028
[14,] 0.276561800 0.047488988
[15,] 0.321519987 0.276561800
[16,] -0.652556668 0.321519987
[17,] 0.047488988 -0.652556668
[18,] -0.023392543 0.047488988
[19,] -0.678480013 -0.023392543
[20,] 0.061066552 -0.678480013
[21,] 0.275397917 0.061066552
[22,] 0.035143207 0.275397917
[23,] 0.033979324 0.035143207
[24,] 0.262984237 0.033979324
[25,] 0.303649028 0.262984237
[26,] -0.024556426 0.303649028
[27,] 0.245113278 -0.024556426
[28,] -0.023392543 0.245113278
[29,] 0.062230435 -0.023392543
[30,] 0.003694685 0.062230435
[31,] 0.002530802 0.003694685
[32,] 0.061066552 0.002530802
[33,] 0.021565643 0.061066552
[34,] 0.003694685 0.021565643
[35,] 0.003694685 0.003694685
[36,] 0.347443332 0.003694685
[37,] 0.218026050 0.347443332
[38,] 0.035143207 0.218026050
[39,] 0.107188621 0.035143207
[40,] -0.723438200 0.107188621
[41,] 0.218026050 -0.723438200
[42,] 0.033979324 0.218026050
[43,] 0.047488988 0.033979324
[44,] 0.062230435 0.047488988
[45,] 0.035143207 0.062230435
[46,] 0.003694685 0.035143207
[47,] -0.023392543 0.003694685
[48,] 0.035143207 -0.023392543
[49,] 0.003694685 0.035143207
[50,] 0.290071464 0.003694685
[51,] -0.652556668 0.290071464
[52,] -0.023392543 -0.652556668
[53,] -0.754886722 -0.023392543
[54,] 0.003694685 -0.754886722
[55,] 0.262984237 0.003694685
[56,] 0.276561800 0.262984237
[57,] -0.023392543 0.276561800
[58,] -0.023392543 -0.023392543
[59,] -0.679643896 -0.023392543
[60,] 0.020401761 -0.679643896
[61,] 0.303649028 0.020401761
[62,] 0.003694685 0.303649028
[63,] 0.020401761 0.003694685
[64,] 0.003694685 0.020401761
[65,] 0.003694685 0.003694685
[66,] -0.651392786 0.003694685
[67,] 0.002530802 -0.651392786
[68,] -0.023392543 0.002530802
[69,] 0.245113278 -0.023392543
[70,] 0.003694685 0.245113278
[71,] -0.023392543 0.003694685
[72,] 0.218026050 -0.023392543
[73,] 0.243949395 0.218026050
[74,] -0.023392543 0.243949395
[75,] 0.080101393 -0.023392543
[76,] -0.023392543 0.080101393
[77,] 0.276561800 -0.023392543
[78,] -0.737015763 0.276561800
[79,] 0.107188621 -0.737015763
[80,] 0.003694685 0.107188621
[81,] 0.216862167 0.003694685
[82,] 0.003694685 0.216862167
[83,] -0.754886722 0.003694685
[84,] 0.035143207 -0.754886722
[85,] 0.002530802 0.035143207
[86,] -0.051219148 0.002530802
[87,] 0.228832267 -0.051219148
[88,] -0.022968037 0.228832267
[89,] -0.050055265 -0.022968037
[90,] 0.035567713 -0.050055265
[91,] 0.014500901 0.035567713
[92,] 0.034403830 0.014500901
[93,] -0.022968037 0.034403830
[94,] 0.015664784 -0.022968037
[95,] -0.050055265 0.015664784
[96,] 0.014500901 -0.050055265
[97,] -0.022968037 0.014500901
[98,] -0.024131920 -0.022968037
[99,] -0.050055265 -0.024131920
[100,] -0.051219148 -0.050055265
[101,] -0.022968037 -0.051219148
[102,] -0.022968037 -0.022968037
[103,] -0.022968037 -0.022968037
[104,] 0.257083377 -0.022968037
[105,] -0.022968037 0.257083377
[106,] -0.022968037 -0.022968037
[107,] 0.255919494 -0.022968037
[108,] -0.022968037 0.255919494
[109,] -0.024131920 -0.022968037
[110,] 0.314455244 -0.024131920
[111,] 0.015664784 0.314455244
[112,] 0.218450556 0.015664784
[113,] 0.255919494 0.218450556
[114,] -0.024131920 0.255919494
[115,] -0.022968037 -0.024131920
[116,] -0.051219148 -0.022968037
[117,] -0.024131920 -0.051219148
[118,] -0.022968037 -0.024131920
[119,] -0.050055265 -0.022968037
[120,] -0.024131920 -0.050055265
[121,] -0.022968037 -0.024131920
[122,] 0.255919494 -0.022968037
[123,] 0.249899078 0.255919494
[124,] -0.050055265 0.249899078
[125,] 0.015664784 -0.050055265
[126,] 0.035567713 0.015664784
[127,] -0.050055265 0.035567713
[128,] -0.022968037 -0.050055265
[129,] -0.050055265 -0.022968037
[130,] -0.024131920 -0.050055265
[131,] -0.051219148 -0.024131920
[132,] 0.217286673 -0.051219148
[133,] -0.022968037 0.217286673
[134,] -0.022968037 -0.022968037
[135,] -0.022968037 -0.022968037
[136,] 0.248735195 -0.022968037
[137,] 0.287368017 0.248735195
[138,] 0.015664784 0.287368017
[139,] -0.022968037 0.015664784
[140,] -0.808636672 -0.022968037
[141,] 0.229996150 -0.808636672
[142,] -0.024131920 0.229996150
[143,] 0.008480485 -0.024131920
[144,] 0.035567713 0.008480485
[145,] -0.011422444 0.035567713
[146,] 0.257083377 -0.011422444
[147,] 0.015664784 0.257083377
[148,] -0.024131920 0.015664784
[149,] 0.008480485 -0.024131920
[150,] -0.050055265 0.008480485
[151,] -0.782713327 -0.050055265
[152,] -0.724177577 -0.782713327
[153,] 0.217286673 -0.724177577
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.003694685 0.020401761
2 0.003694685 0.003694685
3 0.003694685 0.003694685
4 0.003694685 0.003694685
5 0.033979324 0.003694685
6 0.003694685 0.033979324
7 0.048652871 0.003694685
8 -0.023392543 0.048652871
9 0.002530802 -0.023392543
10 0.047488988 0.002530802
11 0.003694685 0.047488988
12 0.303649028 0.003694685
13 0.047488988 0.303649028
14 0.276561800 0.047488988
15 0.321519987 0.276561800
16 -0.652556668 0.321519987
17 0.047488988 -0.652556668
18 -0.023392543 0.047488988
19 -0.678480013 -0.023392543
20 0.061066552 -0.678480013
21 0.275397917 0.061066552
22 0.035143207 0.275397917
23 0.033979324 0.035143207
24 0.262984237 0.033979324
25 0.303649028 0.262984237
26 -0.024556426 0.303649028
27 0.245113278 -0.024556426
28 -0.023392543 0.245113278
29 0.062230435 -0.023392543
30 0.003694685 0.062230435
31 0.002530802 0.003694685
32 0.061066552 0.002530802
33 0.021565643 0.061066552
34 0.003694685 0.021565643
35 0.003694685 0.003694685
36 0.347443332 0.003694685
37 0.218026050 0.347443332
38 0.035143207 0.218026050
39 0.107188621 0.035143207
40 -0.723438200 0.107188621
41 0.218026050 -0.723438200
42 0.033979324 0.218026050
43 0.047488988 0.033979324
44 0.062230435 0.047488988
45 0.035143207 0.062230435
46 0.003694685 0.035143207
47 -0.023392543 0.003694685
48 0.035143207 -0.023392543
49 0.003694685 0.035143207
50 0.290071464 0.003694685
51 -0.652556668 0.290071464
52 -0.023392543 -0.652556668
53 -0.754886722 -0.023392543
54 0.003694685 -0.754886722
55 0.262984237 0.003694685
56 0.276561800 0.262984237
57 -0.023392543 0.276561800
58 -0.023392543 -0.023392543
59 -0.679643896 -0.023392543
60 0.020401761 -0.679643896
61 0.303649028 0.020401761
62 0.003694685 0.303649028
63 0.020401761 0.003694685
64 0.003694685 0.020401761
65 0.003694685 0.003694685
66 -0.651392786 0.003694685
67 0.002530802 -0.651392786
68 -0.023392543 0.002530802
69 0.245113278 -0.023392543
70 0.003694685 0.245113278
71 -0.023392543 0.003694685
72 0.218026050 -0.023392543
73 0.243949395 0.218026050
74 -0.023392543 0.243949395
75 0.080101393 -0.023392543
76 -0.023392543 0.080101393
77 0.276561800 -0.023392543
78 -0.737015763 0.276561800
79 0.107188621 -0.737015763
80 0.003694685 0.107188621
81 0.216862167 0.003694685
82 0.003694685 0.216862167
83 -0.754886722 0.003694685
84 0.035143207 -0.754886722
85 0.002530802 0.035143207
86 -0.051219148 0.002530802
87 0.228832267 -0.051219148
88 -0.022968037 0.228832267
89 -0.050055265 -0.022968037
90 0.035567713 -0.050055265
91 0.014500901 0.035567713
92 0.034403830 0.014500901
93 -0.022968037 0.034403830
94 0.015664784 -0.022968037
95 -0.050055265 0.015664784
96 0.014500901 -0.050055265
97 -0.022968037 0.014500901
98 -0.024131920 -0.022968037
99 -0.050055265 -0.024131920
100 -0.051219148 -0.050055265
101 -0.022968037 -0.051219148
102 -0.022968037 -0.022968037
103 -0.022968037 -0.022968037
104 0.257083377 -0.022968037
105 -0.022968037 0.257083377
106 -0.022968037 -0.022968037
107 0.255919494 -0.022968037
108 -0.022968037 0.255919494
109 -0.024131920 -0.022968037
110 0.314455244 -0.024131920
111 0.015664784 0.314455244
112 0.218450556 0.015664784
113 0.255919494 0.218450556
114 -0.024131920 0.255919494
115 -0.022968037 -0.024131920
116 -0.051219148 -0.022968037
117 -0.024131920 -0.051219148
118 -0.022968037 -0.024131920
119 -0.050055265 -0.022968037
120 -0.024131920 -0.050055265
121 -0.022968037 -0.024131920
122 0.255919494 -0.022968037
123 0.249899078 0.255919494
124 -0.050055265 0.249899078
125 0.015664784 -0.050055265
126 0.035567713 0.015664784
127 -0.050055265 0.035567713
128 -0.022968037 -0.050055265
129 -0.050055265 -0.022968037
130 -0.024131920 -0.050055265
131 -0.051219148 -0.024131920
132 0.217286673 -0.051219148
133 -0.022968037 0.217286673
134 -0.022968037 -0.022968037
135 -0.022968037 -0.022968037
136 0.248735195 -0.022968037
137 0.287368017 0.248735195
138 0.015664784 0.287368017
139 -0.022968037 0.015664784
140 -0.808636672 -0.022968037
141 0.229996150 -0.808636672
142 -0.024131920 0.229996150
143 0.008480485 -0.024131920
144 0.035567713 0.008480485
145 -0.011422444 0.035567713
146 0.257083377 -0.011422444
147 0.015664784 0.257083377
148 -0.024131920 0.015664784
149 0.008480485 -0.024131920
150 -0.050055265 0.008480485
151 -0.782713327 -0.050055265
152 -0.724177577 -0.782713327
153 0.217286673 -0.724177577
> 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/70fx81356006121.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/87cie1356006121.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/9nhx31356006121.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/10hec61356006121.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/11lysi1356006121.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/12s9rr1356006121.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/13zvma1356006122.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/14v0971356006122.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/15i3uu1356006122.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/16xtrp1356006122.tab")
+ }
>
> try(system("convert tmp/1i1dq1356006121.ps tmp/1i1dq1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/2sm1k1356006121.ps tmp/2sm1k1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/3vzxp1356006121.ps tmp/3vzxp1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/4u6sw1356006121.ps tmp/4u6sw1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/5rnrd1356006121.ps tmp/5rnrd1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/6j6mt1356006121.ps tmp/6j6mt1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/70fx81356006121.ps tmp/70fx81356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/87cie1356006121.ps tmp/87cie1356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/9nhx31356006121.ps tmp/9nhx31356006121.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hec61356006121.ps tmp/10hec61356006121.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.668 0.972 9.632