R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(23
+ ,10
+ ,0
+ ,0
+ ,53
+ ,7
+ ,12
+ ,2
+ ,4
+ ,21
+ ,6
+ ,0
+ ,0
+ ,86
+ ,4
+ ,11
+ ,4
+ ,3
+ ,21
+ ,13
+ ,0
+ ,0
+ ,66
+ ,6
+ ,14
+ ,7
+ ,5
+ ,21
+ ,12
+ ,1
+ ,0
+ ,67
+ ,5
+ ,12
+ ,3
+ ,3
+ ,24
+ ,8
+ ,0
+ ,0
+ ,76
+ ,4
+ ,21
+ ,7
+ ,6
+ ,22
+ ,6
+ ,0
+ ,0
+ ,78
+ ,3
+ ,12
+ ,2
+ ,5
+ ,21
+ ,10
+ ,0
+ ,0
+ ,53
+ ,5
+ ,22
+ ,7
+ ,6
+ ,22
+ ,10
+ ,0
+ ,0
+ ,80
+ ,6
+ ,11
+ ,2
+ ,6
+ ,21
+ ,9
+ ,0
+ ,0
+ ,74
+ ,5
+ ,10
+ ,1
+ ,5
+ ,20
+ ,9
+ ,0
+ ,0
+ ,76
+ ,6
+ ,13
+ ,2
+ ,5
+ ,22
+ ,7
+ ,1
+ ,0
+ ,79
+ ,7
+ ,10
+ ,6
+ ,3
+ ,21
+ ,5
+ ,0
+ ,0
+ ,54
+ ,6
+ ,8
+ ,1
+ ,5
+ ,21
+ ,14
+ ,1
+ ,0
+ ,67
+ ,7
+ ,15
+ ,1
+ ,7
+ ,23
+ ,6
+ ,0
+ ,0
+ ,87
+ ,6
+ ,10
+ ,1
+ ,5
+ ,22
+ ,10
+ ,1
+ ,0
+ ,58
+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{
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.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
PStress AGE Pstress_M Pstress_OKT BelInSprt KunnenRekRel Depressie
1 10 23 0 0 53 7 12
2 6 21 0 0 86 4 11
3 13 21 0 0 66 6 14
4 12 21 1 0 67 5 12
5 8 24 0 0 76 4 21
6 6 22 0 0 78 3 12
7 10 21 0 0 53 5 22
8 10 22 0 0 80 6 11
9 9 21 0 0 74 5 10
10 9 20 0 0 76 6 13
11 7 22 1 0 79 7 10
12 5 21 0 0 54 6 8
13 14 21 1 0 67 7 15
14 6 23 0 0 87 6 10
15 10 22 1 0 58 4 14
16 10 23 1 0 75 6 14
17 7 22 0 0 88 4 11
18 10 24 1 0 64 5 10
19 8 23 0 0 57 3 13
20 6 21 1 0 66 3 7
21 10 23 0 0 54 4 12
22 12 23 0 0 56 5 14
23 7 21 1 0 86 3 11
24 15 20 0 0 80 7 9
25 8 32 1 0 76 7 11
26 10 22 0 0 69 4 15
27 13 21 1 0 67 4 13
28 8 21 0 0 80 5 9
29 11 21 1 0 54 6 15
30 7 22 0 0 71 5 10
31 9 21 0 0 84 4 11
32 10 21 1 0 74 6 13
33 8 21 1 0 71 5 8
34 15 22 1 0 63 5 20
35 9 21 1 0 71 6 12
36 7 21 0 0 76 2 10
37 11 21 1 0 69 6 10
38 9 21 1 0 74 7 9
39 8 23 0 0 75 5 14
40 8 21 1 0 54 5 8
41 12 23 0 0 69 5 11
42 13 23 0 0 68 6 13
43 9 21 0 0 75 4 11
44 11 21 1 0 75 6 11
45 8 20 0 0 72 5 10
46 10 21 1 0 67 5 14
47 13 21 1 0 63 3 18
48 12 22 0 0 62 4 14
49 12 21 1 0 63 4 11
50 9 21 0 0 76 2 12
51 8 22 0 0 74 3 13
52 9 20 0 0 67 6 9
53 12 22 1 0 73 5 10
54 12 22 0 0 70 6 15
55 16 21 1 0 53 2 20
56 11 23 1 0 77 3 12
57 13 22 0 0 77 6 12
58 10 24 0 0 52 3 14
59 9 23 0 0 54 6 13
60 14 21 1 1 80 6 11
61 13 22 0 1 66 4 17
62 12 22 1 1 73 7 12
63 9 21 0 1 63 6 13
64 9 21 1 1 69 3 14
65 10 21 1 1 67 7 13
66 8 21 0 1 54 2 15
67 9 20 0 1 81 4 13
68 9 22 1 1 69 6 10
69 11 22 1 1 84 4 11
70 7 22 0 1 70 1 13
71 11 23 0 1 69 4 17
72 9 21 1 1 77 7 13
73 11 23 1 1 54 4 9
74 9 22 1 1 79 4 11
75 8 21 1 1 30 4 10
76 9 21 0 1 71 6 9
77 8 20 1 1 73 2 12
78 9 24 0 1 72 3 12
79 10 24 0 1 77 4 13
80 9 21 1 1 75 4 13
81 17 20 0 1 70 4 22
82 7 21 0 1 73 6 13
83 11 21 0 1 54 2 15
84 9 21 0 1 77 4 13
85 10 21 0 1 82 3 15
86 11 22 0 1 80 7 10
87 8 22 0 1 80 4 11
88 12 21 0 1 69 5 16
89 10 22 0 1 78 6 11
90 7 21 1 1 81 5 11
91 9 23 1 1 76 4 10
92 7 21 0 1 76 5 10
93 12 22 1 1 73 4 16
94 8 22 0 1 85 5 12
95 13 22 1 1 66 7 11
96 9 20 0 1 79 7 16
97 15 21 1 1 68 4 19
98 8 21 0 1 76 6 11
99 14 22 1 1 54 4 15
100 14 25 0 1 46 1 24
101 9 22 0 1 82 3 14
102 13 22 0 1 74 6 15
103 11 21 0 1 88 7 11
104 10 22 1 1 38 6 15
105 6 21 0 1 76 6 12
106 8 24 1 1 86 6 10
107 10 23 0 1 54 4 14
108 10 23 0 1 69 1 9
109 10 22 0 1 90 3 15
110 12 22 0 1 54 7 15
111 10 25 0 1 76 2 14
112 9 23 0 1 89 7 11
113 9 22 0 1 76 4 8
114 11 21 0 1 79 5 11
115 7 21 1 1 90 6 8
116 7 22 0 1 74 6 10
117 5 22 0 1 81 5 11
118 9 21 0 1 72 5 13
119 11 0 1 1 71 4 11
120 15 21 1 1 66 2 20
121 9 22 0 1 77 2 10
122 9 21 1 1 74 4 12
123 8 24 0 1 82 4 14
124 13 21 1 1 54 6 23
125 10 23 1 1 63 5 14
126 13 23 0 1 54 5 16
127 9 22 0 1 64 6 11
128 11 21 1 1 69 5 12
129 8 21 1 1 84 7 14
130 10 21 0 1 86 5 12
131 9 21 1 1 77 3 12
132 8 22 0 1 89 5 11
133 8 20 0 1 76 1 12
134 13 21 1 1 60 5 13
135 11 23 0 1 79 7 17
136 8 32 1 0 76 7 11
137 12 22 0 1 72 6 12
138 15 24 0 0 69 4 19
139 11 21 0 1 54 2 15
140 10 22 0 1 69 6 14
141 5 22 0 1 81 5 11
142 11 23 0 1 84 1 9
Slaapgebrek ToekZorgen t
1 2 4 1
2 4 3 2
3 7 5 3
4 3 3 4
5 7 6 5
6 2 5 6
7 7 6 7
8 2 6 8
9 1 5 9
10 2 5 10
11 6 3 11
12 1 5 12
13 1 7 13
14 1 5 14
15 2 5 15
16 2 3 16
17 2 5 17
18 1 6 18
19 7 5 19
20 1 2 20
21 2 5 21
22 4 4 22
23 2 6 23
24 1 3 24
25 1 5 25
26 5 4 26
27 2 5 27
28 1 2 28
29 3 2 29
30 1 5 30
31 2 2 31
32 5 2 32
33 2 2 33
34 6 5 34
35 4 5 35
36 1 1 36
37 3 5 37
38 6 2 38
39 7 6 39
40 4 1 40
41 5 3 41
42 3 2 42
43 2 5 43
44 2 3 44
45 2 4 45
46 2 3 46
47 1 6 47
48 2 4 48
49 1 5 49
50 2 2 50
51 2 5 51
52 5 5 52
53 5 3 53
54 2 5 54
55 1 7 55
56 1 4 56
57 2 2 57
58 3 3 58
59 7 6 59
60 4 7 60
61 4 4 61
62 1 4 62
63 2 4 63
64 2 5 64
65 2 2 65
66 5 3 66
67 1 3 67
68 6 4 68
69 2 3 69
70 2 4 70
71 4 6 71
72 6 2 72
73 2 4 73
74 2 5 74
75 2 2 75
76 1 1 76
77 1 2 77
78 2 5 78
79 2 4 79
80 3 4 80
81 3 6 81
82 5 1 82
83 2 4 83
84 5 5 84
85 3 2 85
86 1 3 86
87 2 3 87
88 2 6 88
89 1 5 89
90 2 4 90
91 2 4 91
92 5 5 92
93 5 5 93
94 2 6 94
95 3 6 95
96 5 5 96
97 5 7 97
98 6 5 98
99 2 5 99
100 7 7 100
101 1 5 101
102 1 6 102
103 6 6 103
104 6 4 104
105 2 5 105
106 1 1 106
107 2 6 107
108 1 5 108
109 2 2 109
110 1 1 110
111 3 5 111
112 3 6 112
113 6 5 113
114 4 5 114
115 1 4 115
116 2 2 116
117 5 3 117
118 6 3 118
119 3 5 119
120 5 3 120
121 3 2 121
122 2 2 122
123 3 3 123
124 2 6 124
125 5 5 125
126 5 6 126
127 7 2 127
128 4 5 128
129 5 5 129
130 1 1 130
131 4 4 131
132 1 2 132
133 4 2 133
134 6 7 134
135 7 6 135
136 1 5 136
137 3 5 137
138 5 5 138
139 2 4 139
140 4 3 140
141 5 3 141
142 1 3 142
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) AGE Pstress_M Pstress_OKT BelInSprt
7.78523 -0.11007 0.69938 -0.88485 -0.03379
KunnenRekRel Depressie Slaapgebrek ToekZorgen t
0.20248 0.40161 -0.21340 0.18862 0.01345
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.9828 -1.2861 -0.1169 1.2262 6.4128
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.785235 2.124281 3.665 0.000357 ***
AGE -0.110075 0.066625 -1.652 0.100881
Pstress_M 0.699383 0.334342 2.092 0.038371 *
Pstress_OKT -0.884853 0.545914 -1.621 0.107433
BelInSprt -0.033794 0.016095 -2.100 0.037669 *
KunnenRekRel 0.202478 0.106642 1.899 0.059790 .
Depressie 0.401608 0.061003 6.583 9.92e-10 ***
Slaapgebrek -0.213401 0.091801 -2.325 0.021620 *
ToekZorgen 0.188623 0.109684 1.720 0.087833 .
t 0.013446 0.006606 2.035 0.043803 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.883 on 132 degrees of freedom
Multiple R-squared: 0.4172, Adjusted R-squared: 0.3775
F-statistic: 10.5 on 9 and 132 DF, p-value: 3.797e-12
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.4980896 0.99617916 0.50191042
[2,] 0.5861155 0.82776909 0.41388455
[3,] 0.7239606 0.55207878 0.27603939
[4,] 0.7843690 0.43126205 0.21563103
[5,] 0.8252483 0.34950330 0.17475165
[6,] 0.7796007 0.44079866 0.22039933
[7,] 0.8388455 0.32230899 0.16115449
[8,] 0.7834642 0.43307164 0.21653582
[9,] 0.8465122 0.30697562 0.15348781
[10,] 0.9065312 0.18693763 0.09346882
[11,] 0.8884485 0.22310308 0.11155154
[12,] 0.9812065 0.03758707 0.01879353
[13,] 0.9734754 0.05304916 0.02652458
[14,] 0.9610099 0.07798013 0.03899006
[15,] 0.9584708 0.08305847 0.04152924
[16,] 0.9522462 0.09550761 0.04775381
[17,] 0.9608831 0.07823387 0.03911693
[18,] 0.9702177 0.05956465 0.02978233
[19,] 0.9584976 0.08300474 0.04150237
[20,] 0.9504648 0.09907039 0.04953519
[21,] 0.9388735 0.12225291 0.06112646
[22,] 0.9304664 0.13906718 0.06953359
[23,] 0.9398439 0.12031212 0.06015606
[24,] 0.9228545 0.15429104 0.07714552
[25,] 0.8993518 0.20129640 0.10064820
[26,] 0.8765917 0.24681652 0.12340826
[27,] 0.8712719 0.25745626 0.12872813
[28,] 0.8466582 0.30668354 0.15334177
[29,] 0.9013100 0.19738004 0.09869002
[30,] 0.9101201 0.17975976 0.08987988
[31,] 0.8889194 0.22216116 0.11108058
[32,] 0.8629675 0.27406491 0.13703246
[33,] 0.8655889 0.26882213 0.13441106
[34,] 0.8650732 0.26985364 0.13492682
[35,] 0.8411836 0.31763276 0.15881638
[36,] 0.8138707 0.37225860 0.18612930
[37,] 0.7927290 0.41454194 0.20727097
[38,] 0.7535386 0.49292272 0.24646136
[39,] 0.7743177 0.45136469 0.22568235
[40,] 0.7401210 0.51975797 0.25987899
[41,] 0.7774452 0.44510955 0.22255478
[42,] 0.7402090 0.51958193 0.25979097
[43,] 0.7274907 0.54501867 0.27250934
[44,] 0.6903196 0.61936074 0.30968037
[45,] 0.7418732 0.51625356 0.25812678
[46,] 0.7032395 0.59352096 0.29676048
[47,] 0.6992675 0.60146506 0.30073253
[48,] 0.7455870 0.50882608 0.25441304
[49,] 0.7479243 0.50415138 0.25207569
[50,] 0.7784379 0.44312418 0.22156209
[51,] 0.8250666 0.34986673 0.17493337
[52,] 0.8339427 0.33211455 0.16605727
[53,] 0.8391925 0.32161501 0.16080751
[54,] 0.8343982 0.33120365 0.16560183
[55,] 0.8053589 0.38928216 0.19464108
[56,] 0.7721758 0.45564842 0.22782421
[57,] 0.7934351 0.41312977 0.20656488
[58,] 0.8113620 0.37727591 0.18863795
[59,] 0.7791909 0.44161813 0.22080907
[60,] 0.7756792 0.44864155 0.22432077
[61,] 0.7884097 0.42318069 0.21159035
[62,] 0.7520217 0.49595665 0.24797832
[63,] 0.7543113 0.49137737 0.24568869
[64,] 0.7329286 0.53414273 0.26707137
[65,] 0.7127526 0.57449487 0.28724743
[66,] 0.6753566 0.64928670 0.32464335
[67,] 0.6308590 0.73828199 0.36914099
[68,] 0.6042484 0.79150328 0.39575164
[69,] 0.6745064 0.65098726 0.32549363
[70,] 0.6935625 0.61287505 0.30643752
[71,] 0.6549411 0.69011777 0.34505888
[72,] 0.6112016 0.77759683 0.38879841
[73,] 0.5616734 0.87665317 0.43832658
[74,] 0.6082456 0.78350877 0.39175439
[75,] 0.5628398 0.87432032 0.43716016
[76,] 0.5154796 0.96904089 0.48452045
[77,] 0.4777239 0.95544775 0.52227613
[78,] 0.5412020 0.91759594 0.45879797
[79,] 0.4871423 0.97428455 0.51285772
[80,] 0.4759810 0.95196195 0.52401902
[81,] 0.4278333 0.85566662 0.57216669
[82,] 0.4281168 0.85623361 0.57188319
[83,] 0.4880110 0.97602203 0.51198899
[84,] 0.5164715 0.96705698 0.48352849
[85,] 0.5187223 0.96255538 0.48127769
[86,] 0.4741517 0.94830344 0.52584828
[87,] 0.5055380 0.98892398 0.49446199
[88,] 0.4740509 0.94810180 0.52594910
[89,] 0.4621188 0.92423755 0.53788123
[90,] 0.4573109 0.91462184 0.54268908
[91,] 0.5246328 0.95073444 0.47536722
[92,] 0.5252569 0.94948612 0.47474306
[93,] 0.7085085 0.58298302 0.29149151
[94,] 0.6870359 0.62592826 0.31296413
[95,] 0.7146601 0.57067984 0.28533992
[96,] 0.6867353 0.62652943 0.31326472
[97,] 0.6317656 0.73646881 0.36823441
[98,] 0.6308981 0.73820384 0.36910192
[99,] 0.6015554 0.79688911 0.39844456
[100,] 0.5370385 0.92592298 0.46296149
[101,] 0.4784587 0.95691748 0.52154126
[102,] 0.4809221 0.96184422 0.51907789
[103,] 0.4412173 0.88243459 0.55878270
[104,] 0.3833333 0.76666660 0.61666670
[105,] 0.4961191 0.99223820 0.50388090
[106,] 0.4250336 0.85006714 0.57496643
[107,] 0.4131003 0.82620050 0.58689975
[108,] 0.7840044 0.43199116 0.21599558
[109,] 0.7242052 0.55158963 0.27579481
[110,] 0.6538768 0.69224646 0.34612323
[111,] 0.5847650 0.83047000 0.41523500
[112,] 0.5101246 0.97975087 0.48987544
[113,] 0.4133593 0.82671864 0.58664068
[114,] 0.3427722 0.68554437 0.65722782
[115,] 0.3064340 0.61286799 0.69356600
[116,] 0.2084675 0.41693491 0.79153255
[117,] 0.2379338 0.47586759 0.76206620
> postscript(file="/var/www/html/rcomp/tmp/19ujw1291565270.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/html/rcomp/tmp/29ujw1291565270.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/html/rcomp/tmp/39ujw1291565270.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/html/rcomp/tmp/4jl0h1291565270.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/html/rcomp/tmp/5jl0h1291565270.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 = 142
Frequency = 1
1 2 3 4 5 6
-0.04021989 -1.53416041 3.42970162 2.27999840 -3.52395007 -2.75139803
7 8 9 10 11 12
-3.26240600 0.89484783 0.14787140 -1.10196156 -1.26006464 -3.96760296
13 14 15 16 17 18
1.36790899 -2.46237173 -1.25336390 -0.60995417 -1.36224280 0.13113644
19 20 21 22 23 24
-0.86039307 -1.79412501 0.14345595 1.80732946 -2.30611130 6.41275918
25 26 27 28 29 30
-1.29480647 0.09705758 2.18095420 0.06262662 -0.71415677 -2.12580944
31 32 33 34 35 36
0.77012600 0.15139409 -0.39312209 1.90160497 -1.36798797 -0.78567069
37 38 39 40 41 42
1.12734556 0.68806919 -1.51622218 -0.44631302 3.59801104 3.30689809
43 44 45 46 47 48
-0.26124166 0.99821876 -1.11183783 -1.30136774 -0.43073252 1.32608428
49 50 51 52 53 54
1.33977206 0.24764311 -1.89326900 0.27578038 3.16397810 0.52056892
55 56 57 58 59 60
1.33440004 0.92840044 3.48747552 -0.32166448 -1.29568683 4.50920959
61 62 63 64 65 66
2.39328898 1.67741487 -1.07038795 -1.56325247 -0.48672171 -1.57934675
67 68 69 70 71 72
-0.24578659 0.53426167 2.36608462 -1.80549380 0.09303512 -0.38930490
73 74 75 76 77 78
2.02315766 -0.24736093 -2.05929386 0.98405415 -1.35479695 0.18270107
79 80 81 82 83 84
0.92276012 -0.97447973 3.44070095 -1.78186156 0.36323719 -0.02311511
85 86 87 88 89 90
0.67073457 2.28247670 -0.31174248 0.41662310 0.59817511 -2.51884643
91 92 93 94 95 96
0.12297411 -1.16213537 0.92656204 -1.40685269 2.44829257 -2.03921568
97 98 99 100 101 102
2.01166552 -0.63349779 1.96520811 0.39374782 -1.02539665 1.49314447
103 104 105 106 107 108
2.31369302 -2.00544913 -3.98283586 -0.68320010 -1.11992061 1.96422934
109 110 111 112 113 114
0.51504284 0.45033640 0.59688266 -0.19358560 1.88465883 2.02841528
115 116 117 118 119 120
-1.76192112 -1.71917580 -3.24361511 -0.26109256 -1.33104481 2.39264937
121 122 123 124 125 126
1.33828547 -1.00757161 -1.49949779 -3.28746560 -1.13084752 1.25910878
127 128 129 130 131 132
0.46037691 0.40123875 -3.10007260 0.76250686 -0.77517334 -0.83994544
133 134 135 136 137 138
-0.46435079 1.66436761 -0.39682888 -2.78735933 1.77518045 2.01615536
139 140 141 142
-0.38976246 -0.57910790 -3.56632924 3.39120059
> postscript(file="/var/www/html/rcomp/tmp/6jl0h1291565270.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 = 142
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.04021989 NA
1 -1.53416041 -0.04021989
2 3.42970162 -1.53416041
3 2.27999840 3.42970162
4 -3.52395007 2.27999840
5 -2.75139803 -3.52395007
6 -3.26240600 -2.75139803
7 0.89484783 -3.26240600
8 0.14787140 0.89484783
9 -1.10196156 0.14787140
10 -1.26006464 -1.10196156
11 -3.96760296 -1.26006464
12 1.36790899 -3.96760296
13 -2.46237173 1.36790899
14 -1.25336390 -2.46237173
15 -0.60995417 -1.25336390
16 -1.36224280 -0.60995417
17 0.13113644 -1.36224280
18 -0.86039307 0.13113644
19 -1.79412501 -0.86039307
20 0.14345595 -1.79412501
21 1.80732946 0.14345595
22 -2.30611130 1.80732946
23 6.41275918 -2.30611130
24 -1.29480647 6.41275918
25 0.09705758 -1.29480647
26 2.18095420 0.09705758
27 0.06262662 2.18095420
28 -0.71415677 0.06262662
29 -2.12580944 -0.71415677
30 0.77012600 -2.12580944
31 0.15139409 0.77012600
32 -0.39312209 0.15139409
33 1.90160497 -0.39312209
34 -1.36798797 1.90160497
35 -0.78567069 -1.36798797
36 1.12734556 -0.78567069
37 0.68806919 1.12734556
38 -1.51622218 0.68806919
39 -0.44631302 -1.51622218
40 3.59801104 -0.44631302
41 3.30689809 3.59801104
42 -0.26124166 3.30689809
43 0.99821876 -0.26124166
44 -1.11183783 0.99821876
45 -1.30136774 -1.11183783
46 -0.43073252 -1.30136774
47 1.32608428 -0.43073252
48 1.33977206 1.32608428
49 0.24764311 1.33977206
50 -1.89326900 0.24764311
51 0.27578038 -1.89326900
52 3.16397810 0.27578038
53 0.52056892 3.16397810
54 1.33440004 0.52056892
55 0.92840044 1.33440004
56 3.48747552 0.92840044
57 -0.32166448 3.48747552
58 -1.29568683 -0.32166448
59 4.50920959 -1.29568683
60 2.39328898 4.50920959
61 1.67741487 2.39328898
62 -1.07038795 1.67741487
63 -1.56325247 -1.07038795
64 -0.48672171 -1.56325247
65 -1.57934675 -0.48672171
66 -0.24578659 -1.57934675
67 0.53426167 -0.24578659
68 2.36608462 0.53426167
69 -1.80549380 2.36608462
70 0.09303512 -1.80549380
71 -0.38930490 0.09303512
72 2.02315766 -0.38930490
73 -0.24736093 2.02315766
74 -2.05929386 -0.24736093
75 0.98405415 -2.05929386
76 -1.35479695 0.98405415
77 0.18270107 -1.35479695
78 0.92276012 0.18270107
79 -0.97447973 0.92276012
80 3.44070095 -0.97447973
81 -1.78186156 3.44070095
82 0.36323719 -1.78186156
83 -0.02311511 0.36323719
84 0.67073457 -0.02311511
85 2.28247670 0.67073457
86 -0.31174248 2.28247670
87 0.41662310 -0.31174248
88 0.59817511 0.41662310
89 -2.51884643 0.59817511
90 0.12297411 -2.51884643
91 -1.16213537 0.12297411
92 0.92656204 -1.16213537
93 -1.40685269 0.92656204
94 2.44829257 -1.40685269
95 -2.03921568 2.44829257
96 2.01166552 -2.03921568
97 -0.63349779 2.01166552
98 1.96520811 -0.63349779
99 0.39374782 1.96520811
100 -1.02539665 0.39374782
101 1.49314447 -1.02539665
102 2.31369302 1.49314447
103 -2.00544913 2.31369302
104 -3.98283586 -2.00544913
105 -0.68320010 -3.98283586
106 -1.11992061 -0.68320010
107 1.96422934 -1.11992061
108 0.51504284 1.96422934
109 0.45033640 0.51504284
110 0.59688266 0.45033640
111 -0.19358560 0.59688266
112 1.88465883 -0.19358560
113 2.02841528 1.88465883
114 -1.76192112 2.02841528
115 -1.71917580 -1.76192112
116 -3.24361511 -1.71917580
117 -0.26109256 -3.24361511
118 -1.33104481 -0.26109256
119 2.39264937 -1.33104481
120 1.33828547 2.39264937
121 -1.00757161 1.33828547
122 -1.49949779 -1.00757161
123 -3.28746560 -1.49949779
124 -1.13084752 -3.28746560
125 1.25910878 -1.13084752
126 0.46037691 1.25910878
127 0.40123875 0.46037691
128 -3.10007260 0.40123875
129 0.76250686 -3.10007260
130 -0.77517334 0.76250686
131 -0.83994544 -0.77517334
132 -0.46435079 -0.83994544
133 1.66436761 -0.46435079
134 -0.39682888 1.66436761
135 -2.78735933 -0.39682888
136 1.77518045 -2.78735933
137 2.01615536 1.77518045
138 -0.38976246 2.01615536
139 -0.57910790 -0.38976246
140 -3.56632924 -0.57910790
141 3.39120059 -3.56632924
142 NA 3.39120059
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.53416041 -0.04021989
[2,] 3.42970162 -1.53416041
[3,] 2.27999840 3.42970162
[4,] -3.52395007 2.27999840
[5,] -2.75139803 -3.52395007
[6,] -3.26240600 -2.75139803
[7,] 0.89484783 -3.26240600
[8,] 0.14787140 0.89484783
[9,] -1.10196156 0.14787140
[10,] -1.26006464 -1.10196156
[11,] -3.96760296 -1.26006464
[12,] 1.36790899 -3.96760296
[13,] -2.46237173 1.36790899
[14,] -1.25336390 -2.46237173
[15,] -0.60995417 -1.25336390
[16,] -1.36224280 -0.60995417
[17,] 0.13113644 -1.36224280
[18,] -0.86039307 0.13113644
[19,] -1.79412501 -0.86039307
[20,] 0.14345595 -1.79412501
[21,] 1.80732946 0.14345595
[22,] -2.30611130 1.80732946
[23,] 6.41275918 -2.30611130
[24,] -1.29480647 6.41275918
[25,] 0.09705758 -1.29480647
[26,] 2.18095420 0.09705758
[27,] 0.06262662 2.18095420
[28,] -0.71415677 0.06262662
[29,] -2.12580944 -0.71415677
[30,] 0.77012600 -2.12580944
[31,] 0.15139409 0.77012600
[32,] -0.39312209 0.15139409
[33,] 1.90160497 -0.39312209
[34,] -1.36798797 1.90160497
[35,] -0.78567069 -1.36798797
[36,] 1.12734556 -0.78567069
[37,] 0.68806919 1.12734556
[38,] -1.51622218 0.68806919
[39,] -0.44631302 -1.51622218
[40,] 3.59801104 -0.44631302
[41,] 3.30689809 3.59801104
[42,] -0.26124166 3.30689809
[43,] 0.99821876 -0.26124166
[44,] -1.11183783 0.99821876
[45,] -1.30136774 -1.11183783
[46,] -0.43073252 -1.30136774
[47,] 1.32608428 -0.43073252
[48,] 1.33977206 1.32608428
[49,] 0.24764311 1.33977206
[50,] -1.89326900 0.24764311
[51,] 0.27578038 -1.89326900
[52,] 3.16397810 0.27578038
[53,] 0.52056892 3.16397810
[54,] 1.33440004 0.52056892
[55,] 0.92840044 1.33440004
[56,] 3.48747552 0.92840044
[57,] -0.32166448 3.48747552
[58,] -1.29568683 -0.32166448
[59,] 4.50920959 -1.29568683
[60,] 2.39328898 4.50920959
[61,] 1.67741487 2.39328898
[62,] -1.07038795 1.67741487
[63,] -1.56325247 -1.07038795
[64,] -0.48672171 -1.56325247
[65,] -1.57934675 -0.48672171
[66,] -0.24578659 -1.57934675
[67,] 0.53426167 -0.24578659
[68,] 2.36608462 0.53426167
[69,] -1.80549380 2.36608462
[70,] 0.09303512 -1.80549380
[71,] -0.38930490 0.09303512
[72,] 2.02315766 -0.38930490
[73,] -0.24736093 2.02315766
[74,] -2.05929386 -0.24736093
[75,] 0.98405415 -2.05929386
[76,] -1.35479695 0.98405415
[77,] 0.18270107 -1.35479695
[78,] 0.92276012 0.18270107
[79,] -0.97447973 0.92276012
[80,] 3.44070095 -0.97447973
[81,] -1.78186156 3.44070095
[82,] 0.36323719 -1.78186156
[83,] -0.02311511 0.36323719
[84,] 0.67073457 -0.02311511
[85,] 2.28247670 0.67073457
[86,] -0.31174248 2.28247670
[87,] 0.41662310 -0.31174248
[88,] 0.59817511 0.41662310
[89,] -2.51884643 0.59817511
[90,] 0.12297411 -2.51884643
[91,] -1.16213537 0.12297411
[92,] 0.92656204 -1.16213537
[93,] -1.40685269 0.92656204
[94,] 2.44829257 -1.40685269
[95,] -2.03921568 2.44829257
[96,] 2.01166552 -2.03921568
[97,] -0.63349779 2.01166552
[98,] 1.96520811 -0.63349779
[99,] 0.39374782 1.96520811
[100,] -1.02539665 0.39374782
[101,] 1.49314447 -1.02539665
[102,] 2.31369302 1.49314447
[103,] -2.00544913 2.31369302
[104,] -3.98283586 -2.00544913
[105,] -0.68320010 -3.98283586
[106,] -1.11992061 -0.68320010
[107,] 1.96422934 -1.11992061
[108,] 0.51504284 1.96422934
[109,] 0.45033640 0.51504284
[110,] 0.59688266 0.45033640
[111,] -0.19358560 0.59688266
[112,] 1.88465883 -0.19358560
[113,] 2.02841528 1.88465883
[114,] -1.76192112 2.02841528
[115,] -1.71917580 -1.76192112
[116,] -3.24361511 -1.71917580
[117,] -0.26109256 -3.24361511
[118,] -1.33104481 -0.26109256
[119,] 2.39264937 -1.33104481
[120,] 1.33828547 2.39264937
[121,] -1.00757161 1.33828547
[122,] -1.49949779 -1.00757161
[123,] -3.28746560 -1.49949779
[124,] -1.13084752 -3.28746560
[125,] 1.25910878 -1.13084752
[126,] 0.46037691 1.25910878
[127,] 0.40123875 0.46037691
[128,] -3.10007260 0.40123875
[129,] 0.76250686 -3.10007260
[130,] -0.77517334 0.76250686
[131,] -0.83994544 -0.77517334
[132,] -0.46435079 -0.83994544
[133,] 1.66436761 -0.46435079
[134,] -0.39682888 1.66436761
[135,] -2.78735933 -0.39682888
[136,] 1.77518045 -2.78735933
[137,] 2.01615536 1.77518045
[138,] -0.38976246 2.01615536
[139,] -0.57910790 -0.38976246
[140,] -3.56632924 -0.57910790
[141,] 3.39120059 -3.56632924
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.53416041 -0.04021989
2 3.42970162 -1.53416041
3 2.27999840 3.42970162
4 -3.52395007 2.27999840
5 -2.75139803 -3.52395007
6 -3.26240600 -2.75139803
7 0.89484783 -3.26240600
8 0.14787140 0.89484783
9 -1.10196156 0.14787140
10 -1.26006464 -1.10196156
11 -3.96760296 -1.26006464
12 1.36790899 -3.96760296
13 -2.46237173 1.36790899
14 -1.25336390 -2.46237173
15 -0.60995417 -1.25336390
16 -1.36224280 -0.60995417
17 0.13113644 -1.36224280
18 -0.86039307 0.13113644
19 -1.79412501 -0.86039307
20 0.14345595 -1.79412501
21 1.80732946 0.14345595
22 -2.30611130 1.80732946
23 6.41275918 -2.30611130
24 -1.29480647 6.41275918
25 0.09705758 -1.29480647
26 2.18095420 0.09705758
27 0.06262662 2.18095420
28 -0.71415677 0.06262662
29 -2.12580944 -0.71415677
30 0.77012600 -2.12580944
31 0.15139409 0.77012600
32 -0.39312209 0.15139409
33 1.90160497 -0.39312209
34 -1.36798797 1.90160497
35 -0.78567069 -1.36798797
36 1.12734556 -0.78567069
37 0.68806919 1.12734556
38 -1.51622218 0.68806919
39 -0.44631302 -1.51622218
40 3.59801104 -0.44631302
41 3.30689809 3.59801104
42 -0.26124166 3.30689809
43 0.99821876 -0.26124166
44 -1.11183783 0.99821876
45 -1.30136774 -1.11183783
46 -0.43073252 -1.30136774
47 1.32608428 -0.43073252
48 1.33977206 1.32608428
49 0.24764311 1.33977206
50 -1.89326900 0.24764311
51 0.27578038 -1.89326900
52 3.16397810 0.27578038
53 0.52056892 3.16397810
54 1.33440004 0.52056892
55 0.92840044 1.33440004
56 3.48747552 0.92840044
57 -0.32166448 3.48747552
58 -1.29568683 -0.32166448
59 4.50920959 -1.29568683
60 2.39328898 4.50920959
61 1.67741487 2.39328898
62 -1.07038795 1.67741487
63 -1.56325247 -1.07038795
64 -0.48672171 -1.56325247
65 -1.57934675 -0.48672171
66 -0.24578659 -1.57934675
67 0.53426167 -0.24578659
68 2.36608462 0.53426167
69 -1.80549380 2.36608462
70 0.09303512 -1.80549380
71 -0.38930490 0.09303512
72 2.02315766 -0.38930490
73 -0.24736093 2.02315766
74 -2.05929386 -0.24736093
75 0.98405415 -2.05929386
76 -1.35479695 0.98405415
77 0.18270107 -1.35479695
78 0.92276012 0.18270107
79 -0.97447973 0.92276012
80 3.44070095 -0.97447973
81 -1.78186156 3.44070095
82 0.36323719 -1.78186156
83 -0.02311511 0.36323719
84 0.67073457 -0.02311511
85 2.28247670 0.67073457
86 -0.31174248 2.28247670
87 0.41662310 -0.31174248
88 0.59817511 0.41662310
89 -2.51884643 0.59817511
90 0.12297411 -2.51884643
91 -1.16213537 0.12297411
92 0.92656204 -1.16213537
93 -1.40685269 0.92656204
94 2.44829257 -1.40685269
95 -2.03921568 2.44829257
96 2.01166552 -2.03921568
97 -0.63349779 2.01166552
98 1.96520811 -0.63349779
99 0.39374782 1.96520811
100 -1.02539665 0.39374782
101 1.49314447 -1.02539665
102 2.31369302 1.49314447
103 -2.00544913 2.31369302
104 -3.98283586 -2.00544913
105 -0.68320010 -3.98283586
106 -1.11992061 -0.68320010
107 1.96422934 -1.11992061
108 0.51504284 1.96422934
109 0.45033640 0.51504284
110 0.59688266 0.45033640
111 -0.19358560 0.59688266
112 1.88465883 -0.19358560
113 2.02841528 1.88465883
114 -1.76192112 2.02841528
115 -1.71917580 -1.76192112
116 -3.24361511 -1.71917580
117 -0.26109256 -3.24361511
118 -1.33104481 -0.26109256
119 2.39264937 -1.33104481
120 1.33828547 2.39264937
121 -1.00757161 1.33828547
122 -1.49949779 -1.00757161
123 -3.28746560 -1.49949779
124 -1.13084752 -3.28746560
125 1.25910878 -1.13084752
126 0.46037691 1.25910878
127 0.40123875 0.46037691
128 -3.10007260 0.40123875
129 0.76250686 -3.10007260
130 -0.77517334 0.76250686
131 -0.83994544 -0.77517334
132 -0.46435079 -0.83994544
133 1.66436761 -0.46435079
134 -0.39682888 1.66436761
135 -2.78735933 -0.39682888
136 1.77518045 -2.78735933
137 2.01615536 1.77518045
138 -0.38976246 2.01615536
139 -0.57910790 -0.38976246
140 -3.56632924 -0.57910790
141 3.39120059 -3.56632924
> 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/html/rcomp/tmp/7uczk1291565270.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/html/rcomp/tmp/853hn1291565270.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/html/rcomp/tmp/953hn1291565270.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/html/rcomp/tmp/1053hn1291565270.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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/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/html/rcomp/tmp/11jvfw1291565270.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/html/rcomp/tmp/12t4ey1291565270.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/html/rcomp/tmp/1305ta1291565270.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/html/rcomp/tmp/14txav1291565270.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/html/rcomp/tmp/15exrj1291565270.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/html/rcomp/tmp/16ap6s1291565270.tab")
+ }
>
> try(system("convert tmp/19ujw1291565270.ps tmp/19ujw1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/29ujw1291565270.ps tmp/29ujw1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/39ujw1291565270.ps tmp/39ujw1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/4jl0h1291565270.ps tmp/4jl0h1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/5jl0h1291565270.ps tmp/5jl0h1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jl0h1291565270.ps tmp/6jl0h1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/7uczk1291565270.ps tmp/7uczk1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/853hn1291565270.ps tmp/853hn1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/953hn1291565270.ps tmp/953hn1291565270.png",intern=TRUE))
character(0)
> try(system("convert tmp/1053hn1291565270.ps tmp/1053hn1291565270.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.112 1.919 9.372