R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(47
+ ,46
+ ,84
+ ,26
+ ,24
+ ,48
+ ,72
+ ,20
+ ,31
+ ,37
+ ,37
+ ,24
+ ,42
+ ,75
+ ,85
+ ,25
+ ,24
+ ,31
+ ,30
+ ,15
+ ,10
+ ,18
+ ,53
+ ,16
+ ,85
+ ,79
+ ,74
+ ,20
+ ,9
+ ,16
+ ,22
+ ,18
+ ,32
+ ,38
+ ,68
+ ,19
+ ,36
+ ,24
+ ,47
+ ,20
+ ,45
+ ,65
+ ,102
+ ,30
+ ,36
+ ,74
+ ,123
+ ,37
+ ,28
+ ,43
+ ,69
+ ,23
+ ,54
+ ,42
+ ,108
+ ,36
+ ,39
+ ,55
+ ,59
+ ,29
+ ,70
+ ,121
+ ,122
+ ,35
+ ,50
+ ,42
+ ,91
+ ,24
+ ,55
+ ,102
+ ,45
+ ,22
+ ,32
+ ,36
+ ,53
+ ,19
+ ,44
+ ,50
+ ,112
+ ,30
+ ,46
+ ,48
+ ,82
+ ,27
+ ,80
+ ,56
+ ,92
+ ,26
+ ,25
+ ,19
+ ,51
+ ,15
+ ,30
+ ,32
+ ,120
+ ,30
+ ,41
+ ,77
+ ,99
+ ,28
+ ,40
+ ,90
+ ,86
+ ,24
+ ,45
+ ,81
+ ,59
+ ,21
+ ,45
+ ,55
+ ,98
+ ,27
+ ,30
+ ,34
+ ,71
+ ,21
+ ,52
+ ,38
+ ,100
+ ,30
+ ,53
+ ,53
+ ,113
+ ,30
+ ,36
+ ,48
+ ,92
+ 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,5
+ ,5
+ ,5
+ ,4
+ ,1
+ ,20
+ ,27
+ ,31
+ ,23
+ ,0
+ ,2
+ ,0
+ ,0
+ ,29
+ ,33
+ ,29
+ ,16)
+ ,dim=c(4
+ ,164)
+ ,dimnames=list(c('Y'
+ ,'X1'
+ ,'X2'
+ ,'X3')
+ ,1:164))
> y <- array(NA,dim=c(4,164),dimnames=list(c('Y','X1','X2','X3'),1:164))
> 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 = '3'
> library(lattice)
> library(lmtest)
Loading required package: zoo
> 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
X2 Y X1 X3
1 84 47 46 26
2 72 24 48 20
3 37 31 37 24
4 85 42 75 25
5 30 24 31 15
6 53 10 18 16
7 74 85 79 20
8 22 9 16 18
9 68 32 38 19
10 47 36 24 20
11 102 45 65 30
12 123 36 74 37
13 69 28 43 23
14 108 54 42 36
15 59 39 55 29
16 122 70 121 35
17 91 50 42 24
18 45 55 102 22
19 53 32 36 19
20 112 44 50 30
21 82 46 48 27
22 92 80 56 26
23 51 25 19 15
24 120 30 32 30
25 99 41 77 28
26 86 40 90 24
27 59 45 81 21
28 98 45 55 27
29 71 30 34 21
30 100 52 38 30
31 113 53 53 30
32 92 36 48 33
33 107 57 63 30
34 75 17 25 20
35 100 68 56 27
36 69 46 37 25
37 106 73 83 30
38 51 34 50 20
39 18 22 26 8
40 91 58 108 24
41 75 62 55 25
42 63 32 41 25
43 72 38 49 21
44 59 23 31 21
45 29 26 49 21
46 85 85 96 26
47 66 22 42 26
48 106 44 55 30
49 113 62 70 34
50 101 36 39 30
51 65 36 53 18
52 7 7 24 4
53 111 72 209 31
54 61 18 17 18
55 41 27 58 14
56 70 48 27 20
57 136 50 58 36
58 87 55 114 24
59 90 59 75 26
60 76 39 51 22
61 101 68 86 31
62 57 57 77 21
63 61 40 62 31
64 92 47 60 26
65 80 39 39 24
66 35 32 35 15
67 72 32 86 19
68 88 40 102 28
69 80 42 49 24
70 62 26 35 18
71 81 33 33 25
72 63 19 28 20
73 91 35 44 25
74 65 41 37 24
75 79 27 33 23
76 85 53 45 25
77 75 55 57 20
78 70 29 58 23
79 78 25 36 22
80 75 33 42 25
81 55 27 30 18
82 80 76 67 30
83 83 37 53 22
84 38 38 59 25
85 27 22 25 8
86 62 30 39 21
87 82 27 36 22
88 88 63 114 24
89 59 48 54 30
90 92 33 70 27
91 40 37 51 24
92 91 42 49 25
93 63 31 42 21
94 88 47 51 24
95 85 52 51 24
96 76 36 27 20
97 67 40 29 20
98 69 53 54 24
99 150 56 92 40
100 77 69 72 22
101 103 43 63 31
102 81 51 41 26
103 37 30 111 20
104 64 12 14 19
105 22 35 45 15
106 35 36 91 21
107 61 41 29 22
108 80 52 64 24
109 54 21 32 19
110 76 26 65 24
111 87 49 42 23
112 75 39 55 27
113 0 6 10 1
114 61 35 53 24
115 30 17 25 11
116 66 25 33 27
117 56 71 66 22
118 0 6 16 0
119 32 47 35 17
120 9 9 19 8
121 82 52 76 24
122 110 38 35 31
123 71 21 46 24
124 50 21 29 20
125 21 11 34 8
126 78 25 25 22
127 118 54 48 33
128 102 38 38 33
129 109 68 50 31
130 104 56 65 33
131 124 71 72 35
132 76 39 23 21
133 57 21 29 20
134 91 53 194 24
135 101 78 114 29
136 66 14 15 20
137 98 70 86 27
138 63 29 50 24
139 85 47 33 26
140 74 36 50 26
141 19 21 72 12
142 57 69 81 21
143 74 42 54 24
144 78 48 63 21
145 91 55 69 30
146 112 19 39 32
147 79 39 49 24
148 100 51 67 29
149 0 0 0 0
150 0 4 10 0
151 0 0 1 0
152 0 0 2 0
153 0 0 0 0
154 0 0 0 0
155 48 38 58 20
156 55 51 72 27
157 0 0 0 0
158 0 0 4 0
159 0 2 5 0
160 13 13 20 5
161 4 5 5 1
162 31 20 27 23
163 0 0 2 0
164 29 29 33 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Y X1 X3
-6.96454 0.19933 -0.01597 3.12165
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-39.709 -7.327 4.038 8.833 27.846
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -6.96454 2.87391 -2.423 0.0165 *
Y 0.19933 0.09244 2.156 0.0326 *
X1 -0.01597 0.04845 -0.330 0.7421
X3 3.12165 0.17618 17.719 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 13.54 on 160 degrees of freedom
Multiple R-squared: 0.8315, Adjusted R-squared: 0.8283
F-statistic: 263.2 on 3 and 160 DF, p-value: < 2.2e-16
> 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.9325361 1.349277e-01 6.746387e-02
[2,] 0.9299147 1.401707e-01 7.008533e-02
[3,] 0.9284115 1.431769e-01 7.158846e-02
[4,] 0.8856086 2.287828e-01 1.143914e-01
[5,] 0.8508953 2.982094e-01 1.491047e-01
[6,] 0.7874806 4.250387e-01 2.125194e-01
[7,] 0.7108217 5.783566e-01 2.891783e-01
[8,] 0.6638505 6.722990e-01 3.361495e-01
[9,] 0.8737026 2.525948e-01 1.262974e-01
[10,] 0.8513014 2.973972e-01 1.486986e-01
[11,] 0.8906854 2.186291e-01 1.093146e-01
[12,] 0.9674530 6.509396e-02 3.254698e-02
[13,] 0.9522586 9.548271e-02 4.774135e-02
[14,] 0.9621090 7.578194e-02 3.789097e-02
[15,] 0.9458262 1.083476e-01 5.417381e-02
[16,] 0.9245354 1.509293e-01 7.546464e-02
[17,] 0.9181368 1.637264e-01 8.186318e-02
[18,] 0.9648221 7.035577e-02 3.517788e-02
[19,] 0.9606478 7.870435e-02 3.935218e-02
[20,] 0.9568528 8.629439e-02 4.314719e-02
[21,] 0.9434526 1.130948e-01 5.654741e-02
[22,] 0.9371546 1.256908e-01 6.284538e-02
[23,] 0.9243838 1.512324e-01 7.561621e-02
[24,] 0.9013350 1.973301e-01 9.866503e-02
[25,] 0.8992771 2.014458e-01 1.007229e-01
[26,] 0.8976056 2.047888e-01 1.023944e-01
[27,] 0.8777972 2.444055e-01 1.222028e-01
[28,] 0.8957897 2.084205e-01 1.042103e-01
[29,] 0.8770933 2.458134e-01 1.229067e-01
[30,] 0.8680697 2.638606e-01 1.319303e-01
[31,] 0.8391645 3.216710e-01 1.608355e-01
[32,] 0.8188314 3.623372e-01 1.811686e-01
[33,] 0.7841365 4.317270e-01 2.158635e-01
[34,] 0.7751294 4.497413e-01 2.248706e-01
[35,] 0.7502015 4.995969e-01 2.497985e-01
[36,] 0.7489682 5.020635e-01 2.510318e-01
[37,] 0.7182967 5.634067e-01 2.817033e-01
[38,] 0.6742892 6.514216e-01 3.257108e-01
[39,] 0.8467220 3.065560e-01 1.532780e-01
[40,] 0.8239458 3.521084e-01 1.760542e-01
[41,] 0.8122406 3.755187e-01 1.877594e-01
[42,] 0.7964013 4.071973e-01 2.035987e-01
[43,] 0.7611980 4.776039e-01 2.388020e-01
[44,] 0.7311343 5.377314e-01 2.688657e-01
[45,] 0.7199941 5.600117e-01 2.800059e-01
[46,] 0.6921997 6.156007e-01 3.078003e-01
[47,] 0.6634752 6.730496e-01 3.365248e-01
[48,] 0.6458359 7.083282e-01 3.541641e-01
[49,] 0.6009349 7.981303e-01 3.990651e-01
[50,] 0.5629539 8.740923e-01 4.370461e-01
[51,] 0.6097127 7.805747e-01 3.902873e-01
[52,] 0.5857330 8.285340e-01 4.142670e-01
[53,] 0.5449621 9.100757e-01 4.550379e-01
[54,] 0.5125556 9.748888e-01 4.874444e-01
[55,] 0.4720624 9.441249e-01 5.279376e-01
[56,] 0.4596240 9.192481e-01 5.403760e-01
[57,] 0.7382640 5.234721e-01 2.617360e-01
[58,] 0.7174142 5.651716e-01 2.825858e-01
[59,] 0.6826396 6.347208e-01 3.173604e-01
[60,] 0.6596988 6.806023e-01 3.403012e-01
[61,] 0.6722765 6.554471e-01 3.277235e-01
[62,] 0.6312558 7.374885e-01 3.687442e-01
[63,] 0.5922875 8.154251e-01 4.077125e-01
[64,] 0.5679966 8.640068e-01 4.320034e-01
[65,] 0.5263372 9.473255e-01 4.736628e-01
[66,] 0.4868579 9.737158e-01 5.131421e-01
[67,] 0.4875100 9.750200e-01 5.124900e-01
[68,] 0.4688417 9.376834e-01 5.311583e-01
[69,] 0.4461268 8.922537e-01 5.538732e-01
[70,] 0.4057136 8.114271e-01 5.942864e-01
[71,] 0.3859692 7.719384e-01 6.140308e-01
[72,] 0.3433664 6.867327e-01 6.566336e-01
[73,] 0.3356847 6.713694e-01 6.643153e-01
[74,] 0.2961970 5.923940e-01 7.038030e-01
[75,] 0.2585809 5.171617e-01 7.414191e-01
[76,] 0.3138789 6.277578e-01 6.861211e-01
[77,] 0.3234908 6.469817e-01 6.765092e-01
[78,] 0.6485861 7.028278e-01 3.514139e-01
[79,] 0.6140651 7.718698e-01 3.859349e-01
[80,] 0.5704624 8.590753e-01 4.295376e-01
[81,] 0.5852049 8.295901e-01 4.147951e-01
[82,] 0.5682413 8.635175e-01 4.317587e-01
[83,] 0.8067952 3.864096e-01 1.932048e-01
[84,] 0.7916568 4.166864e-01 2.083432e-01
[85,] 0.9245639 1.508723e-01 7.543614e-02
[86,] 0.9223762 1.552475e-01 7.762376e-02
[87,] 0.9041885 1.916230e-01 9.581150e-02
[88,] 0.8998377 2.003245e-01 1.001623e-01
[89,] 0.8861426 2.277149e-01 1.138574e-01
[90,] 0.8879793 2.240414e-01 1.120207e-01
[91,] 0.8667811 2.664377e-01 1.332189e-01
[92,] 0.8495367 3.009265e-01 1.504633e-01
[93,] 0.9027698 1.944603e-01 9.723016e-02
[94,] 0.8838368 2.323264e-01 1.161632e-01
[95,] 0.8671049 2.657901e-01 1.328951e-01
[96,] 0.8404690 3.190619e-01 1.595310e-01
[97,] 0.8771048 2.457904e-01 1.228952e-01
[98,] 0.8655290 2.689419e-01 1.344710e-01
[99,] 0.9118053 1.763895e-01 8.819473e-02
[100,] 0.9647362 7.052764e-02 3.526382e-02
[101,] 0.9576452 8.470957e-02 4.235479e-02
[102,] 0.9463889 1.072222e-01 5.361109e-02
[103,] 0.9317312 1.365376e-01 6.826879e-02
[104,] 0.9157034 1.685931e-01 8.429657e-02
[105,] 0.9202250 1.595500e-01 7.977498e-02
[106,] 0.9084321 1.831358e-01 9.156788e-02
[107,] 0.8880987 2.238026e-01 1.119013e-01
[108,] 0.8857874 2.284252e-01 1.142126e-01
[109,] 0.8594999 2.810002e-01 1.405001e-01
[110,] 0.8724570 2.550860e-01 1.275430e-01
[111,] 0.8892242 2.215516e-01 1.107758e-01
[112,] 0.8680199 2.639602e-01 1.319801e-01
[113,] 0.9196932 1.606137e-01 8.030685e-02
[114,] 0.9159084 1.681832e-01 8.409158e-02
[115,] 0.8959373 2.081255e-01 1.040627e-01
[116,] 0.9001203 1.997594e-01 9.987969e-02
[117,] 0.8738611 2.522779e-01 1.261389e-01
[118,] 0.8583391 2.833217e-01 1.416609e-01
[119,] 0.8257610 3.484781e-01 1.742390e-01
[120,] 0.8200946 3.598108e-01 1.799054e-01
[121,] 0.8250719 3.498562e-01 1.749281e-01
[122,] 0.7881762 4.236476e-01 2.118238e-01
[123,] 0.7649092 4.701817e-01 2.350908e-01
[124,] 0.7191783 5.616435e-01 2.808217e-01
[125,] 0.7218435 5.563130e-01 2.781565e-01
[126,] 0.7262584 5.474831e-01 2.737416e-01
[127,] 0.6731818 6.536363e-01 3.268182e-01
[128,] 0.7218943 5.562113e-01 2.781057e-01
[129,] 0.7305293 5.389413e-01 2.694707e-01
[130,] 0.6935391 6.129218e-01 3.064609e-01
[131,] 0.7300218 5.399563e-01 2.699782e-01
[132,] 0.6811434 6.377133e-01 3.188566e-01
[133,] 0.6212062 7.575875e-01 3.787938e-01
[134,] 0.5569640 8.860719e-01 4.430360e-01
[135,] 0.5530252 8.939497e-01 4.469748e-01
[136,] 0.4925856 9.851713e-01 5.074144e-01
[137,] 0.4324746 8.649492e-01 5.675254e-01
[138,] 0.4947420 9.894840e-01 5.052580e-01
[139,] 0.4769933 9.539867e-01 5.230067e-01
[140,] 0.8596208 2.807585e-01 1.403792e-01
[141,] 0.9135472 1.729057e-01 8.645283e-02
[142,] 1.0000000 8.971109e-09 4.485554e-09
[143,] 1.0000000 5.706891e-08 2.853446e-08
[144,] 1.0000000 3.609289e-08 1.804644e-08
[145,] 0.9999998 3.002920e-07 1.501460e-07
[146,] 0.9999988 2.360785e-06 1.180392e-06
[147,] 0.9999916 1.678139e-05 8.390697e-06
[148,] 0.9999441 1.117283e-04 5.586416e-05
[149,] 0.9999965 7.031927e-06 3.515964e-06
[150,] 0.9999532 9.369713e-05 4.684856e-05
[151,] 0.9993390 1.322035e-03 6.610175e-04
> postscript(file="/var/www/rcomp/tmp/1casr1321904670.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/www/rcomp/tmp/21y471321904670.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/www/rcomp/tmp/38am61321904670.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/www/rcomp/tmp/4ok381321904670.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/www/rcomp/tmp/5t6ao1321904670.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 = 164
Frequency = 1
1 2 3 4 5 6
1.1679604 12.5143556 -36.5432263 6.7494371 -14.1489318 8.3123951
7 8 9 10 11 12
2.8504057 -28.7635132 9.8816507 -15.2609189 7.3834967 8.4696778
13 14 15 16 17 18
-0.7277609 -7.5076996 -31.4586002 7.6864583 13.7493793 -26.0456608
19 20 21 22 23 24
-5.1502931 17.3432479 -3.7224136 2.7498174 6.4600767 27.8463623
25 26 27 28 29 30
11.6157694 11.5093203 -7.2661317 12.5887187 6.9731278 3.5569523
31 32 33 34 35 36
16.5972012 -10.4590033 9.9596033 16.5423067 10.0201202 -10.6548104
37 38 39 40 41 42
6.0897743 -10.4469921 -3.9786048 13.2088893 -7.5565831 -13.8003149
43 44 45 46 47 48
6.6180726 -3.6794838 -33.9899777 -4.6079537 -11.9126984 11.4231072
49 50 51 52 53 54
2.5881732 7.7621905 9.4455589 0.4659760 10.1799117 8.4584964
55 56 57 58 59 60
-0.1940320 5.3950470 21.5451668 9.9027079 5.2391948 7.3290403
61 62 63 64 65 66
-0.9873112 -11.7219689 -35.7894200 9.3915666 4.8940842 -10.6796775
67 68 69 70 71 72
14.6483002 1.2143952 4.4558155 8.1513568 3.8725810 4.1915640
73 74 75 76 77 78
13.6496133 -10.5365178 9.3118496 4.0776606 9.4788990 0.3124880
79 80 81 82 83 84
11.8800704 -1.9836722 0.8721683 -20.7637630 14.7596424 -39.7087962
85 86 87 88 89 90
5.0054233 -1.9470129 15.4814121 9.3080747 -36.3901812 9.2202464
91 92 93 94 95 96
-34.5155951 12.3341686 -1.0984264 11.4911135 7.4944678 13.7869967
97 98 99 100 101 102
4.0216239 -8.6569458 22.4056479 2.6845752 5.6285644 -2.7092155
103 104 105 106 107 108
-22.6753917 9.4849088 -24.1179463 -29.3124507 -8.4209990 2.7021020
109 110 111 112 113 114
-2.0215599 3.9006316 13.0703553 -9.2153065 2.8066396 -13.0849931
115 116 117 118 119 120
-0.3628716 -15.7760795 -18.8099143 6.0241177 -22.9129084 -10.4991290
121 122 123 124 125 126
4.8937644 13.1779979 -0.4061881 -9.1911224 1.3417907 11.7043798
127 128 129 130 131 132
11.9530721 -1.0173802 6.4377016 -2.1740644 8.7045078 10.0034750
133 134 135 136 137 138
-2.1911224 15.5791154 3.7099033 7.9805755 8.1006179 -9.9369338
139 140 141 142 143 144
1.9603262 -6.5755315 -14.5311573 -14.0500311 -1.4643252 10.8483873
145 146 147 148 149 150
-5.5459072 15.9074922 4.0538029 7.3411125 6.9645427 6.3269448
151 152 153 154 155 156
6.9805146 6.9964864 6.9645427 6.9645427 -14.1165337 -31.3357345
157 158 159 160 161 162
6.9645427 7.0284302 6.6457437 2.0844668 6.9261094 -37.3886776
163 164
6.9964864 -19.2352806
> postscript(file="/var/www/rcomp/tmp/6gqm31321904670.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 = 164
Frequency = 1
lag(myerror, k = 1) myerror
0 1.1679604 NA
1 12.5143556 1.1679604
2 -36.5432263 12.5143556
3 6.7494371 -36.5432263
4 -14.1489318 6.7494371
5 8.3123951 -14.1489318
6 2.8504057 8.3123951
7 -28.7635132 2.8504057
8 9.8816507 -28.7635132
9 -15.2609189 9.8816507
10 7.3834967 -15.2609189
11 8.4696778 7.3834967
12 -0.7277609 8.4696778
13 -7.5076996 -0.7277609
14 -31.4586002 -7.5076996
15 7.6864583 -31.4586002
16 13.7493793 7.6864583
17 -26.0456608 13.7493793
18 -5.1502931 -26.0456608
19 17.3432479 -5.1502931
20 -3.7224136 17.3432479
21 2.7498174 -3.7224136
22 6.4600767 2.7498174
23 27.8463623 6.4600767
24 11.6157694 27.8463623
25 11.5093203 11.6157694
26 -7.2661317 11.5093203
27 12.5887187 -7.2661317
28 6.9731278 12.5887187
29 3.5569523 6.9731278
30 16.5972012 3.5569523
31 -10.4590033 16.5972012
32 9.9596033 -10.4590033
33 16.5423067 9.9596033
34 10.0201202 16.5423067
35 -10.6548104 10.0201202
36 6.0897743 -10.6548104
37 -10.4469921 6.0897743
38 -3.9786048 -10.4469921
39 13.2088893 -3.9786048
40 -7.5565831 13.2088893
41 -13.8003149 -7.5565831
42 6.6180726 -13.8003149
43 -3.6794838 6.6180726
44 -33.9899777 -3.6794838
45 -4.6079537 -33.9899777
46 -11.9126984 -4.6079537
47 11.4231072 -11.9126984
48 2.5881732 11.4231072
49 7.7621905 2.5881732
50 9.4455589 7.7621905
51 0.4659760 9.4455589
52 10.1799117 0.4659760
53 8.4584964 10.1799117
54 -0.1940320 8.4584964
55 5.3950470 -0.1940320
56 21.5451668 5.3950470
57 9.9027079 21.5451668
58 5.2391948 9.9027079
59 7.3290403 5.2391948
60 -0.9873112 7.3290403
61 -11.7219689 -0.9873112
62 -35.7894200 -11.7219689
63 9.3915666 -35.7894200
64 4.8940842 9.3915666
65 -10.6796775 4.8940842
66 14.6483002 -10.6796775
67 1.2143952 14.6483002
68 4.4558155 1.2143952
69 8.1513568 4.4558155
70 3.8725810 8.1513568
71 4.1915640 3.8725810
72 13.6496133 4.1915640
73 -10.5365178 13.6496133
74 9.3118496 -10.5365178
75 4.0776606 9.3118496
76 9.4788990 4.0776606
77 0.3124880 9.4788990
78 11.8800704 0.3124880
79 -1.9836722 11.8800704
80 0.8721683 -1.9836722
81 -20.7637630 0.8721683
82 14.7596424 -20.7637630
83 -39.7087962 14.7596424
84 5.0054233 -39.7087962
85 -1.9470129 5.0054233
86 15.4814121 -1.9470129
87 9.3080747 15.4814121
88 -36.3901812 9.3080747
89 9.2202464 -36.3901812
90 -34.5155951 9.2202464
91 12.3341686 -34.5155951
92 -1.0984264 12.3341686
93 11.4911135 -1.0984264
94 7.4944678 11.4911135
95 13.7869967 7.4944678
96 4.0216239 13.7869967
97 -8.6569458 4.0216239
98 22.4056479 -8.6569458
99 2.6845752 22.4056479
100 5.6285644 2.6845752
101 -2.7092155 5.6285644
102 -22.6753917 -2.7092155
103 9.4849088 -22.6753917
104 -24.1179463 9.4849088
105 -29.3124507 -24.1179463
106 -8.4209990 -29.3124507
107 2.7021020 -8.4209990
108 -2.0215599 2.7021020
109 3.9006316 -2.0215599
110 13.0703553 3.9006316
111 -9.2153065 13.0703553
112 2.8066396 -9.2153065
113 -13.0849931 2.8066396
114 -0.3628716 -13.0849931
115 -15.7760795 -0.3628716
116 -18.8099143 -15.7760795
117 6.0241177 -18.8099143
118 -22.9129084 6.0241177
119 -10.4991290 -22.9129084
120 4.8937644 -10.4991290
121 13.1779979 4.8937644
122 -0.4061881 13.1779979
123 -9.1911224 -0.4061881
124 1.3417907 -9.1911224
125 11.7043798 1.3417907
126 11.9530721 11.7043798
127 -1.0173802 11.9530721
128 6.4377016 -1.0173802
129 -2.1740644 6.4377016
130 8.7045078 -2.1740644
131 10.0034750 8.7045078
132 -2.1911224 10.0034750
133 15.5791154 -2.1911224
134 3.7099033 15.5791154
135 7.9805755 3.7099033
136 8.1006179 7.9805755
137 -9.9369338 8.1006179
138 1.9603262 -9.9369338
139 -6.5755315 1.9603262
140 -14.5311573 -6.5755315
141 -14.0500311 -14.5311573
142 -1.4643252 -14.0500311
143 10.8483873 -1.4643252
144 -5.5459072 10.8483873
145 15.9074922 -5.5459072
146 4.0538029 15.9074922
147 7.3411125 4.0538029
148 6.9645427 7.3411125
149 6.3269448 6.9645427
150 6.9805146 6.3269448
151 6.9964864 6.9805146
152 6.9645427 6.9964864
153 6.9645427 6.9645427
154 -14.1165337 6.9645427
155 -31.3357345 -14.1165337
156 6.9645427 -31.3357345
157 7.0284302 6.9645427
158 6.6457437 7.0284302
159 2.0844668 6.6457437
160 6.9261094 2.0844668
161 -37.3886776 6.9261094
162 6.9964864 -37.3886776
163 -19.2352806 6.9964864
164 NA -19.2352806
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 12.5143556 1.1679604
[2,] -36.5432263 12.5143556
[3,] 6.7494371 -36.5432263
[4,] -14.1489318 6.7494371
[5,] 8.3123951 -14.1489318
[6,] 2.8504057 8.3123951
[7,] -28.7635132 2.8504057
[8,] 9.8816507 -28.7635132
[9,] -15.2609189 9.8816507
[10,] 7.3834967 -15.2609189
[11,] 8.4696778 7.3834967
[12,] -0.7277609 8.4696778
[13,] -7.5076996 -0.7277609
[14,] -31.4586002 -7.5076996
[15,] 7.6864583 -31.4586002
[16,] 13.7493793 7.6864583
[17,] -26.0456608 13.7493793
[18,] -5.1502931 -26.0456608
[19,] 17.3432479 -5.1502931
[20,] -3.7224136 17.3432479
[21,] 2.7498174 -3.7224136
[22,] 6.4600767 2.7498174
[23,] 27.8463623 6.4600767
[24,] 11.6157694 27.8463623
[25,] 11.5093203 11.6157694
[26,] -7.2661317 11.5093203
[27,] 12.5887187 -7.2661317
[28,] 6.9731278 12.5887187
[29,] 3.5569523 6.9731278
[30,] 16.5972012 3.5569523
[31,] -10.4590033 16.5972012
[32,] 9.9596033 -10.4590033
[33,] 16.5423067 9.9596033
[34,] 10.0201202 16.5423067
[35,] -10.6548104 10.0201202
[36,] 6.0897743 -10.6548104
[37,] -10.4469921 6.0897743
[38,] -3.9786048 -10.4469921
[39,] 13.2088893 -3.9786048
[40,] -7.5565831 13.2088893
[41,] -13.8003149 -7.5565831
[42,] 6.6180726 -13.8003149
[43,] -3.6794838 6.6180726
[44,] -33.9899777 -3.6794838
[45,] -4.6079537 -33.9899777
[46,] -11.9126984 -4.6079537
[47,] 11.4231072 -11.9126984
[48,] 2.5881732 11.4231072
[49,] 7.7621905 2.5881732
[50,] 9.4455589 7.7621905
[51,] 0.4659760 9.4455589
[52,] 10.1799117 0.4659760
[53,] 8.4584964 10.1799117
[54,] -0.1940320 8.4584964
[55,] 5.3950470 -0.1940320
[56,] 21.5451668 5.3950470
[57,] 9.9027079 21.5451668
[58,] 5.2391948 9.9027079
[59,] 7.3290403 5.2391948
[60,] -0.9873112 7.3290403
[61,] -11.7219689 -0.9873112
[62,] -35.7894200 -11.7219689
[63,] 9.3915666 -35.7894200
[64,] 4.8940842 9.3915666
[65,] -10.6796775 4.8940842
[66,] 14.6483002 -10.6796775
[67,] 1.2143952 14.6483002
[68,] 4.4558155 1.2143952
[69,] 8.1513568 4.4558155
[70,] 3.8725810 8.1513568
[71,] 4.1915640 3.8725810
[72,] 13.6496133 4.1915640
[73,] -10.5365178 13.6496133
[74,] 9.3118496 -10.5365178
[75,] 4.0776606 9.3118496
[76,] 9.4788990 4.0776606
[77,] 0.3124880 9.4788990
[78,] 11.8800704 0.3124880
[79,] -1.9836722 11.8800704
[80,] 0.8721683 -1.9836722
[81,] -20.7637630 0.8721683
[82,] 14.7596424 -20.7637630
[83,] -39.7087962 14.7596424
[84,] 5.0054233 -39.7087962
[85,] -1.9470129 5.0054233
[86,] 15.4814121 -1.9470129
[87,] 9.3080747 15.4814121
[88,] -36.3901812 9.3080747
[89,] 9.2202464 -36.3901812
[90,] -34.5155951 9.2202464
[91,] 12.3341686 -34.5155951
[92,] -1.0984264 12.3341686
[93,] 11.4911135 -1.0984264
[94,] 7.4944678 11.4911135
[95,] 13.7869967 7.4944678
[96,] 4.0216239 13.7869967
[97,] -8.6569458 4.0216239
[98,] 22.4056479 -8.6569458
[99,] 2.6845752 22.4056479
[100,] 5.6285644 2.6845752
[101,] -2.7092155 5.6285644
[102,] -22.6753917 -2.7092155
[103,] 9.4849088 -22.6753917
[104,] -24.1179463 9.4849088
[105,] -29.3124507 -24.1179463
[106,] -8.4209990 -29.3124507
[107,] 2.7021020 -8.4209990
[108,] -2.0215599 2.7021020
[109,] 3.9006316 -2.0215599
[110,] 13.0703553 3.9006316
[111,] -9.2153065 13.0703553
[112,] 2.8066396 -9.2153065
[113,] -13.0849931 2.8066396
[114,] -0.3628716 -13.0849931
[115,] -15.7760795 -0.3628716
[116,] -18.8099143 -15.7760795
[117,] 6.0241177 -18.8099143
[118,] -22.9129084 6.0241177
[119,] -10.4991290 -22.9129084
[120,] 4.8937644 -10.4991290
[121,] 13.1779979 4.8937644
[122,] -0.4061881 13.1779979
[123,] -9.1911224 -0.4061881
[124,] 1.3417907 -9.1911224
[125,] 11.7043798 1.3417907
[126,] 11.9530721 11.7043798
[127,] -1.0173802 11.9530721
[128,] 6.4377016 -1.0173802
[129,] -2.1740644 6.4377016
[130,] 8.7045078 -2.1740644
[131,] 10.0034750 8.7045078
[132,] -2.1911224 10.0034750
[133,] 15.5791154 -2.1911224
[134,] 3.7099033 15.5791154
[135,] 7.9805755 3.7099033
[136,] 8.1006179 7.9805755
[137,] -9.9369338 8.1006179
[138,] 1.9603262 -9.9369338
[139,] -6.5755315 1.9603262
[140,] -14.5311573 -6.5755315
[141,] -14.0500311 -14.5311573
[142,] -1.4643252 -14.0500311
[143,] 10.8483873 -1.4643252
[144,] -5.5459072 10.8483873
[145,] 15.9074922 -5.5459072
[146,] 4.0538029 15.9074922
[147,] 7.3411125 4.0538029
[148,] 6.9645427 7.3411125
[149,] 6.3269448 6.9645427
[150,] 6.9805146 6.3269448
[151,] 6.9964864 6.9805146
[152,] 6.9645427 6.9964864
[153,] 6.9645427 6.9645427
[154,] -14.1165337 6.9645427
[155,] -31.3357345 -14.1165337
[156,] 6.9645427 -31.3357345
[157,] 7.0284302 6.9645427
[158,] 6.6457437 7.0284302
[159,] 2.0844668 6.6457437
[160,] 6.9261094 2.0844668
[161,] -37.3886776 6.9261094
[162,] 6.9964864 -37.3886776
[163,] -19.2352806 6.9964864
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 12.5143556 1.1679604
2 -36.5432263 12.5143556
3 6.7494371 -36.5432263
4 -14.1489318 6.7494371
5 8.3123951 -14.1489318
6 2.8504057 8.3123951
7 -28.7635132 2.8504057
8 9.8816507 -28.7635132
9 -15.2609189 9.8816507
10 7.3834967 -15.2609189
11 8.4696778 7.3834967
12 -0.7277609 8.4696778
13 -7.5076996 -0.7277609
14 -31.4586002 -7.5076996
15 7.6864583 -31.4586002
16 13.7493793 7.6864583
17 -26.0456608 13.7493793
18 -5.1502931 -26.0456608
19 17.3432479 -5.1502931
20 -3.7224136 17.3432479
21 2.7498174 -3.7224136
22 6.4600767 2.7498174
23 27.8463623 6.4600767
24 11.6157694 27.8463623
25 11.5093203 11.6157694
26 -7.2661317 11.5093203
27 12.5887187 -7.2661317
28 6.9731278 12.5887187
29 3.5569523 6.9731278
30 16.5972012 3.5569523
31 -10.4590033 16.5972012
32 9.9596033 -10.4590033
33 16.5423067 9.9596033
34 10.0201202 16.5423067
35 -10.6548104 10.0201202
36 6.0897743 -10.6548104
37 -10.4469921 6.0897743
38 -3.9786048 -10.4469921
39 13.2088893 -3.9786048
40 -7.5565831 13.2088893
41 -13.8003149 -7.5565831
42 6.6180726 -13.8003149
43 -3.6794838 6.6180726
44 -33.9899777 -3.6794838
45 -4.6079537 -33.9899777
46 -11.9126984 -4.6079537
47 11.4231072 -11.9126984
48 2.5881732 11.4231072
49 7.7621905 2.5881732
50 9.4455589 7.7621905
51 0.4659760 9.4455589
52 10.1799117 0.4659760
53 8.4584964 10.1799117
54 -0.1940320 8.4584964
55 5.3950470 -0.1940320
56 21.5451668 5.3950470
57 9.9027079 21.5451668
58 5.2391948 9.9027079
59 7.3290403 5.2391948
60 -0.9873112 7.3290403
61 -11.7219689 -0.9873112
62 -35.7894200 -11.7219689
63 9.3915666 -35.7894200
64 4.8940842 9.3915666
65 -10.6796775 4.8940842
66 14.6483002 -10.6796775
67 1.2143952 14.6483002
68 4.4558155 1.2143952
69 8.1513568 4.4558155
70 3.8725810 8.1513568
71 4.1915640 3.8725810
72 13.6496133 4.1915640
73 -10.5365178 13.6496133
74 9.3118496 -10.5365178
75 4.0776606 9.3118496
76 9.4788990 4.0776606
77 0.3124880 9.4788990
78 11.8800704 0.3124880
79 -1.9836722 11.8800704
80 0.8721683 -1.9836722
81 -20.7637630 0.8721683
82 14.7596424 -20.7637630
83 -39.7087962 14.7596424
84 5.0054233 -39.7087962
85 -1.9470129 5.0054233
86 15.4814121 -1.9470129
87 9.3080747 15.4814121
88 -36.3901812 9.3080747
89 9.2202464 -36.3901812
90 -34.5155951 9.2202464
91 12.3341686 -34.5155951
92 -1.0984264 12.3341686
93 11.4911135 -1.0984264
94 7.4944678 11.4911135
95 13.7869967 7.4944678
96 4.0216239 13.7869967
97 -8.6569458 4.0216239
98 22.4056479 -8.6569458
99 2.6845752 22.4056479
100 5.6285644 2.6845752
101 -2.7092155 5.6285644
102 -22.6753917 -2.7092155
103 9.4849088 -22.6753917
104 -24.1179463 9.4849088
105 -29.3124507 -24.1179463
106 -8.4209990 -29.3124507
107 2.7021020 -8.4209990
108 -2.0215599 2.7021020
109 3.9006316 -2.0215599
110 13.0703553 3.9006316
111 -9.2153065 13.0703553
112 2.8066396 -9.2153065
113 -13.0849931 2.8066396
114 -0.3628716 -13.0849931
115 -15.7760795 -0.3628716
116 -18.8099143 -15.7760795
117 6.0241177 -18.8099143
118 -22.9129084 6.0241177
119 -10.4991290 -22.9129084
120 4.8937644 -10.4991290
121 13.1779979 4.8937644
122 -0.4061881 13.1779979
123 -9.1911224 -0.4061881
124 1.3417907 -9.1911224
125 11.7043798 1.3417907
126 11.9530721 11.7043798
127 -1.0173802 11.9530721
128 6.4377016 -1.0173802
129 -2.1740644 6.4377016
130 8.7045078 -2.1740644
131 10.0034750 8.7045078
132 -2.1911224 10.0034750
133 15.5791154 -2.1911224
134 3.7099033 15.5791154
135 7.9805755 3.7099033
136 8.1006179 7.9805755
137 -9.9369338 8.1006179
138 1.9603262 -9.9369338
139 -6.5755315 1.9603262
140 -14.5311573 -6.5755315
141 -14.0500311 -14.5311573
142 -1.4643252 -14.0500311
143 10.8483873 -1.4643252
144 -5.5459072 10.8483873
145 15.9074922 -5.5459072
146 4.0538029 15.9074922
147 7.3411125 4.0538029
148 6.9645427 7.3411125
149 6.3269448 6.9645427
150 6.9805146 6.3269448
151 6.9964864 6.9805146
152 6.9645427 6.9964864
153 6.9645427 6.9645427
154 -14.1165337 6.9645427
155 -31.3357345 -14.1165337
156 6.9645427 -31.3357345
157 7.0284302 6.9645427
158 6.6457437 7.0284302
159 2.0844668 6.6457437
160 6.9261094 2.0844668
161 -37.3886776 6.9261094
162 6.9964864 -37.3886776
163 -19.2352806 6.9964864
> 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/www/rcomp/tmp/7drjl1321904670.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/www/rcomp/tmp/8lcgx1321904670.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/www/rcomp/tmp/9n8po1321904670.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/www/rcomp/tmp/106tvf1321904670.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/www/rcomp/tmp/114ims1321904670.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/www/rcomp/tmp/122p1w1321904670.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/www/rcomp/tmp/13wbkc1321904670.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/www/rcomp/tmp/1417ge1321904670.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/www/rcomp/tmp/15yz0j1321904670.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/www/rcomp/tmp/16bhhy1321904670.tab")
+ }
>
> try(system("convert tmp/1casr1321904670.ps tmp/1casr1321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/21y471321904670.ps tmp/21y471321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/38am61321904670.ps tmp/38am61321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ok381321904670.ps tmp/4ok381321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/5t6ao1321904670.ps tmp/5t6ao1321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/6gqm31321904670.ps tmp/6gqm31321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/7drjl1321904670.ps tmp/7drjl1321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/8lcgx1321904670.ps tmp/8lcgx1321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/9n8po1321904670.ps tmp/9n8po1321904670.png",intern=TRUE))
character(0)
> try(system("convert tmp/106tvf1321904670.ps tmp/106tvf1321904670.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.980 0.170 4.236