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(100
+ ,95
+ ,102
+ ,103
+ ,91
+ ,99
+ ,101
+ ,91
+ ,114
+ ,101
+ ,103
+ ,85
+ ,94
+ ,97
+ ,99
+ ,117
+ ,85
+ ,97
+ ,97
+ ,87
+ ,99
+ ,99
+ ,97
+ ,94
+ ,105
+ ,97
+ ,108
+ ,115
+ ,110
+ ,113
+ ,108
+ ,103
+ ,98
+ ,104
+ ,110
+ ,107
+ ,95
+ ,97
+ ,92
+ ,74
+ ,90
+ ,100
+ ,95
+ ,97
+ ,91
+ ,99
+ ,97
+ ,98
+ ,103
+ ,103
+ ,99
+ ,74
+ ,103
+ ,105
+ ,99
+ ,96
+ ,111
+ ,101
+ ,103
+ ,111
+ ,103
+ ,101
+ ,102
+ ,81
+ ,119
+ ,109
+ ,101
+ ,105
+ ,104
+ ,102
+ ,106
+ ,115
+ ,100
+ ,96
+ ,87
+ ,86
+ ,76
+ ,91
+ ,92
+ ,74
+ ,100
+ ,93
+ ,89
+ ,76
+ ,108
+ ,94
+ ,71
+ ,114
+ ,93
+ ,89
+ ,92
+ ,87
+ ,108
+ ,97
+ ,85
+ ,100
+ ,108
+ ,97
+ ,105
+ ,102
+ ,105
+ ,105
+ ,100
+ ,105
+ ,113
+ ,91
+ ,100
+ ,103
+ ,120
+ ,101
+ ,115
+ ,85
+ ,92
+ ,120
+ ,106
+ ,118
+ ,113
+ ,97
+ ,106
+ ,117
+ ,112
+ ,77
+ ,103
+ ,63
+ ,75
+ ,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,121
+ ,100
+ ,101
+ ,101
+ ,102
+ ,118
+ ,102
+ ,105
+ ,132
+ ,56
+ ,111
+ ,63
+ ,127
+ ,128
+ ,111
+ ,119
+ ,91
+ ,117
+ ,126
+ ,128
+ ,141
+ ,58
+ ,112
+ ,32
+ ,118
+ ,135
+ ,114
+ ,118
+ ,94
+ ,121
+ ,129
+ ,127
+ ,138
+ ,54
+ ,111
+ ,34
+ ,108
+ ,131
+ ,110
+ ,120
+ ,53
+ ,115
+ ,122
+ ,120
+ ,129
+ ,51
+ ,84
+ ,24
+ ,89
+ ,107
+ ,100
+ ,120
+ ,77
+ ,117
+ ,100
+ ,93
+ ,127
+ ,59
+ ,102
+ ,65
+ ,137
+ ,122
+ ,104
+ ,99
+ ,70
+ ,119
+ ,122
+ ,98
+ ,121
+ ,49
+ ,102
+ ,73
+ ,142
+ ,121
+ ,106
+ ,103
+ ,65
+ ,115
+ ,120
+ ,106
+ ,139
+ ,61
+ ,114
+ ,62
+ ,137
+ ,141
+ ,116
+ ,118
+ ,89
+ ,126
+ ,137
+ ,122
+ ,129
+ ,52
+ ,99
+ ,32
+ ,123
+ ,125
+ ,104
+ ,103
+ ,70
+ ,118
+ ,124
+ ,116
+ ,131
+ ,58
+ ,100
+ ,31
+ ,126
+ ,130
+ ,107
+ ,114
+ ,78
+ ,118
+ ,130
+ ,122
+ ,136
+ ,66
+ ,110
+ ,37
+ ,148
+ ,159
+ ,113
+ ,116
+ ,78
+ ,115
+ ,137
+ ,134
+ ,129
+ ,62
+ ,93
+ ,48
+ ,116
+ ,111
+ ,104
+ ,84
+ ,73
+ ,122
+ ,114
+ ,88
+ ,133
+ ,45
+ ,77
+ ,54
+ ,139
+ ,110
+ ,103
+ ,106
+ ,83
+ ,117
+ ,109
+ ,110
+ ,136
+ ,52
+ ,108
+ ,44
+ ,151
+ ,133
+ ,109
+ ,117
+ ,74
+ ,106
+ ,126
+ ,122
+ ,151
+ ,59
+ ,120
+ ,41
+ ,124
+ ,135
+ ,123
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,145
+ ,78
+ ,90
+ ,33
+ ,140
+ ,113
+ ,114
+ ,102
+ ,69
+ ,129
+ ,124
+ ,114
+ ,135
+ ,70
+ ,84
+ ,22
+ ,109
+ ,105
+ ,107
+ ,86
+ ,67
+ ,124
+ ,118
+ ,107
+ ,128
+ ,65
+ ,75
+ ,20
+ ,109
+ ,100
+ ,100
+ ,84
+ ,71
+ ,128
+ ,109
+ ,102
+ ,142
+ ,88
+ ,90
+ ,31
+ ,128
+ ,116
+ ,112
+ ,93
+ ,58
+ ,129
+ ,129
+ ,125
+ ,130
+ ,75
+ ,77
+ ,27
+ ,162
+ ,89
+ ,101
+ ,64
+ ,57
+ ,128
+ ,105
+ ,80
+ ,131
+ ,62
+ ,60
+ ,28
+ ,147
+ ,87
+ ,100
+ ,81
+ ,69
+ ,125
+ ,100
+ ,95
+ ,141
+ ,85
+ ,92
+ ,28
+ ,148
+ ,111
+ ,111
+ ,100
+ ,76
+ ,125
+ ,125
+ ,120
+ ,140
+ ,82
+ ,88
+ ,25
+ ,103
+ ,110
+ ,107
+ ,96
+ ,74
+ ,130
+ ,116
+ ,117
+ ,142
+ ,83
+ ,83
+ ,21
+ ,102
+ ,104
+ ,105
+ ,93
+ ,77
+ ,125
+ ,112
+ ,99
+ ,140
+ ,78
+ ,69
+ ,24
+ ,100
+ ,85
+ ,104
+ ,102
+ ,81
+ ,122
+ ,97
+ ,64
+ ,132
+ ,81
+ ,73
+ ,28
+ ,117
+ ,96
+ ,106
+ ,78
+ ,77
+ ,129
+ ,107
+ ,82
+ ,132
+ ,75
+ ,78
+ ,33
+ ,139
+ ,99
+ ,105
+ ,92
+ ,64
+ ,124
+ ,114
+ ,97
+ ,151
+ ,91
+ ,92
+ ,31
+ ,122
+ ,117
+ ,114
+ ,99
+ ,67
+ ,144
+ ,130
+ ,121)
+ ,dim=c(12
+ ,123)
+ ,dimnames=list(c('Voedingsmiddelen'
+ ,'Tabaksproducten'
+ ,'Textiel'
+ ,'Kleding'
+ ,'Leer'
+ ,'Hout'
+ ,'Papier'
+ ,'Uitgeverijen'
+ ,'Cokes'
+ ,'Chemische'
+ ,'Rubber'
+ ,'Nietmetaalhoudende')
+ ,1:123))
> y <- array(NA,dim=c(12,123),dimnames=list(c('Voedingsmiddelen','Tabaksproducten','Textiel','Kleding','Leer','Hout','Papier','Uitgeverijen','Cokes','Chemische','Rubber','Nietmetaalhoudende'),1:123))
> 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
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
Textiel Voedingsmiddelen Tabaksproducten Kleding Leer Hout Papier
1 102 100 95 103 91 99 101
2 99 94 97 117 85 97 97
3 108 105 97 115 110 113 108
4 92 95 97 74 90 100 95
5 99 103 103 74 103 105 99
6 102 103 101 81 119 109 101
7 87 100 96 86 76 91 92
8 71 108 94 114 93 89 92
9 105 108 97 102 105 105 100
10 115 120 101 85 92 120 106
11 103 112 77 63 75 107 99
12 75 102 93 61 61 84 84
13 97 105 45 87 80 101 106
14 95 101 48 97 85 105 101
15 99 108 52 88 94 119 113
16 100 107 49 67 78 114 110
17 92 109 53 59 92 114 103
18 94 110 60 63 90 119 107
19 89 111 51 86 72 99 98
20 67 110 42 99 77 91 90
21 109 117 56 85 76 121 105
22 113 130 51 74 89 128 116
23 106 114 53 55 55 112 102
24 78 113 55 54 47 93 88
25 102 110 44 81 91 108 114
26 97 107 51 88 85 107 104
27 96 110 52 75 89 115 111
28 99 113 54 55 90 121 111
29 86 106 50 47 72 112 102
30 92 118 57 54 83 123 106
31 86 118 49 71 72 101 104
32 62 114 41 79 75 87 94
33 105 121 58 77 85 124 116
34 108 130 63 57 81 125 118
35 96 115 54 40 69 111 101
36 80 118 55 44 68 98 101
37 95 111 56 67 94 102 109
38 94 108 56 75 97 105 108
39 108 124 70 75 102 128 124
40 97 115 69 49 94 125 117
41 89 113 57 37 89 116 104
42 107 128 68 50 114 131 121
43 87 117 53 63 82 98 101
44 70 119 48 76 96 89 105
45 111 130 61 69 104 133 121
46 105 126 62 49 88 114 116
47 99 125 58 40 85 113 106
48 84 131 51 39 87 104 105
49 87 116 51 54 86 108 107
50 92 109 48 71 89 106 101
51 98 124 59 68 105 117 113
52 95 119 54 43 83 123 109
53 85 119 56 42 87 114 103
54 100 131 60 48 112 132 116
55 79 111 51 58 97 92 98
56 66 125 51 76 89 94 99
57 105 132 56 57 109 121 117
58 96 127 53 44 88 114 107
59 103 132 53 40 91 116 107
60 83 131 48 36 79 98 102
61 91 122 50 60 115 112 103
62 95 113 49 73 119 109 101
63 109 134 55 71 125 133 117
64 92 119 50 45 96 118 103
65 99 129 57 45 117 132 106
66 110 131 65 48 120 134 111
67 88 117 53 60 104 97 94
68 73 131 42 72 121 100 101
69 111 132 56 63 127 128 111
70 112 141 58 32 118 135 114
71 111 138 54 34 108 131 110
72 84 129 51 24 89 107 100
73 102 127 59 65 137 122 104
74 102 121 49 73 142 121 106
75 114 139 61 62 137 141 116
76 99 129 52 32 123 125 104
77 100 131 58 31 126 130 107
78 110 136 66 37 148 159 113
79 93 129 62 48 116 111 104
80 77 133 45 54 139 110 103
81 108 136 52 44 151 133 109
82 120 151 59 41 124 135 123
83 106 145 58 32 109 119 110
84 78 134 45 31 112 94 94
85 100 136 65 49 136 118 114
86 102 129 64 54 136 115 110
87 97 129 69 44 139 114 110
88 101 139 71 31 138 131 113
89 89 133 63 24 142 117 105
90 93 133 74 37 144 123 108
91 89 137 63 38 147 106 101
92 62 127 52 42 201 89 95
93 96 144 73 36 196 116 112
94 95 150 67 31 170 116 113
95 80 132 63 24 177 97 96
96 67 139 70 29 190 82 93
97 71 123 66 38 138 92 91
98 73 122 60 44 133 90 91
99 81 136 66 33 131 99 101
100 77 133 68 23 110 99 98
101 68 127 68 19 124 89 94
102 77 139 81 27 150 106 102
103 73 131 75 29 163 84 96
104 54 132 55 34 138 78 92
105 85 136 79 26 133 101 106
106 86 142 52 28 123 100 105
107 79 133 56 18 107 96 97
108 67 132 66 24 122 80 94
109 72 121 66 29 141 87 95
110 76 124 59 38 136 90 95
111 90 145 78 33 140 113 114
112 84 135 70 22 109 105 107
113 75 128 65 20 109 100 100
114 90 142 88 31 128 116 112
115 77 130 75 27 162 89 101
116 60 131 62 28 147 87 100
117 92 141 85 28 148 111 111
118 88 140 82 25 103 110 107
119 83 142 83 21 102 104 105
120 69 140 78 24 100 85 104
121 73 132 81 28 117 96 106
122 78 132 75 33 139 99 105
123 92 151 91 31 122 117 114
Uitgeverijen Cokes Chemische Rubber Nietmetaalhoudende
1 91 114 101 103 85
2 87 99 99 97 94
3 103 98 104 110 107
4 97 91 99 97 98
5 96 111 101 103 111
6 105 104 102 106 115
7 74 100 93 89 76
8 87 108 97 85 100
9 105 113 91 100 103
10 118 113 97 106 117
11 102 114 94 95 101
12 101 109 90 74 73
13 86 116 105 94 84
14 83 102 103 90 90
15 92 107 112 99 105
16 87 111 114 100 111
17 94 122 111 96 110
18 94 123 106 102 116
19 75 108 112 88 85
20 85 115 102 78 92
21 104 120 103 99 117
22 109 117 105 107 119
23 121 115 101 93 100
24 124 116 101 74 71
25 88 118 117 96 82
26 86 98 109 99 90
27 98 121 120 103 109
28 94 118 115 102 112
29 102 120 107 96 103
30 96 111 110 106 116
31 79 117 110 95 89
32 95 110 105 82 91
33 106 107 116 109 121
34 116 115 116 114 123
35 101 106 111 95 98
36 108 115 120 85 81
37 92 112 111 98 84
38 89 106 115 100 92
39 109 106 125 119 116
40 97 114 116 109 112
41 99 109 113 99 106
42 110 100 122 119 131
43 76 105 123 94 83
44 91 100 117 88 98
45 105 104 136 116 120
46 103 112 121 109 121
47 108 97 120 103 107
48 122 107 126 93 89
49 92 104 116 100 81
50 95 98 108 102 90
51 106 100 117 113 103
52 98 97 113 112 117
53 110 81 113 104 110
54 107 73 126 118 130
55 69 89 114 94 79
56 95 96 113 95 101
57 114 97 112 121 123
58 104 98 113 114 111
59 110 89 116 114 109
60 112 98 112 99 89
61 92 91 119 112 87
62 97 86 117 111 95
63 114 97 125 126 119
64 93 102 113 112 110
65 115 80 120 124 124
66 112 71 114 127 133
67 76 91 114 101 84
68 101 102 118 102 105
69 119 91 117 126 128
70 118 94 121 129 127
71 120 53 115 122 120
72 120 77 117 100 93
73 99 70 119 122 98
74 103 65 115 120 106
75 118 89 126 137 122
76 103 70 118 124 116
77 114 78 118 130 122
78 116 78 115 137 134
79 84 73 122 114 88
80 106 83 117 109 110
81 117 74 106 126 122
82 125 102 111 141 135
83 123 54 114 130 116
84 119 79 114 98 85
85 100 86 125 130 106
86 100 87 125 130 115
87 103 79 120 125 111
88 104 64 121 136 133
89 99 70 111 124 124
90 101 75 124 133 131
91 73 72 120 121 97
92 86 83 126 102 97
93 110 74 116 131 131
94 115 82 117 130 127
95 101 78 106 106 101
96 112 77 102 93 88
97 89 77 106 100 76
98 93 72 97 99 87
99 103 76 108 112 110
100 91 75 99 109 102
101 88 69 101 102 99
102 93 67 106 116 117
103 65 68 105 103 83
104 82 73 103 91 90
105 102 69 102 119 116
106 102 76 107 117 117
107 122 67 100 106 96
108 105 69 101 92 73
109 83 68 105 102 66
110 85 64 118 104 73
111 102 69 129 124 114
112 86 67 124 118 107
113 84 71 128 109 102
114 93 58 129 129 125
115 64 57 128 105 80
116 81 69 125 100 95
117 100 76 125 125 120
118 96 74 130 116 117
119 93 77 125 112 99
120 102 81 122 97 64
121 78 77 129 107 82
122 92 64 124 114 97
123 99 67 144 130 121
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Voedingsmiddelen Tabaksproducten Kleding
-12.90386 -0.16414 0.08795 0.09248
Leer Hout Papier Uitgeverijen
-0.06658 0.50382 0.50990 0.12287
Cokes Chemische Rubber Nietmetaalhoudende
0.05801 -0.28636 0.48877 -0.24207
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.2452 -2.9274 -0.0738 3.3102 10.1212
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -12.90386 10.86744 -1.187 0.237610
Voedingsmiddelen -0.16414 0.08869 -1.851 0.066868 .
Tabaksproducten 0.08795 0.03539 2.485 0.014450 *
Kleding 0.09248 0.03283 2.817 0.005736 **
Leer -0.06658 0.02590 -2.571 0.011473 *
Hout 0.50382 0.09064 5.558 1.89e-07 ***
Papier 0.50990 0.13474 3.784 0.000250 ***
Uitgeverijen 0.12287 0.05051 2.433 0.016579 *
Cokes 0.05801 0.05207 1.114 0.267654
Chemische -0.28636 0.07109 -4.028 0.000103 ***
Rubber 0.48877 0.10946 4.465 1.93e-05 ***
Nietmetaalhoudende -0.24207 0.05500 -4.401 2.49e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.956 on 111 degrees of freedom
Multiple R-squared: 0.8855, Adjusted R-squared: 0.8742
F-statistic: 78.05 on 11 and 111 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.14780212 0.29560425 0.852197875
[2,] 0.06551570 0.13103141 0.934484297
[3,] 0.05711175 0.11422349 0.942888254
[4,] 0.52574024 0.94851951 0.474259757
[5,] 0.47390496 0.94780993 0.526095037
[6,] 0.53915994 0.92168013 0.460840065
[7,] 0.50183005 0.99633989 0.498169945
[8,] 0.46985257 0.93970515 0.530147427
[9,] 0.44885046 0.89770092 0.551149542
[10,] 0.42425408 0.84850816 0.575745920
[11,] 0.47498961 0.94997922 0.525010389
[12,] 0.44391945 0.88783889 0.556080553
[13,] 0.40600002 0.81200003 0.593999985
[14,] 0.34253580 0.68507160 0.657464201
[15,] 0.58640232 0.82719536 0.413597679
[16,] 0.75537829 0.48924341 0.244621706
[17,] 0.70634701 0.58730598 0.293652991
[18,] 0.73225037 0.53549926 0.267749631
[19,] 0.68504077 0.62991845 0.314959226
[20,] 0.62691389 0.74617221 0.373086105
[21,] 0.70204168 0.59591663 0.297958316
[22,] 0.65020915 0.69958169 0.349790847
[23,] 0.59848131 0.80303737 0.401518685
[24,] 0.54796874 0.90406253 0.452031264
[25,] 0.60194232 0.79611536 0.398057680
[26,] 0.75231209 0.49537582 0.247687909
[27,] 0.70329267 0.59341466 0.296707330
[28,] 0.66078296 0.67843409 0.339217045
[29,] 0.77502883 0.44994235 0.224971175
[30,] 0.75712677 0.48574646 0.242873230
[31,] 0.73825532 0.52348935 0.261744676
[32,] 0.89392968 0.21214065 0.106070324
[33,] 0.95188020 0.09623960 0.048119802
[34,] 0.94292749 0.11414502 0.057072508
[35,] 0.95937974 0.08124052 0.040620259
[36,] 0.94940699 0.10118603 0.050593013
[37,] 0.94487701 0.11024598 0.055122992
[38,] 0.94483855 0.11032290 0.055161450
[39,] 0.93678129 0.12643742 0.063218710
[40,] 0.91711158 0.16577683 0.082888417
[41,] 0.91637636 0.16724728 0.083623639
[42,] 0.95328258 0.09343483 0.046717417
[43,] 0.93912694 0.12174612 0.060873058
[44,] 0.92154194 0.15691612 0.078458058
[45,] 0.95305828 0.09388344 0.046941722
[46,] 0.93854802 0.12290396 0.061451980
[47,] 0.92428535 0.15142930 0.075714648
[48,] 0.91691833 0.16616334 0.083081671
[49,] 0.89500927 0.20998147 0.104990733
[50,] 0.87072361 0.25855278 0.129276390
[51,] 0.84766707 0.30466586 0.152332930
[52,] 0.84836317 0.30327367 0.151636834
[53,] 0.95213943 0.09572115 0.047860573
[54,] 0.94914008 0.10171983 0.050859917
[55,] 0.97023186 0.05953628 0.029768139
[56,] 0.97848805 0.04302391 0.021511953
[57,] 0.98918689 0.02162622 0.010813110
[58,] 0.99031569 0.01936861 0.009684307
[59,] 0.98610695 0.02778610 0.013893050
[60,] 0.98654475 0.02691050 0.013455251
[61,] 0.98242343 0.03515314 0.017576572
[62,] 0.97868302 0.04263396 0.021316978
[63,] 0.97330015 0.05339970 0.026699848
[64,] 0.98808005 0.02383990 0.011919950
[65,] 0.98660115 0.02679771 0.013398855
[66,] 0.98774643 0.02450713 0.012253566
[67,] 0.98567823 0.02864353 0.014321766
[68,] 0.98377773 0.03244455 0.016222274
[69,] 0.97946318 0.04107364 0.020536821
[70,] 0.98131188 0.03737625 0.018688125
[71,] 0.97265751 0.05468498 0.027342489
[72,] 0.97727903 0.04544194 0.022720971
[73,] 0.98582328 0.02835345 0.014176724
[74,] 0.97864215 0.04271570 0.021357851
[75,] 0.96932137 0.06135725 0.030678626
[76,] 0.96260363 0.07479274 0.037396369
[77,] 0.95058533 0.09882935 0.049414673
[78,] 0.95949773 0.08100454 0.040502268
[79,] 0.94139587 0.11720825 0.058604126
[80,] 0.93061904 0.13876192 0.069380960
[81,] 0.90984749 0.18030501 0.090152507
[82,] 0.88315966 0.23368067 0.116840337
[83,] 0.85852831 0.28294337 0.141471686
[84,] 0.87184121 0.25631757 0.128158786
[85,] 0.84655710 0.30688579 0.153442897
[86,] 0.79941750 0.40116500 0.200582498
[87,] 0.73666371 0.52667258 0.263336288
[88,] 0.84494837 0.31010327 0.155051634
[89,] 0.77325996 0.45348008 0.226740041
[90,] 0.80242990 0.39514020 0.197570100
[91,] 0.70629517 0.58740966 0.293704829
[92,] 0.64948422 0.70103156 0.350515780
[93,] 0.51834196 0.96331609 0.481658043
[94,] 0.36164041 0.72328083 0.638359587
> postscript(file="/var/wessaorg/rcomp/tmp/1llro1353059437.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/27mab1353059437.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/3q8gl1353059437.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/4srrt1353059437.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/5mdxe1353059437.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 = 123
Frequency = 1
1 2 3 4 5 6
-0.52356142 2.56901565 -2.12955676 -0.24535538 3.59642870 3.24360435
7 8 9 10 11 12
-1.14386843 -9.25609062 3.42297577 5.70789415 8.07959394 -1.72568121
13 14 15 16 17 18
2.68532987 3.72280823 -2.80753056 5.13653372 1.70997734 -4.77335130
19 20 21 22 23 24
6.78417868 -5.26411092 8.56762966 4.59458058 9.22548841 -1.00323123
25 26 27 28 29 30
3.88801121 1.92137802 -1.82015353 0.83832360 -6.92966839 -6.69474204
31 32 33 34 35 36
-1.61027171 -10.10422765 -0.42152430 0.02312995 7.01609556 -0.49861625
37 38 39 40 41 42
0.70873912 0.49574543 -6.59373901 -9.67777396 -2.39005325 -0.63497838
43 44 45 46 47 48
7.14434013 -3.57049644 4.07329361 9.38514639 9.32140614 1.14017020
49 50 51 52 53 54
-7.17219382 -1.47303325 -5.41662491 -5.04428019 -5.59809209 -1.01438799
55 56 57 58 59 60
2.59188215 -10.87528651 -0.92053044 -0.07376613 7.46875417 -0.48930153
61 62 63 64 65 66
-3.49892091 2.23539995 -2.46921818 -2.80360330 -3.86173760 3.01296963
67 68 69 70 71 72
9.01519863 -5.74801087 5.18756610 4.08603129 8.29115705 0.32602993
73 74 75 76 77 78
1.11753878 1.65644804 -3.45700894 2.27159143 -3.98036436 -12.24520671
79 80 81 82 83 84
1.91575819 -6.88819937 1.68114724 0.50098969 4.79434515 4.35622888
85 86 87 88 89 90
-2.91008012 3.23816594 -0.43392243 -2.94480619 -2.09024661 -4.19706983
91 92 93 94 95 96
5.77251095 1.71748284 3.37686112 0.83933323 6.83012744 4.62184281
97 98 99 100 101 102
-4.32009414 -1.46376828 0.45986883 -4.66698219 -2.28737906 -5.66627290
103 104 105 106 107 108
5.59214650 -3.94081078 -2.61829739 4.14945504 -2.37223940 -1.84675831
109 110 111 112 113 114
-4.56208208 2.29517910 -1.55590991 -0.05203058 0.85986987 -2.07055058
115 116 117 118 119 120
10.12119498 -2.71404852 2.36212377 3.99887902 -0.05402058 -7.60833443
121 122 123
-6.33037564 -2.99023474 0.79876834
> postscript(file="/var/wessaorg/rcomp/tmp/6ere71353059437.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 = 123
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.52356142 NA
1 2.56901565 -0.52356142
2 -2.12955676 2.56901565
3 -0.24535538 -2.12955676
4 3.59642870 -0.24535538
5 3.24360435 3.59642870
6 -1.14386843 3.24360435
7 -9.25609062 -1.14386843
8 3.42297577 -9.25609062
9 5.70789415 3.42297577
10 8.07959394 5.70789415
11 -1.72568121 8.07959394
12 2.68532987 -1.72568121
13 3.72280823 2.68532987
14 -2.80753056 3.72280823
15 5.13653372 -2.80753056
16 1.70997734 5.13653372
17 -4.77335130 1.70997734
18 6.78417868 -4.77335130
19 -5.26411092 6.78417868
20 8.56762966 -5.26411092
21 4.59458058 8.56762966
22 9.22548841 4.59458058
23 -1.00323123 9.22548841
24 3.88801121 -1.00323123
25 1.92137802 3.88801121
26 -1.82015353 1.92137802
27 0.83832360 -1.82015353
28 -6.92966839 0.83832360
29 -6.69474204 -6.92966839
30 -1.61027171 -6.69474204
31 -10.10422765 -1.61027171
32 -0.42152430 -10.10422765
33 0.02312995 -0.42152430
34 7.01609556 0.02312995
35 -0.49861625 7.01609556
36 0.70873912 -0.49861625
37 0.49574543 0.70873912
38 -6.59373901 0.49574543
39 -9.67777396 -6.59373901
40 -2.39005325 -9.67777396
41 -0.63497838 -2.39005325
42 7.14434013 -0.63497838
43 -3.57049644 7.14434013
44 4.07329361 -3.57049644
45 9.38514639 4.07329361
46 9.32140614 9.38514639
47 1.14017020 9.32140614
48 -7.17219382 1.14017020
49 -1.47303325 -7.17219382
50 -5.41662491 -1.47303325
51 -5.04428019 -5.41662491
52 -5.59809209 -5.04428019
53 -1.01438799 -5.59809209
54 2.59188215 -1.01438799
55 -10.87528651 2.59188215
56 -0.92053044 -10.87528651
57 -0.07376613 -0.92053044
58 7.46875417 -0.07376613
59 -0.48930153 7.46875417
60 -3.49892091 -0.48930153
61 2.23539995 -3.49892091
62 -2.46921818 2.23539995
63 -2.80360330 -2.46921818
64 -3.86173760 -2.80360330
65 3.01296963 -3.86173760
66 9.01519863 3.01296963
67 -5.74801087 9.01519863
68 5.18756610 -5.74801087
69 4.08603129 5.18756610
70 8.29115705 4.08603129
71 0.32602993 8.29115705
72 1.11753878 0.32602993
73 1.65644804 1.11753878
74 -3.45700894 1.65644804
75 2.27159143 -3.45700894
76 -3.98036436 2.27159143
77 -12.24520671 -3.98036436
78 1.91575819 -12.24520671
79 -6.88819937 1.91575819
80 1.68114724 -6.88819937
81 0.50098969 1.68114724
82 4.79434515 0.50098969
83 4.35622888 4.79434515
84 -2.91008012 4.35622888
85 3.23816594 -2.91008012
86 -0.43392243 3.23816594
87 -2.94480619 -0.43392243
88 -2.09024661 -2.94480619
89 -4.19706983 -2.09024661
90 5.77251095 -4.19706983
91 1.71748284 5.77251095
92 3.37686112 1.71748284
93 0.83933323 3.37686112
94 6.83012744 0.83933323
95 4.62184281 6.83012744
96 -4.32009414 4.62184281
97 -1.46376828 -4.32009414
98 0.45986883 -1.46376828
99 -4.66698219 0.45986883
100 -2.28737906 -4.66698219
101 -5.66627290 -2.28737906
102 5.59214650 -5.66627290
103 -3.94081078 5.59214650
104 -2.61829739 -3.94081078
105 4.14945504 -2.61829739
106 -2.37223940 4.14945504
107 -1.84675831 -2.37223940
108 -4.56208208 -1.84675831
109 2.29517910 -4.56208208
110 -1.55590991 2.29517910
111 -0.05203058 -1.55590991
112 0.85986987 -0.05203058
113 -2.07055058 0.85986987
114 10.12119498 -2.07055058
115 -2.71404852 10.12119498
116 2.36212377 -2.71404852
117 3.99887902 2.36212377
118 -0.05402058 3.99887902
119 -7.60833443 -0.05402058
120 -6.33037564 -7.60833443
121 -2.99023474 -6.33037564
122 0.79876834 -2.99023474
123 NA 0.79876834
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.56901565 -0.52356142
[2,] -2.12955676 2.56901565
[3,] -0.24535538 -2.12955676
[4,] 3.59642870 -0.24535538
[5,] 3.24360435 3.59642870
[6,] -1.14386843 3.24360435
[7,] -9.25609062 -1.14386843
[8,] 3.42297577 -9.25609062
[9,] 5.70789415 3.42297577
[10,] 8.07959394 5.70789415
[11,] -1.72568121 8.07959394
[12,] 2.68532987 -1.72568121
[13,] 3.72280823 2.68532987
[14,] -2.80753056 3.72280823
[15,] 5.13653372 -2.80753056
[16,] 1.70997734 5.13653372
[17,] -4.77335130 1.70997734
[18,] 6.78417868 -4.77335130
[19,] -5.26411092 6.78417868
[20,] 8.56762966 -5.26411092
[21,] 4.59458058 8.56762966
[22,] 9.22548841 4.59458058
[23,] -1.00323123 9.22548841
[24,] 3.88801121 -1.00323123
[25,] 1.92137802 3.88801121
[26,] -1.82015353 1.92137802
[27,] 0.83832360 -1.82015353
[28,] -6.92966839 0.83832360
[29,] -6.69474204 -6.92966839
[30,] -1.61027171 -6.69474204
[31,] -10.10422765 -1.61027171
[32,] -0.42152430 -10.10422765
[33,] 0.02312995 -0.42152430
[34,] 7.01609556 0.02312995
[35,] -0.49861625 7.01609556
[36,] 0.70873912 -0.49861625
[37,] 0.49574543 0.70873912
[38,] -6.59373901 0.49574543
[39,] -9.67777396 -6.59373901
[40,] -2.39005325 -9.67777396
[41,] -0.63497838 -2.39005325
[42,] 7.14434013 -0.63497838
[43,] -3.57049644 7.14434013
[44,] 4.07329361 -3.57049644
[45,] 9.38514639 4.07329361
[46,] 9.32140614 9.38514639
[47,] 1.14017020 9.32140614
[48,] -7.17219382 1.14017020
[49,] -1.47303325 -7.17219382
[50,] -5.41662491 -1.47303325
[51,] -5.04428019 -5.41662491
[52,] -5.59809209 -5.04428019
[53,] -1.01438799 -5.59809209
[54,] 2.59188215 -1.01438799
[55,] -10.87528651 2.59188215
[56,] -0.92053044 -10.87528651
[57,] -0.07376613 -0.92053044
[58,] 7.46875417 -0.07376613
[59,] -0.48930153 7.46875417
[60,] -3.49892091 -0.48930153
[61,] 2.23539995 -3.49892091
[62,] -2.46921818 2.23539995
[63,] -2.80360330 -2.46921818
[64,] -3.86173760 -2.80360330
[65,] 3.01296963 -3.86173760
[66,] 9.01519863 3.01296963
[67,] -5.74801087 9.01519863
[68,] 5.18756610 -5.74801087
[69,] 4.08603129 5.18756610
[70,] 8.29115705 4.08603129
[71,] 0.32602993 8.29115705
[72,] 1.11753878 0.32602993
[73,] 1.65644804 1.11753878
[74,] -3.45700894 1.65644804
[75,] 2.27159143 -3.45700894
[76,] -3.98036436 2.27159143
[77,] -12.24520671 -3.98036436
[78,] 1.91575819 -12.24520671
[79,] -6.88819937 1.91575819
[80,] 1.68114724 -6.88819937
[81,] 0.50098969 1.68114724
[82,] 4.79434515 0.50098969
[83,] 4.35622888 4.79434515
[84,] -2.91008012 4.35622888
[85,] 3.23816594 -2.91008012
[86,] -0.43392243 3.23816594
[87,] -2.94480619 -0.43392243
[88,] -2.09024661 -2.94480619
[89,] -4.19706983 -2.09024661
[90,] 5.77251095 -4.19706983
[91,] 1.71748284 5.77251095
[92,] 3.37686112 1.71748284
[93,] 0.83933323 3.37686112
[94,] 6.83012744 0.83933323
[95,] 4.62184281 6.83012744
[96,] -4.32009414 4.62184281
[97,] -1.46376828 -4.32009414
[98,] 0.45986883 -1.46376828
[99,] -4.66698219 0.45986883
[100,] -2.28737906 -4.66698219
[101,] -5.66627290 -2.28737906
[102,] 5.59214650 -5.66627290
[103,] -3.94081078 5.59214650
[104,] -2.61829739 -3.94081078
[105,] 4.14945504 -2.61829739
[106,] -2.37223940 4.14945504
[107,] -1.84675831 -2.37223940
[108,] -4.56208208 -1.84675831
[109,] 2.29517910 -4.56208208
[110,] -1.55590991 2.29517910
[111,] -0.05203058 -1.55590991
[112,] 0.85986987 -0.05203058
[113,] -2.07055058 0.85986987
[114,] 10.12119498 -2.07055058
[115,] -2.71404852 10.12119498
[116,] 2.36212377 -2.71404852
[117,] 3.99887902 2.36212377
[118,] -0.05402058 3.99887902
[119,] -7.60833443 -0.05402058
[120,] -6.33037564 -7.60833443
[121,] -2.99023474 -6.33037564
[122,] 0.79876834 -2.99023474
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.56901565 -0.52356142
2 -2.12955676 2.56901565
3 -0.24535538 -2.12955676
4 3.59642870 -0.24535538
5 3.24360435 3.59642870
6 -1.14386843 3.24360435
7 -9.25609062 -1.14386843
8 3.42297577 -9.25609062
9 5.70789415 3.42297577
10 8.07959394 5.70789415
11 -1.72568121 8.07959394
12 2.68532987 -1.72568121
13 3.72280823 2.68532987
14 -2.80753056 3.72280823
15 5.13653372 -2.80753056
16 1.70997734 5.13653372
17 -4.77335130 1.70997734
18 6.78417868 -4.77335130
19 -5.26411092 6.78417868
20 8.56762966 -5.26411092
21 4.59458058 8.56762966
22 9.22548841 4.59458058
23 -1.00323123 9.22548841
24 3.88801121 -1.00323123
25 1.92137802 3.88801121
26 -1.82015353 1.92137802
27 0.83832360 -1.82015353
28 -6.92966839 0.83832360
29 -6.69474204 -6.92966839
30 -1.61027171 -6.69474204
31 -10.10422765 -1.61027171
32 -0.42152430 -10.10422765
33 0.02312995 -0.42152430
34 7.01609556 0.02312995
35 -0.49861625 7.01609556
36 0.70873912 -0.49861625
37 0.49574543 0.70873912
38 -6.59373901 0.49574543
39 -9.67777396 -6.59373901
40 -2.39005325 -9.67777396
41 -0.63497838 -2.39005325
42 7.14434013 -0.63497838
43 -3.57049644 7.14434013
44 4.07329361 -3.57049644
45 9.38514639 4.07329361
46 9.32140614 9.38514639
47 1.14017020 9.32140614
48 -7.17219382 1.14017020
49 -1.47303325 -7.17219382
50 -5.41662491 -1.47303325
51 -5.04428019 -5.41662491
52 -5.59809209 -5.04428019
53 -1.01438799 -5.59809209
54 2.59188215 -1.01438799
55 -10.87528651 2.59188215
56 -0.92053044 -10.87528651
57 -0.07376613 -0.92053044
58 7.46875417 -0.07376613
59 -0.48930153 7.46875417
60 -3.49892091 -0.48930153
61 2.23539995 -3.49892091
62 -2.46921818 2.23539995
63 -2.80360330 -2.46921818
64 -3.86173760 -2.80360330
65 3.01296963 -3.86173760
66 9.01519863 3.01296963
67 -5.74801087 9.01519863
68 5.18756610 -5.74801087
69 4.08603129 5.18756610
70 8.29115705 4.08603129
71 0.32602993 8.29115705
72 1.11753878 0.32602993
73 1.65644804 1.11753878
74 -3.45700894 1.65644804
75 2.27159143 -3.45700894
76 -3.98036436 2.27159143
77 -12.24520671 -3.98036436
78 1.91575819 -12.24520671
79 -6.88819937 1.91575819
80 1.68114724 -6.88819937
81 0.50098969 1.68114724
82 4.79434515 0.50098969
83 4.35622888 4.79434515
84 -2.91008012 4.35622888
85 3.23816594 -2.91008012
86 -0.43392243 3.23816594
87 -2.94480619 -0.43392243
88 -2.09024661 -2.94480619
89 -4.19706983 -2.09024661
90 5.77251095 -4.19706983
91 1.71748284 5.77251095
92 3.37686112 1.71748284
93 0.83933323 3.37686112
94 6.83012744 0.83933323
95 4.62184281 6.83012744
96 -4.32009414 4.62184281
97 -1.46376828 -4.32009414
98 0.45986883 -1.46376828
99 -4.66698219 0.45986883
100 -2.28737906 -4.66698219
101 -5.66627290 -2.28737906
102 5.59214650 -5.66627290
103 -3.94081078 5.59214650
104 -2.61829739 -3.94081078
105 4.14945504 -2.61829739
106 -2.37223940 4.14945504
107 -1.84675831 -2.37223940
108 -4.56208208 -1.84675831
109 2.29517910 -4.56208208
110 -1.55590991 2.29517910
111 -0.05203058 -1.55590991
112 0.85986987 -0.05203058
113 -2.07055058 0.85986987
114 10.12119498 -2.07055058
115 -2.71404852 10.12119498
116 2.36212377 -2.71404852
117 3.99887902 2.36212377
118 -0.05402058 3.99887902
119 -7.60833443 -0.05402058
120 -6.33037564 -7.60833443
121 -2.99023474 -6.33037564
122 0.79876834 -2.99023474
> 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/7ttv11353059437.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/81ito1353059437.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/9u2uh1353059437.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/10lk331353059437.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/11ehkj1353059437.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/12mums1353059437.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/13aez51353059438.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/14axv51353059438.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/15q42p1353059438.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/16mps71353059438.tab")
+ }
>
> try(system("convert tmp/1llro1353059437.ps tmp/1llro1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/27mab1353059437.ps tmp/27mab1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/3q8gl1353059437.ps tmp/3q8gl1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/4srrt1353059437.ps tmp/4srrt1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/5mdxe1353059437.ps tmp/5mdxe1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ere71353059437.ps tmp/6ere71353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ttv11353059437.ps tmp/7ttv11353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/81ito1353059437.ps tmp/81ito1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/9u2uh1353059437.ps tmp/9u2uh1353059437.png",intern=TRUE))
character(0)
> try(system("convert tmp/10lk331353059437.ps tmp/10lk331353059437.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
9.189 1.109 10.285