R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(41
+ ,13
+ ,14
+ ,12
+ ,9
+ ,39
+ ,16
+ ,18
+ ,11
+ ,9
+ ,30
+ ,19
+ ,11
+ ,14
+ ,9
+ ,31
+ ,15
+ ,12
+ ,12
+ ,9
+ ,34
+ ,14
+ ,16
+ ,21
+ ,9
+ ,35
+ ,13
+ ,18
+ ,12
+ ,9
+ ,39
+ ,19
+ ,14
+ ,22
+ ,9
+ ,34
+ ,15
+ ,14
+ ,11
+ ,9
+ ,36
+ ,14
+ ,15
+ ,10
+ ,9
+ ,37
+ ,15
+ ,15
+ ,13
+ ,9
+ ,38
+ ,16
+ ,17
+ ,10
+ ,9
+ ,36
+ ,16
+ ,19
+ ,8
+ ,9
+ ,38
+ ,16
+ ,10
+ ,15
+ ,9
+ ,39
+ ,16
+ ,16
+ ,14
+ ,9
+ ,33
+ ,17
+ ,18
+ ,10
+ ,9
+ ,32
+ ,15
+ ,14
+ ,14
+ ,9
+ ,36
+ ,15
+ ,14
+ ,14
+ ,9
+ ,38
+ ,20
+ ,17
+ ,11
+ ,9
+ ,39
+ ,18
+ ,14
+ ,10
+ ,9
+ ,32
+ ,16
+ ,16
+ ,13
+ ,9
+ ,32
+ ,16
+ ,18
+ ,7
+ ,9
+ ,31
+ ,16
+ ,11
+ ,14
+ ,9
+ ,39
+ ,19
+ ,14
+ ,12
+ ,9
+ ,37
+ ,16
+ ,12
+ ,14
+ ,9
+ ,39
+ ,17
+ ,17
+ ,11
+ ,9
+ ,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,16
+ ,11)
+ ,dim=c(5
+ ,162)
+ ,dimnames=list(c('connected'
+ ,'learning'
+ ,'happiness'
+ ,'depression'
+ ,'month')
+ ,1:162))
> y <- array(NA,dim=c(5,162),dimnames=list(c('connected','learning','happiness','depression','month'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> par3 <- 'Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> 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
connected learning happiness depression month t
1 41 13 14 12 9 1
2 39 16 18 11 9 2
3 30 19 11 14 9 3
4 31 15 12 12 9 4
5 34 14 16 21 9 5
6 35 13 18 12 9 6
7 39 19 14 22 9 7
8 34 15 14 11 9 8
9 36 14 15 10 9 9
10 37 15 15 13 9 10
11 38 16 17 10 9 11
12 36 16 19 8 9 12
13 38 16 10 15 9 13
14 39 16 16 14 9 14
15 33 17 18 10 9 15
16 32 15 14 14 9 16
17 36 15 14 14 9 17
18 38 20 17 11 9 18
19 39 18 14 10 9 19
20 32 16 16 13 9 20
21 32 16 18 7 9 21
22 31 16 11 14 9 22
23 39 19 14 12 9 23
24 37 16 12 14 9 24
25 39 17 17 11 9 25
26 41 17 9 9 9 26
27 36 16 16 11 9 27
28 33 15 14 15 9 28
29 33 16 15 14 9 29
30 34 14 11 13 9 30
31 31 15 16 9 9 31
32 27 12 13 15 9 32
33 37 14 17 10 9 33
34 34 16 15 11 9 34
35 34 14 14 13 9 35
36 32 7 16 8 9 36
37 29 10 9 20 9 37
38 36 14 15 12 9 38
39 29 16 17 10 9 39
40 35 16 13 10 9 40
41 37 16 15 9 9 41
42 34 14 16 14 9 42
43 38 20 16 8 9 43
44 35 14 12 14 9 44
45 38 14 12 11 9 45
46 37 11 11 13 9 46
47 38 14 15 9 9 47
48 33 15 15 11 9 48
49 36 16 17 15 9 49
50 38 14 13 11 9 50
51 32 16 16 10 9 51
52 32 14 14 14 9 52
53 32 12 11 18 9 53
54 34 16 12 14 9 54
55 32 9 12 11 10 55
56 37 14 15 12 10 56
57 39 16 16 13 10 57
58 29 16 15 9 10 58
59 37 15 12 10 10 59
60 35 16 12 15 10 60
61 30 12 8 20 10 61
62 38 16 13 12 10 62
63 34 16 11 12 10 63
64 31 14 14 14 10 64
65 34 16 15 13 10 65
66 35 17 10 11 10 66
67 36 18 11 17 10 67
68 30 18 12 12 10 68
69 39 12 15 13 10 69
70 35 16 15 14 10 70
71 38 10 14 13 10 71
72 31 14 16 15 10 72
73 34 18 15 13 10 73
74 38 18 15 10 10 74
75 34 16 13 11 10 75
76 39 17 12 19 10 76
77 37 16 17 13 10 77
78 34 16 13 17 10 78
79 28 13 15 13 10 79
80 37 16 13 9 10 80
81 33 16 15 11 10 81
82 37 20 16 10 10 82
83 35 16 15 9 10 83
84 37 15 16 12 10 84
85 32 15 15 12 10 85
86 33 16 14 13 10 86
87 38 14 15 13 10 87
88 33 16 14 12 10 88
89 29 16 13 15 10 89
90 33 15 7 22 10 90
91 31 12 17 13 10 91
92 36 17 13 15 10 92
93 35 16 15 13 10 93
94 32 15 14 15 10 94
95 29 13 13 10 10 95
96 39 16 16 11 10 96
97 37 16 12 16 10 97
98 35 16 14 11 10 98
99 37 16 17 11 10 99
100 32 14 15 10 10 100
101 38 16 17 10 10 101
102 37 16 12 16 10 102
103 36 20 16 12 10 103
104 32 15 11 11 10 104
105 33 16 15 16 10 105
106 40 13 9 19 10 106
107 38 17 16 11 10 107
108 41 16 15 16 10 108
109 36 16 10 15 11 109
110 43 12 10 24 11 110
111 30 16 15 14 11 111
112 31 16 11 15 11 112
113 32 17 13 11 11 113
114 32 13 14 15 11 114
115 37 12 18 12 11 115
116 37 18 16 10 11 116
117 33 14 14 14 11 117
118 34 14 14 13 11 118
119 33 13 14 9 11 119
120 38 16 14 15 11 120
121 33 13 12 15 11 121
122 31 16 14 14 11 122
123 38 13 15 11 11 123
124 37 16 15 8 11 124
125 33 15 15 11 11 125
126 31 16 13 11 11 126
127 39 15 17 8 11 127
128 44 17 17 10 11 128
129 33 15 19 11 11 129
130 35 12 15 13 11 130
131 32 16 13 11 11 131
132 28 10 9 20 11 132
133 40 16 15 10 11 133
134 27 12 15 15 11 134
135 37 14 15 12 11 135
136 32 15 16 14 11 136
137 28 13 11 23 11 137
138 34 15 14 14 11 138
139 30 11 11 16 11 139
140 35 12 15 11 11 140
141 31 8 13 12 11 141
142 32 16 15 10 11 142
143 30 15 16 14 11 143
144 30 17 14 12 11 144
145 31 16 15 12 11 145
146 40 10 16 11 11 146
147 32 18 16 12 11 147
148 36 13 11 13 11 148
149 32 16 12 11 11 149
150 35 13 9 19 11 150
151 38 10 16 12 11 151
152 42 15 13 17 11 152
153 34 16 16 9 11 153
154 35 16 12 12 11 154
155 35 14 9 19 11 155
156 33 10 13 18 11 156
157 36 17 13 15 11 157
158 32 13 14 14 11 158
159 33 15 19 11 11 159
160 34 16 13 9 11 160
161 32 12 12 18 11 161
162 34 13 13 16 11 162
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) learning happiness depression month t
30.007710 0.267095 0.133484 -0.020178 -0.065641 -0.004099
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.9235 -2.4429 -0.1265 2.3297 10.1096
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 30.007710 8.882802 3.378 0.000922 ***
learning 0.267095 0.121318 2.202 0.029161 *
happiness 0.133484 0.133808 0.998 0.320029
depression -0.020178 0.100087 -0.202 0.840485
month -0.065641 0.959635 -0.068 0.945553
t -0.004099 0.016807 -0.244 0.807618
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.321 on 156 degrees of freedom
Multiple R-squared: 0.06215, Adjusted R-squared: 0.0321
F-statistic: 2.068 on 5 and 156 DF, p-value: 0.07229
> 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.92623360 0.14753280 0.07376640
[2,] 0.88275285 0.23449430 0.11724715
[3,] 0.81359693 0.37280614 0.18640307
[4,] 0.74795037 0.50409926 0.25204963
[5,] 0.77767100 0.44465799 0.22232900
[6,] 0.71264018 0.57471963 0.28735982
[7,] 0.72854989 0.54290022 0.27145011
[8,] 0.74504190 0.50991620 0.25495810
[9,] 0.67045497 0.65909006 0.32954503
[10,] 0.62516327 0.74967346 0.37483673
[11,] 0.62222427 0.75555145 0.37777573
[12,] 0.65915849 0.68168301 0.34084151
[13,] 0.66364074 0.67271852 0.33635926
[14,] 0.63450168 0.73099665 0.36549832
[15,] 0.65817546 0.68364909 0.34182454
[16,] 0.63078510 0.73842980 0.36921490
[17,] 0.61417771 0.77164459 0.38582229
[18,] 0.72929353 0.54141294 0.27070647
[19,] 0.67273513 0.65452974 0.32726487
[20,] 0.64259947 0.71480105 0.35740053
[21,] 0.60948266 0.78103468 0.39051734
[22,] 0.54797985 0.90404031 0.45202015
[23,] 0.56488073 0.87023853 0.43511927
[24,] 0.64558289 0.70883421 0.35441711
[25,] 0.64794115 0.70411770 0.35205885
[26,] 0.59301508 0.81396984 0.40698492
[27,] 0.53979206 0.92041587 0.46020794
[28,] 0.49534988 0.99069976 0.50465012
[29,] 0.45890860 0.91781720 0.54109140
[30,] 0.43253265 0.86506529 0.56746735
[31,] 0.54064051 0.91871899 0.45935949
[32,] 0.48947656 0.97895311 0.51052344
[33,] 0.46529246 0.93058493 0.53470754
[34,] 0.42045559 0.84091117 0.57954441
[35,] 0.37775220 0.75550440 0.62224780
[36,] 0.34465597 0.68931195 0.65534403
[37,] 0.37489996 0.74979992 0.62510004
[38,] 0.40923353 0.81846706 0.59076647
[39,] 0.41136393 0.82272786 0.58863607
[40,] 0.37429229 0.74858457 0.62570771
[41,] 0.33643299 0.67286597 0.66356701
[42,] 0.34396921 0.68793843 0.65603079
[43,] 0.34258389 0.68516778 0.65741611
[44,] 0.31411828 0.62823656 0.68588172
[45,] 0.27551244 0.55102488 0.72448756
[46,] 0.23668828 0.47337657 0.76331172
[47,] 0.20055174 0.40110347 0.79944826
[48,] 0.18418986 0.36837972 0.81581014
[49,] 0.17683681 0.35367363 0.82316319
[50,] 0.31057521 0.62115041 0.68942479
[51,] 0.28722370 0.57444739 0.71277630
[52,] 0.24755628 0.49511256 0.75244372
[53,] 0.23496362 0.46992724 0.76503638
[54,] 0.22901613 0.45803225 0.77098387
[55,] 0.19774996 0.39549992 0.80225004
[56,] 0.19346809 0.38693618 0.80653191
[57,] 0.16403186 0.32806372 0.83596814
[58,] 0.13742306 0.27484613 0.86257694
[59,] 0.11614203 0.23228407 0.88385797
[60,] 0.15309780 0.30619560 0.84690220
[61,] 0.20807440 0.41614880 0.79192560
[62,] 0.17633789 0.35267579 0.82366211
[63,] 0.21310252 0.42620504 0.78689748
[64,] 0.21333784 0.42667568 0.78666216
[65,] 0.18587165 0.37174329 0.81412835
[66,] 0.17235584 0.34471168 0.82764416
[67,] 0.14534519 0.29069038 0.85465481
[68,] 0.16969436 0.33938873 0.83030564
[69,] 0.14961312 0.29922625 0.85038688
[70,] 0.12470193 0.24940387 0.87529807
[71,] 0.18853201 0.37706402 0.81146799
[72,] 0.17225927 0.34451854 0.82774073
[73,] 0.15312332 0.30624665 0.84687668
[74,] 0.12894178 0.25788356 0.87105822
[75,] 0.10611909 0.21223818 0.89388091
[76,] 0.09507426 0.19014852 0.90492574
[77,] 0.08770977 0.17541954 0.91229023
[78,] 0.07486745 0.14973490 0.92513255
[79,] 0.07831139 0.15662278 0.92168861
[80,] 0.06665567 0.13331133 0.93334433
[81,] 0.09670521 0.19341043 0.90329479
[82,] 0.07971274 0.15942547 0.92028726
[83,] 0.08211669 0.16423339 0.91788331
[84,] 0.06822718 0.13645436 0.93177282
[85,] 0.05517120 0.11034239 0.94482880
[86,] 0.05273110 0.10546219 0.94726890
[87,] 0.07768651 0.15537303 0.92231349
[88,] 0.08077398 0.16154797 0.91922602
[89,] 0.07246634 0.14493267 0.92753366
[90,] 0.05871105 0.11742211 0.94128895
[91,] 0.04882171 0.09764341 0.95117829
[92,] 0.05136363 0.10272727 0.94863637
[93,] 0.04459106 0.08918211 0.95540894
[94,] 0.03815546 0.07631093 0.96184454
[95,] 0.02997148 0.05994296 0.97002852
[96,] 0.03321170 0.06642340 0.96678830
[97,] 0.04100818 0.08201636 0.95899182
[98,] 0.05585797 0.11171594 0.94414203
[99,] 0.05031522 0.10063045 0.94968478
[100,] 0.05473511 0.10947022 0.94526489
[101,] 0.04728887 0.09457773 0.95271113
[102,] 0.31028520 0.62057040 0.68971480
[103,] 0.33586969 0.67173937 0.66413031
[104,] 0.31513861 0.63027722 0.68486139
[105,] 0.29368688 0.58737375 0.70631312
[106,] 0.25896780 0.51793561 0.74103220
[107,] 0.24195609 0.48391219 0.75804391
[108,] 0.21360282 0.42720564 0.78639718
[109,] 0.17950141 0.35900283 0.82049859
[110,] 0.14749120 0.29498240 0.85250880
[111,] 0.12601967 0.25203935 0.87398033
[112,] 0.14828817 0.29657633 0.85171183
[113,] 0.12031014 0.24062028 0.87968986
[114,] 0.10997841 0.21995683 0.89002159
[115,] 0.11546656 0.23093312 0.88453344
[116,] 0.09857471 0.19714943 0.90142529
[117,] 0.07904648 0.15809295 0.92095352
[118,] 0.07633041 0.15266081 0.92366959
[119,] 0.07900872 0.15801745 0.92099128
[120,] 0.35149946 0.70299891 0.64850054
[121,] 0.30496296 0.60992593 0.69503704
[122,] 0.28058486 0.56116971 0.71941514
[123,] 0.23960552 0.47921103 0.76039448
[124,] 0.23867937 0.47735875 0.76132063
[125,] 0.42118077 0.84236155 0.57881923
[126,] 0.51953130 0.96093741 0.48046870
[127,] 0.57510315 0.84979371 0.42489685
[128,] 0.51618322 0.96763356 0.48381678
[129,] 0.53467683 0.93064633 0.46532317
[130,] 0.47950313 0.95900627 0.52049687
[131,] 0.48375323 0.96750647 0.51624677
[132,] 0.42487211 0.84974421 0.57512789
[133,] 0.48624350 0.97248700 0.51375650
[134,] 0.42356733 0.84713467 0.57643267
[135,] 0.45145213 0.90290426 0.54854787
[136,] 0.50456109 0.99087783 0.49543891
[137,] 0.59420825 0.81158350 0.40579175
[138,] 0.61371132 0.77257735 0.38628868
[139,] 0.74386837 0.51226326 0.25613163
[140,] 0.65931946 0.68136107 0.34068054
[141,] 0.74586803 0.50826394 0.25413197
[142,] 0.74028985 0.51942030 0.25971015
[143,] 0.78122769 0.43754461 0.21877231
[144,] 0.98849113 0.02301774 0.01150887
[145,] 0.95652623 0.08694755 0.04347377
> postscript(file="/var/fisher/rcomp/tmp/1fd2k1355176767.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/2k67w1355176767.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/33l6a1355176767.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/4ec5y1355176767.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/5n3vf1355176767.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
6.48828726 3.13698721 -5.66527251 -3.76663548 -0.84777289 -0.02515289
7 8 9 10 11 12
3.11209938 -1.03738489 1.08014651 1.87768639 2.28718740 -0.01603852
13 14 15 16 17 18
3.33066787 3.51368334 -3.09699404 -2.94405474 1.06004463 1.26768270
19 20 21 22 23 24
3.18624577 -3.48189883 -3.86583832 -3.78610043 2.97590537 2.08861406
25 26 27 28 29 30
3.09766232 6.12927891 0.50643998 -1.87468389 -2.29134184 -0.23929451
31 32 33 34 35 36
-4.25042465 -6.92351813 1.91156291 -1.33138017 -0.61925041 -1.11334879
37 38 39 40 41 42
-3.73400296 1.23938506 -6.59803021 -0.05999384 1.65695864 -0.83734492
43 44 45 46 47 48
1.44311604 0.70479083 3.64835501 3.62757945 3.21574421 -2.00689430
49 50 51 52 53 54
0.54385547 3.53536762 -3.41535351 -2.52938271 -1.50992766 -0.78840481
55 56 57 58 59 60
-0.90953711 2.37881453 3.73541870 -6.20771126 2.48411394 0.32201060
61 62 63 64 65 66
-2.97068235 3.13618991 -0.59274221 -3.41454946 -1.09830208 0.26576708
67 68 69 70 71 72
0.99035789 -5.23991896 4.98647410 -0.05762683 4.66234644 -3.62854460
73 74 75 76 77 78
-1.59969646 2.34386773 -0.83069666 4.20121944 1.68392187 -0.69732818
79 80 81 82 83 84
-6.23962687 2.14944341 -2.07306893 0.70898909 -0.10522698 2.09301800
85 86 87 88 89 90
-2.76939838 -1.87873104 3.52607343 -1.89071069 -5.69259189 -0.47924358
91 92 93 94 95 96
-3.19030824 1.05261155 0.01648030 -2.53848461 -4.96760361 3.85493738
97 98 99 100 101 102
2.49386572 0.13010462 1.73375124 -2.48116993 2.72177159 2.51436258
103 104 105 106 107 108
-0.16456733 -2.17775172 -1.87379206 6.79303202 2.63293578 6.13850605
109 110 111 112 113 114
1.85548908 10.10957270 -4.82391182 -3.26569706 -2.87637444 -1.85666704
115 116 117 118 119 120
2.82005482 1.44819785 -1.13164200 -0.14772102 -0.95724055 3.36664516
121 122 123 124 125 126
-0.56100294 -3.64533449 3.96602947 2.10830963 -1.55996114 -3.55598794
127 128 129 130 131 132
4.12073392 8.63100073 -2.07750066 1.30217653 -2.53549109 -4.21328112
133 134 135 136 137 138
5.18556076 -6.64106920 2.76830564 -2.58781713 -5.20050161 -0.31264988
139 140 141 142 143 144
-2.79936227 1.30281345 -1.33756159 -2.77754490 -4.55912153 -4.86259979
145 146 147 148 149 150
-3.72489000 6.72811477 -3.38436486 2.64280753 -2.32821816 2.03904514
151 152 153 154 155 156
4.76879002 7.93876074 -0.88611447 0.71245709 1.79244732 0.31080999
157 158 159 160 161 162
1.38471146 -1.69647312 -1.95451953 -0.45696612 -1.06939825 0.49376541
> postscript(file="/var/fisher/rcomp/tmp/6fc8u1355176767.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 6.48828726 NA
1 3.13698721 6.48828726
2 -5.66527251 3.13698721
3 -3.76663548 -5.66527251
4 -0.84777289 -3.76663548
5 -0.02515289 -0.84777289
6 3.11209938 -0.02515289
7 -1.03738489 3.11209938
8 1.08014651 -1.03738489
9 1.87768639 1.08014651
10 2.28718740 1.87768639
11 -0.01603852 2.28718740
12 3.33066787 -0.01603852
13 3.51368334 3.33066787
14 -3.09699404 3.51368334
15 -2.94405474 -3.09699404
16 1.06004463 -2.94405474
17 1.26768270 1.06004463
18 3.18624577 1.26768270
19 -3.48189883 3.18624577
20 -3.86583832 -3.48189883
21 -3.78610043 -3.86583832
22 2.97590537 -3.78610043
23 2.08861406 2.97590537
24 3.09766232 2.08861406
25 6.12927891 3.09766232
26 0.50643998 6.12927891
27 -1.87468389 0.50643998
28 -2.29134184 -1.87468389
29 -0.23929451 -2.29134184
30 -4.25042465 -0.23929451
31 -6.92351813 -4.25042465
32 1.91156291 -6.92351813
33 -1.33138017 1.91156291
34 -0.61925041 -1.33138017
35 -1.11334879 -0.61925041
36 -3.73400296 -1.11334879
37 1.23938506 -3.73400296
38 -6.59803021 1.23938506
39 -0.05999384 -6.59803021
40 1.65695864 -0.05999384
41 -0.83734492 1.65695864
42 1.44311604 -0.83734492
43 0.70479083 1.44311604
44 3.64835501 0.70479083
45 3.62757945 3.64835501
46 3.21574421 3.62757945
47 -2.00689430 3.21574421
48 0.54385547 -2.00689430
49 3.53536762 0.54385547
50 -3.41535351 3.53536762
51 -2.52938271 -3.41535351
52 -1.50992766 -2.52938271
53 -0.78840481 -1.50992766
54 -0.90953711 -0.78840481
55 2.37881453 -0.90953711
56 3.73541870 2.37881453
57 -6.20771126 3.73541870
58 2.48411394 -6.20771126
59 0.32201060 2.48411394
60 -2.97068235 0.32201060
61 3.13618991 -2.97068235
62 -0.59274221 3.13618991
63 -3.41454946 -0.59274221
64 -1.09830208 -3.41454946
65 0.26576708 -1.09830208
66 0.99035789 0.26576708
67 -5.23991896 0.99035789
68 4.98647410 -5.23991896
69 -0.05762683 4.98647410
70 4.66234644 -0.05762683
71 -3.62854460 4.66234644
72 -1.59969646 -3.62854460
73 2.34386773 -1.59969646
74 -0.83069666 2.34386773
75 4.20121944 -0.83069666
76 1.68392187 4.20121944
77 -0.69732818 1.68392187
78 -6.23962687 -0.69732818
79 2.14944341 -6.23962687
80 -2.07306893 2.14944341
81 0.70898909 -2.07306893
82 -0.10522698 0.70898909
83 2.09301800 -0.10522698
84 -2.76939838 2.09301800
85 -1.87873104 -2.76939838
86 3.52607343 -1.87873104
87 -1.89071069 3.52607343
88 -5.69259189 -1.89071069
89 -0.47924358 -5.69259189
90 -3.19030824 -0.47924358
91 1.05261155 -3.19030824
92 0.01648030 1.05261155
93 -2.53848461 0.01648030
94 -4.96760361 -2.53848461
95 3.85493738 -4.96760361
96 2.49386572 3.85493738
97 0.13010462 2.49386572
98 1.73375124 0.13010462
99 -2.48116993 1.73375124
100 2.72177159 -2.48116993
101 2.51436258 2.72177159
102 -0.16456733 2.51436258
103 -2.17775172 -0.16456733
104 -1.87379206 -2.17775172
105 6.79303202 -1.87379206
106 2.63293578 6.79303202
107 6.13850605 2.63293578
108 1.85548908 6.13850605
109 10.10957270 1.85548908
110 -4.82391182 10.10957270
111 -3.26569706 -4.82391182
112 -2.87637444 -3.26569706
113 -1.85666704 -2.87637444
114 2.82005482 -1.85666704
115 1.44819785 2.82005482
116 -1.13164200 1.44819785
117 -0.14772102 -1.13164200
118 -0.95724055 -0.14772102
119 3.36664516 -0.95724055
120 -0.56100294 3.36664516
121 -3.64533449 -0.56100294
122 3.96602947 -3.64533449
123 2.10830963 3.96602947
124 -1.55996114 2.10830963
125 -3.55598794 -1.55996114
126 4.12073392 -3.55598794
127 8.63100073 4.12073392
128 -2.07750066 8.63100073
129 1.30217653 -2.07750066
130 -2.53549109 1.30217653
131 -4.21328112 -2.53549109
132 5.18556076 -4.21328112
133 -6.64106920 5.18556076
134 2.76830564 -6.64106920
135 -2.58781713 2.76830564
136 -5.20050161 -2.58781713
137 -0.31264988 -5.20050161
138 -2.79936227 -0.31264988
139 1.30281345 -2.79936227
140 -1.33756159 1.30281345
141 -2.77754490 -1.33756159
142 -4.55912153 -2.77754490
143 -4.86259979 -4.55912153
144 -3.72489000 -4.86259979
145 6.72811477 -3.72489000
146 -3.38436486 6.72811477
147 2.64280753 -3.38436486
148 -2.32821816 2.64280753
149 2.03904514 -2.32821816
150 4.76879002 2.03904514
151 7.93876074 4.76879002
152 -0.88611447 7.93876074
153 0.71245709 -0.88611447
154 1.79244732 0.71245709
155 0.31080999 1.79244732
156 1.38471146 0.31080999
157 -1.69647312 1.38471146
158 -1.95451953 -1.69647312
159 -0.45696612 -1.95451953
160 -1.06939825 -0.45696612
161 0.49376541 -1.06939825
162 NA 0.49376541
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.13698721 6.48828726
[2,] -5.66527251 3.13698721
[3,] -3.76663548 -5.66527251
[4,] -0.84777289 -3.76663548
[5,] -0.02515289 -0.84777289
[6,] 3.11209938 -0.02515289
[7,] -1.03738489 3.11209938
[8,] 1.08014651 -1.03738489
[9,] 1.87768639 1.08014651
[10,] 2.28718740 1.87768639
[11,] -0.01603852 2.28718740
[12,] 3.33066787 -0.01603852
[13,] 3.51368334 3.33066787
[14,] -3.09699404 3.51368334
[15,] -2.94405474 -3.09699404
[16,] 1.06004463 -2.94405474
[17,] 1.26768270 1.06004463
[18,] 3.18624577 1.26768270
[19,] -3.48189883 3.18624577
[20,] -3.86583832 -3.48189883
[21,] -3.78610043 -3.86583832
[22,] 2.97590537 -3.78610043
[23,] 2.08861406 2.97590537
[24,] 3.09766232 2.08861406
[25,] 6.12927891 3.09766232
[26,] 0.50643998 6.12927891
[27,] -1.87468389 0.50643998
[28,] -2.29134184 -1.87468389
[29,] -0.23929451 -2.29134184
[30,] -4.25042465 -0.23929451
[31,] -6.92351813 -4.25042465
[32,] 1.91156291 -6.92351813
[33,] -1.33138017 1.91156291
[34,] -0.61925041 -1.33138017
[35,] -1.11334879 -0.61925041
[36,] -3.73400296 -1.11334879
[37,] 1.23938506 -3.73400296
[38,] -6.59803021 1.23938506
[39,] -0.05999384 -6.59803021
[40,] 1.65695864 -0.05999384
[41,] -0.83734492 1.65695864
[42,] 1.44311604 -0.83734492
[43,] 0.70479083 1.44311604
[44,] 3.64835501 0.70479083
[45,] 3.62757945 3.64835501
[46,] 3.21574421 3.62757945
[47,] -2.00689430 3.21574421
[48,] 0.54385547 -2.00689430
[49,] 3.53536762 0.54385547
[50,] -3.41535351 3.53536762
[51,] -2.52938271 -3.41535351
[52,] -1.50992766 -2.52938271
[53,] -0.78840481 -1.50992766
[54,] -0.90953711 -0.78840481
[55,] 2.37881453 -0.90953711
[56,] 3.73541870 2.37881453
[57,] -6.20771126 3.73541870
[58,] 2.48411394 -6.20771126
[59,] 0.32201060 2.48411394
[60,] -2.97068235 0.32201060
[61,] 3.13618991 -2.97068235
[62,] -0.59274221 3.13618991
[63,] -3.41454946 -0.59274221
[64,] -1.09830208 -3.41454946
[65,] 0.26576708 -1.09830208
[66,] 0.99035789 0.26576708
[67,] -5.23991896 0.99035789
[68,] 4.98647410 -5.23991896
[69,] -0.05762683 4.98647410
[70,] 4.66234644 -0.05762683
[71,] -3.62854460 4.66234644
[72,] -1.59969646 -3.62854460
[73,] 2.34386773 -1.59969646
[74,] -0.83069666 2.34386773
[75,] 4.20121944 -0.83069666
[76,] 1.68392187 4.20121944
[77,] -0.69732818 1.68392187
[78,] -6.23962687 -0.69732818
[79,] 2.14944341 -6.23962687
[80,] -2.07306893 2.14944341
[81,] 0.70898909 -2.07306893
[82,] -0.10522698 0.70898909
[83,] 2.09301800 -0.10522698
[84,] -2.76939838 2.09301800
[85,] -1.87873104 -2.76939838
[86,] 3.52607343 -1.87873104
[87,] -1.89071069 3.52607343
[88,] -5.69259189 -1.89071069
[89,] -0.47924358 -5.69259189
[90,] -3.19030824 -0.47924358
[91,] 1.05261155 -3.19030824
[92,] 0.01648030 1.05261155
[93,] -2.53848461 0.01648030
[94,] -4.96760361 -2.53848461
[95,] 3.85493738 -4.96760361
[96,] 2.49386572 3.85493738
[97,] 0.13010462 2.49386572
[98,] 1.73375124 0.13010462
[99,] -2.48116993 1.73375124
[100,] 2.72177159 -2.48116993
[101,] 2.51436258 2.72177159
[102,] -0.16456733 2.51436258
[103,] -2.17775172 -0.16456733
[104,] -1.87379206 -2.17775172
[105,] 6.79303202 -1.87379206
[106,] 2.63293578 6.79303202
[107,] 6.13850605 2.63293578
[108,] 1.85548908 6.13850605
[109,] 10.10957270 1.85548908
[110,] -4.82391182 10.10957270
[111,] -3.26569706 -4.82391182
[112,] -2.87637444 -3.26569706
[113,] -1.85666704 -2.87637444
[114,] 2.82005482 -1.85666704
[115,] 1.44819785 2.82005482
[116,] -1.13164200 1.44819785
[117,] -0.14772102 -1.13164200
[118,] -0.95724055 -0.14772102
[119,] 3.36664516 -0.95724055
[120,] -0.56100294 3.36664516
[121,] -3.64533449 -0.56100294
[122,] 3.96602947 -3.64533449
[123,] 2.10830963 3.96602947
[124,] -1.55996114 2.10830963
[125,] -3.55598794 -1.55996114
[126,] 4.12073392 -3.55598794
[127,] 8.63100073 4.12073392
[128,] -2.07750066 8.63100073
[129,] 1.30217653 -2.07750066
[130,] -2.53549109 1.30217653
[131,] -4.21328112 -2.53549109
[132,] 5.18556076 -4.21328112
[133,] -6.64106920 5.18556076
[134,] 2.76830564 -6.64106920
[135,] -2.58781713 2.76830564
[136,] -5.20050161 -2.58781713
[137,] -0.31264988 -5.20050161
[138,] -2.79936227 -0.31264988
[139,] 1.30281345 -2.79936227
[140,] -1.33756159 1.30281345
[141,] -2.77754490 -1.33756159
[142,] -4.55912153 -2.77754490
[143,] -4.86259979 -4.55912153
[144,] -3.72489000 -4.86259979
[145,] 6.72811477 -3.72489000
[146,] -3.38436486 6.72811477
[147,] 2.64280753 -3.38436486
[148,] -2.32821816 2.64280753
[149,] 2.03904514 -2.32821816
[150,] 4.76879002 2.03904514
[151,] 7.93876074 4.76879002
[152,] -0.88611447 7.93876074
[153,] 0.71245709 -0.88611447
[154,] 1.79244732 0.71245709
[155,] 0.31080999 1.79244732
[156,] 1.38471146 0.31080999
[157,] -1.69647312 1.38471146
[158,] -1.95451953 -1.69647312
[159,] -0.45696612 -1.95451953
[160,] -1.06939825 -0.45696612
[161,] 0.49376541 -1.06939825
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.13698721 6.48828726
2 -5.66527251 3.13698721
3 -3.76663548 -5.66527251
4 -0.84777289 -3.76663548
5 -0.02515289 -0.84777289
6 3.11209938 -0.02515289
7 -1.03738489 3.11209938
8 1.08014651 -1.03738489
9 1.87768639 1.08014651
10 2.28718740 1.87768639
11 -0.01603852 2.28718740
12 3.33066787 -0.01603852
13 3.51368334 3.33066787
14 -3.09699404 3.51368334
15 -2.94405474 -3.09699404
16 1.06004463 -2.94405474
17 1.26768270 1.06004463
18 3.18624577 1.26768270
19 -3.48189883 3.18624577
20 -3.86583832 -3.48189883
21 -3.78610043 -3.86583832
22 2.97590537 -3.78610043
23 2.08861406 2.97590537
24 3.09766232 2.08861406
25 6.12927891 3.09766232
26 0.50643998 6.12927891
27 -1.87468389 0.50643998
28 -2.29134184 -1.87468389
29 -0.23929451 -2.29134184
30 -4.25042465 -0.23929451
31 -6.92351813 -4.25042465
32 1.91156291 -6.92351813
33 -1.33138017 1.91156291
34 -0.61925041 -1.33138017
35 -1.11334879 -0.61925041
36 -3.73400296 -1.11334879
37 1.23938506 -3.73400296
38 -6.59803021 1.23938506
39 -0.05999384 -6.59803021
40 1.65695864 -0.05999384
41 -0.83734492 1.65695864
42 1.44311604 -0.83734492
43 0.70479083 1.44311604
44 3.64835501 0.70479083
45 3.62757945 3.64835501
46 3.21574421 3.62757945
47 -2.00689430 3.21574421
48 0.54385547 -2.00689430
49 3.53536762 0.54385547
50 -3.41535351 3.53536762
51 -2.52938271 -3.41535351
52 -1.50992766 -2.52938271
53 -0.78840481 -1.50992766
54 -0.90953711 -0.78840481
55 2.37881453 -0.90953711
56 3.73541870 2.37881453
57 -6.20771126 3.73541870
58 2.48411394 -6.20771126
59 0.32201060 2.48411394
60 -2.97068235 0.32201060
61 3.13618991 -2.97068235
62 -0.59274221 3.13618991
63 -3.41454946 -0.59274221
64 -1.09830208 -3.41454946
65 0.26576708 -1.09830208
66 0.99035789 0.26576708
67 -5.23991896 0.99035789
68 4.98647410 -5.23991896
69 -0.05762683 4.98647410
70 4.66234644 -0.05762683
71 -3.62854460 4.66234644
72 -1.59969646 -3.62854460
73 2.34386773 -1.59969646
74 -0.83069666 2.34386773
75 4.20121944 -0.83069666
76 1.68392187 4.20121944
77 -0.69732818 1.68392187
78 -6.23962687 -0.69732818
79 2.14944341 -6.23962687
80 -2.07306893 2.14944341
81 0.70898909 -2.07306893
82 -0.10522698 0.70898909
83 2.09301800 -0.10522698
84 -2.76939838 2.09301800
85 -1.87873104 -2.76939838
86 3.52607343 -1.87873104
87 -1.89071069 3.52607343
88 -5.69259189 -1.89071069
89 -0.47924358 -5.69259189
90 -3.19030824 -0.47924358
91 1.05261155 -3.19030824
92 0.01648030 1.05261155
93 -2.53848461 0.01648030
94 -4.96760361 -2.53848461
95 3.85493738 -4.96760361
96 2.49386572 3.85493738
97 0.13010462 2.49386572
98 1.73375124 0.13010462
99 -2.48116993 1.73375124
100 2.72177159 -2.48116993
101 2.51436258 2.72177159
102 -0.16456733 2.51436258
103 -2.17775172 -0.16456733
104 -1.87379206 -2.17775172
105 6.79303202 -1.87379206
106 2.63293578 6.79303202
107 6.13850605 2.63293578
108 1.85548908 6.13850605
109 10.10957270 1.85548908
110 -4.82391182 10.10957270
111 -3.26569706 -4.82391182
112 -2.87637444 -3.26569706
113 -1.85666704 -2.87637444
114 2.82005482 -1.85666704
115 1.44819785 2.82005482
116 -1.13164200 1.44819785
117 -0.14772102 -1.13164200
118 -0.95724055 -0.14772102
119 3.36664516 -0.95724055
120 -0.56100294 3.36664516
121 -3.64533449 -0.56100294
122 3.96602947 -3.64533449
123 2.10830963 3.96602947
124 -1.55996114 2.10830963
125 -3.55598794 -1.55996114
126 4.12073392 -3.55598794
127 8.63100073 4.12073392
128 -2.07750066 8.63100073
129 1.30217653 -2.07750066
130 -2.53549109 1.30217653
131 -4.21328112 -2.53549109
132 5.18556076 -4.21328112
133 -6.64106920 5.18556076
134 2.76830564 -6.64106920
135 -2.58781713 2.76830564
136 -5.20050161 -2.58781713
137 -0.31264988 -5.20050161
138 -2.79936227 -0.31264988
139 1.30281345 -2.79936227
140 -1.33756159 1.30281345
141 -2.77754490 -1.33756159
142 -4.55912153 -2.77754490
143 -4.86259979 -4.55912153
144 -3.72489000 -4.86259979
145 6.72811477 -3.72489000
146 -3.38436486 6.72811477
147 2.64280753 -3.38436486
148 -2.32821816 2.64280753
149 2.03904514 -2.32821816
150 4.76879002 2.03904514
151 7.93876074 4.76879002
152 -0.88611447 7.93876074
153 0.71245709 -0.88611447
154 1.79244732 0.71245709
155 0.31080999 1.79244732
156 1.38471146 0.31080999
157 -1.69647312 1.38471146
158 -1.95451953 -1.69647312
159 -0.45696612 -1.95451953
160 -1.06939825 -0.45696612
161 0.49376541 -1.06939825
> 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/7dl3w1355176767.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/8ge4y1355176767.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/99n821355176767.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/10p00o1355176767.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/11phjw1355176767.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/12vtzh1355176767.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/13ucb31355176767.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/149jsd1355176767.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/15pmq31355176767.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/167wla1355176767.tab")
+ }
>
> try(system("convert tmp/1fd2k1355176767.ps tmp/1fd2k1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/2k67w1355176767.ps tmp/2k67w1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/33l6a1355176767.ps tmp/33l6a1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ec5y1355176767.ps tmp/4ec5y1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/5n3vf1355176767.ps tmp/5n3vf1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/6fc8u1355176767.ps tmp/6fc8u1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/7dl3w1355176767.ps tmp/7dl3w1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ge4y1355176767.ps tmp/8ge4y1355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/99n821355176767.ps tmp/99n821355176767.png",intern=TRUE))
character(0)
> try(system("convert tmp/10p00o1355176767.ps tmp/10p00o1355176767.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.593 1.579 9.195