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(4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,0
+ ,1
+ ,1
+ ,1
+ ,1
+ ,4
+ ,1
+ ,0
+ ,0
+ ,1
+ ,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<- '6'
> #'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
Outcome Weeks USELIMIT Used CorrectAN Useful t
1 1 4 1 0 0 0 1
2 0 4 0 0 0 0 2
3 0 4 0 0 0 0 3
4 0 4 0 0 0 0 4
5 0 4 0 0 0 0 5
6 1 4 1 0 0 1 6
7 0 4 0 0 0 0 7
8 0 4 0 0 0 0 8
9 1 4 0 0 0 0 9
10 0 4 1 0 0 0 10
11 0 4 1 0 0 0 11
12 0 4 0 0 0 0 12
13 0 4 0 1 0 1 13
14 0 4 1 0 0 0 14
15 1 4 0 1 0 1 15
16 1 4 0 1 0 1 16
17 0 4 1 1 1 1 17
18 0 4 1 0 0 0 18
19 1 4 0 0 0 0 19
20 1 4 0 1 1 1 20
21 0 4 1 0 0 1 21
22 1 4 1 1 0 1 22
23 1 4 0 0 0 1 23
24 1 4 1 0 0 1 24
25 1 4 0 1 0 0 25
26 0 4 0 1 0 1 26
27 1 4 1 0 0 0 27
28 0 4 0 1 0 0 28
29 1 4 0 0 0 0 29
30 0 4 0 0 0 1 30
31 0 4 0 0 0 0 31
32 0 4 1 0 0 0 32
33 0 4 1 0 0 1 33
34 1 4 0 0 0 0 34
35 0 4 0 0 0 0 35
36 0 4 0 0 0 0 36
37 0 4 1 1 0 1 37
38 1 4 0 1 0 0 38
39 1 4 0 0 0 1 39
40 0 4 0 0 0 1 40
41 1 4 0 1 1 1 41
42 1 4 0 1 0 0 42
43 1 4 1 0 0 1 43
44 0 4 1 0 0 0 44
45 0 4 0 0 0 1 45
46 1 4 0 0 0 1 46
47 0 4 0 0 0 0 47
48 1 4 0 0 0 0 48
49 1 4 0 0 0 1 49
50 0 4 0 0 0 0 50
51 0 4 0 1 0 0 51
52 0 4 1 1 1 1 52
53 1 4 0 0 0 0 53
54 0 4 0 1 1 0 54
55 0 4 0 0 0 0 55
56 1 4 0 1 0 0 56
57 1 4 0 1 0 1 57
58 1 4 0 0 0 0 58
59 1 4 0 0 0 0 59
60 1 4 1 1 1 1 60
61 1 4 1 0 0 0 61
62 0 4 0 1 0 1 62
63 0 4 0 0 0 0 63
64 1 4 1 0 0 0 64
65 0 4 0 0 0 0 65
66 0 4 0 0 0 0 66
67 0 4 0 1 1 1 67
68 0 4 1 0 0 0 68
69 1 4 0 0 0 0 69
70 0 4 0 1 0 0 70
71 0 4 0 0 0 0 71
72 1 4 0 0 0 0 72
73 1 4 0 1 0 0 73
74 0 4 1 1 0 0 74
75 1 4 0 0 0 0 75
76 1 4 0 0 0 1 76
77 1 4 0 0 0 0 77
78 1 4 0 1 0 1 78
79 1 4 0 1 1 0 79
80 0 4 0 0 0 1 80
81 0 4 0 0 0 0 81
82 1 4 1 1 0 0 82
83 0 4 0 0 0 0 83
84 0 4 0 1 1 0 84
85 1 4 0 0 0 1 85
86 0 4 1 0 0 0 86
87 1 2 1 0 0 0 87
88 1 2 1 1 0 0 88
89 0 2 0 0 0 0 89
90 1 2 0 0 0 0 90
91 0 2 0 0 0 1 91
92 0 2 1 0 0 0 92
93 0 2 1 0 0 1 93
94 0 2 0 0 0 0 94
95 0 2 0 0 0 0 95
96 1 2 0 0 0 0 96
97 0 2 1 0 0 0 97
98 0 2 0 0 0 0 98
99 0 2 1 0 0 0 99
100 1 2 0 0 0 0 100
101 1 2 1 0 0 0 101
102 0 2 0 0 0 0 102
103 0 2 0 0 0 0 103
104 0 2 0 0 0 0 104
105 0 2 0 1 0 0 105
106 0 2 0 0 0 0 106
107 0 2 0 0 0 0 107
108 0 2 1 1 0 0 108
109 0 2 0 0 0 0 109
110 0 2 1 0 0 0 110
111 0 2 1 1 0 1 111
112 0 2 0 0 0 0 112
113 0 2 0 1 0 0 113
114 0 2 1 1 0 0 114
115 0 2 1 0 0 0 115
116 0 2 0 0 0 0 116
117 1 2 1 0 0 0 117
118 0 2 1 0 0 0 118
119 0 2 0 0 0 0 119
120 1 2 0 0 0 0 120
121 0 2 1 0 0 0 121
122 0 2 0 0 0 0 122
123 0 2 1 1 0 0 123
124 1 2 0 1 0 1 124
125 1 2 0 0 0 0 125
126 0 2 0 0 0 0 126
127 0 2 0 0 0 1 127
128 1 2 0 0 0 0 128
129 0 2 0 0 0 0 129
130 1 2 0 0 0 0 130
131 0 2 1 0 0 0 131
132 1 2 1 0 0 0 132
133 0 2 1 1 0 0 133
134 0 2 0 0 0 0 134
135 0 2 0 0 0 0 135
136 0 2 0 0 0 0 136
137 1 2 1 1 0 1 137
138 1 2 1 1 0 1 138
139 0 2 0 0 0 0 139
140 0 2 0 0 0 0 140
141 1 2 0 1 1 0 141
142 1 2 0 1 0 0 142
143 0 2 1 0 0 0 143
144 1 2 0 0 0 1 144
145 0 2 0 0 0 1 145
146 1 2 0 0 0 0 146
147 0 2 0 1 0 0 147
148 0 2 0 0 0 0 148
149 0 2 1 0 0 0 149
150 1 2 0 0 0 1 150
151 1 2 0 0 0 0 151
152 0 2 1 1 1 0 152
153 0 2 1 1 1 1 153
154 0 2 1 1 0 0 154
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks USELIMIT Used CorrectAN Useful
-0.220056 0.137632 -0.071160 0.076674 -0.141203 0.163922
t
0.002003
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.6953 -0.3729 -0.2655 0.5137 0.8417
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.220056 0.377984 -0.582 0.5613
Weeks 0.137632 0.080338 1.713 0.0888 .
USELIMIT -0.071160 0.085046 -0.837 0.4041
Used 0.076674 0.098844 0.776 0.4392
CorrectAN -0.141203 0.165823 -0.852 0.3959
Useful 0.163922 0.093771 1.748 0.0825 .
t 0.002003 0.001770 1.132 0.2596
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.484 on 147 degrees of freedom
Multiple R-squared: 0.06527, Adjusted R-squared: 0.02711
F-statistic: 1.711 on 6 and 147 DF, p-value: 0.1224
> 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.8681104 0.2637792 0.1318896
[2,] 0.8029007 0.3941986 0.1970993
[3,] 0.6976187 0.6047627 0.3023813
[4,] 0.5874150 0.8251700 0.4125850
[5,] 0.4788193 0.9576386 0.5211807
[6,] 0.6066338 0.7867325 0.3933662
[7,] 0.5827472 0.8345056 0.4172528
[8,] 0.4904052 0.9808105 0.5095948
[9,] 0.4016247 0.8032493 0.5983753
[10,] 0.5775513 0.8448974 0.4224487
[11,] 0.6034755 0.7930491 0.3965245
[12,] 0.6972625 0.6054749 0.3027375
[13,] 0.6677771 0.6644457 0.3322229
[14,] 0.6229750 0.7540499 0.3770250
[15,] 0.5807983 0.8384034 0.4192017
[16,] 0.5693660 0.8612679 0.4306340
[17,] 0.6978773 0.6042454 0.3021227
[18,] 0.7036072 0.5927857 0.2963928
[19,] 0.7073709 0.5852581 0.2926291
[20,] 0.6912430 0.6175141 0.3087570
[21,] 0.7639811 0.4720378 0.2360189
[22,] 0.7530825 0.4938350 0.2469175
[23,] 0.7334874 0.5330252 0.2665126
[24,] 0.7384927 0.5230145 0.2615073
[25,] 0.7596081 0.4807837 0.2403919
[26,] 0.7422956 0.5154088 0.2577044
[27,] 0.7189764 0.5620472 0.2810236
[28,] 0.7311444 0.5377111 0.2688556
[29,] 0.7371694 0.5256613 0.2628306
[30,] 0.7261101 0.5477797 0.2738899
[31,] 0.7360276 0.5279448 0.2639724
[32,] 0.7171934 0.5656131 0.2828066
[33,] 0.7065793 0.5868414 0.2934207
[34,] 0.7040587 0.5918826 0.2959413
[35,] 0.6856856 0.6286289 0.3143144
[36,] 0.6973167 0.6053666 0.3026833
[37,] 0.6866456 0.6267089 0.3133544
[38,] 0.6738475 0.6523051 0.3261525
[39,] 0.6860844 0.6278312 0.3139156
[40,] 0.6678853 0.6642293 0.3321147
[41,] 0.6610897 0.6778205 0.3389103
[42,] 0.6687103 0.6625793 0.3312897
[43,] 0.6719502 0.6560995 0.3280498
[44,] 0.6849311 0.6301377 0.3150689
[45,] 0.6647869 0.6704261 0.3352131
[46,] 0.6530017 0.6939967 0.3469983
[47,] 0.6496766 0.7006469 0.3503234
[48,] 0.6173797 0.7652406 0.3826203
[49,] 0.6261225 0.7477549 0.3738775
[50,] 0.6305423 0.7389155 0.3694577
[51,] 0.6312665 0.7374670 0.3687335
[52,] 0.6455526 0.7088948 0.3544474
[53,] 0.7000499 0.5999002 0.2999501
[54,] 0.6995418 0.6009164 0.3004582
[55,] 0.7139035 0.5721930 0.2860965
[56,] 0.7126079 0.5747842 0.2873921
[57,] 0.7093097 0.5813807 0.2906903
[58,] 0.7218635 0.5562731 0.2781365
[59,] 0.7098897 0.5802207 0.2901103
[60,] 0.7146444 0.5707113 0.2853556
[61,] 0.7267508 0.5464984 0.2732492
[62,] 0.7246320 0.5507360 0.2753680
[63,] 0.7274621 0.5450758 0.2725379
[64,] 0.7164845 0.5670311 0.2835155
[65,] 0.7179154 0.5641693 0.2820846
[66,] 0.7193175 0.5613650 0.2806825
[67,] 0.6976750 0.6046500 0.3023250
[68,] 0.7049201 0.5901599 0.2950799
[69,] 0.6789630 0.6420739 0.3210370
[70,] 0.7055872 0.5888256 0.2944128
[71,] 0.7255536 0.5488928 0.2744464
[72,] 0.7185117 0.5629766 0.2814883
[73,] 0.7359805 0.5280389 0.2640195
[74,] 0.7231600 0.5536799 0.2768400
[75,] 0.7072718 0.5854564 0.2927282
[76,] 0.6996445 0.6007110 0.3003555
[77,] 0.6726160 0.6547679 0.3273840
[78,] 0.7092948 0.5814104 0.2907052
[79,] 0.7521069 0.4957863 0.2478931
[80,] 0.7571457 0.4857087 0.2428543
[81,] 0.7952295 0.4095410 0.2047705
[82,] 0.8053853 0.3892294 0.1946147
[83,] 0.7832705 0.4334591 0.2167295
[84,] 0.7708058 0.4583884 0.2291942
[85,] 0.7441563 0.5116875 0.2558437
[86,] 0.7147882 0.5704236 0.2852118
[87,] 0.7706120 0.4587760 0.2293880
[88,] 0.7375752 0.5248495 0.2624248
[89,] 0.7061263 0.5877474 0.2938737
[90,] 0.6670964 0.6658072 0.3329036
[91,] 0.7350427 0.5299146 0.2649573
[92,] 0.8332355 0.3335290 0.1667645
[93,] 0.8062773 0.3874454 0.1937227
[94,] 0.7760746 0.4478508 0.2239254
[95,] 0.7428952 0.5142097 0.2571048
[96,] 0.7147805 0.5704391 0.2852195
[97,] 0.6773097 0.6453807 0.3226903
[98,] 0.6386165 0.7227670 0.3613835
[99,] 0.5969233 0.8061533 0.4030767
[100,] 0.5569759 0.8860481 0.4430241
[101,] 0.5069610 0.9860780 0.4930390
[102,] 0.4945730 0.9891460 0.5054270
[103,] 0.4585803 0.9171606 0.5414197
[104,] 0.4423864 0.8847727 0.5576136
[105,] 0.4084499 0.8168998 0.5915501
[106,] 0.3625891 0.7251783 0.6374109
[107,] 0.3425275 0.6850550 0.6574725
[108,] 0.4375085 0.8750170 0.5624915
[109,] 0.3846310 0.7692619 0.6153690
[110,] 0.3625142 0.7250285 0.6374858
[111,] 0.3965383 0.7930766 0.6034617
[112,] 0.3431909 0.6863818 0.6568091
[113,] 0.3189672 0.6379343 0.6810328
[114,] 0.2954333 0.5908666 0.7045667
[115,] 0.2555336 0.5110671 0.7444664
[116,] 0.2793596 0.5587191 0.7206404
[117,] 0.2546364 0.5092729 0.7453636
[118,] 0.3177224 0.6354448 0.6822776
[119,] 0.3295885 0.6591769 0.6704115
[120,] 0.3156112 0.6312224 0.6843888
[121,] 0.3329987 0.6659974 0.6670013
[122,] 0.2773305 0.5546611 0.7226695
[123,] 0.4599503 0.9199006 0.5400497
[124,] 0.3976122 0.7952244 0.6023878
[125,] 0.3457858 0.6915715 0.6542142
[126,] 0.3071052 0.6142105 0.6928948
[127,] 0.2908845 0.5817689 0.7091155
[128,] 0.2455569 0.4911137 0.7544431
[129,] 0.3079113 0.6158226 0.6920887
[130,] 0.2876447 0.5752893 0.7123553
[131,] 0.3295650 0.6591301 0.6704350
[132,] 0.2593626 0.5187252 0.7406374
[133,] 0.3550612 0.7101225 0.6449388
[134,] 0.2458746 0.4917491 0.7541254
[135,] 0.3120095 0.6240190 0.6879905
> postscript(file="/var/fisher/rcomp/tmp/1kr211355685340.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/2lvef1355685340.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/3tv0u1355685340.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/4spy51355685340.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/56ms21355685340.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 = 154
Frequency = 1
1 2 3 4 5 6 7
0.7386834 -0.3344797 -0.3364828 -0.3384858 -0.3404889 0.5647462 -0.3444950
8 9 10 11 12 13 14
-0.3464980 0.6514989 -0.2793440 -0.2813471 -0.3545102 -0.5971092 -0.2873562
15 16 17 18 19 20 21
0.3988847 0.3968816 -0.3927584 -0.2953684 0.6314685 0.5300723 -0.4652995
22 23 24 25 26 27 28
0.4560234 0.4595343 0.5286913 0.5427761 -0.6231489 0.6866042 -0.4632330
29 30 31 32 33 34 35
0.6114380 -0.5544871 -0.3925681 -0.3234111 -0.4893361 0.6014227 -0.4005803
36 37 38 39 40 41 42
-0.4025834 -0.5740223 0.5167365 0.4274855 -0.5745175 0.4880083 0.5087243
43 44 45 46 47 48 49
0.4906334 -0.3474477 -0.5845328 0.4134642 -0.4246169 0.5733800 0.4074550
50 51 52 53 54 55 56
-0.4306261 -0.5093031 -0.4628651 0.5633648 -0.3741094 -0.4406413 0.4806816
57 58 59 60 61 62 63
0.3147566 0.5533495 0.5513465 0.5211105 0.6185005 -0.6952586 -0.4566657
64 65 66 67 68 69 70
0.6124914 -0.4606718 -0.4626748 -0.5640710 -0.3955208 0.5313160 -0.5473611
71 72 73 74 75 76 77
-0.4726901 0.5253069 0.4466298 -0.4842131 0.5192977 0.3533727 0.5152916
78 79 80 81 82 83 84
0.2726926 0.5758144 -0.6546395 -0.4927206 0.4997625 -0.4967267 -0.4342008
85 86 87 88 89 90 91
0.3353453 -0.4315757 0.8416862 0.7630091 -0.2334800 0.7645169 -0.4014081
92 93 94 95 96 97 98
-0.1683291 -0.3342541 -0.2434953 -0.2454983 0.7524986 -0.1783443 -0.2515075
99 100 101 102 103 104 105
-0.1823504 0.7444865 0.8136435 -0.2595196 -0.2615227 -0.2635257 -0.3422028
106 107 108 109 110 111 112
-0.2675318 -0.2695349 -0.2770519 -0.2735410 -0.2043839 -0.4469830 -0.2795501
113 114 115 116 117 118 119
-0.3582272 -0.2890701 -0.2143992 -0.2875623 0.7815947 -0.2204083 -0.2935715
120 121 122 123 124 125 126
0.7044255 -0.2264175 -0.2995806 -0.3070976 0.4558173 0.6944102 -0.3075928
127 128 129 130 131 132 133
-0.4735178 0.6884011 -0.3136020 0.6843950 -0.2464480 0.7515490 -0.3271281
134 135 136 137 138 139 140
-0.3236172 -0.3256203 -0.3276233 0.5009378 0.4989347 -0.3336325 -0.3356355
141 142 143 144 145 146 147
0.7268904 0.5836844 -0.2704845 0.4924303 -0.5095727 0.6523462 -0.4263309
148 149 150 151 152 153 154
-0.3516599 -0.2825028 0.4804120 0.6423310 -0.2239831 -0.3899081 -0.3691921
> postscript(file="/var/fisher/rcomp/tmp/6ybf11355685340.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 = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 0.7386834 NA
1 -0.3344797 0.7386834
2 -0.3364828 -0.3344797
3 -0.3384858 -0.3364828
4 -0.3404889 -0.3384858
5 0.5647462 -0.3404889
6 -0.3444950 0.5647462
7 -0.3464980 -0.3444950
8 0.6514989 -0.3464980
9 -0.2793440 0.6514989
10 -0.2813471 -0.2793440
11 -0.3545102 -0.2813471
12 -0.5971092 -0.3545102
13 -0.2873562 -0.5971092
14 0.3988847 -0.2873562
15 0.3968816 0.3988847
16 -0.3927584 0.3968816
17 -0.2953684 -0.3927584
18 0.6314685 -0.2953684
19 0.5300723 0.6314685
20 -0.4652995 0.5300723
21 0.4560234 -0.4652995
22 0.4595343 0.4560234
23 0.5286913 0.4595343
24 0.5427761 0.5286913
25 -0.6231489 0.5427761
26 0.6866042 -0.6231489
27 -0.4632330 0.6866042
28 0.6114380 -0.4632330
29 -0.5544871 0.6114380
30 -0.3925681 -0.5544871
31 -0.3234111 -0.3925681
32 -0.4893361 -0.3234111
33 0.6014227 -0.4893361
34 -0.4005803 0.6014227
35 -0.4025834 -0.4005803
36 -0.5740223 -0.4025834
37 0.5167365 -0.5740223
38 0.4274855 0.5167365
39 -0.5745175 0.4274855
40 0.4880083 -0.5745175
41 0.5087243 0.4880083
42 0.4906334 0.5087243
43 -0.3474477 0.4906334
44 -0.5845328 -0.3474477
45 0.4134642 -0.5845328
46 -0.4246169 0.4134642
47 0.5733800 -0.4246169
48 0.4074550 0.5733800
49 -0.4306261 0.4074550
50 -0.5093031 -0.4306261
51 -0.4628651 -0.5093031
52 0.5633648 -0.4628651
53 -0.3741094 0.5633648
54 -0.4406413 -0.3741094
55 0.4806816 -0.4406413
56 0.3147566 0.4806816
57 0.5533495 0.3147566
58 0.5513465 0.5533495
59 0.5211105 0.5513465
60 0.6185005 0.5211105
61 -0.6952586 0.6185005
62 -0.4566657 -0.6952586
63 0.6124914 -0.4566657
64 -0.4606718 0.6124914
65 -0.4626748 -0.4606718
66 -0.5640710 -0.4626748
67 -0.3955208 -0.5640710
68 0.5313160 -0.3955208
69 -0.5473611 0.5313160
70 -0.4726901 -0.5473611
71 0.5253069 -0.4726901
72 0.4466298 0.5253069
73 -0.4842131 0.4466298
74 0.5192977 -0.4842131
75 0.3533727 0.5192977
76 0.5152916 0.3533727
77 0.2726926 0.5152916
78 0.5758144 0.2726926
79 -0.6546395 0.5758144
80 -0.4927206 -0.6546395
81 0.4997625 -0.4927206
82 -0.4967267 0.4997625
83 -0.4342008 -0.4967267
84 0.3353453 -0.4342008
85 -0.4315757 0.3353453
86 0.8416862 -0.4315757
87 0.7630091 0.8416862
88 -0.2334800 0.7630091
89 0.7645169 -0.2334800
90 -0.4014081 0.7645169
91 -0.1683291 -0.4014081
92 -0.3342541 -0.1683291
93 -0.2434953 -0.3342541
94 -0.2454983 -0.2434953
95 0.7524986 -0.2454983
96 -0.1783443 0.7524986
97 -0.2515075 -0.1783443
98 -0.1823504 -0.2515075
99 0.7444865 -0.1823504
100 0.8136435 0.7444865
101 -0.2595196 0.8136435
102 -0.2615227 -0.2595196
103 -0.2635257 -0.2615227
104 -0.3422028 -0.2635257
105 -0.2675318 -0.3422028
106 -0.2695349 -0.2675318
107 -0.2770519 -0.2695349
108 -0.2735410 -0.2770519
109 -0.2043839 -0.2735410
110 -0.4469830 -0.2043839
111 -0.2795501 -0.4469830
112 -0.3582272 -0.2795501
113 -0.2890701 -0.3582272
114 -0.2143992 -0.2890701
115 -0.2875623 -0.2143992
116 0.7815947 -0.2875623
117 -0.2204083 0.7815947
118 -0.2935715 -0.2204083
119 0.7044255 -0.2935715
120 -0.2264175 0.7044255
121 -0.2995806 -0.2264175
122 -0.3070976 -0.2995806
123 0.4558173 -0.3070976
124 0.6944102 0.4558173
125 -0.3075928 0.6944102
126 -0.4735178 -0.3075928
127 0.6884011 -0.4735178
128 -0.3136020 0.6884011
129 0.6843950 -0.3136020
130 -0.2464480 0.6843950
131 0.7515490 -0.2464480
132 -0.3271281 0.7515490
133 -0.3236172 -0.3271281
134 -0.3256203 -0.3236172
135 -0.3276233 -0.3256203
136 0.5009378 -0.3276233
137 0.4989347 0.5009378
138 -0.3336325 0.4989347
139 -0.3356355 -0.3336325
140 0.7268904 -0.3356355
141 0.5836844 0.7268904
142 -0.2704845 0.5836844
143 0.4924303 -0.2704845
144 -0.5095727 0.4924303
145 0.6523462 -0.5095727
146 -0.4263309 0.6523462
147 -0.3516599 -0.4263309
148 -0.2825028 -0.3516599
149 0.4804120 -0.2825028
150 0.6423310 0.4804120
151 -0.2239831 0.6423310
152 -0.3899081 -0.2239831
153 -0.3691921 -0.3899081
154 NA -0.3691921
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.3344797 0.7386834
[2,] -0.3364828 -0.3344797
[3,] -0.3384858 -0.3364828
[4,] -0.3404889 -0.3384858
[5,] 0.5647462 -0.3404889
[6,] -0.3444950 0.5647462
[7,] -0.3464980 -0.3444950
[8,] 0.6514989 -0.3464980
[9,] -0.2793440 0.6514989
[10,] -0.2813471 -0.2793440
[11,] -0.3545102 -0.2813471
[12,] -0.5971092 -0.3545102
[13,] -0.2873562 -0.5971092
[14,] 0.3988847 -0.2873562
[15,] 0.3968816 0.3988847
[16,] -0.3927584 0.3968816
[17,] -0.2953684 -0.3927584
[18,] 0.6314685 -0.2953684
[19,] 0.5300723 0.6314685
[20,] -0.4652995 0.5300723
[21,] 0.4560234 -0.4652995
[22,] 0.4595343 0.4560234
[23,] 0.5286913 0.4595343
[24,] 0.5427761 0.5286913
[25,] -0.6231489 0.5427761
[26,] 0.6866042 -0.6231489
[27,] -0.4632330 0.6866042
[28,] 0.6114380 -0.4632330
[29,] -0.5544871 0.6114380
[30,] -0.3925681 -0.5544871
[31,] -0.3234111 -0.3925681
[32,] -0.4893361 -0.3234111
[33,] 0.6014227 -0.4893361
[34,] -0.4005803 0.6014227
[35,] -0.4025834 -0.4005803
[36,] -0.5740223 -0.4025834
[37,] 0.5167365 -0.5740223
[38,] 0.4274855 0.5167365
[39,] -0.5745175 0.4274855
[40,] 0.4880083 -0.5745175
[41,] 0.5087243 0.4880083
[42,] 0.4906334 0.5087243
[43,] -0.3474477 0.4906334
[44,] -0.5845328 -0.3474477
[45,] 0.4134642 -0.5845328
[46,] -0.4246169 0.4134642
[47,] 0.5733800 -0.4246169
[48,] 0.4074550 0.5733800
[49,] -0.4306261 0.4074550
[50,] -0.5093031 -0.4306261
[51,] -0.4628651 -0.5093031
[52,] 0.5633648 -0.4628651
[53,] -0.3741094 0.5633648
[54,] -0.4406413 -0.3741094
[55,] 0.4806816 -0.4406413
[56,] 0.3147566 0.4806816
[57,] 0.5533495 0.3147566
[58,] 0.5513465 0.5533495
[59,] 0.5211105 0.5513465
[60,] 0.6185005 0.5211105
[61,] -0.6952586 0.6185005
[62,] -0.4566657 -0.6952586
[63,] 0.6124914 -0.4566657
[64,] -0.4606718 0.6124914
[65,] -0.4626748 -0.4606718
[66,] -0.5640710 -0.4626748
[67,] -0.3955208 -0.5640710
[68,] 0.5313160 -0.3955208
[69,] -0.5473611 0.5313160
[70,] -0.4726901 -0.5473611
[71,] 0.5253069 -0.4726901
[72,] 0.4466298 0.5253069
[73,] -0.4842131 0.4466298
[74,] 0.5192977 -0.4842131
[75,] 0.3533727 0.5192977
[76,] 0.5152916 0.3533727
[77,] 0.2726926 0.5152916
[78,] 0.5758144 0.2726926
[79,] -0.6546395 0.5758144
[80,] -0.4927206 -0.6546395
[81,] 0.4997625 -0.4927206
[82,] -0.4967267 0.4997625
[83,] -0.4342008 -0.4967267
[84,] 0.3353453 -0.4342008
[85,] -0.4315757 0.3353453
[86,] 0.8416862 -0.4315757
[87,] 0.7630091 0.8416862
[88,] -0.2334800 0.7630091
[89,] 0.7645169 -0.2334800
[90,] -0.4014081 0.7645169
[91,] -0.1683291 -0.4014081
[92,] -0.3342541 -0.1683291
[93,] -0.2434953 -0.3342541
[94,] -0.2454983 -0.2434953
[95,] 0.7524986 -0.2454983
[96,] -0.1783443 0.7524986
[97,] -0.2515075 -0.1783443
[98,] -0.1823504 -0.2515075
[99,] 0.7444865 -0.1823504
[100,] 0.8136435 0.7444865
[101,] -0.2595196 0.8136435
[102,] -0.2615227 -0.2595196
[103,] -0.2635257 -0.2615227
[104,] -0.3422028 -0.2635257
[105,] -0.2675318 -0.3422028
[106,] -0.2695349 -0.2675318
[107,] -0.2770519 -0.2695349
[108,] -0.2735410 -0.2770519
[109,] -0.2043839 -0.2735410
[110,] -0.4469830 -0.2043839
[111,] -0.2795501 -0.4469830
[112,] -0.3582272 -0.2795501
[113,] -0.2890701 -0.3582272
[114,] -0.2143992 -0.2890701
[115,] -0.2875623 -0.2143992
[116,] 0.7815947 -0.2875623
[117,] -0.2204083 0.7815947
[118,] -0.2935715 -0.2204083
[119,] 0.7044255 -0.2935715
[120,] -0.2264175 0.7044255
[121,] -0.2995806 -0.2264175
[122,] -0.3070976 -0.2995806
[123,] 0.4558173 -0.3070976
[124,] 0.6944102 0.4558173
[125,] -0.3075928 0.6944102
[126,] -0.4735178 -0.3075928
[127,] 0.6884011 -0.4735178
[128,] -0.3136020 0.6884011
[129,] 0.6843950 -0.3136020
[130,] -0.2464480 0.6843950
[131,] 0.7515490 -0.2464480
[132,] -0.3271281 0.7515490
[133,] -0.3236172 -0.3271281
[134,] -0.3256203 -0.3236172
[135,] -0.3276233 -0.3256203
[136,] 0.5009378 -0.3276233
[137,] 0.4989347 0.5009378
[138,] -0.3336325 0.4989347
[139,] -0.3356355 -0.3336325
[140,] 0.7268904 -0.3356355
[141,] 0.5836844 0.7268904
[142,] -0.2704845 0.5836844
[143,] 0.4924303 -0.2704845
[144,] -0.5095727 0.4924303
[145,] 0.6523462 -0.5095727
[146,] -0.4263309 0.6523462
[147,] -0.3516599 -0.4263309
[148,] -0.2825028 -0.3516599
[149,] 0.4804120 -0.2825028
[150,] 0.6423310 0.4804120
[151,] -0.2239831 0.6423310
[152,] -0.3899081 -0.2239831
[153,] -0.3691921 -0.3899081
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.3344797 0.7386834
2 -0.3364828 -0.3344797
3 -0.3384858 -0.3364828
4 -0.3404889 -0.3384858
5 0.5647462 -0.3404889
6 -0.3444950 0.5647462
7 -0.3464980 -0.3444950
8 0.6514989 -0.3464980
9 -0.2793440 0.6514989
10 -0.2813471 -0.2793440
11 -0.3545102 -0.2813471
12 -0.5971092 -0.3545102
13 -0.2873562 -0.5971092
14 0.3988847 -0.2873562
15 0.3968816 0.3988847
16 -0.3927584 0.3968816
17 -0.2953684 -0.3927584
18 0.6314685 -0.2953684
19 0.5300723 0.6314685
20 -0.4652995 0.5300723
21 0.4560234 -0.4652995
22 0.4595343 0.4560234
23 0.5286913 0.4595343
24 0.5427761 0.5286913
25 -0.6231489 0.5427761
26 0.6866042 -0.6231489
27 -0.4632330 0.6866042
28 0.6114380 -0.4632330
29 -0.5544871 0.6114380
30 -0.3925681 -0.5544871
31 -0.3234111 -0.3925681
32 -0.4893361 -0.3234111
33 0.6014227 -0.4893361
34 -0.4005803 0.6014227
35 -0.4025834 -0.4005803
36 -0.5740223 -0.4025834
37 0.5167365 -0.5740223
38 0.4274855 0.5167365
39 -0.5745175 0.4274855
40 0.4880083 -0.5745175
41 0.5087243 0.4880083
42 0.4906334 0.5087243
43 -0.3474477 0.4906334
44 -0.5845328 -0.3474477
45 0.4134642 -0.5845328
46 -0.4246169 0.4134642
47 0.5733800 -0.4246169
48 0.4074550 0.5733800
49 -0.4306261 0.4074550
50 -0.5093031 -0.4306261
51 -0.4628651 -0.5093031
52 0.5633648 -0.4628651
53 -0.3741094 0.5633648
54 -0.4406413 -0.3741094
55 0.4806816 -0.4406413
56 0.3147566 0.4806816
57 0.5533495 0.3147566
58 0.5513465 0.5533495
59 0.5211105 0.5513465
60 0.6185005 0.5211105
61 -0.6952586 0.6185005
62 -0.4566657 -0.6952586
63 0.6124914 -0.4566657
64 -0.4606718 0.6124914
65 -0.4626748 -0.4606718
66 -0.5640710 -0.4626748
67 -0.3955208 -0.5640710
68 0.5313160 -0.3955208
69 -0.5473611 0.5313160
70 -0.4726901 -0.5473611
71 0.5253069 -0.4726901
72 0.4466298 0.5253069
73 -0.4842131 0.4466298
74 0.5192977 -0.4842131
75 0.3533727 0.5192977
76 0.5152916 0.3533727
77 0.2726926 0.5152916
78 0.5758144 0.2726926
79 -0.6546395 0.5758144
80 -0.4927206 -0.6546395
81 0.4997625 -0.4927206
82 -0.4967267 0.4997625
83 -0.4342008 -0.4967267
84 0.3353453 -0.4342008
85 -0.4315757 0.3353453
86 0.8416862 -0.4315757
87 0.7630091 0.8416862
88 -0.2334800 0.7630091
89 0.7645169 -0.2334800
90 -0.4014081 0.7645169
91 -0.1683291 -0.4014081
92 -0.3342541 -0.1683291
93 -0.2434953 -0.3342541
94 -0.2454983 -0.2434953
95 0.7524986 -0.2454983
96 -0.1783443 0.7524986
97 -0.2515075 -0.1783443
98 -0.1823504 -0.2515075
99 0.7444865 -0.1823504
100 0.8136435 0.7444865
101 -0.2595196 0.8136435
102 -0.2615227 -0.2595196
103 -0.2635257 -0.2615227
104 -0.3422028 -0.2635257
105 -0.2675318 -0.3422028
106 -0.2695349 -0.2675318
107 -0.2770519 -0.2695349
108 -0.2735410 -0.2770519
109 -0.2043839 -0.2735410
110 -0.4469830 -0.2043839
111 -0.2795501 -0.4469830
112 -0.3582272 -0.2795501
113 -0.2890701 -0.3582272
114 -0.2143992 -0.2890701
115 -0.2875623 -0.2143992
116 0.7815947 -0.2875623
117 -0.2204083 0.7815947
118 -0.2935715 -0.2204083
119 0.7044255 -0.2935715
120 -0.2264175 0.7044255
121 -0.2995806 -0.2264175
122 -0.3070976 -0.2995806
123 0.4558173 -0.3070976
124 0.6944102 0.4558173
125 -0.3075928 0.6944102
126 -0.4735178 -0.3075928
127 0.6884011 -0.4735178
128 -0.3136020 0.6884011
129 0.6843950 -0.3136020
130 -0.2464480 0.6843950
131 0.7515490 -0.2464480
132 -0.3271281 0.7515490
133 -0.3236172 -0.3271281
134 -0.3256203 -0.3236172
135 -0.3276233 -0.3256203
136 0.5009378 -0.3276233
137 0.4989347 0.5009378
138 -0.3336325 0.4989347
139 -0.3356355 -0.3336325
140 0.7268904 -0.3356355
141 0.5836844 0.7268904
142 -0.2704845 0.5836844
143 0.4924303 -0.2704845
144 -0.5095727 0.4924303
145 0.6523462 -0.5095727
146 -0.4263309 0.6523462
147 -0.3516599 -0.4263309
148 -0.2825028 -0.3516599
149 0.4804120 -0.2825028
150 0.6423310 0.4804120
151 -0.2239831 0.6423310
152 -0.3899081 -0.2239831
153 -0.3691921 -0.3899081
> 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/741wy1355685340.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/8hqob1355685340.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/9rarn1355685340.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/10wpmk1355685340.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/11dwbs1355685340.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/12kktx1355685340.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/135twg1355685340.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/143i1d1355685340.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/15ek8h1355685340.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/16xt1u1355685340.tab")
+ }
>
> try(system("convert tmp/1kr211355685340.ps tmp/1kr211355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/2lvef1355685340.ps tmp/2lvef1355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/3tv0u1355685340.ps tmp/3tv0u1355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/4spy51355685340.ps tmp/4spy51355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/56ms21355685340.ps tmp/56ms21355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ybf11355685340.ps tmp/6ybf11355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/741wy1355685340.ps tmp/741wy1355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/8hqob1355685340.ps tmp/8hqob1355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/9rarn1355685340.ps tmp/9rarn1355685340.png",intern=TRUE))
character(0)
> try(system("convert tmp/10wpmk1355685340.ps tmp/10wpmk1355685340.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.336 1.774 10.112