R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(9
+ ,13
+ ,13
+ ,14
+ ,13
+ ,3
+ ,9
+ ,12
+ ,12
+ ,8
+ ,13
+ ,5
+ ,9
+ ,8
+ ,10
+ ,12
+ ,16
+ ,6
+ ,9
+ ,12
+ ,9
+ ,7
+ ,12
+ ,6
+ ,9
+ ,10
+ ,10
+ ,10
+ ,11
+ ,5
+ ,9
+ ,12
+ ,12
+ ,7
+ ,12
+ ,3
+ ,9
+ ,15
+ ,13
+ ,16
+ ,18
+ ,8
+ ,9
+ ,9
+ ,12
+ ,11
+ ,11
+ ,4
+ ,9
+ ,12
+ ,15
+ ,14
+ ,14
+ ,4
+ ,9
+ ,11
+ ,6
+ ,6
+ ,9
+ ,4
+ ,9
+ ,11
+ ,5
+ ,16
+ ,14
+ ,6
+ ,9
+ ,11
+ ,12
+ ,11
+ ,12
+ ,6
+ ,9
+ ,15
+ ,11
+ ,16
+ ,11
+ ,5
+ ,9
+ ,7
+ ,14
+ ,12
+ ,12
+ ,4
+ ,9
+ ,11
+ ,14
+ ,7
+ ,13
+ ,6
+ ,9
+ ,11
+ ,12
+ ,13
+ ,11
+ ,4
+ ,9
+ ,10
+ ,12
+ ,11
+ ,12
+ ,6
+ ,9
+ ,14
+ ,11
+ ,15
+ ,16
+ ,6
+ ,9
+ ,10
+ ,11
+ ,7
+ ,9
+ ,4
+ ,9
+ ,6
+ ,7
+ ,9
+ ,11
+ ,4
+ ,9
+ ,11
+ ,9
+ ,7
+ ,13
+ ,2
+ ,9
+ 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 ,10
+ ,12
+ ,12
+ ,9
+ ,13
+ ,4
+ ,10
+ ,14
+ ,11
+ ,15
+ ,14
+ ,6
+ ,10
+ ,7
+ ,12
+ ,13
+ ,12
+ ,3
+ ,10
+ ,19
+ ,12
+ ,15
+ ,15
+ ,6
+ ,10
+ ,12
+ ,10
+ ,14
+ ,14
+ ,5
+ ,10
+ ,12
+ ,11
+ ,16
+ ,13
+ ,4
+ ,10
+ ,13
+ ,12
+ ,14
+ ,14
+ ,6
+ ,10
+ ,15
+ ,12
+ ,14
+ ,16
+ ,4
+ ,10
+ ,8
+ ,10
+ ,10
+ ,6
+ ,4
+ ,10
+ ,12
+ ,12
+ ,10
+ ,13
+ ,4
+ ,10
+ ,10
+ ,13
+ ,4
+ ,13
+ ,6
+ ,10
+ ,8
+ ,12
+ ,8
+ ,14
+ ,5
+ ,10
+ ,10
+ ,15
+ ,15
+ ,15
+ ,6
+ ,10
+ ,15
+ ,11
+ ,16
+ ,14
+ ,6
+ ,10
+ ,16
+ ,12
+ ,12
+ ,15
+ ,8
+ ,10
+ ,13
+ ,11
+ ,12
+ ,13
+ ,7
+ ,10
+ ,16
+ ,12
+ ,15
+ ,16
+ ,7
+ ,10
+ ,9
+ ,11
+ ,9
+ ,12
+ ,4
+ ,10
+ ,14
+ ,10
+ ,12
+ ,15
+ ,6
+ ,10
+ ,14
+ ,11
+ ,14
+ ,12
+ ,6
+ ,10
+ ,12
+ ,11
+ ,11
+ ,14
+ ,2)
+ ,dim=c(6
+ ,156)
+ ,dimnames=list(c('Month'
+ ,'Depressie'
+ ,'belasting'
+ ,'autonomie'
+ ,'conformistisch'
+ ,'agressief')
+ ,1:156))
> y <- array(NA,dim=c(6,156),dimnames=list(c('Month','Depressie','belasting','autonomie','conformistisch','agressief'),1:156))
> 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
> 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
autonomie Month Depressie belasting conformistisch agressief
1 14 9 13 13 13 3
2 8 9 12 12 13 5
3 12 9 8 10 16 6
4 7 9 12 9 12 6
5 10 9 10 10 11 5
6 7 9 12 12 12 3
7 16 9 15 13 18 8
8 11 9 9 12 11 4
9 14 9 12 15 14 4
10 6 9 11 6 9 4
11 16 9 11 5 14 6
12 11 9 11 12 12 6
13 16 9 15 11 11 5
14 12 9 7 14 12 4
15 7 9 11 14 13 6
16 13 9 11 12 11 4
17 11 9 10 12 12 6
18 15 9 14 11 16 6
19 7 9 10 11 9 4
20 9 9 6 7 11 4
21 7 9 11 9 13 2
22 14 9 15 11 15 7
23 15 9 11 11 10 5
24 7 9 12 12 11 4
25 15 9 14 12 13 6
26 17 9 15 11 16 6
27 15 9 9 11 15 7
28 14 9 13 8 14 5
29 14 9 13 9 14 6
30 8 9 16 12 14 4
31 8 9 13 10 8 4
32 14 9 12 10 13 7
33 14 9 14 12 15 7
34 8 9 11 8 13 4
35 11 9 9 12 11 4
36 16 9 16 11 15 6
37 10 9 12 12 15 6
38 8 9 10 7 9 5
39 14 9 13 11 13 6
40 16 9 16 11 16 7
41 13 9 14 12 13 6
42 5 9 15 9 11 3
43 8 9 5 15 12 3
44 10 9 8 11 12 4
45 8 9 11 11 12 6
46 13 9 16 11 14 7
47 15 9 17 11 14 5
48 6 9 9 15 8 4
49 12 9 9 11 13 5
50 16 9 13 12 16 6
51 5 9 10 12 13 6
52 15 9 6 9 11 6
53 12 9 12 12 14 5
54 8 9 8 12 13 4
55 13 9 14 13 13 5
56 14 9 12 11 13 5
57 12 10 11 9 12 4
58 16 10 16 9 16 6
59 10 10 8 11 15 2
60 15 10 15 11 15 8
61 8 10 7 12 12 3
62 16 10 16 12 14 6
63 19 10 14 9 12 6
64 14 10 16 11 15 6
65 6 10 9 9 12 5
66 13 10 14 12 13 5
67 15 10 11 12 12 6
68 7 10 13 12 12 5
69 13 10 15 12 13 6
70 4 10 5 14 5 2
71 14 10 15 11 13 5
72 13 10 13 12 13 5
73 11 10 11 11 14 5
74 14 10 11 6 17 6
75 12 10 12 10 13 6
76 15 10 12 12 13 6
77 14 10 12 13 12 5
78 13 10 12 8 13 5
79 8 10 14 12 14 4
80 6 10 6 12 11 2
81 7 10 7 12 12 4
82 13 10 14 6 12 6
83 13 10 14 11 16 6
84 11 10 10 10 12 5
85 5 10 13 12 12 3
86 12 10 12 13 12 6
87 8 10 9 11 10 4
88 11 10 12 7 15 5
89 14 10 16 11 15 8
90 9 10 10 11 12 4
91 10 10 14 11 16 6
92 13 10 10 11 15 6
93 16 10 16 12 16 7
94 16 10 15 10 13 6
95 11 10 12 11 12 5
96 8 10 10 12 11 4
97 4 10 8 7 13 6
98 7 10 8 13 10 3
99 14 10 11 8 15 5
100 11 10 13 12 13 6
101 17 10 16 11 16 7
102 15 10 16 12 15 7
103 17 10 14 14 18 6
104 5 10 11 10 13 3
105 4 10 4 10 10 2
106 10 10 14 13 16 8
107 11 10 9 10 13 3
108 15 10 14 11 15 8
109 10 10 8 10 14 3
110 9 10 8 7 15 4
111 12 10 11 10 14 5
112 15 10 12 8 13 7
113 7 10 11 12 13 6
114 13 10 14 12 15 6
115 12 10 15 12 16 7
116 14 10 16 11 14 6
117 14 10 16 12 14 6
118 8 10 11 12 16 6
119 15 10 14 12 14 6
120 12 10 14 11 12 4
121 12 10 12 12 13 4
122 16 10 14 11 12 5
123 9 10 8 11 12 4
124 15 10 13 13 14 6
125 15 10 16 12 14 6
126 6 10 12 12 14 5
127 14 10 16 12 16 8
128 15 10 12 12 13 6
129 10 10 11 8 14 5
130 6 10 4 8 4 4
131 14 10 16 12 16 8
132 12 10 15 11 13 6
133 8 10 10 12 16 4
134 11 10 13 13 15 6
135 13 10 15 12 14 6
136 9 10 12 12 13 4
137 15 10 14 11 14 6
138 13 10 7 12 12 3
139 15 10 19 12 15 6
140 14 10 12 10 14 5
141 16 10 12 11 13 4
142 14 10 13 12 14 6
143 14 10 15 12 16 4
144 10 10 8 10 6 4
145 10 10 12 12 13 4
146 4 10 10 13 13 6
147 8 10 8 12 14 5
148 15 10 10 15 15 6
149 16 10 15 11 14 6
150 12 10 16 12 15 8
151 12 10 13 11 13 7
152 15 10 16 12 16 7
153 9 10 9 11 12 4
154 12 10 14 10 15 6
155 14 10 14 11 12 6
156 11 10 12 11 14 2
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Month Depressie belasting conformistisch
2.27280 -0.19692 0.38662 -0.05894 0.28639
agressief
0.66472
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.1150 -1.4543 0.2161 1.6392 6.3891
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.27280 4.51857 0.503 0.61571
Month -0.19692 0.44908 -0.438 0.66166
Depressie 0.38662 0.09575 4.038 8.58e-05 ***
belasting -0.05894 0.11989 -0.492 0.62372
conformistisch 0.28639 0.12490 2.293 0.02324 *
agressief 0.66472 0.19991 3.325 0.00111 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.66 on 150 degrees of freedom
Multiple R-squared: 0.4286, Adjusted R-squared: 0.4096
F-statistic: 22.5 on 5 and 150 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.7532023 0.49359542 0.24679771
[2,] 0.7127295 0.57454091 0.28727045
[3,] 0.8713108 0.25737830 0.12868915
[4,] 0.8345242 0.33095155 0.16547578
[5,] 0.9411112 0.11777765 0.05888882
[6,] 0.9380058 0.12398840 0.06199420
[7,] 0.9564475 0.08710503 0.04355251
[8,] 0.9563683 0.08726342 0.04363171
[9,] 0.9365642 0.12687157 0.06343579
[10,] 0.9077160 0.18456805 0.09228402
[11,] 0.8769644 0.24607117 0.12303558
[12,] 0.8329206 0.33415890 0.16707945
[13,] 0.8821468 0.23570650 0.11785325
[14,] 0.8419822 0.31603551 0.15801775
[15,] 0.9168987 0.16620265 0.08310132
[16,] 0.9238931 0.15221383 0.07610691
[17,] 0.9131757 0.17364865 0.08682432
[18,] 0.9053151 0.18936986 0.09468493
[19,] 0.8938672 0.21226569 0.10613285
[20,] 0.8707102 0.25857959 0.12928980
[21,] 0.8378475 0.32430507 0.16215254
[22,] 0.8929531 0.21409382 0.10704691
[23,] 0.8676086 0.26478284 0.13239142
[24,] 0.8365813 0.32683749 0.16341875
[25,] 0.7989236 0.40215280 0.20107640
[26,] 0.7934641 0.41307180 0.20653590
[27,] 0.7660123 0.46797545 0.23398772
[28,] 0.7407982 0.51840356 0.25920178
[29,] 0.7574534 0.48509311 0.24254655
[30,] 0.7248283 0.55034334 0.27517167
[31,] 0.6890321 0.62193570 0.31096785
[32,] 0.6413484 0.71730312 0.35865156
[33,] 0.5886337 0.82273253 0.41136626
[34,] 0.7205136 0.55897287 0.27948644
[35,] 0.6824548 0.63509035 0.31754517
[36,] 0.6363609 0.72727820 0.36363910
[37,] 0.6846349 0.63073021 0.31536511
[38,] 0.6579299 0.68414022 0.34207011
[39,] 0.6347873 0.73042539 0.36521269
[40,] 0.6167388 0.76652235 0.38326117
[41,] 0.5742448 0.85151045 0.42575523
[42,] 0.5517855 0.89642905 0.44821453
[43,] 0.8039075 0.39218506 0.19609253
[44,] 0.8800798 0.23984049 0.11992024
[45,] 0.8533205 0.29335905 0.14667952
[46,] 0.8384772 0.32304550 0.16152275
[47,] 0.8146132 0.37077367 0.18538684
[48,] 0.7990699 0.40186013 0.20093006
[49,] 0.7660774 0.46784512 0.23392256
[50,] 0.7304320 0.53913590 0.26956795
[51,] 0.7031541 0.59369180 0.29684590
[52,] 0.6700699 0.65986020 0.32993010
[53,] 0.6317021 0.73659589 0.36829795
[54,] 0.6052787 0.78944250 0.39472125
[55,] 0.7507690 0.49846191 0.24923096
[56,] 0.7220194 0.55596126 0.27798063
[57,] 0.8067512 0.38649762 0.19324881
[58,] 0.7731489 0.45370218 0.22685109
[59,] 0.7915706 0.41685882 0.20842941
[60,] 0.8644820 0.27103604 0.13551802
[61,] 0.8381134 0.32377318 0.16188659
[62,] 0.8099349 0.38013011 0.19006506
[63,] 0.7810288 0.43794233 0.21897117
[64,] 0.7486726 0.50265480 0.25132740
[65,] 0.7158995 0.56820095 0.28410047
[66,] 0.6921253 0.61574946 0.30787473
[67,] 0.6522864 0.69542729 0.34771364
[68,] 0.6576697 0.68466055 0.34233027
[69,] 0.6576639 0.68467223 0.34233611
[70,] 0.6219004 0.75619929 0.37809964
[71,] 0.6913207 0.61735868 0.30867934
[72,] 0.6514923 0.69701543 0.34850771
[73,] 0.6260630 0.74787396 0.37393698
[74,] 0.5804801 0.83903986 0.41951993
[75,] 0.5427577 0.91448453 0.45724227
[76,] 0.4988915 0.99778299 0.50110850
[77,] 0.6847771 0.63044579 0.31522290
[78,] 0.6427535 0.71449291 0.35724645
[79,] 0.6041627 0.79167451 0.39583726
[80,] 0.5672528 0.86549444 0.43274722
[81,] 0.5400791 0.91984177 0.45992089
[82,] 0.4976170 0.99523395 0.50238303
[83,] 0.5424882 0.91502365 0.45751183
[84,] 0.5306864 0.93862712 0.46931356
[85,] 0.4910726 0.98214527 0.50892736
[86,] 0.4832795 0.96655903 0.51672049
[87,] 0.4361155 0.87223090 0.56388455
[88,] 0.4089601 0.81792011 0.59103994
[89,] 0.6179565 0.76408694 0.38204347
[90,] 0.5768139 0.84637216 0.42318608
[91,] 0.5735600 0.85287999 0.42644000
[92,] 0.5393780 0.92124395 0.46062197
[93,] 0.5246057 0.95078858 0.47539429
[94,] 0.4763889 0.95277775 0.52361113
[95,] 0.5365305 0.92693898 0.46346949
[96,] 0.7107603 0.57847935 0.28923968
[97,] 0.7015573 0.59688533 0.29844266
[98,] 0.7521940 0.49561193 0.24780597
[99,] 0.7258611 0.54827776 0.27413888
[100,] 0.7050082 0.58998356 0.29499178
[101,] 0.6656468 0.66870633 0.33435317
[102,] 0.6180501 0.76389975 0.38194988
[103,] 0.5731675 0.85366503 0.42683251
[104,] 0.6143964 0.77120723 0.38560362
[105,] 0.6925293 0.61494145 0.30747073
[106,] 0.6431134 0.71377311 0.35688655
[107,] 0.6151595 0.76968098 0.38484049
[108,] 0.5616313 0.87673741 0.43836871
[109,] 0.5082443 0.98351130 0.49175565
[110,] 0.5331055 0.93378901 0.46689450
[111,] 0.5066225 0.98675496 0.49337748
[112,] 0.4657323 0.93146458 0.53426771
[113,] 0.4127522 0.82550442 0.58724779
[114,] 0.4351207 0.87024132 0.56487934
[115,] 0.3770672 0.75413437 0.62293282
[116,] 0.3696207 0.73924138 0.63037931
[117,] 0.3188847 0.63776947 0.68111526
[118,] 0.5332195 0.93356091 0.46678046
[119,] 0.4750953 0.95019059 0.52490470
[120,] 0.5086848 0.98263038 0.49131519
[121,] 0.4510583 0.90211661 0.54894170
[122,] 0.3978115 0.79562297 0.60218852
[123,] 0.3391379 0.67827583 0.66086209
[124,] 0.2954942 0.59098841 0.70450579
[125,] 0.3021122 0.60422450 0.69788775
[126,] 0.2556882 0.51137649 0.74431175
[127,] 0.2005728 0.40114557 0.79942721
[128,] 0.2146625 0.42932509 0.78533745
[129,] 0.1854170 0.37083407 0.81458296
[130,] 0.2324026 0.46480514 0.76759743
[131,] 0.1980120 0.39602405 0.80198797
[132,] 0.1931127 0.38622533 0.80688734
[133,] 0.2891758 0.57835165 0.71082418
[134,] 0.2373921 0.47478429 0.76260786
[135,] 0.1658686 0.33173713 0.83413143
[136,] 0.1450675 0.29013498 0.85493251
[137,] 0.1050684 0.21013686 0.89493157
[138,] 0.6436272 0.71274569 0.35637285
[139,] 0.4937410 0.98748192 0.50625904
> postscript(file="/var/wessaorg/rcomp/tmp/1f9sg1321903016.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/2ubl91321903016.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/371ev1321903016.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/4keuh1321903016.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/5p5el1321903016.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 = 156
Frequency = 1
1 2 3 4 5 6
3.522352696 -3.479403522 0.425284659 -5.034537412 -0.251256226 -2.863573656
7 8 9 10 11 12
-0.006440601 1.917951312 3.075730368 -3.636113203 3.543541184 -0.471110467
13 14 15 16 17 18
3.874600988 3.522662530 -4.639631162 3.144719399 -0.084494510 1.164525917
19 20 21 22 23 24
-1.954812266 0.783114200 -2.275445787 -0.600412941 4.707459501 -3.241896558
25 26 27 28 29 30
2.082646976 2.777909960 2.719282798 1.611837849 1.006057256 -4.647544446
31 32 33 34 35 36
-1.887202444 1.073287307 -0.154859988 -2.663817962 1.917951312 1.677688691
37 38 39 40 41 42
-2.716910486 -1.855277840 1.410325936 0.726576415 0.082646976 -5.913837827
43 44 45 46 47 48
1.019549028 0.959235584 -3.530047463 -1.700634210 1.242185012 -2.046053636
49 50 51 52 53 54
1.621507351 2.610078869 -6.370889198 5.571553014 0.234201790 -1.268222107
55 56 57 58 59 60
0.806301561 2.461659482 1.878431865 1.470338154 1.626404842 -0.068212387
61 62 63 64 65 66
0.266424269 2.219938518 6.389148818 -0.125393166 -4.013053811 0.944282708
67 68 69 70 71 72
3.725807676 -4.382706648 -0.107050838 -0.172989423 1.498729755 1.330898664
73 74 75 76 77 78
-0.241201107 0.940212260 -0.065076961 3.052797032 3.062846305 1.481766636
79 80 81 82 83 84
-3.677394391 -0.395847498 -1.398293320 0.212337829 -0.638555941 0.659267229
85 86 87 88 89 90
-5.053271470 0.398128716 -0.657672854 -1.149959736 -1.454828344 -0.617078186
91 92 93 94 95 96
-3.638555941 1.194302573 0.982431554 2.775075170 -0.055027688 -1.271746502
97 98 99 100 101 102
-6.695424124 -0.488465316 2.295593217 -1.333818925 1.923494557 0.268826241
103 104 105 106 107 108
2.965465673 -4.684308237 -1.454094890 -4.850117126 2.088923676 0.318403569
109 110 111 112 113 114
1.189144944 -0.938778321 0.699861897 2.152331457 -4.560587012 -0.293224257
115 116 117 118 119 120
-2.630952490 0.161001522 0.219938518 -4.419771075 1.993170431 0.836457988
121 122 123 124 125 126
1.382232210 4.171740399 0.156153727 2.438723384 1.219938518 -5.568880067
127 128 129 130 131 132
-1.682286035 3.052797032 -1.418012096 0.816964065 -1.682286035 -1.165987834
133 134 135 136 137 138
-2.703719940 -1.847671304 -0.393445525 -1.617767790 1.934233435 5.266424269
139 140 141 142 143 144
-0.226304039 2.313245940 5.323295213 1.379786388 1.363200277 2.815584857
145 146 147 148 149 150
-0.617767790 -7.115034059 -2.022416241 3.430050558 2.547617478 -3.395891348
151 152 153 154 155 156
-1.057473510 -0.017568446 -0.230462230 -1.411098249 1.507022810 1.366335704
> postscript(file="/var/wessaorg/rcomp/tmp/6t1m91321903016.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 3.522352696 NA
1 -3.479403522 3.522352696
2 0.425284659 -3.479403522
3 -5.034537412 0.425284659
4 -0.251256226 -5.034537412
5 -2.863573656 -0.251256226
6 -0.006440601 -2.863573656
7 1.917951312 -0.006440601
8 3.075730368 1.917951312
9 -3.636113203 3.075730368
10 3.543541184 -3.636113203
11 -0.471110467 3.543541184
12 3.874600988 -0.471110467
13 3.522662530 3.874600988
14 -4.639631162 3.522662530
15 3.144719399 -4.639631162
16 -0.084494510 3.144719399
17 1.164525917 -0.084494510
18 -1.954812266 1.164525917
19 0.783114200 -1.954812266
20 -2.275445787 0.783114200
21 -0.600412941 -2.275445787
22 4.707459501 -0.600412941
23 -3.241896558 4.707459501
24 2.082646976 -3.241896558
25 2.777909960 2.082646976
26 2.719282798 2.777909960
27 1.611837849 2.719282798
28 1.006057256 1.611837849
29 -4.647544446 1.006057256
30 -1.887202444 -4.647544446
31 1.073287307 -1.887202444
32 -0.154859988 1.073287307
33 -2.663817962 -0.154859988
34 1.917951312 -2.663817962
35 1.677688691 1.917951312
36 -2.716910486 1.677688691
37 -1.855277840 -2.716910486
38 1.410325936 -1.855277840
39 0.726576415 1.410325936
40 0.082646976 0.726576415
41 -5.913837827 0.082646976
42 1.019549028 -5.913837827
43 0.959235584 1.019549028
44 -3.530047463 0.959235584
45 -1.700634210 -3.530047463
46 1.242185012 -1.700634210
47 -2.046053636 1.242185012
48 1.621507351 -2.046053636
49 2.610078869 1.621507351
50 -6.370889198 2.610078869
51 5.571553014 -6.370889198
52 0.234201790 5.571553014
53 -1.268222107 0.234201790
54 0.806301561 -1.268222107
55 2.461659482 0.806301561
56 1.878431865 2.461659482
57 1.470338154 1.878431865
58 1.626404842 1.470338154
59 -0.068212387 1.626404842
60 0.266424269 -0.068212387
61 2.219938518 0.266424269
62 6.389148818 2.219938518
63 -0.125393166 6.389148818
64 -4.013053811 -0.125393166
65 0.944282708 -4.013053811
66 3.725807676 0.944282708
67 -4.382706648 3.725807676
68 -0.107050838 -4.382706648
69 -0.172989423 -0.107050838
70 1.498729755 -0.172989423
71 1.330898664 1.498729755
72 -0.241201107 1.330898664
73 0.940212260 -0.241201107
74 -0.065076961 0.940212260
75 3.052797032 -0.065076961
76 3.062846305 3.052797032
77 1.481766636 3.062846305
78 -3.677394391 1.481766636
79 -0.395847498 -3.677394391
80 -1.398293320 -0.395847498
81 0.212337829 -1.398293320
82 -0.638555941 0.212337829
83 0.659267229 -0.638555941
84 -5.053271470 0.659267229
85 0.398128716 -5.053271470
86 -0.657672854 0.398128716
87 -1.149959736 -0.657672854
88 -1.454828344 -1.149959736
89 -0.617078186 -1.454828344
90 -3.638555941 -0.617078186
91 1.194302573 -3.638555941
92 0.982431554 1.194302573
93 2.775075170 0.982431554
94 -0.055027688 2.775075170
95 -1.271746502 -0.055027688
96 -6.695424124 -1.271746502
97 -0.488465316 -6.695424124
98 2.295593217 -0.488465316
99 -1.333818925 2.295593217
100 1.923494557 -1.333818925
101 0.268826241 1.923494557
102 2.965465673 0.268826241
103 -4.684308237 2.965465673
104 -1.454094890 -4.684308237
105 -4.850117126 -1.454094890
106 2.088923676 -4.850117126
107 0.318403569 2.088923676
108 1.189144944 0.318403569
109 -0.938778321 1.189144944
110 0.699861897 -0.938778321
111 2.152331457 0.699861897
112 -4.560587012 2.152331457
113 -0.293224257 -4.560587012
114 -2.630952490 -0.293224257
115 0.161001522 -2.630952490
116 0.219938518 0.161001522
117 -4.419771075 0.219938518
118 1.993170431 -4.419771075
119 0.836457988 1.993170431
120 1.382232210 0.836457988
121 4.171740399 1.382232210
122 0.156153727 4.171740399
123 2.438723384 0.156153727
124 1.219938518 2.438723384
125 -5.568880067 1.219938518
126 -1.682286035 -5.568880067
127 3.052797032 -1.682286035
128 -1.418012096 3.052797032
129 0.816964065 -1.418012096
130 -1.682286035 0.816964065
131 -1.165987834 -1.682286035
132 -2.703719940 -1.165987834
133 -1.847671304 -2.703719940
134 -0.393445525 -1.847671304
135 -1.617767790 -0.393445525
136 1.934233435 -1.617767790
137 5.266424269 1.934233435
138 -0.226304039 5.266424269
139 2.313245940 -0.226304039
140 5.323295213 2.313245940
141 1.379786388 5.323295213
142 1.363200277 1.379786388
143 2.815584857 1.363200277
144 -0.617767790 2.815584857
145 -7.115034059 -0.617767790
146 -2.022416241 -7.115034059
147 3.430050558 -2.022416241
148 2.547617478 3.430050558
149 -3.395891348 2.547617478
150 -1.057473510 -3.395891348
151 -0.017568446 -1.057473510
152 -0.230462230 -0.017568446
153 -1.411098249 -0.230462230
154 1.507022810 -1.411098249
155 1.366335704 1.507022810
156 NA 1.366335704
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.479403522 3.522352696
[2,] 0.425284659 -3.479403522
[3,] -5.034537412 0.425284659
[4,] -0.251256226 -5.034537412
[5,] -2.863573656 -0.251256226
[6,] -0.006440601 -2.863573656
[7,] 1.917951312 -0.006440601
[8,] 3.075730368 1.917951312
[9,] -3.636113203 3.075730368
[10,] 3.543541184 -3.636113203
[11,] -0.471110467 3.543541184
[12,] 3.874600988 -0.471110467
[13,] 3.522662530 3.874600988
[14,] -4.639631162 3.522662530
[15,] 3.144719399 -4.639631162
[16,] -0.084494510 3.144719399
[17,] 1.164525917 -0.084494510
[18,] -1.954812266 1.164525917
[19,] 0.783114200 -1.954812266
[20,] -2.275445787 0.783114200
[21,] -0.600412941 -2.275445787
[22,] 4.707459501 -0.600412941
[23,] -3.241896558 4.707459501
[24,] 2.082646976 -3.241896558
[25,] 2.777909960 2.082646976
[26,] 2.719282798 2.777909960
[27,] 1.611837849 2.719282798
[28,] 1.006057256 1.611837849
[29,] -4.647544446 1.006057256
[30,] -1.887202444 -4.647544446
[31,] 1.073287307 -1.887202444
[32,] -0.154859988 1.073287307
[33,] -2.663817962 -0.154859988
[34,] 1.917951312 -2.663817962
[35,] 1.677688691 1.917951312
[36,] -2.716910486 1.677688691
[37,] -1.855277840 -2.716910486
[38,] 1.410325936 -1.855277840
[39,] 0.726576415 1.410325936
[40,] 0.082646976 0.726576415
[41,] -5.913837827 0.082646976
[42,] 1.019549028 -5.913837827
[43,] 0.959235584 1.019549028
[44,] -3.530047463 0.959235584
[45,] -1.700634210 -3.530047463
[46,] 1.242185012 -1.700634210
[47,] -2.046053636 1.242185012
[48,] 1.621507351 -2.046053636
[49,] 2.610078869 1.621507351
[50,] -6.370889198 2.610078869
[51,] 5.571553014 -6.370889198
[52,] 0.234201790 5.571553014
[53,] -1.268222107 0.234201790
[54,] 0.806301561 -1.268222107
[55,] 2.461659482 0.806301561
[56,] 1.878431865 2.461659482
[57,] 1.470338154 1.878431865
[58,] 1.626404842 1.470338154
[59,] -0.068212387 1.626404842
[60,] 0.266424269 -0.068212387
[61,] 2.219938518 0.266424269
[62,] 6.389148818 2.219938518
[63,] -0.125393166 6.389148818
[64,] -4.013053811 -0.125393166
[65,] 0.944282708 -4.013053811
[66,] 3.725807676 0.944282708
[67,] -4.382706648 3.725807676
[68,] -0.107050838 -4.382706648
[69,] -0.172989423 -0.107050838
[70,] 1.498729755 -0.172989423
[71,] 1.330898664 1.498729755
[72,] -0.241201107 1.330898664
[73,] 0.940212260 -0.241201107
[74,] -0.065076961 0.940212260
[75,] 3.052797032 -0.065076961
[76,] 3.062846305 3.052797032
[77,] 1.481766636 3.062846305
[78,] -3.677394391 1.481766636
[79,] -0.395847498 -3.677394391
[80,] -1.398293320 -0.395847498
[81,] 0.212337829 -1.398293320
[82,] -0.638555941 0.212337829
[83,] 0.659267229 -0.638555941
[84,] -5.053271470 0.659267229
[85,] 0.398128716 -5.053271470
[86,] -0.657672854 0.398128716
[87,] -1.149959736 -0.657672854
[88,] -1.454828344 -1.149959736
[89,] -0.617078186 -1.454828344
[90,] -3.638555941 -0.617078186
[91,] 1.194302573 -3.638555941
[92,] 0.982431554 1.194302573
[93,] 2.775075170 0.982431554
[94,] -0.055027688 2.775075170
[95,] -1.271746502 -0.055027688
[96,] -6.695424124 -1.271746502
[97,] -0.488465316 -6.695424124
[98,] 2.295593217 -0.488465316
[99,] -1.333818925 2.295593217
[100,] 1.923494557 -1.333818925
[101,] 0.268826241 1.923494557
[102,] 2.965465673 0.268826241
[103,] -4.684308237 2.965465673
[104,] -1.454094890 -4.684308237
[105,] -4.850117126 -1.454094890
[106,] 2.088923676 -4.850117126
[107,] 0.318403569 2.088923676
[108,] 1.189144944 0.318403569
[109,] -0.938778321 1.189144944
[110,] 0.699861897 -0.938778321
[111,] 2.152331457 0.699861897
[112,] -4.560587012 2.152331457
[113,] -0.293224257 -4.560587012
[114,] -2.630952490 -0.293224257
[115,] 0.161001522 -2.630952490
[116,] 0.219938518 0.161001522
[117,] -4.419771075 0.219938518
[118,] 1.993170431 -4.419771075
[119,] 0.836457988 1.993170431
[120,] 1.382232210 0.836457988
[121,] 4.171740399 1.382232210
[122,] 0.156153727 4.171740399
[123,] 2.438723384 0.156153727
[124,] 1.219938518 2.438723384
[125,] -5.568880067 1.219938518
[126,] -1.682286035 -5.568880067
[127,] 3.052797032 -1.682286035
[128,] -1.418012096 3.052797032
[129,] 0.816964065 -1.418012096
[130,] -1.682286035 0.816964065
[131,] -1.165987834 -1.682286035
[132,] -2.703719940 -1.165987834
[133,] -1.847671304 -2.703719940
[134,] -0.393445525 -1.847671304
[135,] -1.617767790 -0.393445525
[136,] 1.934233435 -1.617767790
[137,] 5.266424269 1.934233435
[138,] -0.226304039 5.266424269
[139,] 2.313245940 -0.226304039
[140,] 5.323295213 2.313245940
[141,] 1.379786388 5.323295213
[142,] 1.363200277 1.379786388
[143,] 2.815584857 1.363200277
[144,] -0.617767790 2.815584857
[145,] -7.115034059 -0.617767790
[146,] -2.022416241 -7.115034059
[147,] 3.430050558 -2.022416241
[148,] 2.547617478 3.430050558
[149,] -3.395891348 2.547617478
[150,] -1.057473510 -3.395891348
[151,] -0.017568446 -1.057473510
[152,] -0.230462230 -0.017568446
[153,] -1.411098249 -0.230462230
[154,] 1.507022810 -1.411098249
[155,] 1.366335704 1.507022810
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.479403522 3.522352696
2 0.425284659 -3.479403522
3 -5.034537412 0.425284659
4 -0.251256226 -5.034537412
5 -2.863573656 -0.251256226
6 -0.006440601 -2.863573656
7 1.917951312 -0.006440601
8 3.075730368 1.917951312
9 -3.636113203 3.075730368
10 3.543541184 -3.636113203
11 -0.471110467 3.543541184
12 3.874600988 -0.471110467
13 3.522662530 3.874600988
14 -4.639631162 3.522662530
15 3.144719399 -4.639631162
16 -0.084494510 3.144719399
17 1.164525917 -0.084494510
18 -1.954812266 1.164525917
19 0.783114200 -1.954812266
20 -2.275445787 0.783114200
21 -0.600412941 -2.275445787
22 4.707459501 -0.600412941
23 -3.241896558 4.707459501
24 2.082646976 -3.241896558
25 2.777909960 2.082646976
26 2.719282798 2.777909960
27 1.611837849 2.719282798
28 1.006057256 1.611837849
29 -4.647544446 1.006057256
30 -1.887202444 -4.647544446
31 1.073287307 -1.887202444
32 -0.154859988 1.073287307
33 -2.663817962 -0.154859988
34 1.917951312 -2.663817962
35 1.677688691 1.917951312
36 -2.716910486 1.677688691
37 -1.855277840 -2.716910486
38 1.410325936 -1.855277840
39 0.726576415 1.410325936
40 0.082646976 0.726576415
41 -5.913837827 0.082646976
42 1.019549028 -5.913837827
43 0.959235584 1.019549028
44 -3.530047463 0.959235584
45 -1.700634210 -3.530047463
46 1.242185012 -1.700634210
47 -2.046053636 1.242185012
48 1.621507351 -2.046053636
49 2.610078869 1.621507351
50 -6.370889198 2.610078869
51 5.571553014 -6.370889198
52 0.234201790 5.571553014
53 -1.268222107 0.234201790
54 0.806301561 -1.268222107
55 2.461659482 0.806301561
56 1.878431865 2.461659482
57 1.470338154 1.878431865
58 1.626404842 1.470338154
59 -0.068212387 1.626404842
60 0.266424269 -0.068212387
61 2.219938518 0.266424269
62 6.389148818 2.219938518
63 -0.125393166 6.389148818
64 -4.013053811 -0.125393166
65 0.944282708 -4.013053811
66 3.725807676 0.944282708
67 -4.382706648 3.725807676
68 -0.107050838 -4.382706648
69 -0.172989423 -0.107050838
70 1.498729755 -0.172989423
71 1.330898664 1.498729755
72 -0.241201107 1.330898664
73 0.940212260 -0.241201107
74 -0.065076961 0.940212260
75 3.052797032 -0.065076961
76 3.062846305 3.052797032
77 1.481766636 3.062846305
78 -3.677394391 1.481766636
79 -0.395847498 -3.677394391
80 -1.398293320 -0.395847498
81 0.212337829 -1.398293320
82 -0.638555941 0.212337829
83 0.659267229 -0.638555941
84 -5.053271470 0.659267229
85 0.398128716 -5.053271470
86 -0.657672854 0.398128716
87 -1.149959736 -0.657672854
88 -1.454828344 -1.149959736
89 -0.617078186 -1.454828344
90 -3.638555941 -0.617078186
91 1.194302573 -3.638555941
92 0.982431554 1.194302573
93 2.775075170 0.982431554
94 -0.055027688 2.775075170
95 -1.271746502 -0.055027688
96 -6.695424124 -1.271746502
97 -0.488465316 -6.695424124
98 2.295593217 -0.488465316
99 -1.333818925 2.295593217
100 1.923494557 -1.333818925
101 0.268826241 1.923494557
102 2.965465673 0.268826241
103 -4.684308237 2.965465673
104 -1.454094890 -4.684308237
105 -4.850117126 -1.454094890
106 2.088923676 -4.850117126
107 0.318403569 2.088923676
108 1.189144944 0.318403569
109 -0.938778321 1.189144944
110 0.699861897 -0.938778321
111 2.152331457 0.699861897
112 -4.560587012 2.152331457
113 -0.293224257 -4.560587012
114 -2.630952490 -0.293224257
115 0.161001522 -2.630952490
116 0.219938518 0.161001522
117 -4.419771075 0.219938518
118 1.993170431 -4.419771075
119 0.836457988 1.993170431
120 1.382232210 0.836457988
121 4.171740399 1.382232210
122 0.156153727 4.171740399
123 2.438723384 0.156153727
124 1.219938518 2.438723384
125 -5.568880067 1.219938518
126 -1.682286035 -5.568880067
127 3.052797032 -1.682286035
128 -1.418012096 3.052797032
129 0.816964065 -1.418012096
130 -1.682286035 0.816964065
131 -1.165987834 -1.682286035
132 -2.703719940 -1.165987834
133 -1.847671304 -2.703719940
134 -0.393445525 -1.847671304
135 -1.617767790 -0.393445525
136 1.934233435 -1.617767790
137 5.266424269 1.934233435
138 -0.226304039 5.266424269
139 2.313245940 -0.226304039
140 5.323295213 2.313245940
141 1.379786388 5.323295213
142 1.363200277 1.379786388
143 2.815584857 1.363200277
144 -0.617767790 2.815584857
145 -7.115034059 -0.617767790
146 -2.022416241 -7.115034059
147 3.430050558 -2.022416241
148 2.547617478 3.430050558
149 -3.395891348 2.547617478
150 -1.057473510 -3.395891348
151 -0.017568446 -1.057473510
152 -0.230462230 -0.017568446
153 -1.411098249 -0.230462230
154 1.507022810 -1.411098249
155 1.366335704 1.507022810
> 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/7o9201321903016.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/8vlda1321903016.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/9v5qq1321903016.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/10hc0o1321903016.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/11dfky1321903016.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/12tfgi1321903016.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/13ku4e1321903016.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/14wqok1321903016.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/15zqkv1321903017.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/16cy671321903017.tab")
+ }
>
> try(system("convert tmp/1f9sg1321903016.ps tmp/1f9sg1321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ubl91321903016.ps tmp/2ubl91321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/371ev1321903016.ps tmp/371ev1321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/4keuh1321903016.ps tmp/4keuh1321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/5p5el1321903016.ps tmp/5p5el1321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/6t1m91321903016.ps tmp/6t1m91321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/7o9201321903016.ps tmp/7o9201321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/8vlda1321903016.ps tmp/8vlda1321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/9v5qq1321903016.ps tmp/9v5qq1321903016.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hc0o1321903016.ps tmp/10hc0o1321903016.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.348 0.597 6.055