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(41
+ ,38
+ ,13
+ ,12
+ ,14
+ ,12
+ ,53
+ ,39
+ ,32
+ ,16
+ ,11
+ ,18
+ ,11
+ ,86
+ ,30
+ ,35
+ ,19
+ ,15
+ ,11
+ ,14
+ ,66
+ ,31
+ ,33
+ ,15
+ ,6
+ ,12
+ ,12
+ ,67
+ ,34
+ ,37
+ ,14
+ ,13
+ ,16
+ ,21
+ ,76
+ ,35
+ ,29
+ ,13
+ ,10
+ ,18
+ ,12
+ ,78
+ ,39
+ ,31
+ ,19
+ ,12
+ ,14
+ ,22
+ ,53
+ ,34
+ ,36
+ ,15
+ ,14
+ ,14
+ ,11
+ ,80
+ ,36
+ ,35
+ ,14
+ ,12
+ ,15
+ ,10
+ ,74
+ ,37
+ ,38
+ ,15
+ ,6
+ ,15
+ ,13
+ ,76
+ ,38
+ ,31
+ ,16
+ ,10
+ ,17
+ ,10
+ ,79
+ ,36
+ ,34
+ ,16
+ ,12
+ ,19
+ ,8
+ ,54
+ ,38
+ ,35
+ ,16
+ ,12
+ ,10
+ ,15
+ ,67
+ ,39
+ ,38
+ ,16
+ ,11
+ ,16
+ ,14
+ ,54
+ ,33
+ ,37
+ ,17
+ ,15
+ ,18
+ ,10
+ ,87
+ ,32
+ ,33
+ ,15
+ ,12
+ ,14
+ ,14
+ ,58
+ ,36
+ ,32
+ ,15
+ ,10
+ ,14
+ ,14
+ ,75
+ ,38
+ ,38
+ ,20
+ ,12
+ ,17
+ ,11
+ ,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onging')
+ ,1:162))
> y <- array(NA,dim=c(7,162),dimnames=list(c('Connected','Separate','Learning','Software','Happiness','Depression','Belonging'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '4'
> 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
Software Connected Separate Learning Happiness Depression Belonging t
1 12 41 38 13 14 12 53 1
2 11 39 32 16 18 11 86 2
3 15 30 35 19 11 14 66 3
4 6 31 33 15 12 12 67 4
5 13 34 37 14 16 21 76 5
6 10 35 29 13 18 12 78 6
7 12 39 31 19 14 22 53 7
8 14 34 36 15 14 11 80 8
9 12 36 35 14 15 10 74 9
10 6 37 38 15 15 13 76 10
11 10 38 31 16 17 10 79 11
12 12 36 34 16 19 8 54 12
13 12 38 35 16 10 15 67 13
14 11 39 38 16 16 14 54 14
15 15 33 37 17 18 10 87 15
16 12 32 33 15 14 14 58 16
17 10 36 32 15 14 14 75 17
18 12 38 38 20 17 11 88 18
19 11 39 38 18 14 10 64 19
20 12 32 32 16 16 13 57 20
21 11 32 33 16 18 7 66 21
22 12 31 31 16 11 14 68 22
23 13 39 38 19 14 12 54 23
24 11 37 39 16 12 14 56 24
25 9 39 32 17 17 11 86 25
26 13 41 32 17 9 9 80 26
27 10 36 35 16 16 11 76 27
28 14 33 37 15 14 15 69 28
29 12 33 33 16 15 14 78 29
30 10 34 33 14 11 13 67 30
31 12 31 28 15 16 9 80 31
32 8 27 32 12 13 15 54 32
33 10 37 31 14 17 10 71 33
34 12 34 37 16 15 11 84 34
35 12 34 30 14 14 13 74 35
36 7 32 33 7 16 8 71 36
37 6 29 31 10 9 20 63 37
38 12 36 33 14 15 12 71 38
39 10 29 31 16 17 10 76 39
40 10 35 33 16 13 10 69 40
41 10 37 32 16 15 9 74 41
42 12 34 33 14 16 14 75 42
43 15 38 32 20 16 8 54 43
44 10 35 33 14 12 14 52 44
45 10 38 28 14 12 11 69 45
46 12 37 35 11 11 13 68 46
47 13 38 39 14 15 9 65 47
48 11 33 34 15 15 11 75 48
49 11 36 38 16 17 15 74 49
50 12 38 32 14 13 11 75 50
51 14 32 38 16 16 10 72 51
52 10 32 30 14 14 14 67 52
53 12 32 33 12 11 18 63 53
54 13 34 38 16 12 14 62 54
55 5 32 32 9 12 11 63 55
56 6 37 32 14 15 12 76 56
57 12 39 34 16 16 13 74 57
58 12 29 34 16 15 9 67 58
59 11 37 36 15 12 10 73 59
60 10 35 34 16 12 15 70 60
61 7 30 28 12 8 20 53 61
62 12 38 34 16 13 12 77 62
63 14 34 35 16 11 12 77 63
64 11 31 35 14 14 14 52 64
65 12 34 31 16 15 13 54 65
66 13 35 37 17 10 11 80 66
67 14 36 35 18 11 17 66 67
68 11 30 27 18 12 12 73 68
69 12 39 40 12 15 13 63 69
70 12 35 37 16 15 14 69 70
71 8 38 36 10 14 13 67 71
72 11 31 38 14 16 15 54 72
73 14 34 39 18 15 13 81 73
74 14 38 41 18 15 10 69 74
75 12 34 27 16 13 11 84 75
76 9 39 30 17 12 19 80 76
77 13 37 37 16 17 13 70 77
78 11 34 31 16 13 17 69 78
79 12 28 31 13 15 13 77 79
80 12 37 27 16 13 9 54 80
81 12 33 36 16 15 11 79 81
82 12 37 38 20 16 10 30 82
83 12 35 37 16 15 9 71 83
84 12 37 33 15 16 12 73 84
85 11 32 34 15 15 12 72 85
86 10 33 31 16 14 13 77 86
87 9 38 39 14 15 13 75 87
88 12 33 34 16 14 12 69 88
89 12 29 32 16 13 15 54 89
90 12 33 33 15 7 22 70 90
91 9 31 36 12 17 13 73 91
92 15 36 32 17 13 15 54 92
93 12 35 41 16 15 13 77 93
94 12 32 28 15 14 15 82 94
95 12 29 30 13 13 10 80 95
96 10 39 36 16 16 11 80 96
97 13 37 35 16 12 16 69 97
98 9 35 31 16 14 11 78 98
99 12 37 34 16 17 11 81 99
100 10 32 36 14 15 10 76 100
101 14 38 36 16 17 10 76 101
102 11 37 35 16 12 16 73 102
103 15 36 37 20 16 12 85 103
104 11 32 28 15 11 11 66 104
105 11 33 39 16 15 16 79 105
106 12 40 32 13 9 19 68 106
107 12 38 35 17 16 11 76 107
108 12 41 39 16 15 16 71 108
109 11 36 35 16 10 15 54 109
110 7 43 42 12 10 24 46 110
111 12 30 34 16 15 14 82 111
112 14 31 33 16 11 15 74 112
113 11 32 41 17 13 11 88 113
114 11 32 33 13 14 15 38 114
115 10 37 34 12 18 12 76 115
116 13 37 32 18 16 10 86 116
117 13 33 40 14 14 14 54 117
118 8 34 40 14 14 13 70 118
119 11 33 35 13 14 9 69 119
120 12 38 36 16 14 15 90 120
121 11 33 37 13 12 15 54 121
122 13 31 27 16 14 14 76 122
123 12 38 39 13 15 11 89 123
124 14 37 38 16 15 8 76 124
125 13 33 31 15 15 11 73 125
126 15 31 33 16 13 11 79 126
127 10 39 32 15 17 8 90 127
128 11 44 39 17 17 10 74 128
129 9 33 36 15 19 11 81 129
130 11 35 33 12 15 13 72 130
131 10 32 33 16 13 11 71 131
132 11 28 32 10 9 20 66 132
133 8 40 37 16 15 10 77 133
134 11 27 30 12 15 15 65 134
135 12 37 38 14 15 12 74 135
136 12 32 29 15 16 14 82 136
137 9 28 22 13 11 23 54 137
138 11 34 35 15 14 14 63 138
139 10 30 35 11 11 16 54 139
140 8 35 34 12 15 11 64 140
141 9 31 35 8 13 12 69 141
142 8 32 34 16 15 10 54 142
143 9 30 34 15 16 14 84 143
144 15 30 35 17 14 12 86 144
145 11 31 23 16 15 12 77 145
146 8 40 31 10 16 11 89 146
147 13 32 27 18 16 12 76 147
148 12 36 36 13 11 13 60 148
149 12 32 31 16 12 11 75 149
150 9 35 32 13 9 19 73 150
151 7 38 39 10 16 12 85 151
152 13 42 37 15 13 17 79 152
153 9 34 38 16 16 9 71 153
154 6 35 39 16 12 12 72 154
155 8 35 34 14 9 19 69 155
156 8 33 31 10 13 18 78 156
157 15 36 32 17 13 15 54 157
158 6 32 37 13 14 14 69 158
159 9 33 36 15 19 11 81 159
160 11 34 32 16 13 9 84 160
161 8 32 35 12 12 18 84 161
162 8 34 36 13 13 16 69 162
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Connected Separate Learning Happiness Depression
4.723146 -0.051401 0.036375 0.521164 -0.043863 -0.019363
Belonging t
0.002016 -0.002410
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.6966 -1.0310 0.2315 1.3055 3.2589
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.723146 2.568571 1.839 0.0679 .
Connected -0.051401 0.047191 -1.089 0.2778
Separate 0.036375 0.044151 0.824 0.4113
Learning 0.521164 0.067653 7.704 1.51e-12 ***
Happiness -0.043863 0.075403 -0.582 0.5616
Depression -0.019363 0.055610 -0.348 0.7282
Belonging 0.002016 0.014509 0.139 0.8897
t -0.002410 0.003221 -0.748 0.4555
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.823 on 154 degrees of freedom
Multiple R-squared: 0.307, Adjusted R-squared: 0.2755
F-statistic: 9.746 on 7 and 154 DF, p-value: 5.071e-10
> 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.99979836 0.0004032766 0.0002016383
[2,] 0.99957885 0.0008423066 0.0004211533
[3,] 0.99953442 0.0009311506 0.0004655753
[4,] 0.99896503 0.0020699353 0.0010349677
[5,] 0.99884385 0.0023123089 0.0011561544
[6,] 0.99807612 0.0038477552 0.0019238776
[7,] 0.99634750 0.0073049928 0.0036524964
[8,] 0.99524034 0.0095193143 0.0047596571
[9,] 0.99245373 0.0150925495 0.0075462748
[10,] 0.98739271 0.0252145766 0.0126072883
[11,] 0.98046505 0.0390699047 0.0195349524
[12,] 0.97305034 0.0538993299 0.0269496649
[13,] 0.96117259 0.0776548172 0.0388274086
[14,] 0.94569311 0.1086137870 0.0543068935
[15,] 0.94044972 0.1191005588 0.0595502794
[16,] 0.95863568 0.0827286309 0.0413643154
[17,] 0.94889175 0.1022165096 0.0511082548
[18,] 0.95511756 0.0897648738 0.0448824369
[19,] 0.93796624 0.1240675249 0.0620337624
[20,] 0.92142895 0.1571420908 0.0785710454
[21,] 0.90479601 0.1904079836 0.0952039918
[22,] 0.91879074 0.1624185275 0.0812092637
[23,] 0.89485866 0.2102826845 0.1051413423
[24,] 0.86509989 0.2698002191 0.1349001095
[25,] 0.85491462 0.2901707680 0.1450853840
[26,] 0.82182736 0.3563452820 0.1781726410
[27,] 0.86027547 0.2794490689 0.1397245344
[28,] 0.85283034 0.2943393142 0.1471696571
[29,] 0.84632887 0.3073422528 0.1536711264
[30,] 0.83134181 0.3373163731 0.1686581865
[31,] 0.81116221 0.3776755865 0.1888377932
[32,] 0.79846887 0.4030622599 0.2015311299
[33,] 0.79985706 0.4002858774 0.2001429387
[34,] 0.76429497 0.4714100640 0.2357050320
[35,] 0.72682805 0.5463439093 0.2731719546
[36,] 0.77284052 0.4543189694 0.2271594847
[37,] 0.76435932 0.4712813674 0.2356406837
[38,] 0.72559844 0.5488031253 0.2744015626
[39,] 0.69994283 0.6001143498 0.3000571749
[40,] 0.67622121 0.6475575804 0.3237787902
[41,] 0.66409457 0.6718108560 0.3359054280
[42,] 0.62303436 0.7539312899 0.3769656450
[43,] 0.62718338 0.7456332373 0.3728166186
[44,] 0.58367735 0.8326453076 0.4163226538
[45,] 0.70445658 0.5910868313 0.2955434156
[46,] 0.88641848 0.2271630423 0.1135815211
[47,] 0.86190306 0.2761938880 0.1380969440
[48,] 0.83397508 0.3320498380 0.1660249190
[49,] 0.80595129 0.3880974224 0.1940487112
[50,] 0.80795716 0.3840856762 0.1920428381
[51,] 0.84672255 0.3065548979 0.1532774489
[52,] 0.81913155 0.3617369074 0.1808684537
[53,] 0.81866677 0.3626664678 0.1813332339
[54,] 0.78644279 0.4271144122 0.2135572061
[55,] 0.75526171 0.4894765762 0.2447382881
[56,] 0.71616276 0.5676744878 0.2838372439
[57,] 0.68687410 0.6262518071 0.3131259035
[58,] 0.69547712 0.6090457645 0.3045228823
[59,] 0.68504999 0.6299000278 0.3149500139
[60,] 0.64375848 0.7124830366 0.3562415183
[61,] 0.62013563 0.7597287441 0.3798643720
[62,] 0.57774701 0.8445059873 0.4222529936
[63,] 0.53855352 0.9228929523 0.4614464762
[64,] 0.50361990 0.9927601941 0.4963800971
[65,] 0.47565514 0.9513102759 0.5243448621
[66,] 0.57341179 0.8531764235 0.4265882117
[67,] 0.54228203 0.9154359370 0.4577179685
[68,] 0.51401173 0.9719765395 0.4859882698
[69,] 0.49568176 0.9913635269 0.5043182366
[70,] 0.47082264 0.9416452890 0.5291773555
[71,] 0.42690626 0.8538125241 0.5730937380
[72,] 0.43723127 0.8744625420 0.5627687290
[73,] 0.39352514 0.7870502724 0.6064748638
[74,] 0.35435289 0.7087057723 0.6456471139
[75,] 0.31895614 0.6379122785 0.6810438608
[76,] 0.34326942 0.6865388365 0.6567305817
[77,] 0.36995710 0.7399141939 0.6300429030
[78,] 0.32955109 0.6591021764 0.6704489118
[79,] 0.29439157 0.5887831304 0.7056084348
[80,] 0.26368687 0.5273737306 0.7363131347
[81,] 0.24698723 0.4939744548 0.7530127726
[82,] 0.28953856 0.5790771279 0.7104614361
[83,] 0.25437669 0.5087533895 0.7456233052
[84,] 0.22982137 0.4596427394 0.7701786303
[85,] 0.20833185 0.4166636903 0.7916681548
[86,] 0.21926202 0.4385240302 0.7807379849
[87,] 0.19314387 0.3862877488 0.8068561256
[88,] 0.29639892 0.5927978401 0.7036010800
[89,] 0.25896289 0.5179257750 0.7410371125
[90,] 0.25417543 0.5083508673 0.7458245663
[91,] 0.25754766 0.5150953166 0.7424523417
[92,] 0.24029419 0.4805883746 0.7597058127
[93,] 0.21514987 0.4302997343 0.7848501328
[94,] 0.23010226 0.4602045229 0.7698977385
[95,] 0.20725308 0.4145061667 0.7927469166
[96,] 0.19059152 0.3811830453 0.8094084774
[97,] 0.16234207 0.3246841445 0.8376579277
[98,] 0.13690540 0.2738107952 0.8630946024
[99,] 0.13091528 0.2618305657 0.8690847172
[100,] 0.17322224 0.3464444809 0.8267777596
[101,] 0.14449673 0.2889934699 0.8555032651
[102,] 0.12984587 0.2596917441 0.8701541279
[103,] 0.13935675 0.2787134970 0.8606432515
[104,] 0.11464464 0.2292892728 0.8853553636
[105,] 0.09207026 0.1841405193 0.9079297404
[106,] 0.07432828 0.1486565675 0.9256717163
[107,] 0.07845330 0.1569065907 0.9215467047
[108,] 0.12659010 0.2531802034 0.8734098983
[109,] 0.10245555 0.2049110953 0.8975444523
[110,] 0.08421896 0.1684379285 0.9157810358
[111,] 0.06553558 0.1310711544 0.9344644228
[112,] 0.05284327 0.1056865452 0.9471567274
[113,] 0.04364679 0.0872935849 0.9563532075
[114,] 0.04456855 0.0891370963 0.9554314519
[115,] 0.03795432 0.0759086333 0.9620456833
[116,] 0.05410387 0.1082077369 0.9458961315
[117,] 0.04584797 0.0916959353 0.9541520323
[118,] 0.03544571 0.0708914174 0.9645542913
[119,] 0.03482488 0.0696497612 0.9651751194
[120,] 0.02743387 0.0548677395 0.9725661302
[121,] 0.02766983 0.0553396519 0.9723301741
[122,] 0.02381921 0.0476384247 0.9761807877
[123,] 0.07905353 0.1581070510 0.9209464745
[124,] 0.07239050 0.1447809959 0.9276095021
[125,] 0.05608890 0.1121777911 0.9439111045
[126,] 0.04078155 0.0815630987 0.9592184507
[127,] 0.04066048 0.0813209651 0.9593395174
[128,] 0.02789289 0.0557857812 0.9721071094
[129,] 0.02213249 0.0442649720 0.9778675140
[130,] 0.01776254 0.0355250889 0.9822374556
[131,] 0.03654163 0.0730832608 0.9634583696
[132,] 0.05483280 0.1096655979 0.9451672011
[133,] 0.05039893 0.1007978683 0.9496010658
[134,] 0.31583211 0.6316642149 0.6841678925
[135,] 0.30368772 0.6073754431 0.6963122785
[136,] 0.56084469 0.8783106270 0.4391553135
[137,] 0.51845151 0.9630969781 0.4815484890
[138,] 0.73951521 0.5209695790 0.2604847895
[139,] 0.78237024 0.4352595232 0.2176297616
[140,] 0.65541688 0.6891662429 0.3445831215
[141,] 0.51729302 0.9654139615 0.4827069808
> postscript(file="/var/wessaorg/rcomp/tmp/1vef81353262287.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/2exj61353262287.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/37nqb1353262287.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/494sw1353262287.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/53cjq1353262287.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 162
Frequency = 1
1 2 3 4 5 6
1.96892501 -0.38714160 1.27140509 -5.51425507 2.34959826 0.12500115
7 8 9 10 11 12
-0.79815551 2.58262280 1.28196827 -5.24045271 -1.42959339 0.46028681
13 14 15 16 17 18
0.24368740 -0.54160352 2.61136919 0.71065919 -1.07922129 -1.75078175
19 20 21 22 23 24
-1.75721681 0.30588903 -0.77466612 0.07355577 -0.20985859 -0.83616398
25 26 27 28 29 30
-2.89673918 0.83093501 -1.65778608 2.64267135 0.27577392 -0.80072912
31 32 33 34 35 36
0.82384840 -1.92435391 -0.36951904 0.12354437 1.43792412 -0.12647871
37 38 39 40 41 42
-2.82758108 1.46937991 -1.81867195 -1.74194994 -1.54207881 1.45074412
43 44 45 46 47 48
1.49429968 -0.62212628 -0.37599721 2.88076160 2.32963099 -0.24568654
49 50 51 52 53 54
-0.58854425 1.52232366 2.07402831 -0.59043428 2.29910456 1.10621428
55 56 57 58 59 60
-3.18788243 -4.40954350 0.64784733 0.02904719 -0.23324380 -1.67919037
61 62 63 64 65 66
-2.67525148 0.45149696 2.12420319 0.23544880 0.51569914 0.51964729
67 68 69 70 71 72
1.31330182 -1.76875605 2.52148809 0.35002927 -0.38919194 0.24866307
73 74 75 76 77 78
1.14722919 1.24859402 0.49837309 -2.75340109 1.53604892 -0.49348316
79 80 81 82 83 84
1.75816646 0.68637228 0.23186728 -1.59425464 0.28051490 1.15030830
85 86 87 88 89 90
-0.18250710 -1.57531680 -1.51667577 0.31714308 0.23116006 0.76406912
91 92 93 94 95 96
-0.62362992 3.07703031 0.22447288 1.05149701 1.73264012 -1.38173104
97 98 99 100 101 102
1.49778509 -2.48433630 0.63729421 -0.74472970 2.61148202 -0.49822785
103 104 105 106 107 108
1.36918859 -0.10119129 -0.72260306 2.27480763 0.11665141 0.71195826
109 110 111 112 113 114
-0.60154852 -2.21890824 0.27475506 2.22497557 -1.55131840 1.04884632
115 116 117 118 119 120
0.83381675 0.63537983 2.28007655 -2.71772729 0.86088437 0.59427480
121 122 123 124 125 126
0.85164052 1.57551848 2.02430334 2.41631073 2.05303904 3.25891319
127 128 129 130 131 132
-0.67474027 -0.64130023 -1.95986618 1.69937569 -1.66151015 2.30754724
133 134 135 136 137 138
-3.33471325 1.45976928 1.56663158 1.18470684 -0.71014773 0.02465373
139 140 141 142 143 144
0.83139584 -1.33549797 1.43114993 -3.56874290 -2.08712843 2.70609489
145 146 147 148 149 150
-0.22043097 0.08088751 0.69384186 2.01260426 0.40269270 -0.88623410
151 152 153 154 155 156
-1.27343423 2.37882274 -2.59469643 -5.69664143 -2.46003454 -0.22869565
157 158 159 160 161 162
3.23368081 -4.07246203 -1.88756595 -0.51737396 -1.51183095 -1.92878427
> postscript(file="/var/wessaorg/rcomp/tmp/6lkm31353262287.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 1.96892501 NA
1 -0.38714160 1.96892501
2 1.27140509 -0.38714160
3 -5.51425507 1.27140509
4 2.34959826 -5.51425507
5 0.12500115 2.34959826
6 -0.79815551 0.12500115
7 2.58262280 -0.79815551
8 1.28196827 2.58262280
9 -5.24045271 1.28196827
10 -1.42959339 -5.24045271
11 0.46028681 -1.42959339
12 0.24368740 0.46028681
13 -0.54160352 0.24368740
14 2.61136919 -0.54160352
15 0.71065919 2.61136919
16 -1.07922129 0.71065919
17 -1.75078175 -1.07922129
18 -1.75721681 -1.75078175
19 0.30588903 -1.75721681
20 -0.77466612 0.30588903
21 0.07355577 -0.77466612
22 -0.20985859 0.07355577
23 -0.83616398 -0.20985859
24 -2.89673918 -0.83616398
25 0.83093501 -2.89673918
26 -1.65778608 0.83093501
27 2.64267135 -1.65778608
28 0.27577392 2.64267135
29 -0.80072912 0.27577392
30 0.82384840 -0.80072912
31 -1.92435391 0.82384840
32 -0.36951904 -1.92435391
33 0.12354437 -0.36951904
34 1.43792412 0.12354437
35 -0.12647871 1.43792412
36 -2.82758108 -0.12647871
37 1.46937991 -2.82758108
38 -1.81867195 1.46937991
39 -1.74194994 -1.81867195
40 -1.54207881 -1.74194994
41 1.45074412 -1.54207881
42 1.49429968 1.45074412
43 -0.62212628 1.49429968
44 -0.37599721 -0.62212628
45 2.88076160 -0.37599721
46 2.32963099 2.88076160
47 -0.24568654 2.32963099
48 -0.58854425 -0.24568654
49 1.52232366 -0.58854425
50 2.07402831 1.52232366
51 -0.59043428 2.07402831
52 2.29910456 -0.59043428
53 1.10621428 2.29910456
54 -3.18788243 1.10621428
55 -4.40954350 -3.18788243
56 0.64784733 -4.40954350
57 0.02904719 0.64784733
58 -0.23324380 0.02904719
59 -1.67919037 -0.23324380
60 -2.67525148 -1.67919037
61 0.45149696 -2.67525148
62 2.12420319 0.45149696
63 0.23544880 2.12420319
64 0.51569914 0.23544880
65 0.51964729 0.51569914
66 1.31330182 0.51964729
67 -1.76875605 1.31330182
68 2.52148809 -1.76875605
69 0.35002927 2.52148809
70 -0.38919194 0.35002927
71 0.24866307 -0.38919194
72 1.14722919 0.24866307
73 1.24859402 1.14722919
74 0.49837309 1.24859402
75 -2.75340109 0.49837309
76 1.53604892 -2.75340109
77 -0.49348316 1.53604892
78 1.75816646 -0.49348316
79 0.68637228 1.75816646
80 0.23186728 0.68637228
81 -1.59425464 0.23186728
82 0.28051490 -1.59425464
83 1.15030830 0.28051490
84 -0.18250710 1.15030830
85 -1.57531680 -0.18250710
86 -1.51667577 -1.57531680
87 0.31714308 -1.51667577
88 0.23116006 0.31714308
89 0.76406912 0.23116006
90 -0.62362992 0.76406912
91 3.07703031 -0.62362992
92 0.22447288 3.07703031
93 1.05149701 0.22447288
94 1.73264012 1.05149701
95 -1.38173104 1.73264012
96 1.49778509 -1.38173104
97 -2.48433630 1.49778509
98 0.63729421 -2.48433630
99 -0.74472970 0.63729421
100 2.61148202 -0.74472970
101 -0.49822785 2.61148202
102 1.36918859 -0.49822785
103 -0.10119129 1.36918859
104 -0.72260306 -0.10119129
105 2.27480763 -0.72260306
106 0.11665141 2.27480763
107 0.71195826 0.11665141
108 -0.60154852 0.71195826
109 -2.21890824 -0.60154852
110 0.27475506 -2.21890824
111 2.22497557 0.27475506
112 -1.55131840 2.22497557
113 1.04884632 -1.55131840
114 0.83381675 1.04884632
115 0.63537983 0.83381675
116 2.28007655 0.63537983
117 -2.71772729 2.28007655
118 0.86088437 -2.71772729
119 0.59427480 0.86088437
120 0.85164052 0.59427480
121 1.57551848 0.85164052
122 2.02430334 1.57551848
123 2.41631073 2.02430334
124 2.05303904 2.41631073
125 3.25891319 2.05303904
126 -0.67474027 3.25891319
127 -0.64130023 -0.67474027
128 -1.95986618 -0.64130023
129 1.69937569 -1.95986618
130 -1.66151015 1.69937569
131 2.30754724 -1.66151015
132 -3.33471325 2.30754724
133 1.45976928 -3.33471325
134 1.56663158 1.45976928
135 1.18470684 1.56663158
136 -0.71014773 1.18470684
137 0.02465373 -0.71014773
138 0.83139584 0.02465373
139 -1.33549797 0.83139584
140 1.43114993 -1.33549797
141 -3.56874290 1.43114993
142 -2.08712843 -3.56874290
143 2.70609489 -2.08712843
144 -0.22043097 2.70609489
145 0.08088751 -0.22043097
146 0.69384186 0.08088751
147 2.01260426 0.69384186
148 0.40269270 2.01260426
149 -0.88623410 0.40269270
150 -1.27343423 -0.88623410
151 2.37882274 -1.27343423
152 -2.59469643 2.37882274
153 -5.69664143 -2.59469643
154 -2.46003454 -5.69664143
155 -0.22869565 -2.46003454
156 3.23368081 -0.22869565
157 -4.07246203 3.23368081
158 -1.88756595 -4.07246203
159 -0.51737396 -1.88756595
160 -1.51183095 -0.51737396
161 -1.92878427 -1.51183095
162 NA -1.92878427
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.38714160 1.96892501
[2,] 1.27140509 -0.38714160
[3,] -5.51425507 1.27140509
[4,] 2.34959826 -5.51425507
[5,] 0.12500115 2.34959826
[6,] -0.79815551 0.12500115
[7,] 2.58262280 -0.79815551
[8,] 1.28196827 2.58262280
[9,] -5.24045271 1.28196827
[10,] -1.42959339 -5.24045271
[11,] 0.46028681 -1.42959339
[12,] 0.24368740 0.46028681
[13,] -0.54160352 0.24368740
[14,] 2.61136919 -0.54160352
[15,] 0.71065919 2.61136919
[16,] -1.07922129 0.71065919
[17,] -1.75078175 -1.07922129
[18,] -1.75721681 -1.75078175
[19,] 0.30588903 -1.75721681
[20,] -0.77466612 0.30588903
[21,] 0.07355577 -0.77466612
[22,] -0.20985859 0.07355577
[23,] -0.83616398 -0.20985859
[24,] -2.89673918 -0.83616398
[25,] 0.83093501 -2.89673918
[26,] -1.65778608 0.83093501
[27,] 2.64267135 -1.65778608
[28,] 0.27577392 2.64267135
[29,] -0.80072912 0.27577392
[30,] 0.82384840 -0.80072912
[31,] -1.92435391 0.82384840
[32,] -0.36951904 -1.92435391
[33,] 0.12354437 -0.36951904
[34,] 1.43792412 0.12354437
[35,] -0.12647871 1.43792412
[36,] -2.82758108 -0.12647871
[37,] 1.46937991 -2.82758108
[38,] -1.81867195 1.46937991
[39,] -1.74194994 -1.81867195
[40,] -1.54207881 -1.74194994
[41,] 1.45074412 -1.54207881
[42,] 1.49429968 1.45074412
[43,] -0.62212628 1.49429968
[44,] -0.37599721 -0.62212628
[45,] 2.88076160 -0.37599721
[46,] 2.32963099 2.88076160
[47,] -0.24568654 2.32963099
[48,] -0.58854425 -0.24568654
[49,] 1.52232366 -0.58854425
[50,] 2.07402831 1.52232366
[51,] -0.59043428 2.07402831
[52,] 2.29910456 -0.59043428
[53,] 1.10621428 2.29910456
[54,] -3.18788243 1.10621428
[55,] -4.40954350 -3.18788243
[56,] 0.64784733 -4.40954350
[57,] 0.02904719 0.64784733
[58,] -0.23324380 0.02904719
[59,] -1.67919037 -0.23324380
[60,] -2.67525148 -1.67919037
[61,] 0.45149696 -2.67525148
[62,] 2.12420319 0.45149696
[63,] 0.23544880 2.12420319
[64,] 0.51569914 0.23544880
[65,] 0.51964729 0.51569914
[66,] 1.31330182 0.51964729
[67,] -1.76875605 1.31330182
[68,] 2.52148809 -1.76875605
[69,] 0.35002927 2.52148809
[70,] -0.38919194 0.35002927
[71,] 0.24866307 -0.38919194
[72,] 1.14722919 0.24866307
[73,] 1.24859402 1.14722919
[74,] 0.49837309 1.24859402
[75,] -2.75340109 0.49837309
[76,] 1.53604892 -2.75340109
[77,] -0.49348316 1.53604892
[78,] 1.75816646 -0.49348316
[79,] 0.68637228 1.75816646
[80,] 0.23186728 0.68637228
[81,] -1.59425464 0.23186728
[82,] 0.28051490 -1.59425464
[83,] 1.15030830 0.28051490
[84,] -0.18250710 1.15030830
[85,] -1.57531680 -0.18250710
[86,] -1.51667577 -1.57531680
[87,] 0.31714308 -1.51667577
[88,] 0.23116006 0.31714308
[89,] 0.76406912 0.23116006
[90,] -0.62362992 0.76406912
[91,] 3.07703031 -0.62362992
[92,] 0.22447288 3.07703031
[93,] 1.05149701 0.22447288
[94,] 1.73264012 1.05149701
[95,] -1.38173104 1.73264012
[96,] 1.49778509 -1.38173104
[97,] -2.48433630 1.49778509
[98,] 0.63729421 -2.48433630
[99,] -0.74472970 0.63729421
[100,] 2.61148202 -0.74472970
[101,] -0.49822785 2.61148202
[102,] 1.36918859 -0.49822785
[103,] -0.10119129 1.36918859
[104,] -0.72260306 -0.10119129
[105,] 2.27480763 -0.72260306
[106,] 0.11665141 2.27480763
[107,] 0.71195826 0.11665141
[108,] -0.60154852 0.71195826
[109,] -2.21890824 -0.60154852
[110,] 0.27475506 -2.21890824
[111,] 2.22497557 0.27475506
[112,] -1.55131840 2.22497557
[113,] 1.04884632 -1.55131840
[114,] 0.83381675 1.04884632
[115,] 0.63537983 0.83381675
[116,] 2.28007655 0.63537983
[117,] -2.71772729 2.28007655
[118,] 0.86088437 -2.71772729
[119,] 0.59427480 0.86088437
[120,] 0.85164052 0.59427480
[121,] 1.57551848 0.85164052
[122,] 2.02430334 1.57551848
[123,] 2.41631073 2.02430334
[124,] 2.05303904 2.41631073
[125,] 3.25891319 2.05303904
[126,] -0.67474027 3.25891319
[127,] -0.64130023 -0.67474027
[128,] -1.95986618 -0.64130023
[129,] 1.69937569 -1.95986618
[130,] -1.66151015 1.69937569
[131,] 2.30754724 -1.66151015
[132,] -3.33471325 2.30754724
[133,] 1.45976928 -3.33471325
[134,] 1.56663158 1.45976928
[135,] 1.18470684 1.56663158
[136,] -0.71014773 1.18470684
[137,] 0.02465373 -0.71014773
[138,] 0.83139584 0.02465373
[139,] -1.33549797 0.83139584
[140,] 1.43114993 -1.33549797
[141,] -3.56874290 1.43114993
[142,] -2.08712843 -3.56874290
[143,] 2.70609489 -2.08712843
[144,] -0.22043097 2.70609489
[145,] 0.08088751 -0.22043097
[146,] 0.69384186 0.08088751
[147,] 2.01260426 0.69384186
[148,] 0.40269270 2.01260426
[149,] -0.88623410 0.40269270
[150,] -1.27343423 -0.88623410
[151,] 2.37882274 -1.27343423
[152,] -2.59469643 2.37882274
[153,] -5.69664143 -2.59469643
[154,] -2.46003454 -5.69664143
[155,] -0.22869565 -2.46003454
[156,] 3.23368081 -0.22869565
[157,] -4.07246203 3.23368081
[158,] -1.88756595 -4.07246203
[159,] -0.51737396 -1.88756595
[160,] -1.51183095 -0.51737396
[161,] -1.92878427 -1.51183095
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.38714160 1.96892501
2 1.27140509 -0.38714160
3 -5.51425507 1.27140509
4 2.34959826 -5.51425507
5 0.12500115 2.34959826
6 -0.79815551 0.12500115
7 2.58262280 -0.79815551
8 1.28196827 2.58262280
9 -5.24045271 1.28196827
10 -1.42959339 -5.24045271
11 0.46028681 -1.42959339
12 0.24368740 0.46028681
13 -0.54160352 0.24368740
14 2.61136919 -0.54160352
15 0.71065919 2.61136919
16 -1.07922129 0.71065919
17 -1.75078175 -1.07922129
18 -1.75721681 -1.75078175
19 0.30588903 -1.75721681
20 -0.77466612 0.30588903
21 0.07355577 -0.77466612
22 -0.20985859 0.07355577
23 -0.83616398 -0.20985859
24 -2.89673918 -0.83616398
25 0.83093501 -2.89673918
26 -1.65778608 0.83093501
27 2.64267135 -1.65778608
28 0.27577392 2.64267135
29 -0.80072912 0.27577392
30 0.82384840 -0.80072912
31 -1.92435391 0.82384840
32 -0.36951904 -1.92435391
33 0.12354437 -0.36951904
34 1.43792412 0.12354437
35 -0.12647871 1.43792412
36 -2.82758108 -0.12647871
37 1.46937991 -2.82758108
38 -1.81867195 1.46937991
39 -1.74194994 -1.81867195
40 -1.54207881 -1.74194994
41 1.45074412 -1.54207881
42 1.49429968 1.45074412
43 -0.62212628 1.49429968
44 -0.37599721 -0.62212628
45 2.88076160 -0.37599721
46 2.32963099 2.88076160
47 -0.24568654 2.32963099
48 -0.58854425 -0.24568654
49 1.52232366 -0.58854425
50 2.07402831 1.52232366
51 -0.59043428 2.07402831
52 2.29910456 -0.59043428
53 1.10621428 2.29910456
54 -3.18788243 1.10621428
55 -4.40954350 -3.18788243
56 0.64784733 -4.40954350
57 0.02904719 0.64784733
58 -0.23324380 0.02904719
59 -1.67919037 -0.23324380
60 -2.67525148 -1.67919037
61 0.45149696 -2.67525148
62 2.12420319 0.45149696
63 0.23544880 2.12420319
64 0.51569914 0.23544880
65 0.51964729 0.51569914
66 1.31330182 0.51964729
67 -1.76875605 1.31330182
68 2.52148809 -1.76875605
69 0.35002927 2.52148809
70 -0.38919194 0.35002927
71 0.24866307 -0.38919194
72 1.14722919 0.24866307
73 1.24859402 1.14722919
74 0.49837309 1.24859402
75 -2.75340109 0.49837309
76 1.53604892 -2.75340109
77 -0.49348316 1.53604892
78 1.75816646 -0.49348316
79 0.68637228 1.75816646
80 0.23186728 0.68637228
81 -1.59425464 0.23186728
82 0.28051490 -1.59425464
83 1.15030830 0.28051490
84 -0.18250710 1.15030830
85 -1.57531680 -0.18250710
86 -1.51667577 -1.57531680
87 0.31714308 -1.51667577
88 0.23116006 0.31714308
89 0.76406912 0.23116006
90 -0.62362992 0.76406912
91 3.07703031 -0.62362992
92 0.22447288 3.07703031
93 1.05149701 0.22447288
94 1.73264012 1.05149701
95 -1.38173104 1.73264012
96 1.49778509 -1.38173104
97 -2.48433630 1.49778509
98 0.63729421 -2.48433630
99 -0.74472970 0.63729421
100 2.61148202 -0.74472970
101 -0.49822785 2.61148202
102 1.36918859 -0.49822785
103 -0.10119129 1.36918859
104 -0.72260306 -0.10119129
105 2.27480763 -0.72260306
106 0.11665141 2.27480763
107 0.71195826 0.11665141
108 -0.60154852 0.71195826
109 -2.21890824 -0.60154852
110 0.27475506 -2.21890824
111 2.22497557 0.27475506
112 -1.55131840 2.22497557
113 1.04884632 -1.55131840
114 0.83381675 1.04884632
115 0.63537983 0.83381675
116 2.28007655 0.63537983
117 -2.71772729 2.28007655
118 0.86088437 -2.71772729
119 0.59427480 0.86088437
120 0.85164052 0.59427480
121 1.57551848 0.85164052
122 2.02430334 1.57551848
123 2.41631073 2.02430334
124 2.05303904 2.41631073
125 3.25891319 2.05303904
126 -0.67474027 3.25891319
127 -0.64130023 -0.67474027
128 -1.95986618 -0.64130023
129 1.69937569 -1.95986618
130 -1.66151015 1.69937569
131 2.30754724 -1.66151015
132 -3.33471325 2.30754724
133 1.45976928 -3.33471325
134 1.56663158 1.45976928
135 1.18470684 1.56663158
136 -0.71014773 1.18470684
137 0.02465373 -0.71014773
138 0.83139584 0.02465373
139 -1.33549797 0.83139584
140 1.43114993 -1.33549797
141 -3.56874290 1.43114993
142 -2.08712843 -3.56874290
143 2.70609489 -2.08712843
144 -0.22043097 2.70609489
145 0.08088751 -0.22043097
146 0.69384186 0.08088751
147 2.01260426 0.69384186
148 0.40269270 2.01260426
149 -0.88623410 0.40269270
150 -1.27343423 -0.88623410
151 2.37882274 -1.27343423
152 -2.59469643 2.37882274
153 -5.69664143 -2.59469643
154 -2.46003454 -5.69664143
155 -0.22869565 -2.46003454
156 3.23368081 -0.22869565
157 -4.07246203 3.23368081
158 -1.88756595 -4.07246203
159 -0.51737396 -1.88756595
160 -1.51183095 -0.51737396
161 -1.92878427 -1.51183095
> 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/7r5z61353262287.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/8s69i1353262287.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/9fa1v1353262287.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/10k1zk1353262287.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/11i6n91353262287.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/12pc5m1353262287.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/13ao021353262287.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/14r75t1353262287.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/15jxx41353262287.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/16ntv91353262287.tab")
+ }
>
> try(system("convert tmp/1vef81353262287.ps tmp/1vef81353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/2exj61353262287.ps tmp/2exj61353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/37nqb1353262287.ps tmp/37nqb1353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/494sw1353262287.ps tmp/494sw1353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/53cjq1353262287.ps tmp/53cjq1353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/6lkm31353262287.ps tmp/6lkm31353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/7r5z61353262287.ps tmp/7r5z61353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/8s69i1353262287.ps tmp/8s69i1353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/9fa1v1353262287.ps tmp/9fa1v1353262287.png",intern=TRUE))
character(0)
> try(system("convert tmp/10k1zk1353262287.ps tmp/10k1zk1353262287.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.742 1.093 8.864