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(2
+ ,41
+ ,38
+ ,13
+ ,12
+ ,14
+ ,12
+ ,2
+ ,39
+ ,32
+ ,16
+ ,11
+ ,18
+ ,11
+ ,2
+ ,30
+ ,35
+ ,19
+ ,15
+ ,11
+ ,14
+ ,1
+ ,31
+ ,33
+ ,15
+ ,6
+ ,12
+ ,12
+ ,2
+ ,34
+ ,37
+ ,14
+ ,13
+ ,16
+ ,21
+ ,2
+ ,35
+ ,29
+ ,13
+ ,10
+ ,18
+ ,12
+ ,2
+ ,39
+ ,31
+ ,19
+ ,12
+ ,14
+ ,22
+ ,2
+ ,34
+ ,36
+ ,15
+ ,14
+ ,14
+ ,11
+ ,2
+ ,36
+ ,35
+ ,14
+ ,12
+ ,15
+ ,10
+ ,2
+ ,37
+ ,38
+ ,15
+ ,6
+ ,15
+ ,13
+ ,1
+ ,38
+ ,31
+ ,16
+ ,10
+ ,17
+ ,10
+ ,2
+ ,36
+ ,34
+ ,16
+ ,12
+ ,19
+ ,8
+ ,1
+ ,38
+ ,35
+ ,16
+ ,12
+ ,10
+ ,15
+ ,2
+ ,39
+ ,38
+ ,16
+ ,11
+ ,16
+ ,14
+ ,2
+ ,33
+ ,37
+ ,17
+ ,15
+ ,18
+ ,10
+ ,1
+ ,32
+ ,33
+ ,15
+ ,12
+ ,14
+ ,14
+ ,1
+ ,36
+ ,32
+ ,15
+ ,10
+ ,14
+ ,14
+ ,2
+ ,38
+ ,38
+ ,20
+ ,12
+ ,17
+ ,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')
+ ,1:162))
> y <- array(NA,dim=c(7,162),dimnames=list(c('Gender','Connected','Separate','Learning','Software','Happiness','depression'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '5'
> 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 Gender Connected Separate Learning Happiness depression
1 12 2 41 38 13 14 12
2 11 2 39 32 16 18 11
3 15 2 30 35 19 11 14
4 6 1 31 33 15 12 12
5 13 2 34 37 14 16 21
6 10 2 35 29 13 18 12
7 12 2 39 31 19 14 22
8 14 2 34 36 15 14 11
9 12 2 36 35 14 15 10
10 6 2 37 38 15 15 13
11 10 1 38 31 16 17 10
12 12 2 36 34 16 19 8
13 12 1 38 35 16 10 15
14 11 2 39 38 16 16 14
15 15 2 33 37 17 18 10
16 12 1 32 33 15 14 14
17 10 1 36 32 15 14 14
18 12 2 38 38 20 17 11
19 11 1 39 38 18 14 10
20 12 2 32 32 16 16 13
21 11 1 32 33 16 18 7
22 12 2 31 31 16 11 14
23 13 2 39 38 19 14 12
24 11 2 37 39 16 12 14
25 9 1 39 32 17 17 11
26 13 2 41 32 17 9 9
27 10 1 36 35 16 16 11
28 14 2 33 37 15 14 15
29 12 2 33 33 16 15 14
30 10 1 34 33 14 11 13
31 12 2 31 28 15 16 9
32 8 1 27 32 12 13 15
33 10 2 37 31 14 17 10
34 12 2 34 37 16 15 11
35 12 1 34 30 14 14 13
36 7 1 32 33 7 16 8
37 6 1 29 31 10 9 20
38 12 1 36 33 14 15 12
39 10 2 29 31 16 17 10
40 10 1 35 33 16 13 10
41 10 1 37 32 16 15 9
42 12 2 34 33 14 16 14
43 15 1 38 32 20 16 8
44 10 1 35 33 14 12 14
45 10 2 38 28 14 12 11
46 12 2 37 35 11 11 13
47 13 2 38 39 14 15 9
48 11 2 33 34 15 15 11
49 11 2 36 38 16 17 15
50 12 1 38 32 14 13 11
51 14 2 32 38 16 16 10
52 10 1 32 30 14 14 14
53 12 1 32 33 12 11 18
54 13 2 34 38 16 12 14
55 5 1 32 32 9 12 11
56 6 2 37 32 14 15 12
57 12 2 39 34 16 16 13
58 12 2 29 34 16 15 9
59 11 1 37 36 15 12 10
60 10 2 35 34 16 12 15
61 7 1 30 28 12 8 20
62 12 1 38 34 16 13 12
63 14 2 34 35 16 11 12
64 11 2 31 35 14 14 14
65 12 2 34 31 16 15 13
66 13 1 35 37 17 10 11
67 14 2 36 35 18 11 17
68 11 1 30 27 18 12 12
69 12 2 39 40 12 15 13
70 12 1 35 37 16 15 14
71 8 1 38 36 10 14 13
72 11 2 31 38 14 16 15
73 14 2 34 39 18 15 13
74 14 1 38 41 18 15 10
75 12 1 34 27 16 13 11
76 9 2 39 30 17 12 19
77 13 2 37 37 16 17 13
78 11 2 34 31 16 13 17
79 12 1 28 31 13 15 13
80 12 1 37 27 16 13 9
81 12 1 33 36 16 15 11
82 12 1 37 38 20 16 10
83 12 2 35 37 16 15 9
84 12 1 37 33 15 16 12
85 11 2 32 34 15 15 12
86 10 2 33 31 16 14 13
87 9 1 38 39 14 15 13
88 12 2 33 34 16 14 12
89 12 2 29 32 16 13 15
90 12 2 33 33 15 7 22
91 9 2 31 36 12 17 13
92 15 2 36 32 17 13 15
93 12 2 35 41 16 15 13
94 12 2 32 28 15 14 15
95 12 2 29 30 13 13 10
96 10 2 39 36 16 16 11
97 13 2 37 35 16 12 16
98 9 2 35 31 16 14 11
99 12 1 37 34 16 17 11
100 10 1 32 36 14 15 10
101 14 2 38 36 16 17 10
102 11 1 37 35 16 12 16
103 15 2 36 37 20 16 12
104 11 1 32 28 15 11 11
105 11 2 33 39 16 15 16
106 12 1 40 32 13 9 19
107 12 2 38 35 17 16 11
108 12 1 41 39 16 15 16
109 11 1 36 35 16 10 15
110 7 2 43 42 12 10 24
111 12 2 30 34 16 15 14
112 14 2 31 33 16 11 15
113 11 2 32 41 17 13 11
114 11 1 32 33 13 14 15
115 10 2 37 34 12 18 12
116 13 1 37 32 18 16 10
117 13 2 33 40 14 14 14
118 8 2 34 40 14 14 13
119 11 2 33 35 13 14 9
120 12 2 38 36 16 14 15
121 11 2 33 37 13 12 15
122 13 2 31 27 16 14 14
123 12 2 38 39 13 15 11
124 14 2 37 38 16 15 8
125 13 2 33 31 15 15 11
126 15 2 31 33 16 13 11
127 10 1 39 32 15 17 8
128 11 2 44 39 17 17 10
129 9 2 33 36 15 19 11
130 11 2 35 33 12 15 13
131 10 1 32 33 16 13 11
132 11 1 28 32 10 9 20
133 8 2 40 37 16 15 10
134 11 1 27 30 12 15 15
135 12 1 37 38 14 15 12
136 12 2 32 29 15 16 14
137 9 1 28 22 13 11 23
138 11 1 34 35 15 14 14
139 10 2 30 35 11 11 16
140 8 2 35 34 12 15 11
141 9 1 31 35 8 13 12
142 8 2 32 34 16 15 10
143 9 1 30 34 15 16 14
144 15 2 30 35 17 14 12
145 11 1 31 23 16 15 12
146 8 2 40 31 10 16 11
147 13 2 32 27 18 16 12
148 12 1 36 36 13 11 13
149 12 1 32 31 16 12 11
150 9 1 35 32 13 9 19
151 7 2 38 39 10 16 12
152 13 2 42 37 15 13 17
153 9 1 34 38 16 16 9
154 6 2 35 39 16 12 12
155 8 2 35 34 14 9 19
156 8 2 33 31 10 13 18
157 15 2 36 32 17 13 15
158 6 2 32 37 13 14 14
159 9 2 33 36 15 19 11
160 11 2 34 32 16 13 9
161 8 2 32 35 12 12 18
162 8 2 34 36 13 13 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Gender Connected Separate Learning Happiness
4.88226 0.49303 -0.04375 0.01789 0.51660 -0.06645
depression
-0.03971
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.0265 -0.9724 0.1241 1.2802 2.9326
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.88226 2.36400 2.065 0.0406 *
Gender 0.49303 0.31241 1.578 0.1166
Connected -0.04375 0.04645 -0.942 0.3477
Separate 0.01789 0.04446 0.402 0.6880
Learning 0.51660 0.06666 7.750 1.13e-12 ***
Happiness -0.06645 0.07524 -0.883 0.3785
depression -0.03971 0.05535 -0.717 0.4742
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.806 on 155 degrees of freedom
Multiple R-squared: 0.3155, Adjusted R-squared: 0.289
F-statistic: 11.91 on 6 and 155 DF, p-value: 5.739e-11
> 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.987294437 0.025411127 0.012705563
[2,] 0.998158069 0.003683861 0.001841931
[3,] 0.995603891 0.008792219 0.004396109
[4,] 0.996317386 0.007365227 0.003682614
[5,] 0.992863945 0.014272110 0.007136055
[6,] 0.994579259 0.010841482 0.005420741
[7,] 0.994255640 0.011488720 0.005744360
[8,] 0.989997710 0.020004579 0.010002290
[9,] 0.986462897 0.027074206 0.013537103
[10,] 0.979091359 0.041817283 0.020908641
[11,] 0.967540455 0.064919091 0.032459545
[12,] 0.952058782 0.095882435 0.047941218
[13,] 0.931159737 0.137680525 0.068840263
[14,] 0.904208057 0.191583885 0.095791943
[15,] 0.880412508 0.239174984 0.119587492
[16,] 0.861857307 0.276285386 0.138142693
[17,] 0.838829630 0.322340740 0.161170370
[18,] 0.798881106 0.402237788 0.201118894
[19,] 0.804283927 0.391432146 0.195716073
[20,] 0.757784001 0.484431998 0.242215999
[21,] 0.706109291 0.587781418 0.293890709
[22,] 0.650984734 0.698030532 0.349015266
[23,] 0.639762552 0.720474896 0.360237448
[24,] 0.591459717 0.817080565 0.408540283
[25,] 0.533804412 0.932391177 0.466195588
[26,] 0.580612491 0.838775018 0.419387509
[27,] 0.522618976 0.954762047 0.477381024
[28,] 0.566084656 0.867830688 0.433915344
[29,] 0.612787099 0.774425802 0.387212901
[30,] 0.630882656 0.738234687 0.369117344
[31,] 0.590488926 0.819022148 0.409511074
[32,] 0.545853744 0.908292513 0.454146256
[33,] 0.510820043 0.978359913 0.489179957
[34,] 0.573087830 0.853824340 0.426912170
[35,] 0.522276022 0.955447955 0.477723978
[36,] 0.478040350 0.956080700 0.521959650
[37,] 0.510346441 0.979307118 0.489653559
[38,] 0.504286339 0.991427322 0.495713661
[39,] 0.458751663 0.917503326 0.541248337
[40,] 0.419262637 0.838525274 0.580737363
[41,] 0.432679339 0.865358679 0.567320661
[42,] 0.430788173 0.861576346 0.569211827
[43,] 0.384695596 0.769391192 0.615304404
[44,] 0.451195066 0.902390131 0.548804934
[45,] 0.410527789 0.821055579 0.589472211
[46,] 0.505599933 0.988800134 0.494400067
[47,] 0.761943661 0.476112677 0.238056339
[48,] 0.724923229 0.550153542 0.275076771
[49,] 0.683306373 0.633387255 0.316693627
[50,] 0.639445732 0.721108536 0.360554268
[51,] 0.641857022 0.716285957 0.358142978
[52,] 0.658750423 0.682499155 0.341249577
[53,] 0.626357548 0.747284905 0.373642452
[54,] 0.628066958 0.743866085 0.371933042
[55,] 0.582761048 0.834477905 0.417238952
[56,] 0.538365084 0.923269832 0.461634916
[57,] 0.499676132 0.999352263 0.500323868
[58,] 0.472554563 0.945109127 0.527445437
[59,] 0.452456568 0.904913135 0.547543432
[60,] 0.469534931 0.939069861 0.530465069
[61,] 0.429563160 0.859126319 0.570436840
[62,] 0.385157232 0.770314465 0.614842768
[63,] 0.345643663 0.691287326 0.654356337
[64,] 0.319549500 0.639099000 0.680450500
[65,] 0.305211464 0.610422929 0.694788536
[66,] 0.290667459 0.581334918 0.709332541
[67,] 0.349158783 0.698317565 0.650841217
[68,] 0.334566959 0.669133919 0.665433041
[69,] 0.297694343 0.595388687 0.702305657
[70,] 0.320431546 0.640863093 0.679568454
[71,] 0.302041909 0.604083818 0.697958091
[72,] 0.266222715 0.532445429 0.733777285
[73,] 0.251285821 0.502571642 0.748714179
[74,] 0.219601854 0.439203707 0.780398146
[75,] 0.207728454 0.415456908 0.792271546
[76,] 0.177880359 0.355760718 0.822119641
[77,] 0.176862741 0.353725481 0.823137259
[78,] 0.164112222 0.328224444 0.835887778
[79,] 0.137075457 0.274150914 0.862924543
[80,] 0.113120249 0.226240498 0.886879751
[81,] 0.094771991 0.189543983 0.905228009
[82,] 0.081063977 0.162127953 0.918936023
[83,] 0.110021369 0.220042739 0.889978631
[84,] 0.094750144 0.189500287 0.905249856
[85,] 0.081009048 0.162018096 0.918990952
[86,] 0.073628959 0.147257918 0.926371041
[87,] 0.070499990 0.140999981 0.929500010
[88,] 0.063176748 0.126353495 0.936823252
[89,] 0.086992262 0.173984523 0.913007738
[90,] 0.073830691 0.147661383 0.926169309
[91,] 0.059611267 0.119222535 0.940388733
[92,] 0.072490795 0.144981590 0.927509205
[93,] 0.057793835 0.115587670 0.942206165
[94,] 0.055055394 0.110110789 0.944944606
[95,] 0.045854305 0.091708611 0.954145695
[96,] 0.038077576 0.076155152 0.961922424
[97,] 0.041682807 0.083365613 0.958317193
[98,] 0.032278295 0.064556590 0.967721705
[99,] 0.029522235 0.059044469 0.970477765
[100,] 0.022638441 0.045276881 0.977361559
[101,] 0.025180134 0.050360269 0.974819866
[102,] 0.019306501 0.038613001 0.980693499
[103,] 0.020669484 0.041338968 0.979330516
[104,] 0.018735432 0.037470864 0.981264568
[105,] 0.015721542 0.031443085 0.984278458
[106,] 0.012096692 0.024193384 0.987903308
[107,] 0.009356467 0.018712934 0.990643533
[108,] 0.014423048 0.028846095 0.985576952
[109,] 0.017734028 0.035468055 0.982265972
[110,] 0.013145818 0.026291637 0.986854182
[111,] 0.010288343 0.020576687 0.989711657
[112,] 0.008085633 0.016171266 0.991914367
[113,] 0.006534007 0.013068014 0.993465993
[114,] 0.007997790 0.015995579 0.992002210
[115,] 0.012763188 0.025526376 0.987236812
[116,] 0.013489376 0.026978751 0.986510624
[117,] 0.038680647 0.077361295 0.961319353
[118,] 0.030312750 0.060625500 0.969687250
[119,] 0.023194232 0.046388463 0.976805768
[120,] 0.019509100 0.039018199 0.980490900
[121,] 0.019312405 0.038624810 0.980687595
[122,] 0.016039402 0.032078804 0.983960598
[123,] 0.018352325 0.036704650 0.981647675
[124,] 0.030984662 0.061969323 0.969015338
[125,] 0.031753356 0.063506712 0.968246644
[126,] 0.031916839 0.063833677 0.968083161
[127,] 0.027905012 0.055810024 0.972094988
[128,] 0.024471565 0.048943131 0.975528435
[129,] 0.016850816 0.033701632 0.983149184
[130,] 0.019404954 0.038809908 0.980595046
[131,] 0.013952399 0.027904798 0.986047601
[132,] 0.034359508 0.068719017 0.965640492
[133,] 0.044818743 0.089637486 0.955181257
[134,] 0.031992847 0.063985695 0.968007153
[135,] 0.262353496 0.524706992 0.737646504
[136,] 0.332436386 0.664872773 0.667563614
[137,] 0.521110078 0.957779844 0.478889922
[138,] 0.498540471 0.997080941 0.501459529
[139,] 0.826095232 0.347809535 0.173904768
[140,] 0.795948374 0.408103252 0.204051626
[141,] 0.740126606 0.519746789 0.259873394
[142,] 0.675021904 0.649956192 0.324978096
[143,] 0.658428014 0.683143971 0.341571986
> postscript(file="/var/fisher/rcomp/tmp/1jmfc1355142506.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/fisher/rcomp/tmp/2ygme1355142506.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/fisher/rcomp/tmp/3hy1f1355142506.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/fisher/rcomp/tmp/4vbcw1355142506.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/fisher/rcomp/tmp/5jwk41355142506.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.93657479 -0.36733865 1.28947525 -5.08453610 2.62192321 0.10085266
7 8 9 10 11 12
-0.72820603 2.59319276 1.24191282 -5.16546711 -1.00632521 0.41295000
13 14 15 16 17 18
0.65557026 -0.48841621 2.72441937 1.17152753 -0.63559210 -1.65126949
19 20 21 22 23 24
-1.32033092 0.27295777 -0.35728132 -0.04541721 -0.25054144 -0.85958125
25 26 27 28 29 30
-2.45735521 0.52612212 -1.19210405 2.69040672 0.27208576 -0.46342096
31 32 33 34 35 36
0.65851267 -1.50624942 -0.50989891 0.12514742 1.78957700 0.19897007
37 38 39 40 41 42
-2.43487820 1.85014434 -1.89309151 -1.43912586 -1.24056380 1.41548589
43 44 45 46 47 48
1.76350420 -0.31351502 -0.70500268 2.68882693 2.21814750 -0.34833548
49 50 51 52 53 54
-0.51350328 1.78292522 2.04649646 -0.25820711 2.68085107 1.02706135
55 56 57 58 59 60
-2.96299315 -4.58125208 0.54342083 -0.11935656 0.04486657 -1.81792858
61 62 63 64 65 66
-2.43711975 0.75365632 1.93485334 0.11557583 0.31189634 0.81309793
67 68 69 70 71 72
1.18770523 -1.57077008 2.43606454 0.78106487 -0.07634098 0.23451674
73 74 75 76 77 78
1.13559091 1.64870406 0.66416241 -2.92913986 1.46870755 -0.66214468
79 80 81 82 83 84
2.09224871 0.71598239 0.59231854 -1.30814341 0.08947088 1.44373460
85 86 87 88 89 90
-0.35237134 -1.79829721 -1.12997090 0.10832833 0.02180191 0.57482583
91 92 93 94 95 96
-0.70948146 2.81143639 0.17677103 0.80764468 1.40882453 -1.57177867
97 98 99 100 101 102
1.29139296 -2.79022549 0.93597686 -0.45793552 2.41120598 -0.21557501
103 104 105 106 107 108
1.25238846 -0.05750875 -0.75581359 2.43894297 -0.11424285 1.08720446
109 110 111 112 113 114
-0.43192625 -2.32010732 0.12295365 1.95852047 -1.68339239 1.24444650
115 116 117 118 119 120
0.61551567 0.83238731 2.11363555 -2.88232859 0.52111366 0.41043206
121 122 123 124 125 126
0.59072271 1.22546810 1.81417558 2.11936764 1.70532659 2.93256149
127 128 129 130 131 132
-0.54328581 -0.89656986 -2.11832901 1.38628303 -1.53065823 2.50348619
133 134 135 136 137 138
-3.65207546 1.66241589 1.80445581 0.88293552 -0.61542234 0.22324932
139 140 141 142 143 144
0.50172634 -1.71102911 1.56235750 -3.94839941 -1.80096574 2.44259293
145 146 147 148 149 150
-0.22292993 -0.33897391 0.28947559 2.08701677 0.43867119 -0.77979830
151 152 153 154 155 156
-1.52985687 2.09712049 -2.41268740 -6.02650254 -2.82520832 -0.56656082
157 158 159 160 161 162
2.81143639 -4.35984735 -2.11832901 -0.99773118 -1.78151037 -2.24148400
> postscript(file="/var/fisher/rcomp/tmp/6mhn21355142506.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.93657479 NA
1 -0.36733865 1.93657479
2 1.28947525 -0.36733865
3 -5.08453610 1.28947525
4 2.62192321 -5.08453610
5 0.10085266 2.62192321
6 -0.72820603 0.10085266
7 2.59319276 -0.72820603
8 1.24191282 2.59319276
9 -5.16546711 1.24191282
10 -1.00632521 -5.16546711
11 0.41295000 -1.00632521
12 0.65557026 0.41295000
13 -0.48841621 0.65557026
14 2.72441937 -0.48841621
15 1.17152753 2.72441937
16 -0.63559210 1.17152753
17 -1.65126949 -0.63559210
18 -1.32033092 -1.65126949
19 0.27295777 -1.32033092
20 -0.35728132 0.27295777
21 -0.04541721 -0.35728132
22 -0.25054144 -0.04541721
23 -0.85958125 -0.25054144
24 -2.45735521 -0.85958125
25 0.52612212 -2.45735521
26 -1.19210405 0.52612212
27 2.69040672 -1.19210405
28 0.27208576 2.69040672
29 -0.46342096 0.27208576
30 0.65851267 -0.46342096
31 -1.50624942 0.65851267
32 -0.50989891 -1.50624942
33 0.12514742 -0.50989891
34 1.78957700 0.12514742
35 0.19897007 1.78957700
36 -2.43487820 0.19897007
37 1.85014434 -2.43487820
38 -1.89309151 1.85014434
39 -1.43912586 -1.89309151
40 -1.24056380 -1.43912586
41 1.41548589 -1.24056380
42 1.76350420 1.41548589
43 -0.31351502 1.76350420
44 -0.70500268 -0.31351502
45 2.68882693 -0.70500268
46 2.21814750 2.68882693
47 -0.34833548 2.21814750
48 -0.51350328 -0.34833548
49 1.78292522 -0.51350328
50 2.04649646 1.78292522
51 -0.25820711 2.04649646
52 2.68085107 -0.25820711
53 1.02706135 2.68085107
54 -2.96299315 1.02706135
55 -4.58125208 -2.96299315
56 0.54342083 -4.58125208
57 -0.11935656 0.54342083
58 0.04486657 -0.11935656
59 -1.81792858 0.04486657
60 -2.43711975 -1.81792858
61 0.75365632 -2.43711975
62 1.93485334 0.75365632
63 0.11557583 1.93485334
64 0.31189634 0.11557583
65 0.81309793 0.31189634
66 1.18770523 0.81309793
67 -1.57077008 1.18770523
68 2.43606454 -1.57077008
69 0.78106487 2.43606454
70 -0.07634098 0.78106487
71 0.23451674 -0.07634098
72 1.13559091 0.23451674
73 1.64870406 1.13559091
74 0.66416241 1.64870406
75 -2.92913986 0.66416241
76 1.46870755 -2.92913986
77 -0.66214468 1.46870755
78 2.09224871 -0.66214468
79 0.71598239 2.09224871
80 0.59231854 0.71598239
81 -1.30814341 0.59231854
82 0.08947088 -1.30814341
83 1.44373460 0.08947088
84 -0.35237134 1.44373460
85 -1.79829721 -0.35237134
86 -1.12997090 -1.79829721
87 0.10832833 -1.12997090
88 0.02180191 0.10832833
89 0.57482583 0.02180191
90 -0.70948146 0.57482583
91 2.81143639 -0.70948146
92 0.17677103 2.81143639
93 0.80764468 0.17677103
94 1.40882453 0.80764468
95 -1.57177867 1.40882453
96 1.29139296 -1.57177867
97 -2.79022549 1.29139296
98 0.93597686 -2.79022549
99 -0.45793552 0.93597686
100 2.41120598 -0.45793552
101 -0.21557501 2.41120598
102 1.25238846 -0.21557501
103 -0.05750875 1.25238846
104 -0.75581359 -0.05750875
105 2.43894297 -0.75581359
106 -0.11424285 2.43894297
107 1.08720446 -0.11424285
108 -0.43192625 1.08720446
109 -2.32010732 -0.43192625
110 0.12295365 -2.32010732
111 1.95852047 0.12295365
112 -1.68339239 1.95852047
113 1.24444650 -1.68339239
114 0.61551567 1.24444650
115 0.83238731 0.61551567
116 2.11363555 0.83238731
117 -2.88232859 2.11363555
118 0.52111366 -2.88232859
119 0.41043206 0.52111366
120 0.59072271 0.41043206
121 1.22546810 0.59072271
122 1.81417558 1.22546810
123 2.11936764 1.81417558
124 1.70532659 2.11936764
125 2.93256149 1.70532659
126 -0.54328581 2.93256149
127 -0.89656986 -0.54328581
128 -2.11832901 -0.89656986
129 1.38628303 -2.11832901
130 -1.53065823 1.38628303
131 2.50348619 -1.53065823
132 -3.65207546 2.50348619
133 1.66241589 -3.65207546
134 1.80445581 1.66241589
135 0.88293552 1.80445581
136 -0.61542234 0.88293552
137 0.22324932 -0.61542234
138 0.50172634 0.22324932
139 -1.71102911 0.50172634
140 1.56235750 -1.71102911
141 -3.94839941 1.56235750
142 -1.80096574 -3.94839941
143 2.44259293 -1.80096574
144 -0.22292993 2.44259293
145 -0.33897391 -0.22292993
146 0.28947559 -0.33897391
147 2.08701677 0.28947559
148 0.43867119 2.08701677
149 -0.77979830 0.43867119
150 -1.52985687 -0.77979830
151 2.09712049 -1.52985687
152 -2.41268740 2.09712049
153 -6.02650254 -2.41268740
154 -2.82520832 -6.02650254
155 -0.56656082 -2.82520832
156 2.81143639 -0.56656082
157 -4.35984735 2.81143639
158 -2.11832901 -4.35984735
159 -0.99773118 -2.11832901
160 -1.78151037 -0.99773118
161 -2.24148400 -1.78151037
162 NA -2.24148400
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.36733865 1.93657479
[2,] 1.28947525 -0.36733865
[3,] -5.08453610 1.28947525
[4,] 2.62192321 -5.08453610
[5,] 0.10085266 2.62192321
[6,] -0.72820603 0.10085266
[7,] 2.59319276 -0.72820603
[8,] 1.24191282 2.59319276
[9,] -5.16546711 1.24191282
[10,] -1.00632521 -5.16546711
[11,] 0.41295000 -1.00632521
[12,] 0.65557026 0.41295000
[13,] -0.48841621 0.65557026
[14,] 2.72441937 -0.48841621
[15,] 1.17152753 2.72441937
[16,] -0.63559210 1.17152753
[17,] -1.65126949 -0.63559210
[18,] -1.32033092 -1.65126949
[19,] 0.27295777 -1.32033092
[20,] -0.35728132 0.27295777
[21,] -0.04541721 -0.35728132
[22,] -0.25054144 -0.04541721
[23,] -0.85958125 -0.25054144
[24,] -2.45735521 -0.85958125
[25,] 0.52612212 -2.45735521
[26,] -1.19210405 0.52612212
[27,] 2.69040672 -1.19210405
[28,] 0.27208576 2.69040672
[29,] -0.46342096 0.27208576
[30,] 0.65851267 -0.46342096
[31,] -1.50624942 0.65851267
[32,] -0.50989891 -1.50624942
[33,] 0.12514742 -0.50989891
[34,] 1.78957700 0.12514742
[35,] 0.19897007 1.78957700
[36,] -2.43487820 0.19897007
[37,] 1.85014434 -2.43487820
[38,] -1.89309151 1.85014434
[39,] -1.43912586 -1.89309151
[40,] -1.24056380 -1.43912586
[41,] 1.41548589 -1.24056380
[42,] 1.76350420 1.41548589
[43,] -0.31351502 1.76350420
[44,] -0.70500268 -0.31351502
[45,] 2.68882693 -0.70500268
[46,] 2.21814750 2.68882693
[47,] -0.34833548 2.21814750
[48,] -0.51350328 -0.34833548
[49,] 1.78292522 -0.51350328
[50,] 2.04649646 1.78292522
[51,] -0.25820711 2.04649646
[52,] 2.68085107 -0.25820711
[53,] 1.02706135 2.68085107
[54,] -2.96299315 1.02706135
[55,] -4.58125208 -2.96299315
[56,] 0.54342083 -4.58125208
[57,] -0.11935656 0.54342083
[58,] 0.04486657 -0.11935656
[59,] -1.81792858 0.04486657
[60,] -2.43711975 -1.81792858
[61,] 0.75365632 -2.43711975
[62,] 1.93485334 0.75365632
[63,] 0.11557583 1.93485334
[64,] 0.31189634 0.11557583
[65,] 0.81309793 0.31189634
[66,] 1.18770523 0.81309793
[67,] -1.57077008 1.18770523
[68,] 2.43606454 -1.57077008
[69,] 0.78106487 2.43606454
[70,] -0.07634098 0.78106487
[71,] 0.23451674 -0.07634098
[72,] 1.13559091 0.23451674
[73,] 1.64870406 1.13559091
[74,] 0.66416241 1.64870406
[75,] -2.92913986 0.66416241
[76,] 1.46870755 -2.92913986
[77,] -0.66214468 1.46870755
[78,] 2.09224871 -0.66214468
[79,] 0.71598239 2.09224871
[80,] 0.59231854 0.71598239
[81,] -1.30814341 0.59231854
[82,] 0.08947088 -1.30814341
[83,] 1.44373460 0.08947088
[84,] -0.35237134 1.44373460
[85,] -1.79829721 -0.35237134
[86,] -1.12997090 -1.79829721
[87,] 0.10832833 -1.12997090
[88,] 0.02180191 0.10832833
[89,] 0.57482583 0.02180191
[90,] -0.70948146 0.57482583
[91,] 2.81143639 -0.70948146
[92,] 0.17677103 2.81143639
[93,] 0.80764468 0.17677103
[94,] 1.40882453 0.80764468
[95,] -1.57177867 1.40882453
[96,] 1.29139296 -1.57177867
[97,] -2.79022549 1.29139296
[98,] 0.93597686 -2.79022549
[99,] -0.45793552 0.93597686
[100,] 2.41120598 -0.45793552
[101,] -0.21557501 2.41120598
[102,] 1.25238846 -0.21557501
[103,] -0.05750875 1.25238846
[104,] -0.75581359 -0.05750875
[105,] 2.43894297 -0.75581359
[106,] -0.11424285 2.43894297
[107,] 1.08720446 -0.11424285
[108,] -0.43192625 1.08720446
[109,] -2.32010732 -0.43192625
[110,] 0.12295365 -2.32010732
[111,] 1.95852047 0.12295365
[112,] -1.68339239 1.95852047
[113,] 1.24444650 -1.68339239
[114,] 0.61551567 1.24444650
[115,] 0.83238731 0.61551567
[116,] 2.11363555 0.83238731
[117,] -2.88232859 2.11363555
[118,] 0.52111366 -2.88232859
[119,] 0.41043206 0.52111366
[120,] 0.59072271 0.41043206
[121,] 1.22546810 0.59072271
[122,] 1.81417558 1.22546810
[123,] 2.11936764 1.81417558
[124,] 1.70532659 2.11936764
[125,] 2.93256149 1.70532659
[126,] -0.54328581 2.93256149
[127,] -0.89656986 -0.54328581
[128,] -2.11832901 -0.89656986
[129,] 1.38628303 -2.11832901
[130,] -1.53065823 1.38628303
[131,] 2.50348619 -1.53065823
[132,] -3.65207546 2.50348619
[133,] 1.66241589 -3.65207546
[134,] 1.80445581 1.66241589
[135,] 0.88293552 1.80445581
[136,] -0.61542234 0.88293552
[137,] 0.22324932 -0.61542234
[138,] 0.50172634 0.22324932
[139,] -1.71102911 0.50172634
[140,] 1.56235750 -1.71102911
[141,] -3.94839941 1.56235750
[142,] -1.80096574 -3.94839941
[143,] 2.44259293 -1.80096574
[144,] -0.22292993 2.44259293
[145,] -0.33897391 -0.22292993
[146,] 0.28947559 -0.33897391
[147,] 2.08701677 0.28947559
[148,] 0.43867119 2.08701677
[149,] -0.77979830 0.43867119
[150,] -1.52985687 -0.77979830
[151,] 2.09712049 -1.52985687
[152,] -2.41268740 2.09712049
[153,] -6.02650254 -2.41268740
[154,] -2.82520832 -6.02650254
[155,] -0.56656082 -2.82520832
[156,] 2.81143639 -0.56656082
[157,] -4.35984735 2.81143639
[158,] -2.11832901 -4.35984735
[159,] -0.99773118 -2.11832901
[160,] -1.78151037 -0.99773118
[161,] -2.24148400 -1.78151037
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.36733865 1.93657479
2 1.28947525 -0.36733865
3 -5.08453610 1.28947525
4 2.62192321 -5.08453610
5 0.10085266 2.62192321
6 -0.72820603 0.10085266
7 2.59319276 -0.72820603
8 1.24191282 2.59319276
9 -5.16546711 1.24191282
10 -1.00632521 -5.16546711
11 0.41295000 -1.00632521
12 0.65557026 0.41295000
13 -0.48841621 0.65557026
14 2.72441937 -0.48841621
15 1.17152753 2.72441937
16 -0.63559210 1.17152753
17 -1.65126949 -0.63559210
18 -1.32033092 -1.65126949
19 0.27295777 -1.32033092
20 -0.35728132 0.27295777
21 -0.04541721 -0.35728132
22 -0.25054144 -0.04541721
23 -0.85958125 -0.25054144
24 -2.45735521 -0.85958125
25 0.52612212 -2.45735521
26 -1.19210405 0.52612212
27 2.69040672 -1.19210405
28 0.27208576 2.69040672
29 -0.46342096 0.27208576
30 0.65851267 -0.46342096
31 -1.50624942 0.65851267
32 -0.50989891 -1.50624942
33 0.12514742 -0.50989891
34 1.78957700 0.12514742
35 0.19897007 1.78957700
36 -2.43487820 0.19897007
37 1.85014434 -2.43487820
38 -1.89309151 1.85014434
39 -1.43912586 -1.89309151
40 -1.24056380 -1.43912586
41 1.41548589 -1.24056380
42 1.76350420 1.41548589
43 -0.31351502 1.76350420
44 -0.70500268 -0.31351502
45 2.68882693 -0.70500268
46 2.21814750 2.68882693
47 -0.34833548 2.21814750
48 -0.51350328 -0.34833548
49 1.78292522 -0.51350328
50 2.04649646 1.78292522
51 -0.25820711 2.04649646
52 2.68085107 -0.25820711
53 1.02706135 2.68085107
54 -2.96299315 1.02706135
55 -4.58125208 -2.96299315
56 0.54342083 -4.58125208
57 -0.11935656 0.54342083
58 0.04486657 -0.11935656
59 -1.81792858 0.04486657
60 -2.43711975 -1.81792858
61 0.75365632 -2.43711975
62 1.93485334 0.75365632
63 0.11557583 1.93485334
64 0.31189634 0.11557583
65 0.81309793 0.31189634
66 1.18770523 0.81309793
67 -1.57077008 1.18770523
68 2.43606454 -1.57077008
69 0.78106487 2.43606454
70 -0.07634098 0.78106487
71 0.23451674 -0.07634098
72 1.13559091 0.23451674
73 1.64870406 1.13559091
74 0.66416241 1.64870406
75 -2.92913986 0.66416241
76 1.46870755 -2.92913986
77 -0.66214468 1.46870755
78 2.09224871 -0.66214468
79 0.71598239 2.09224871
80 0.59231854 0.71598239
81 -1.30814341 0.59231854
82 0.08947088 -1.30814341
83 1.44373460 0.08947088
84 -0.35237134 1.44373460
85 -1.79829721 -0.35237134
86 -1.12997090 -1.79829721
87 0.10832833 -1.12997090
88 0.02180191 0.10832833
89 0.57482583 0.02180191
90 -0.70948146 0.57482583
91 2.81143639 -0.70948146
92 0.17677103 2.81143639
93 0.80764468 0.17677103
94 1.40882453 0.80764468
95 -1.57177867 1.40882453
96 1.29139296 -1.57177867
97 -2.79022549 1.29139296
98 0.93597686 -2.79022549
99 -0.45793552 0.93597686
100 2.41120598 -0.45793552
101 -0.21557501 2.41120598
102 1.25238846 -0.21557501
103 -0.05750875 1.25238846
104 -0.75581359 -0.05750875
105 2.43894297 -0.75581359
106 -0.11424285 2.43894297
107 1.08720446 -0.11424285
108 -0.43192625 1.08720446
109 -2.32010732 -0.43192625
110 0.12295365 -2.32010732
111 1.95852047 0.12295365
112 -1.68339239 1.95852047
113 1.24444650 -1.68339239
114 0.61551567 1.24444650
115 0.83238731 0.61551567
116 2.11363555 0.83238731
117 -2.88232859 2.11363555
118 0.52111366 -2.88232859
119 0.41043206 0.52111366
120 0.59072271 0.41043206
121 1.22546810 0.59072271
122 1.81417558 1.22546810
123 2.11936764 1.81417558
124 1.70532659 2.11936764
125 2.93256149 1.70532659
126 -0.54328581 2.93256149
127 -0.89656986 -0.54328581
128 -2.11832901 -0.89656986
129 1.38628303 -2.11832901
130 -1.53065823 1.38628303
131 2.50348619 -1.53065823
132 -3.65207546 2.50348619
133 1.66241589 -3.65207546
134 1.80445581 1.66241589
135 0.88293552 1.80445581
136 -0.61542234 0.88293552
137 0.22324932 -0.61542234
138 0.50172634 0.22324932
139 -1.71102911 0.50172634
140 1.56235750 -1.71102911
141 -3.94839941 1.56235750
142 -1.80096574 -3.94839941
143 2.44259293 -1.80096574
144 -0.22292993 2.44259293
145 -0.33897391 -0.22292993
146 0.28947559 -0.33897391
147 2.08701677 0.28947559
148 0.43867119 2.08701677
149 -0.77979830 0.43867119
150 -1.52985687 -0.77979830
151 2.09712049 -1.52985687
152 -2.41268740 2.09712049
153 -6.02650254 -2.41268740
154 -2.82520832 -6.02650254
155 -0.56656082 -2.82520832
156 2.81143639 -0.56656082
157 -4.35984735 2.81143639
158 -2.11832901 -4.35984735
159 -0.99773118 -2.11832901
160 -1.78151037 -0.99773118
161 -2.24148400 -1.78151037
> 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/fisher/rcomp/tmp/7bua21355142506.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/fisher/rcomp/tmp/8dm8v1355142506.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/fisher/rcomp/tmp/95dv21355142506.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/fisher/rcomp/tmp/107tpl1355142506.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11sinl1355142506.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/fisher/rcomp/tmp/12kpk71355142506.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/fisher/rcomp/tmp/132krn1355142506.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/fisher/rcomp/tmp/14a3d31355142506.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/fisher/rcomp/tmp/15qvkz1355142506.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/fisher/rcomp/tmp/16smwj1355142507.tab")
+ }
>
> try(system("convert tmp/1jmfc1355142506.ps tmp/1jmfc1355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ygme1355142506.ps tmp/2ygme1355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/3hy1f1355142506.ps tmp/3hy1f1355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/4vbcw1355142506.ps tmp/4vbcw1355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/5jwk41355142506.ps tmp/5jwk41355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/6mhn21355142506.ps tmp/6mhn21355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bua21355142506.ps tmp/7bua21355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dm8v1355142506.ps tmp/8dm8v1355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/95dv21355142506.ps tmp/95dv21355142506.png",intern=TRUE))
character(0)
> try(system("convert tmp/107tpl1355142506.ps tmp/107tpl1355142506.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.089 1.599 9.708