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(1901
+ ,61
+ ,17
+ ,56
+ ,84
+ ,4
+ ,21
+ ,51
+ ,9
+ ,2509
+ ,74
+ ,19
+ ,73
+ ,47
+ ,3
+ ,15
+ ,45
+ ,9
+ ,2114
+ ,57
+ ,18
+ ,62
+ ,63
+ ,3
+ ,17
+ ,44
+ ,9
+ ,1331
+ ,50
+ ,15
+ ,42
+ ,28
+ ,3
+ ,20
+ ,42
+ ,9
+ ,1399
+ ,48
+ ,15
+ ,59
+ ,22
+ ,2
+ ,12
+ ,38
+ ,9
+ ,7333
+ ,2
+ ,12
+ ,27
+ ,18
+ ,6
+ ,4
+ ,38
+ ,9
+ ,1170
+ ,31
+ ,20
+ ,78
+ ,27
+ ,5
+ ,11
+ ,35
+ ,9
+ ,1507
+ ,61
+ ,14
+ ,56
+ ,37
+ ,5
+ ,12
+ ,35
+ ,9
+ ,1107
+ ,36
+ ,15
+ ,59
+ ,20
+ ,5
+ ,9
+ ,34
+ ,9
+ ,2051
+ ,46
+ ,13
+ ,51
+ ,67
+ ,5
+ ,14
+ ,33
+ ,9
+ ,1290
+ ,30
+ ,17
+ ,47
+ ,28
+ ,4
+ ,11
+ ,32
+ ,9
+ ,820
+ ,49
+ ,10
+ ,35
+ ,45
+ ,3
+ ,14
+ ,31
+ ,9
+ ,1502
+ ,14
+ ,13
+ ,47
+ ,15
+ ,5
+ ,4
+ ,30
+ ,9
+ ,1451
+ ,12
+ ,12
+ ,47
+ ,23
+ ,6
+ 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,6
+ ,11
+ ,308
+ ,3
+ ,12
+ ,24
+ ,4
+ ,4
+ ,2
+ ,5
+ ,11
+ ,466
+ ,8
+ ,15
+ ,28
+ ,0
+ ,0
+ ,0
+ ,5
+ ,11
+ ,228
+ ,0
+ ,11
+ ,38
+ ,9
+ ,9
+ ,1
+ ,5
+ ,11
+ ,428
+ ,8
+ ,3
+ ,4
+ ,5
+ ,5
+ ,3
+ ,5
+ ,11
+ ,242
+ ,1
+ ,8
+ ,25
+ ,0
+ ,0
+ ,0
+ ,5
+ ,11
+ ,352
+ ,0
+ ,12
+ ,40
+ ,0
+ ,0
+ ,0
+ ,5
+ ,11
+ ,244
+ ,8
+ ,0
+ ,0
+ ,13
+ ,4
+ ,4
+ ,5
+ ,11
+ ,269
+ ,3
+ ,9
+ ,23
+ ,1
+ ,0
+ ,1
+ ,5
+ ,11
+ ,242
+ ,0
+ ,4
+ ,13
+ ,0
+ ,0
+ ,0
+ ,4
+ ,11
+ ,291
+ ,0
+ ,14
+ ,6
+ ,39
+ ,0
+ ,2
+ ,4
+ ,11
+ ,213
+ ,0
+ ,9
+ ,31
+ ,10
+ ,0
+ ,0
+ ,4
+ ,11
+ ,135
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,3
+ ,11
+ ,210
+ ,3
+ ,1
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,11)
+ ,dim=c(9
+ ,140)
+ ,dimnames=list(c('month'
+ ,'Connected'
+ ,'Separate'
+ ,'Learning'
+ ,'Software'
+ ,'Happiness'
+ ,'Depression'
+ ,'Belonging'
+ ,'Belonging_Final')
+ ,1:140))
> y <- array(NA,dim=c(9,140),dimnames=list(c('month','Connected','Separate','Learning','Software','Happiness','Depression','Belonging','Belonging_Final'),1:140))
> 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 = '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
Learning month Connected Separate Software Happiness Depression Belonging
1 56 1901 61 17 84 4 21 51
2 73 2509 74 19 47 3 15 45
3 62 2114 57 18 63 3 17 44
4 42 1331 50 15 28 3 20 42
5 59 1399 48 15 22 2 12 38
6 27 7333 2 12 18 6 4 38
7 78 1170 31 20 27 5 11 35
8 56 1507 61 14 37 5 12 35
9 59 1107 36 15 20 5 9 34
10 51 2051 46 13 67 5 14 33
11 47 1290 30 17 28 4 11 32
12 35 820 49 10 45 3 14 31
13 47 1502 14 13 15 5 4 30
14 47 1451 12 12 23 6 7 30
15 55 1178 54 16 30 6 9 30
16 54 1514 44 15 27 2 14 29
17 60 883 40 15 43 5 13 29
18 55 1405 57 15 36 5 11 29
19 48 927 29 12 28 5 9 28
20 47 1352 32 13 28 9 8 27
21 47 1314 28 12 22 4 9 27
22 52 1307 40 15 27 4 11 27
23 48 1243 54 12 24 5 7 26
24 48 1232 56 12 52 3 15 26
25 27 1097 19 9 12 0 4 26
26 12 1100 67 12 24 5 10 26
27 51 1316 25 13 10 3 10 26
28 58 903 42 16 71 4 13 25
29 60 929 28 15 12 2 10 25
30 46 1049 57 13 24 5 10 25
31 45 1372 28 12 22 11 6 24
32 42 1470 35 13 21 5 8 24
33 41 821 10 12 13 3 7 24
34 47 1239 30 12 28 4 11 24
35 32 1384 23 8 19 5 10 24
36 56 820 32 15 29 5 11 24
37 42 1462 24 12 12 2 10 24
38 41 1202 42 12 32 6 8 23
39 47 1091 33 12 21 3 10 23
40 47 1228 19 14 19 4 5 23
41 49 707 17 15 15 8 5 23
42 52 868 49 15 14 14 5 23
43 42 1165 30 12 34 11 9 22
44 55 1106 3 13 8 8 2 22
45 48 1429 56 12 27 3 9 22
46 48 1671 37 13 31 3 13 22
47 38 1579 26 12 21 11 7 22
48 48 774 19 12 10 3 5 21
49 50 934 22 13 21 4 7 21
50 39 825 53 12 19 3 8 21
51 48 1375 35 12 27 5 8 21
52 36 968 12 9 17 6 5 21
53 49 1156 34 13 30 8 5 21
54 39 1374 28 13 19 3 10 21
55 41 1224 38 12 17 3 5 21
56 45 804 38 15 24 5 10 21
57 60 998 45 15 36 5 10 21
58 45 1112 15 13 16 3 7 21
59 41 1153 35 14 16 3 10 20
60 52 613 27 14 30 3 9 20
61 46 729 23 12 18 5 10 20
62 39 813 33 12 26 3 10 20
63 32 912 23 9 17 3 5 20
64 52 1178 26 14 28 6 8 20
65 54 1201 32 16 20 4 6 19
66 51 1165 35 15 27 3 7 19
67 52 705 18 13 13 13 6 18
68 57 814 18 16 10 5 3 17
69 47 1082 41 12 29 6 9 17
70 45 885 39 12 34 5 11 17
71 41 837 56 12 30 3 9 17
72 43 586 35 12 16 4 10 16
73 31 913 37 10 22 4 9 16
74 32 547 26 15 22 7 7 15
75 41 758 33 12 31 4 6 15
76 27 848 7 9 10 5 6 15
77 40 634 16 10 7 7 5 15
78 46 501 13 13 10 3 5 15
79 32 849 54 12 55 6 8 15
80 9 733 30 13 25 8 7 15
81 64 634 9 16 9 5 5 15
82 30 1010 35 15 31 5 10 15
83 46 778 0 12 0 0 0 15
84 37 480 40 12 24 3 10 15
85 22 848 22 12 14 5 6 15
86 20 714 29 12 11 3 6 14
87 21 871 25 12 8 8 4 14
88 44 776 17 14 9 9 3 14
89 24 815 32 12 18 9 7 14
90 33 811 40 12 14 4 5 14
91 45 529 24 12 27 2 8 13
92 35 642 18 13 10 0 0 13
93 31 562 15 8 16 3 5 13
94 20 626 17 16 13 7 5 13
95 13 636 28 12 10 5 5 13
96 33 935 18 11 16 3 5 13
97 58 473 16 15 11 3 6 12
98 26 836 28 13 8 3 5 12
99 36 938 17 12 29 7 6 12
100 32 656 25 13 12 4 4 12
101 34 566 2 13 1 0 0 12
102 15 765 10 12 26 5 8 12
103 40 705 9 12 5 5 2 11
104 37 558 7 12 5 5 2 11
105 26 582 27 14 24 6 8 11
106 31 608 25 12 19 6 3 11
107 47 567 16 16 10 5 3 11
108 21 434 28 8 6 6 3 11
109 21 479 7 8 61 0 3 11
110 9 488 0 5 25 25 1 10
111 28 507 16 9 7 2 2 10
112 24 394 10 11 10 5 2 10
113 15 504 0 4 3 3 1 9
114 19 368 2 8 1 1 2 9
115 35 386 5 13 38 5 7 9
116 45 451 36 13 13 4 4 9
117 20 580 10 12 2 0 1 9
118 1 565 43 13 8 4 6 9
119 29 510 14 12 30 10 3 9
120 33 495 12 12 11 6 2 8
121 32 596 15 10 69 23 3 8
122 11 412 8 12 2 0 2 8
123 10 338 39 5 23 6 5 7
124 18 446 10 13 8 4 4 7
125 41 418 0 12 0 0 0 7
126 0 335 7 6 2 0 0 6
127 10 349 10 9 4 2 3 6
128 24 308 3 12 4 4 2 5
129 28 466 8 15 0 0 0 5
130 38 228 0 11 9 9 1 5
131 4 428 8 3 5 5 3 5
132 25 242 1 8 0 0 0 5
133 40 352 0 12 0 0 0 5
134 0 244 8 0 13 4 4 5
135 23 269 3 9 1 0 1 5
136 13 242 0 4 0 0 0 4
137 6 291 0 14 39 0 2 4
138 31 213 0 9 10 0 0 4
139 0 135 0 0 1 0 1 3
140 3 210 3 1 3 3 3 3
Belonging_Final
1 9
2 9
3 9
4 9
5 9
6 9
7 9
8 9
9 9
10 9
11 9
12 9
13 9
14 9
15 9
16 9
17 9
18 9
19 9
20 9
21 9
22 9
23 9
24 9
25 9
26 9
27 9
28 9
29 9
30 9
31 9
32 9
33 9
34 9
35 9
36 9
37 9
38 9
39 9
40 9
41 9
42 9
43 9
44 9
45 9
46 9
47 10
48 10
49 10
50 10
51 10
52 10
53 10
54 10
55 10
56 10
57 10
58 10
59 10
60 10
61 10
62 10
63 10
64 10
65 10
66 10
67 10
68 10
69 10
70 10
71 10
72 10
73 10
74 10
75 10
76 10
77 10
78 10
79 10
80 10
81 10
82 10
83 10
84 10
85 10
86 10
87 10
88 10
89 10
90 10
91 10
92 10
93 10
94 11
95 11
96 11
97 11
98 11
99 11
100 11
101 11
102 11
103 11
104 11
105 11
106 11
107 11
108 11
109 11
110 11
111 11
112 11
113 11
114 11
115 11
116 11
117 11
118 11
119 11
120 11
121 11
122 11
123 11
124 11
125 11
126 11
127 11
128 11
129 11
130 11
131 11
132 11
133 11
134 11
135 11
136 11
137 11
138 11
139 11
140 11
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) month Connected Separate
63.377250 -0.004361 -0.104279 2.513469
Software Happiness Depression Belonging
0.053009 0.017854 -0.347745 0.634499
Belonging_Final
-5.995953
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-30.173 -3.729 1.676 5.926 20.443
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 63.377250 23.362232 2.713 0.00757 **
month -0.004361 0.001629 -2.676 0.00839 **
Connected -0.104279 0.077024 -1.354 0.17811
Separate 2.513469 0.298703 8.415 5.92e-14 ***
Software 0.053009 0.077075 0.688 0.49282
Happiness 0.017854 0.238579 0.075 0.94046
Depression -0.347745 0.432475 -0.804 0.42281
Belonging 0.634499 0.248472 2.554 0.01181 *
Belonging_Final -5.995953 2.055088 -2.918 0.00415 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9.353 on 131 degrees of freedom
Multiple R-squared: 0.6768, Adjusted R-squared: 0.6571
F-statistic: 34.3 on 8 and 131 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,] 5.392595e-01 9.214810e-01 0.4607405
[2,] 3.873542e-01 7.747084e-01 0.6126458
[3,] 2.939762e-01 5.879524e-01 0.7060238
[4,] 3.474767e-01 6.949533e-01 0.6525233
[5,] 2.841921e-01 5.683841e-01 0.7158079
[6,] 2.367192e-01 4.734385e-01 0.7632808
[7,] 1.661132e-01 3.322265e-01 0.8338868
[8,] 1.135946e-01 2.271893e-01 0.8864054
[9,] 7.161748e-02 1.432350e-01 0.9283825
[10,] 4.644169e-02 9.288337e-02 0.9535583
[11,] 2.870489e-02 5.740979e-02 0.9712951
[12,] 1.725538e-02 3.451077e-02 0.9827446
[13,] 1.057746e-02 2.115492e-02 0.9894225
[14,] 1.545719e-02 3.091439e-02 0.9845428
[15,] 5.830559e-01 8.338881e-01 0.4169441
[16,] 5.486459e-01 9.027082e-01 0.4513541
[17,] 5.173792e-01 9.652416e-01 0.4826208
[18,] 4.671752e-01 9.343503e-01 0.5328248
[19,] 4.027133e-01 8.054265e-01 0.5972867
[20,] 3.420972e-01 6.841943e-01 0.6579028
[21,] 2.943586e-01 5.887171e-01 0.7056414
[22,] 2.683614e-01 5.367229e-01 0.7316386
[23,] 2.285740e-01 4.571480e-01 0.7714260
[24,] 2.031878e-01 4.063755e-01 0.7968122
[25,] 1.606304e-01 3.212608e-01 0.8393696
[26,] 1.266528e-01 2.533055e-01 0.8733472
[27,] 9.995474e-02 1.999095e-01 0.9000453
[28,] 7.952383e-02 1.590477e-01 0.9204762
[29,] 6.916986e-02 1.383397e-01 0.9308301
[30,] 7.000462e-02 1.400092e-01 0.9299954
[31,] 5.228320e-02 1.045664e-01 0.9477168
[32,] 3.954097e-02 7.908195e-02 0.9604590
[33,] 3.331846e-02 6.663692e-02 0.9666815
[34,] 3.006697e-02 6.013395e-02 0.9699330
[35,] 2.235918e-02 4.471836e-02 0.9776408
[36,] 1.574755e-02 3.149509e-02 0.9842525
[37,] 1.173862e-02 2.347725e-02 0.9882614
[38,] 8.022050e-03 1.604410e-02 0.9919779
[39,] 5.688451e-03 1.137690e-02 0.9943115
[40,] 4.686488e-03 9.372976e-03 0.9953135
[41,] 3.299294e-03 6.598588e-03 0.9967007
[42,] 2.160833e-03 4.321666e-03 0.9978392
[43,] 1.914599e-03 3.829198e-03 0.9980854
[44,] 1.242195e-03 2.484390e-03 0.9987578
[45,] 1.183687e-03 2.367373e-03 0.9988163
[46,] 1.194166e-03 2.388332e-03 0.9988058
[47,] 7.891434e-04 1.578287e-03 0.9992109
[48,] 6.323386e-04 1.264677e-03 0.9993677
[49,] 3.904463e-04 7.808926e-04 0.9996096
[50,] 2.583622e-04 5.167244e-04 0.9997416
[51,] 1.719669e-04 3.439337e-04 0.9998280
[52,] 1.185823e-04 2.371646e-04 0.9998814
[53,] 7.713716e-05 1.542743e-04 0.9999229
[54,] 5.293547e-05 1.058709e-04 0.9999471
[55,] 3.597788e-05 7.195577e-05 0.9999640
[56,] 2.700600e-05 5.401199e-05 0.9999730
[57,] 1.725260e-05 3.450521e-05 0.9999827
[58,] 2.222809e-05 4.445619e-05 0.9999778
[59,] 1.979688e-05 3.959377e-05 0.9999802
[60,] 1.518866e-05 3.037732e-05 0.9999848
[61,] 1.061866e-05 2.123731e-05 0.9999894
[62,] 7.561798e-06 1.512360e-05 0.9999924
[63,] 1.182049e-04 2.364098e-04 0.9998818
[64,] 8.661629e-05 1.732326e-04 0.9999134
[65,] 6.014713e-05 1.202943e-04 0.9999399
[66,] 4.317648e-05 8.635296e-05 0.9999568
[67,] 2.552015e-05 5.104029e-05 0.9999745
[68,] 3.166888e-05 6.333776e-05 0.9999683
[69,] 8.578134e-03 1.715627e-02 0.9914219
[70,] 1.100646e-02 2.201293e-02 0.9889935
[71,] 1.664826e-02 3.329652e-02 0.9833517
[72,] 1.272837e-02 2.545673e-02 0.9872716
[73,] 9.752831e-03 1.950566e-02 0.9902472
[74,] 1.575984e-02 3.151968e-02 0.9842402
[75,] 2.745837e-02 5.491675e-02 0.9725416
[76,] 4.107393e-02 8.214785e-02 0.9589261
[77,] 3.082486e-02 6.164972e-02 0.9691751
[78,] 3.251399e-02 6.502799e-02 0.9674860
[79,] 2.443739e-02 4.887478e-02 0.9755626
[80,] 2.382493e-02 4.764985e-02 0.9761751
[81,] 2.252640e-02 4.505280e-02 0.9774736
[82,] 1.655020e-02 3.310041e-02 0.9834498
[83,] 6.191081e-02 1.238216e-01 0.9380892
[84,] 1.066527e-01 2.133055e-01 0.8933473
[85,] 9.681013e-02 1.936203e-01 0.9031899
[86,] 2.035600e-01 4.071199e-01 0.7964400
[87,] 1.724500e-01 3.449000e-01 0.8275500
[88,] 1.958325e-01 3.916649e-01 0.8041675
[89,] 1.617205e-01 3.234409e-01 0.8382795
[90,] 1.361598e-01 2.723196e-01 0.8638402
[91,] 1.384001e-01 2.768001e-01 0.8615999
[92,] 1.495929e-01 2.991858e-01 0.8504071
[93,] 1.280484e-01 2.560969e-01 0.8719516
[94,] 1.076238e-01 2.152476e-01 0.8923762
[95,] 8.544511e-02 1.708902e-01 0.9145549
[96,] 8.609716e-02 1.721943e-01 0.9139028
[97,] 6.471629e-02 1.294326e-01 0.9352837
[98,] 4.867776e-02 9.735551e-02 0.9513222
[99,] 1.491116e-01 2.982231e-01 0.8508884
[100,] 1.335279e-01 2.670558e-01 0.8664721
[101,] 1.536266e-01 3.072531e-01 0.8463734
[102,] 1.195249e-01 2.390498e-01 0.8804751
[103,] 1.050244e-01 2.100488e-01 0.8949756
[104,] 2.026462e-01 4.052924e-01 0.7973538
[105,] 5.035448e-01 9.929103e-01 0.4964552
[106,] 4.444086e-01 8.888172e-01 0.5555914
[107,] 5.169761e-01 9.660478e-01 0.4830239
[108,] 4.375856e-01 8.751711e-01 0.5624144
[109,] 3.782183e-01 7.564366e-01 0.6217817
[110,] 2.992484e-01 5.984968e-01 0.7007516
[111,] 3.470322e-01 6.940643e-01 0.6529678
[112,] 6.931517e-01 6.136966e-01 0.3068483
[113,] 6.130164e-01 7.739673e-01 0.3869836
[114,] 5.053379e-01 9.893242e-01 0.4946621
[115,] 6.653224e-01 6.693551e-01 0.3346776
[116,] 5.680107e-01 8.639787e-01 0.4319893
[117,] 4.962969e-01 9.925937e-01 0.5037031
> postscript(file="/var/wessaorg/rcomp/tmp/1o33z1352124478.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/24h951352124478.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/3sjc31352124478.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/415a31352124478.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/5neod1352124478.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 = 140
Frequency = 1
1 2 3 4 5 6
-11.07308322 8.60652534 -2.89332687 -15.32966229 1.85023409 -4.17198151
7 8 9 10 11 12
6.74871482 4.24508118 0.87280948 2.94073422 -14.42354899 -8.10297833
13 14 15 16 17 18
-5.60766801 -2.92383342 -1.46397507 3.07551603 4.65743800 3.38197180
19 20 21 22 23 24
-0.71871833 -1.85077310 0.83494418 -0.05418539 4.05174663 5.54576982
25 26 27 28 29 30
-14.01213199 -30.17294473 3.65355925 1.51134690 6.79825754 0.68290166
31 32 33 34 35 36
-0.17686232 -3.67741595 -7.48890680 2.99739585 -1.93492506 2.76760951
37 38 39 40 41 42
-1.11977504 -2.56907165 3.34053849 -4.19947856 -7.05274151 -0.06786440
43 44 45 46 47 48
-2.19480971 4.21647109 8.18153771 5.92096232 1.18291933 7.60764566
49 50 51 52 53 54
8.19924712 2.94169460 12.00319672 2.83942293 8.17466087 0.91067878
55 56 57 58 59 60
4.18014824 0.14026362 16.08006574 3.52836815 0.95700611 7.67820096
61 62 63 64 65 66
7.74198665 1.76270788 0.43036637 9.74234879 7.84016539 7.50403176
67 68 69 70 71 72
10.60269271 8.43070827 13.11309710 10.49380926 7.60950487 8.03164537
73 74 75 76 77 78
2.02724914 -12.39769001 5.02149128 -2.66159061 7.60586738 5.08505797
79 80 81 82 83 84
-2.00425280 -29.31944956 15.72478846 -10.83836753 6.29569122 2.31910694
85 86 87 88 89 90
-13.84984003 -14.87496660 -14.23321162 2.07275329 -10.25215089 -0.82954331
91 92 93 94 95 96
9.29663793 -5.19487283 4.07790156 -20.45865284 -16.01936336 6.47277583
97 98 99 100 101 102
20.44304821 -3.88449581 7.08982485 0.44013069 -1.08721792 -14.50428387
103 104 105 106 107 108
9.79100983 5.94144823 -6.83379228 1.62427745 6.94803496 1.92136557
109 110 111 112 113 114
-2.88062603 -6.62996558 5.78002524 -4.57792109 4.14675054 -1.80213207
115 116 117 118 119 120
1.72784392 15.54377658 -9.48023288 -26.26862935 -1.33564554 3.75572015
121 122 123 124 125 126
5.50564000 -18.43912231 1.52257140 -12.65525191 10.79783045 -14.22484491
127 128 129 130 131 132
-10.48985481 -4.68795594 -7.43003659 10.46177073 -0.74518789 5.45752392
133 134 135 136 137 138
10.77903051 1.93440618 1.56508584 4.04161888 -29.25124775 8.81773179
139 140
1.55814990 3.22047273
> postscript(file="/var/wessaorg/rcomp/tmp/65uh41352124478.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 = 140
Frequency = 1
lag(myerror, k = 1) myerror
0 -11.07308322 NA
1 8.60652534 -11.07308322
2 -2.89332687 8.60652534
3 -15.32966229 -2.89332687
4 1.85023409 -15.32966229
5 -4.17198151 1.85023409
6 6.74871482 -4.17198151
7 4.24508118 6.74871482
8 0.87280948 4.24508118
9 2.94073422 0.87280948
10 -14.42354899 2.94073422
11 -8.10297833 -14.42354899
12 -5.60766801 -8.10297833
13 -2.92383342 -5.60766801
14 -1.46397507 -2.92383342
15 3.07551603 -1.46397507
16 4.65743800 3.07551603
17 3.38197180 4.65743800
18 -0.71871833 3.38197180
19 -1.85077310 -0.71871833
20 0.83494418 -1.85077310
21 -0.05418539 0.83494418
22 4.05174663 -0.05418539
23 5.54576982 4.05174663
24 -14.01213199 5.54576982
25 -30.17294473 -14.01213199
26 3.65355925 -30.17294473
27 1.51134690 3.65355925
28 6.79825754 1.51134690
29 0.68290166 6.79825754
30 -0.17686232 0.68290166
31 -3.67741595 -0.17686232
32 -7.48890680 -3.67741595
33 2.99739585 -7.48890680
34 -1.93492506 2.99739585
35 2.76760951 -1.93492506
36 -1.11977504 2.76760951
37 -2.56907165 -1.11977504
38 3.34053849 -2.56907165
39 -4.19947856 3.34053849
40 -7.05274151 -4.19947856
41 -0.06786440 -7.05274151
42 -2.19480971 -0.06786440
43 4.21647109 -2.19480971
44 8.18153771 4.21647109
45 5.92096232 8.18153771
46 1.18291933 5.92096232
47 7.60764566 1.18291933
48 8.19924712 7.60764566
49 2.94169460 8.19924712
50 12.00319672 2.94169460
51 2.83942293 12.00319672
52 8.17466087 2.83942293
53 0.91067878 8.17466087
54 4.18014824 0.91067878
55 0.14026362 4.18014824
56 16.08006574 0.14026362
57 3.52836815 16.08006574
58 0.95700611 3.52836815
59 7.67820096 0.95700611
60 7.74198665 7.67820096
61 1.76270788 7.74198665
62 0.43036637 1.76270788
63 9.74234879 0.43036637
64 7.84016539 9.74234879
65 7.50403176 7.84016539
66 10.60269271 7.50403176
67 8.43070827 10.60269271
68 13.11309710 8.43070827
69 10.49380926 13.11309710
70 7.60950487 10.49380926
71 8.03164537 7.60950487
72 2.02724914 8.03164537
73 -12.39769001 2.02724914
74 5.02149128 -12.39769001
75 -2.66159061 5.02149128
76 7.60586738 -2.66159061
77 5.08505797 7.60586738
78 -2.00425280 5.08505797
79 -29.31944956 -2.00425280
80 15.72478846 -29.31944956
81 -10.83836753 15.72478846
82 6.29569122 -10.83836753
83 2.31910694 6.29569122
84 -13.84984003 2.31910694
85 -14.87496660 -13.84984003
86 -14.23321162 -14.87496660
87 2.07275329 -14.23321162
88 -10.25215089 2.07275329
89 -0.82954331 -10.25215089
90 9.29663793 -0.82954331
91 -5.19487283 9.29663793
92 4.07790156 -5.19487283
93 -20.45865284 4.07790156
94 -16.01936336 -20.45865284
95 6.47277583 -16.01936336
96 20.44304821 6.47277583
97 -3.88449581 20.44304821
98 7.08982485 -3.88449581
99 0.44013069 7.08982485
100 -1.08721792 0.44013069
101 -14.50428387 -1.08721792
102 9.79100983 -14.50428387
103 5.94144823 9.79100983
104 -6.83379228 5.94144823
105 1.62427745 -6.83379228
106 6.94803496 1.62427745
107 1.92136557 6.94803496
108 -2.88062603 1.92136557
109 -6.62996558 -2.88062603
110 5.78002524 -6.62996558
111 -4.57792109 5.78002524
112 4.14675054 -4.57792109
113 -1.80213207 4.14675054
114 1.72784392 -1.80213207
115 15.54377658 1.72784392
116 -9.48023288 15.54377658
117 -26.26862935 -9.48023288
118 -1.33564554 -26.26862935
119 3.75572015 -1.33564554
120 5.50564000 3.75572015
121 -18.43912231 5.50564000
122 1.52257140 -18.43912231
123 -12.65525191 1.52257140
124 10.79783045 -12.65525191
125 -14.22484491 10.79783045
126 -10.48985481 -14.22484491
127 -4.68795594 -10.48985481
128 -7.43003659 -4.68795594
129 10.46177073 -7.43003659
130 -0.74518789 10.46177073
131 5.45752392 -0.74518789
132 10.77903051 5.45752392
133 1.93440618 10.77903051
134 1.56508584 1.93440618
135 4.04161888 1.56508584
136 -29.25124775 4.04161888
137 8.81773179 -29.25124775
138 1.55814990 8.81773179
139 3.22047273 1.55814990
140 NA 3.22047273
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 8.60652534 -11.07308322
[2,] -2.89332687 8.60652534
[3,] -15.32966229 -2.89332687
[4,] 1.85023409 -15.32966229
[5,] -4.17198151 1.85023409
[6,] 6.74871482 -4.17198151
[7,] 4.24508118 6.74871482
[8,] 0.87280948 4.24508118
[9,] 2.94073422 0.87280948
[10,] -14.42354899 2.94073422
[11,] -8.10297833 -14.42354899
[12,] -5.60766801 -8.10297833
[13,] -2.92383342 -5.60766801
[14,] -1.46397507 -2.92383342
[15,] 3.07551603 -1.46397507
[16,] 4.65743800 3.07551603
[17,] 3.38197180 4.65743800
[18,] -0.71871833 3.38197180
[19,] -1.85077310 -0.71871833
[20,] 0.83494418 -1.85077310
[21,] -0.05418539 0.83494418
[22,] 4.05174663 -0.05418539
[23,] 5.54576982 4.05174663
[24,] -14.01213199 5.54576982
[25,] -30.17294473 -14.01213199
[26,] 3.65355925 -30.17294473
[27,] 1.51134690 3.65355925
[28,] 6.79825754 1.51134690
[29,] 0.68290166 6.79825754
[30,] -0.17686232 0.68290166
[31,] -3.67741595 -0.17686232
[32,] -7.48890680 -3.67741595
[33,] 2.99739585 -7.48890680
[34,] -1.93492506 2.99739585
[35,] 2.76760951 -1.93492506
[36,] -1.11977504 2.76760951
[37,] -2.56907165 -1.11977504
[38,] 3.34053849 -2.56907165
[39,] -4.19947856 3.34053849
[40,] -7.05274151 -4.19947856
[41,] -0.06786440 -7.05274151
[42,] -2.19480971 -0.06786440
[43,] 4.21647109 -2.19480971
[44,] 8.18153771 4.21647109
[45,] 5.92096232 8.18153771
[46,] 1.18291933 5.92096232
[47,] 7.60764566 1.18291933
[48,] 8.19924712 7.60764566
[49,] 2.94169460 8.19924712
[50,] 12.00319672 2.94169460
[51,] 2.83942293 12.00319672
[52,] 8.17466087 2.83942293
[53,] 0.91067878 8.17466087
[54,] 4.18014824 0.91067878
[55,] 0.14026362 4.18014824
[56,] 16.08006574 0.14026362
[57,] 3.52836815 16.08006574
[58,] 0.95700611 3.52836815
[59,] 7.67820096 0.95700611
[60,] 7.74198665 7.67820096
[61,] 1.76270788 7.74198665
[62,] 0.43036637 1.76270788
[63,] 9.74234879 0.43036637
[64,] 7.84016539 9.74234879
[65,] 7.50403176 7.84016539
[66,] 10.60269271 7.50403176
[67,] 8.43070827 10.60269271
[68,] 13.11309710 8.43070827
[69,] 10.49380926 13.11309710
[70,] 7.60950487 10.49380926
[71,] 8.03164537 7.60950487
[72,] 2.02724914 8.03164537
[73,] -12.39769001 2.02724914
[74,] 5.02149128 -12.39769001
[75,] -2.66159061 5.02149128
[76,] 7.60586738 -2.66159061
[77,] 5.08505797 7.60586738
[78,] -2.00425280 5.08505797
[79,] -29.31944956 -2.00425280
[80,] 15.72478846 -29.31944956
[81,] -10.83836753 15.72478846
[82,] 6.29569122 -10.83836753
[83,] 2.31910694 6.29569122
[84,] -13.84984003 2.31910694
[85,] -14.87496660 -13.84984003
[86,] -14.23321162 -14.87496660
[87,] 2.07275329 -14.23321162
[88,] -10.25215089 2.07275329
[89,] -0.82954331 -10.25215089
[90,] 9.29663793 -0.82954331
[91,] -5.19487283 9.29663793
[92,] 4.07790156 -5.19487283
[93,] -20.45865284 4.07790156
[94,] -16.01936336 -20.45865284
[95,] 6.47277583 -16.01936336
[96,] 20.44304821 6.47277583
[97,] -3.88449581 20.44304821
[98,] 7.08982485 -3.88449581
[99,] 0.44013069 7.08982485
[100,] -1.08721792 0.44013069
[101,] -14.50428387 -1.08721792
[102,] 9.79100983 -14.50428387
[103,] 5.94144823 9.79100983
[104,] -6.83379228 5.94144823
[105,] 1.62427745 -6.83379228
[106,] 6.94803496 1.62427745
[107,] 1.92136557 6.94803496
[108,] -2.88062603 1.92136557
[109,] -6.62996558 -2.88062603
[110,] 5.78002524 -6.62996558
[111,] -4.57792109 5.78002524
[112,] 4.14675054 -4.57792109
[113,] -1.80213207 4.14675054
[114,] 1.72784392 -1.80213207
[115,] 15.54377658 1.72784392
[116,] -9.48023288 15.54377658
[117,] -26.26862935 -9.48023288
[118,] -1.33564554 -26.26862935
[119,] 3.75572015 -1.33564554
[120,] 5.50564000 3.75572015
[121,] -18.43912231 5.50564000
[122,] 1.52257140 -18.43912231
[123,] -12.65525191 1.52257140
[124,] 10.79783045 -12.65525191
[125,] -14.22484491 10.79783045
[126,] -10.48985481 -14.22484491
[127,] -4.68795594 -10.48985481
[128,] -7.43003659 -4.68795594
[129,] 10.46177073 -7.43003659
[130,] -0.74518789 10.46177073
[131,] 5.45752392 -0.74518789
[132,] 10.77903051 5.45752392
[133,] 1.93440618 10.77903051
[134,] 1.56508584 1.93440618
[135,] 4.04161888 1.56508584
[136,] -29.25124775 4.04161888
[137,] 8.81773179 -29.25124775
[138,] 1.55814990 8.81773179
[139,] 3.22047273 1.55814990
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 8.60652534 -11.07308322
2 -2.89332687 8.60652534
3 -15.32966229 -2.89332687
4 1.85023409 -15.32966229
5 -4.17198151 1.85023409
6 6.74871482 -4.17198151
7 4.24508118 6.74871482
8 0.87280948 4.24508118
9 2.94073422 0.87280948
10 -14.42354899 2.94073422
11 -8.10297833 -14.42354899
12 -5.60766801 -8.10297833
13 -2.92383342 -5.60766801
14 -1.46397507 -2.92383342
15 3.07551603 -1.46397507
16 4.65743800 3.07551603
17 3.38197180 4.65743800
18 -0.71871833 3.38197180
19 -1.85077310 -0.71871833
20 0.83494418 -1.85077310
21 -0.05418539 0.83494418
22 4.05174663 -0.05418539
23 5.54576982 4.05174663
24 -14.01213199 5.54576982
25 -30.17294473 -14.01213199
26 3.65355925 -30.17294473
27 1.51134690 3.65355925
28 6.79825754 1.51134690
29 0.68290166 6.79825754
30 -0.17686232 0.68290166
31 -3.67741595 -0.17686232
32 -7.48890680 -3.67741595
33 2.99739585 -7.48890680
34 -1.93492506 2.99739585
35 2.76760951 -1.93492506
36 -1.11977504 2.76760951
37 -2.56907165 -1.11977504
38 3.34053849 -2.56907165
39 -4.19947856 3.34053849
40 -7.05274151 -4.19947856
41 -0.06786440 -7.05274151
42 -2.19480971 -0.06786440
43 4.21647109 -2.19480971
44 8.18153771 4.21647109
45 5.92096232 8.18153771
46 1.18291933 5.92096232
47 7.60764566 1.18291933
48 8.19924712 7.60764566
49 2.94169460 8.19924712
50 12.00319672 2.94169460
51 2.83942293 12.00319672
52 8.17466087 2.83942293
53 0.91067878 8.17466087
54 4.18014824 0.91067878
55 0.14026362 4.18014824
56 16.08006574 0.14026362
57 3.52836815 16.08006574
58 0.95700611 3.52836815
59 7.67820096 0.95700611
60 7.74198665 7.67820096
61 1.76270788 7.74198665
62 0.43036637 1.76270788
63 9.74234879 0.43036637
64 7.84016539 9.74234879
65 7.50403176 7.84016539
66 10.60269271 7.50403176
67 8.43070827 10.60269271
68 13.11309710 8.43070827
69 10.49380926 13.11309710
70 7.60950487 10.49380926
71 8.03164537 7.60950487
72 2.02724914 8.03164537
73 -12.39769001 2.02724914
74 5.02149128 -12.39769001
75 -2.66159061 5.02149128
76 7.60586738 -2.66159061
77 5.08505797 7.60586738
78 -2.00425280 5.08505797
79 -29.31944956 -2.00425280
80 15.72478846 -29.31944956
81 -10.83836753 15.72478846
82 6.29569122 -10.83836753
83 2.31910694 6.29569122
84 -13.84984003 2.31910694
85 -14.87496660 -13.84984003
86 -14.23321162 -14.87496660
87 2.07275329 -14.23321162
88 -10.25215089 2.07275329
89 -0.82954331 -10.25215089
90 9.29663793 -0.82954331
91 -5.19487283 9.29663793
92 4.07790156 -5.19487283
93 -20.45865284 4.07790156
94 -16.01936336 -20.45865284
95 6.47277583 -16.01936336
96 20.44304821 6.47277583
97 -3.88449581 20.44304821
98 7.08982485 -3.88449581
99 0.44013069 7.08982485
100 -1.08721792 0.44013069
101 -14.50428387 -1.08721792
102 9.79100983 -14.50428387
103 5.94144823 9.79100983
104 -6.83379228 5.94144823
105 1.62427745 -6.83379228
106 6.94803496 1.62427745
107 1.92136557 6.94803496
108 -2.88062603 1.92136557
109 -6.62996558 -2.88062603
110 5.78002524 -6.62996558
111 -4.57792109 5.78002524
112 4.14675054 -4.57792109
113 -1.80213207 4.14675054
114 1.72784392 -1.80213207
115 15.54377658 1.72784392
116 -9.48023288 15.54377658
117 -26.26862935 -9.48023288
118 -1.33564554 -26.26862935
119 3.75572015 -1.33564554
120 5.50564000 3.75572015
121 -18.43912231 5.50564000
122 1.52257140 -18.43912231
123 -12.65525191 1.52257140
124 10.79783045 -12.65525191
125 -14.22484491 10.79783045
126 -10.48985481 -14.22484491
127 -4.68795594 -10.48985481
128 -7.43003659 -4.68795594
129 10.46177073 -7.43003659
130 -0.74518789 10.46177073
131 5.45752392 -0.74518789
132 10.77903051 5.45752392
133 1.93440618 10.77903051
134 1.56508584 1.93440618
135 4.04161888 1.56508584
136 -29.25124775 4.04161888
137 8.81773179 -29.25124775
138 1.55814990 8.81773179
139 3.22047273 1.55814990
> 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/763h01352124478.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/8hdzj1352124478.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/9f3fh1352124478.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/106q171352124478.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/1133t81352124478.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/12hgg71352124478.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/130nr01352124478.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/14c7431352124478.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/15pr221352124478.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/164qo71352124479.tab")
+ }
>
> try(system("convert tmp/1o33z1352124478.ps tmp/1o33z1352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/24h951352124478.ps tmp/24h951352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/3sjc31352124478.ps tmp/3sjc31352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/415a31352124478.ps tmp/415a31352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/5neod1352124478.ps tmp/5neod1352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/65uh41352124478.ps tmp/65uh41352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/763h01352124478.ps tmp/763h01352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/8hdzj1352124478.ps tmp/8hdzj1352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/9f3fh1352124478.ps tmp/9f3fh1352124478.png",intern=TRUE))
character(0)
> try(system("convert tmp/106q171352124478.ps tmp/106q171352124478.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.342 1.292 9.625