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
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,0
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,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Dummies'
> par1 <- '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\r Weeks*T UseLimit Used CorrectAnalysis Useful t
1 1 4 1 0 0 0 1
2 0 0 0 0 0 0 2
3 0 0 0 0 0 0 3
4 0 0 0 0 0 0 4
5 0 0 0 0 0 0 5
6 1 0 1 0 0 1 6
7 0 0 0 0 0 0 7
8 0 4 0 0 0 0 8
9 1 0 0 0 0 0 9
10 0 0 1 0 0 0 10
11 0 4 1 0 0 0 11
12 0 0 0 0 0 0 12
13 0 0 0 1 0 1 13
14 0 4 1 0 0 0 14
15 1 0 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 0 0 0 0 0 19
20 1 4 0 1 1 1 20
21 0 0 1 0 0 1 21
22 1 0 1 1 0 1 22
23 1 0 0 0 0 1 23
24 1 0 1 0 0 1 24
25 1 4 0 1 0 0 25
26 0 0 0 1 0 1 26
27 1 0 1 0 0 0 27
28 0 0 0 1 0 0 28
29 1 0 0 0 0 0 29
30 0 0 0 0 0 1 30
31 0 0 0 0 0 0 31
32 0 0 1 0 0 0 32
33 0 0 1 0 0 1 33
34 1 4 0 0 0 0 34
35 0 0 0 0 0 0 35
36 0 0 0 0 0 0 36
37 0 4 1 1 0 1 37
38 1 0 0 1 0 0 38
39 1 0 0 0 0 1 39
40 0 4 0 0 0 1 40
41 1 0 0 1 1 1 41
42 1 0 0 1 0 0 42
43 1 0 1 0 0 1 43
44 0 4 1 0 0 0 44
45 0 0 0 0 0 1 45
46 1 0 0 0 0 1 46
47 0 0 0 0 0 0 47
48 1 0 0 0 0 0 48
49 1 0 0 0 0 1 49
50 0 0 0 0 0 0 50
51 0 4 0 1 0 0 51
52 0 4 1 1 1 1 52
53 1 0 0 0 0 0 53
54 0 0 0 1 1 0 54
55 0 0 0 0 0 0 55
56 1 4 0 1 0 0 56
57 1 0 0 1 0 1 57
58 1 0 0 0 0 0 58
59 1 0 0 0 0 0 59
60 1 4 1 1 1 1 60
61 1 4 1 0 0 0 61
62 0 0 0 1 0 1 62
63 0 0 0 0 0 0 63
64 1 4 1 0 0 0 64
65 0 0 0 0 0 0 65
66 0 0 0 0 0 0 66
67 0 4 0 1 1 1 67
68 0 0 1 0 0 0 68
69 1 0 0 0 0 0 69
70 0 0 0 1 0 0 70
71 0 0 0 0 0 0 71
72 1 0 0 0 0 0 72
73 1 0 0 1 0 0 73
74 0 0 1 1 0 0 74
75 1 0 0 0 0 0 75
76 1 4 0 0 0 1 76
77 1 0 0 0 0 0 77
78 1 0 0 1 0 1 78
79 1 4 0 1 1 0 79
80 0 4 0 0 0 1 80
81 0 0 0 0 0 0 81
82 1 0 1 1 0 0 82
83 0 0 0 0 0 0 83
84 0 0 0 1 1 0 84
85 1 0 0 0 0 1 85
86 0 0 1 0 0 0 86
87 1 0 1 0 0 0 87
88 1 2 1 1 0 0 88
89 0 0 0 0 0 0 89
90 1 0 0 0 0 0 90
91 0 0 0 0 0 1 91
92 0 2 1 0 0 0 92
93 0 0 1 0 0 1 93
94 0 0 0 0 0 0 94
95 0 2 0 0 0 0 95
96 1 0 0 0 0 0 96
97 0 2 1 0 0 0 97
98 0 0 0 0 0 0 98
99 0 0 1 0 0 0 99
100 1 0 0 0 0 0 100
101 1 0 1 0 0 0 101
102 0 0 0 0 0 0 102
103 0 0 0 0 0 0 103
104 0 0 0 0 0 0 104
105 0 2 0 1 0 0 105
106 0 0 0 0 0 0 106
107 0 0 0 0 0 0 107
108 0 2 1 1 0 0 108
109 0 0 0 0 0 0 109
110 0 0 1 0 0 0 110
111 0 2 1 1 0 1 111
112 0 2 0 0 0 0 112
113 0 0 0 1 0 0 113
114 0 2 1 1 0 0 114
115 0 0 1 0 0 0 115
116 0 0 0 0 0 0 116
117 1 0 1 0 0 0 117
118 0 0 1 0 0 0 118
119 0 0 0 0 0 0 119
120 1 0 0 0 0 0 120
121 0 0 1 0 0 0 121
122 0 0 0 0 0 0 122
123 0 2 1 1 0 0 123
124 1 0 0 1 0 1 124
125 1 0 0 0 0 0 125
126 0 2 0 0 0 0 126
127 0 0 0 0 0 1 127
128 1 0 0 0 0 0 128
129 0 0 0 0 0 0 129
130 1 0 0 0 0 0 130
131 0 0 1 0 0 0 131
132 1 0 1 0 0 0 132
133 0 0 1 1 0 0 133
134 0 0 0 0 0 0 134
135 0 0 0 0 0 0 135
136 0 0 0 0 0 0 136
137 1 0 1 1 0 1 137
138 1 2 1 1 0 1 138
139 0 2 0 0 0 0 139
140 0 0 0 0 0 0 140
141 1 0 0 1 1 0 141
142 1 2 0 1 0 0 142
143 0 0 1 0 0 0 143
144 1 0 0 0 0 1 144
145 0 0 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 0 1 0 0 0 149
150 1 0 0 0 0 1 150
151 1 0 0 0 0 0 151
152 0 0 1 1 1 0 152
153 0 0 1 1 1 1 153
154 0 0 1 1 0 0 154
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Weeks*T` UseLimit Used
0.4090198 -0.0001892 -0.0950776 0.0936293
CorrectAnalysis Useful t
-0.1000590 0.1734867 -0.0006147
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.6681 -0.3701 -0.3034 0.5263 0.7672
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.4090198 0.0952702 4.293 3.18e-05 ***
`Weeks*T` -0.0001892 0.0289683 -0.007 0.9948
UseLimit -0.0950776 0.0860313 -1.105 0.2709
Used 0.0936293 0.1005303 0.931 0.3532
CorrectAnalysis -0.1000590 0.1674606 -0.598 0.5511
Useful 0.1734867 0.0945469 1.835 0.0685 .
t -0.0006147 0.0009252 -0.664 0.5074
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4888 on 147 degrees of freedom
Multiple R-squared: 0.0466, Adjusted R-squared: 0.007689
F-statistic: 1.198 on 6 and 147 DF, p-value: 0.3108
> 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.8410637 0.3178725 0.1589363
[2,] 0.7888480 0.4223040 0.2111520
[3,] 0.6808118 0.6383763 0.3191882
[4,] 0.5702337 0.8595326 0.4297663
[5,] 0.4652722 0.9305444 0.5347278
[6,] 0.5930098 0.8139804 0.4069902
[7,] 0.5313480 0.9373039 0.4686520
[8,] 0.4393499 0.8786998 0.5606501
[9,] 0.3536612 0.7073225 0.6463388
[10,] 0.5558718 0.8882563 0.4441282
[11,] 0.5566710 0.8866579 0.4433290
[12,] 0.6491300 0.7017400 0.3508700
[13,] 0.6447126 0.7105747 0.3552874
[14,] 0.5924172 0.8151655 0.4075828
[15,] 0.5500731 0.8998539 0.4499269
[16,] 0.5308723 0.9382554 0.4691277
[17,] 0.6523482 0.6953036 0.3476518
[18,] 0.6759545 0.6480909 0.3240455
[19,] 0.6682523 0.6634955 0.3317477
[20,] 0.6497169 0.7005661 0.3502831
[21,] 0.7403133 0.5193735 0.2596867
[22,] 0.7289841 0.5420318 0.2710159
[23,] 0.7039299 0.5921402 0.2960701
[24,] 0.7114387 0.5771226 0.2885613
[25,] 0.7088149 0.5823702 0.2911851
[26,] 0.6874621 0.6250758 0.3125379
[27,] 0.6609165 0.6781670 0.3390835
[28,] 0.6963128 0.6073743 0.3036872
[29,] 0.7112506 0.5774989 0.2887494
[30,] 0.6949360 0.6101281 0.3050640
[31,] 0.7168164 0.5663671 0.2831836
[32,] 0.6928562 0.6142875 0.3071438
[33,] 0.6783795 0.6432410 0.3216205
[34,] 0.6740160 0.6519681 0.3259840
[35,] 0.6514811 0.6970378 0.3485189
[36,] 0.6640583 0.6718835 0.3359417
[37,] 0.6521564 0.6956873 0.3478436
[38,] 0.6396211 0.7207577 0.3603789
[39,] 0.6507405 0.6985190 0.3492595
[40,] 0.6316237 0.7367525 0.3683763
[41,] 0.6244181 0.7511637 0.3755819
[42,] 0.6290035 0.7419930 0.3709965
[43,] 0.6365801 0.7268399 0.3634199
[44,] 0.6496646 0.7006708 0.3503354
[45,] 0.6355791 0.7288417 0.3644209
[46,] 0.6215955 0.7568089 0.3784045
[47,] 0.6195781 0.7608438 0.3804219
[48,] 0.5860267 0.8279466 0.4139733
[49,] 0.5971289 0.8057422 0.4028711
[50,] 0.6047903 0.7904194 0.3952097
[51,] 0.6009242 0.7981516 0.3990758
[52,] 0.6193934 0.7612133 0.3806066
[53,] 0.6758846 0.6482308 0.3241154
[54,] 0.6727466 0.6545068 0.3272534
[55,] 0.7031441 0.5937119 0.2968559
[56,] 0.6994779 0.6010443 0.3005221
[57,] 0.6930456 0.6139088 0.3069544
[58,] 0.7025699 0.5948602 0.2974301
[59,] 0.6847598 0.6304805 0.3152402
[60,] 0.6951119 0.6097762 0.3048881
[61,] 0.7040200 0.5919600 0.2959800
[62,] 0.6948895 0.6102211 0.3051105
[63,] 0.7052801 0.5894398 0.2947199
[64,] 0.6975055 0.6049889 0.3024945
[65,] 0.6901062 0.6197876 0.3098938
[66,] 0.7010908 0.5978184 0.2989092
[67,] 0.6944393 0.6111213 0.3055607
[68,] 0.7085485 0.5829030 0.2914515
[69,] 0.6815640 0.6368719 0.3184360
[70,] 0.7398752 0.5202496 0.2601248
[71,] 0.7466380 0.5067240 0.2533620
[72,] 0.7359121 0.5281758 0.2640879
[73,] 0.7498864 0.5002272 0.2501136
[74,] 0.7371933 0.5256134 0.2628067
[75,] 0.7162084 0.5675832 0.2837916
[76,] 0.7124208 0.5751584 0.2875792
[77,] 0.6886005 0.6227991 0.3113995
[78,] 0.7398830 0.5202340 0.2601170
[79,] 0.7952330 0.4095341 0.2047670
[80,] 0.7798796 0.4402408 0.2201204
[81,] 0.8184494 0.3631012 0.1815506
[82,] 0.8204012 0.3591976 0.1795988
[83,] 0.7999369 0.4001263 0.2000631
[84,] 0.7898301 0.4203399 0.2101699
[85,] 0.7699262 0.4601476 0.2300738
[86,] 0.7437931 0.5124138 0.2562069
[87,] 0.7877669 0.4244663 0.2122331
[88,] 0.7587408 0.4825184 0.2412592
[89,] 0.7332296 0.5335408 0.2667704
[90,] 0.6985468 0.6029064 0.3014532
[91,] 0.7550241 0.4899517 0.2449759
[92,] 0.8464158 0.3071683 0.1535842
[93,] 0.8231445 0.3537111 0.1768555
[94,] 0.7972289 0.4055422 0.2027711
[95,] 0.7688666 0.4622669 0.2311334
[96,] 0.7453409 0.5093182 0.2546591
[97,] 0.7132409 0.5735182 0.2867591
[98,] 0.6801518 0.6396963 0.3198482
[99,] 0.6423672 0.7152655 0.3576328
[100,] 0.6077296 0.7845407 0.3922704
[101,] 0.5599145 0.8801710 0.4400855
[102,] 0.5410122 0.9179756 0.4589878
[103,] 0.5007261 0.9985478 0.4992739
[104,] 0.4948348 0.9896696 0.5051652
[105,] 0.4561752 0.9123504 0.5438248
[106,] 0.4088217 0.8176434 0.5911783
[107,] 0.3901290 0.7802579 0.6098710
[108,] 0.4870829 0.9741658 0.5129171
[109,] 0.4328019 0.8656038 0.5671981
[110,] 0.4126244 0.8252489 0.5873756
[111,] 0.4404712 0.8809425 0.5595288
[112,] 0.3849643 0.7699286 0.6150357
[113,] 0.3626209 0.7252419 0.6373791
[114,] 0.3304677 0.6609353 0.6695323
[115,] 0.2852704 0.5705407 0.7147296
[116,] 0.3069347 0.6138694 0.6930653
[117,] 0.2845538 0.5691075 0.7154462
[118,] 0.3513364 0.7026727 0.6486636
[119,] 0.3650533 0.7301065 0.6349467
[120,] 0.3470077 0.6940153 0.6529923
[121,] 0.3696745 0.7393490 0.6303255
[122,] 0.3120203 0.6240405 0.6879797
[123,] 0.4911331 0.9822662 0.5088669
[124,] 0.4246366 0.8492733 0.5753634
[125,] 0.3691041 0.7382083 0.6308959
[126,] 0.3282466 0.6564931 0.6717534
[127,] 0.3194166 0.6388331 0.6805834
[128,] 0.2650564 0.5301127 0.7349436
[129,] 0.3744310 0.7488621 0.6255690
[130,] 0.3188353 0.6376706 0.6811647
[131,] 0.4298198 0.8596396 0.5701802
[132,] 0.3312376 0.6624751 0.6687624
[133,] 0.4174215 0.8348429 0.5825785
[134,] 0.2911477 0.5822953 0.7088523
[135,] 0.3231865 0.6463730 0.6768135
> postscript(file="/var/fisher/rcomp/tmp/1ehqp1355687671.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/2w7i91355687671.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/3b79g1355687671.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/4r3j51355687671.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/5pa4d1355687671.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.6874295 -0.4077904 -0.4071756 -0.4065609 -0.4059462 0.5162595 -0.4047167
8 9 10 11 12 13 14
-0.4033450 0.5965128 -0.3077949 -0.3064232 -0.4016430 -0.6681442 -0.3045789
15 16 17 18 19 20 21
0.3330853 0.3344570 -0.4697917 -0.3021200 0.6026602 0.4369749 -0.4745194
22 23 24 25 26 27 28
0.4324661 0.4316325 0.5273248 0.5134763 -0.6601526 0.7026557 -0.4854365
29 30 31 32 33 34 35
0.6088075 -0.5640644 -0.3899630 -0.2942706 -0.4671426 0.6126382 -0.3875040
36 37 38 39 40 41 42
-0.3868893 -0.5575559 0.5207109 0.4414683 -0.5571600 0.4491274 0.5231699
43 44 45 46 47 48 49
0.5390048 -0.2861368 -0.5548433 0.4457714 -0.3801272 0.6204876 0.4476156
50 51 52 53 54 55 56
-0.3782830 -0.4705405 -0.4482759 0.6235613 -0.3693943 -0.3752093 0.5325332
57 58 59 60 61 62 63
0.3589043 0.6266349 0.6272497 0.5566420 0.7243137 -0.6380220 -0.3702914
64 65 66 67 68 69 70
0.7261579 -0.3690619 -0.3684472 -0.5341324 -0.2721401 0.6333971 -0.4596175
71 72 73 74 75 76 77
-0.3653735 0.6352413 0.5422267 -0.3620809 0.6370855 0.4649705 0.6383150
78 79 80 81 82 83 84
0.3718138 0.6467311 -0.5325705 -0.3592261 0.6428370 -0.3579966 -0.3509522
85 86 87 88 89 90 91
0.4697462 -0.2610748 0.7395399 0.6469039 -0.3543082 0.6463065 -0.5265654
92 93 94 95 96 97 98
-0.2570079 -0.4302583 -0.3512345 -0.3502413 0.6499950 -0.2539342 -0.3487756
99 100 101 102 103 104 105
-0.2530832 0.6524539 0.7481463 -0.3463166 -0.3457019 -0.3450871 -0.4377232
106 107 108 109 110 111 112
-0.3438577 -0.3432429 -0.3408014 -0.3420134 -0.2463211 -0.5124438 -0.3397907
113 114 115 116 117 118 119
-0.4331838 -0.3371129 -0.2432474 -0.3377103 0.7579821 -0.2414032 -0.3358661
120 121 122 123 124 125 126
0.6647487 -0.2395590 -0.3340218 -0.3315803 0.4000917 0.6678224 -0.3311844
127 128 129 130 131 132 133
-0.5044348 0.6696666 -0.3297187 0.6708961 -0.2334116 0.7672031 -0.3258114
134 135 136 137 138 139 140
-0.3266450 -0.3260303 -0.3254155 0.5031609 0.5041541 -0.3231928 -0.3229566
141 142 143 144 145 146 147
0.6840879 0.5850221 -0.2260348 0.5060157 -0.4933695 0.6811103 -0.4119042
148 149 150 151 152 153 154
-0.3176602 -0.2223463 0.5097042 0.6838055 -0.2140724 -0.3869443 -0.3129019
> postscript(file="/var/fisher/rcomp/tmp/6a5y31355687671.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.6874295 NA
1 -0.4077904 0.6874295
2 -0.4071756 -0.4077904
3 -0.4065609 -0.4071756
4 -0.4059462 -0.4065609
5 0.5162595 -0.4059462
6 -0.4047167 0.5162595
7 -0.4033450 -0.4047167
8 0.5965128 -0.4033450
9 -0.3077949 0.5965128
10 -0.3064232 -0.3077949
11 -0.4016430 -0.3064232
12 -0.6681442 -0.4016430
13 -0.3045789 -0.6681442
14 0.3330853 -0.3045789
15 0.3344570 0.3330853
16 -0.4697917 0.3344570
17 -0.3021200 -0.4697917
18 0.6026602 -0.3021200
19 0.4369749 0.6026602
20 -0.4745194 0.4369749
21 0.4324661 -0.4745194
22 0.4316325 0.4324661
23 0.5273248 0.4316325
24 0.5134763 0.5273248
25 -0.6601526 0.5134763
26 0.7026557 -0.6601526
27 -0.4854365 0.7026557
28 0.6088075 -0.4854365
29 -0.5640644 0.6088075
30 -0.3899630 -0.5640644
31 -0.2942706 -0.3899630
32 -0.4671426 -0.2942706
33 0.6126382 -0.4671426
34 -0.3875040 0.6126382
35 -0.3868893 -0.3875040
36 -0.5575559 -0.3868893
37 0.5207109 -0.5575559
38 0.4414683 0.5207109
39 -0.5571600 0.4414683
40 0.4491274 -0.5571600
41 0.5231699 0.4491274
42 0.5390048 0.5231699
43 -0.2861368 0.5390048
44 -0.5548433 -0.2861368
45 0.4457714 -0.5548433
46 -0.3801272 0.4457714
47 0.6204876 -0.3801272
48 0.4476156 0.6204876
49 -0.3782830 0.4476156
50 -0.4705405 -0.3782830
51 -0.4482759 -0.4705405
52 0.6235613 -0.4482759
53 -0.3693943 0.6235613
54 -0.3752093 -0.3693943
55 0.5325332 -0.3752093
56 0.3589043 0.5325332
57 0.6266349 0.3589043
58 0.6272497 0.6266349
59 0.5566420 0.6272497
60 0.7243137 0.5566420
61 -0.6380220 0.7243137
62 -0.3702914 -0.6380220
63 0.7261579 -0.3702914
64 -0.3690619 0.7261579
65 -0.3684472 -0.3690619
66 -0.5341324 -0.3684472
67 -0.2721401 -0.5341324
68 0.6333971 -0.2721401
69 -0.4596175 0.6333971
70 -0.3653735 -0.4596175
71 0.6352413 -0.3653735
72 0.5422267 0.6352413
73 -0.3620809 0.5422267
74 0.6370855 -0.3620809
75 0.4649705 0.6370855
76 0.6383150 0.4649705
77 0.3718138 0.6383150
78 0.6467311 0.3718138
79 -0.5325705 0.6467311
80 -0.3592261 -0.5325705
81 0.6428370 -0.3592261
82 -0.3579966 0.6428370
83 -0.3509522 -0.3579966
84 0.4697462 -0.3509522
85 -0.2610748 0.4697462
86 0.7395399 -0.2610748
87 0.6469039 0.7395399
88 -0.3543082 0.6469039
89 0.6463065 -0.3543082
90 -0.5265654 0.6463065
91 -0.2570079 -0.5265654
92 -0.4302583 -0.2570079
93 -0.3512345 -0.4302583
94 -0.3502413 -0.3512345
95 0.6499950 -0.3502413
96 -0.2539342 0.6499950
97 -0.3487756 -0.2539342
98 -0.2530832 -0.3487756
99 0.6524539 -0.2530832
100 0.7481463 0.6524539
101 -0.3463166 0.7481463
102 -0.3457019 -0.3463166
103 -0.3450871 -0.3457019
104 -0.4377232 -0.3450871
105 -0.3438577 -0.4377232
106 -0.3432429 -0.3438577
107 -0.3408014 -0.3432429
108 -0.3420134 -0.3408014
109 -0.2463211 -0.3420134
110 -0.5124438 -0.2463211
111 -0.3397907 -0.5124438
112 -0.4331838 -0.3397907
113 -0.3371129 -0.4331838
114 -0.2432474 -0.3371129
115 -0.3377103 -0.2432474
116 0.7579821 -0.3377103
117 -0.2414032 0.7579821
118 -0.3358661 -0.2414032
119 0.6647487 -0.3358661
120 -0.2395590 0.6647487
121 -0.3340218 -0.2395590
122 -0.3315803 -0.3340218
123 0.4000917 -0.3315803
124 0.6678224 0.4000917
125 -0.3311844 0.6678224
126 -0.5044348 -0.3311844
127 0.6696666 -0.5044348
128 -0.3297187 0.6696666
129 0.6708961 -0.3297187
130 -0.2334116 0.6708961
131 0.7672031 -0.2334116
132 -0.3258114 0.7672031
133 -0.3266450 -0.3258114
134 -0.3260303 -0.3266450
135 -0.3254155 -0.3260303
136 0.5031609 -0.3254155
137 0.5041541 0.5031609
138 -0.3231928 0.5041541
139 -0.3229566 -0.3231928
140 0.6840879 -0.3229566
141 0.5850221 0.6840879
142 -0.2260348 0.5850221
143 0.5060157 -0.2260348
144 -0.4933695 0.5060157
145 0.6811103 -0.4933695
146 -0.4119042 0.6811103
147 -0.3176602 -0.4119042
148 -0.2223463 -0.3176602
149 0.5097042 -0.2223463
150 0.6838055 0.5097042
151 -0.2140724 0.6838055
152 -0.3869443 -0.2140724
153 -0.3129019 -0.3869443
154 NA -0.3129019
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.4077904 0.6874295
[2,] -0.4071756 -0.4077904
[3,] -0.4065609 -0.4071756
[4,] -0.4059462 -0.4065609
[5,] 0.5162595 -0.4059462
[6,] -0.4047167 0.5162595
[7,] -0.4033450 -0.4047167
[8,] 0.5965128 -0.4033450
[9,] -0.3077949 0.5965128
[10,] -0.3064232 -0.3077949
[11,] -0.4016430 -0.3064232
[12,] -0.6681442 -0.4016430
[13,] -0.3045789 -0.6681442
[14,] 0.3330853 -0.3045789
[15,] 0.3344570 0.3330853
[16,] -0.4697917 0.3344570
[17,] -0.3021200 -0.4697917
[18,] 0.6026602 -0.3021200
[19,] 0.4369749 0.6026602
[20,] -0.4745194 0.4369749
[21,] 0.4324661 -0.4745194
[22,] 0.4316325 0.4324661
[23,] 0.5273248 0.4316325
[24,] 0.5134763 0.5273248
[25,] -0.6601526 0.5134763
[26,] 0.7026557 -0.6601526
[27,] -0.4854365 0.7026557
[28,] 0.6088075 -0.4854365
[29,] -0.5640644 0.6088075
[30,] -0.3899630 -0.5640644
[31,] -0.2942706 -0.3899630
[32,] -0.4671426 -0.2942706
[33,] 0.6126382 -0.4671426
[34,] -0.3875040 0.6126382
[35,] -0.3868893 -0.3875040
[36,] -0.5575559 -0.3868893
[37,] 0.5207109 -0.5575559
[38,] 0.4414683 0.5207109
[39,] -0.5571600 0.4414683
[40,] 0.4491274 -0.5571600
[41,] 0.5231699 0.4491274
[42,] 0.5390048 0.5231699
[43,] -0.2861368 0.5390048
[44,] -0.5548433 -0.2861368
[45,] 0.4457714 -0.5548433
[46,] -0.3801272 0.4457714
[47,] 0.6204876 -0.3801272
[48,] 0.4476156 0.6204876
[49,] -0.3782830 0.4476156
[50,] -0.4705405 -0.3782830
[51,] -0.4482759 -0.4705405
[52,] 0.6235613 -0.4482759
[53,] -0.3693943 0.6235613
[54,] -0.3752093 -0.3693943
[55,] 0.5325332 -0.3752093
[56,] 0.3589043 0.5325332
[57,] 0.6266349 0.3589043
[58,] 0.6272497 0.6266349
[59,] 0.5566420 0.6272497
[60,] 0.7243137 0.5566420
[61,] -0.6380220 0.7243137
[62,] -0.3702914 -0.6380220
[63,] 0.7261579 -0.3702914
[64,] -0.3690619 0.7261579
[65,] -0.3684472 -0.3690619
[66,] -0.5341324 -0.3684472
[67,] -0.2721401 -0.5341324
[68,] 0.6333971 -0.2721401
[69,] -0.4596175 0.6333971
[70,] -0.3653735 -0.4596175
[71,] 0.6352413 -0.3653735
[72,] 0.5422267 0.6352413
[73,] -0.3620809 0.5422267
[74,] 0.6370855 -0.3620809
[75,] 0.4649705 0.6370855
[76,] 0.6383150 0.4649705
[77,] 0.3718138 0.6383150
[78,] 0.6467311 0.3718138
[79,] -0.5325705 0.6467311
[80,] -0.3592261 -0.5325705
[81,] 0.6428370 -0.3592261
[82,] -0.3579966 0.6428370
[83,] -0.3509522 -0.3579966
[84,] 0.4697462 -0.3509522
[85,] -0.2610748 0.4697462
[86,] 0.7395399 -0.2610748
[87,] 0.6469039 0.7395399
[88,] -0.3543082 0.6469039
[89,] 0.6463065 -0.3543082
[90,] -0.5265654 0.6463065
[91,] -0.2570079 -0.5265654
[92,] -0.4302583 -0.2570079
[93,] -0.3512345 -0.4302583
[94,] -0.3502413 -0.3512345
[95,] 0.6499950 -0.3502413
[96,] -0.2539342 0.6499950
[97,] -0.3487756 -0.2539342
[98,] -0.2530832 -0.3487756
[99,] 0.6524539 -0.2530832
[100,] 0.7481463 0.6524539
[101,] -0.3463166 0.7481463
[102,] -0.3457019 -0.3463166
[103,] -0.3450871 -0.3457019
[104,] -0.4377232 -0.3450871
[105,] -0.3438577 -0.4377232
[106,] -0.3432429 -0.3438577
[107,] -0.3408014 -0.3432429
[108,] -0.3420134 -0.3408014
[109,] -0.2463211 -0.3420134
[110,] -0.5124438 -0.2463211
[111,] -0.3397907 -0.5124438
[112,] -0.4331838 -0.3397907
[113,] -0.3371129 -0.4331838
[114,] -0.2432474 -0.3371129
[115,] -0.3377103 -0.2432474
[116,] 0.7579821 -0.3377103
[117,] -0.2414032 0.7579821
[118,] -0.3358661 -0.2414032
[119,] 0.6647487 -0.3358661
[120,] -0.2395590 0.6647487
[121,] -0.3340218 -0.2395590
[122,] -0.3315803 -0.3340218
[123,] 0.4000917 -0.3315803
[124,] 0.6678224 0.4000917
[125,] -0.3311844 0.6678224
[126,] -0.5044348 -0.3311844
[127,] 0.6696666 -0.5044348
[128,] -0.3297187 0.6696666
[129,] 0.6708961 -0.3297187
[130,] -0.2334116 0.6708961
[131,] 0.7672031 -0.2334116
[132,] -0.3258114 0.7672031
[133,] -0.3266450 -0.3258114
[134,] -0.3260303 -0.3266450
[135,] -0.3254155 -0.3260303
[136,] 0.5031609 -0.3254155
[137,] 0.5041541 0.5031609
[138,] -0.3231928 0.5041541
[139,] -0.3229566 -0.3231928
[140,] 0.6840879 -0.3229566
[141,] 0.5850221 0.6840879
[142,] -0.2260348 0.5850221
[143,] 0.5060157 -0.2260348
[144,] -0.4933695 0.5060157
[145,] 0.6811103 -0.4933695
[146,] -0.4119042 0.6811103
[147,] -0.3176602 -0.4119042
[148,] -0.2223463 -0.3176602
[149,] 0.5097042 -0.2223463
[150,] 0.6838055 0.5097042
[151,] -0.2140724 0.6838055
[152,] -0.3869443 -0.2140724
[153,] -0.3129019 -0.3869443
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.4077904 0.6874295
2 -0.4071756 -0.4077904
3 -0.4065609 -0.4071756
4 -0.4059462 -0.4065609
5 0.5162595 -0.4059462
6 -0.4047167 0.5162595
7 -0.4033450 -0.4047167
8 0.5965128 -0.4033450
9 -0.3077949 0.5965128
10 -0.3064232 -0.3077949
11 -0.4016430 -0.3064232
12 -0.6681442 -0.4016430
13 -0.3045789 -0.6681442
14 0.3330853 -0.3045789
15 0.3344570 0.3330853
16 -0.4697917 0.3344570
17 -0.3021200 -0.4697917
18 0.6026602 -0.3021200
19 0.4369749 0.6026602
20 -0.4745194 0.4369749
21 0.4324661 -0.4745194
22 0.4316325 0.4324661
23 0.5273248 0.4316325
24 0.5134763 0.5273248
25 -0.6601526 0.5134763
26 0.7026557 -0.6601526
27 -0.4854365 0.7026557
28 0.6088075 -0.4854365
29 -0.5640644 0.6088075
30 -0.3899630 -0.5640644
31 -0.2942706 -0.3899630
32 -0.4671426 -0.2942706
33 0.6126382 -0.4671426
34 -0.3875040 0.6126382
35 -0.3868893 -0.3875040
36 -0.5575559 -0.3868893
37 0.5207109 -0.5575559
38 0.4414683 0.5207109
39 -0.5571600 0.4414683
40 0.4491274 -0.5571600
41 0.5231699 0.4491274
42 0.5390048 0.5231699
43 -0.2861368 0.5390048
44 -0.5548433 -0.2861368
45 0.4457714 -0.5548433
46 -0.3801272 0.4457714
47 0.6204876 -0.3801272
48 0.4476156 0.6204876
49 -0.3782830 0.4476156
50 -0.4705405 -0.3782830
51 -0.4482759 -0.4705405
52 0.6235613 -0.4482759
53 -0.3693943 0.6235613
54 -0.3752093 -0.3693943
55 0.5325332 -0.3752093
56 0.3589043 0.5325332
57 0.6266349 0.3589043
58 0.6272497 0.6266349
59 0.5566420 0.6272497
60 0.7243137 0.5566420
61 -0.6380220 0.7243137
62 -0.3702914 -0.6380220
63 0.7261579 -0.3702914
64 -0.3690619 0.7261579
65 -0.3684472 -0.3690619
66 -0.5341324 -0.3684472
67 -0.2721401 -0.5341324
68 0.6333971 -0.2721401
69 -0.4596175 0.6333971
70 -0.3653735 -0.4596175
71 0.6352413 -0.3653735
72 0.5422267 0.6352413
73 -0.3620809 0.5422267
74 0.6370855 -0.3620809
75 0.4649705 0.6370855
76 0.6383150 0.4649705
77 0.3718138 0.6383150
78 0.6467311 0.3718138
79 -0.5325705 0.6467311
80 -0.3592261 -0.5325705
81 0.6428370 -0.3592261
82 -0.3579966 0.6428370
83 -0.3509522 -0.3579966
84 0.4697462 -0.3509522
85 -0.2610748 0.4697462
86 0.7395399 -0.2610748
87 0.6469039 0.7395399
88 -0.3543082 0.6469039
89 0.6463065 -0.3543082
90 -0.5265654 0.6463065
91 -0.2570079 -0.5265654
92 -0.4302583 -0.2570079
93 -0.3512345 -0.4302583
94 -0.3502413 -0.3512345
95 0.6499950 -0.3502413
96 -0.2539342 0.6499950
97 -0.3487756 -0.2539342
98 -0.2530832 -0.3487756
99 0.6524539 -0.2530832
100 0.7481463 0.6524539
101 -0.3463166 0.7481463
102 -0.3457019 -0.3463166
103 -0.3450871 -0.3457019
104 -0.4377232 -0.3450871
105 -0.3438577 -0.4377232
106 -0.3432429 -0.3438577
107 -0.3408014 -0.3432429
108 -0.3420134 -0.3408014
109 -0.2463211 -0.3420134
110 -0.5124438 -0.2463211
111 -0.3397907 -0.5124438
112 -0.4331838 -0.3397907
113 -0.3371129 -0.4331838
114 -0.2432474 -0.3371129
115 -0.3377103 -0.2432474
116 0.7579821 -0.3377103
117 -0.2414032 0.7579821
118 -0.3358661 -0.2414032
119 0.6647487 -0.3358661
120 -0.2395590 0.6647487
121 -0.3340218 -0.2395590
122 -0.3315803 -0.3340218
123 0.4000917 -0.3315803
124 0.6678224 0.4000917
125 -0.3311844 0.6678224
126 -0.5044348 -0.3311844
127 0.6696666 -0.5044348
128 -0.3297187 0.6696666
129 0.6708961 -0.3297187
130 -0.2334116 0.6708961
131 0.7672031 -0.2334116
132 -0.3258114 0.7672031
133 -0.3266450 -0.3258114
134 -0.3260303 -0.3266450
135 -0.3254155 -0.3260303
136 0.5031609 -0.3254155
137 0.5041541 0.5031609
138 -0.3231928 0.5041541
139 -0.3229566 -0.3231928
140 0.6840879 -0.3229566
141 0.5850221 0.6840879
142 -0.2260348 0.5850221
143 0.5060157 -0.2260348
144 -0.4933695 0.5060157
145 0.6811103 -0.4933695
146 -0.4119042 0.6811103
147 -0.3176602 -0.4119042
148 -0.2223463 -0.3176602
149 0.5097042 -0.2223463
150 0.6838055 0.5097042
151 -0.2140724 0.6838055
152 -0.3869443 -0.2140724
153 -0.3129019 -0.3869443
> 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/7ard11355687671.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/8tekr1355687671.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/9b5bv1355687671.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/10bs051355687671.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/11tqtm1355687671.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/121gfk1355687671.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/13p4mv1355687672.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/14t7131355687672.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/15zqs21355687672.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/16f2zb1355687672.tab")
+ }
>
> try(system("convert tmp/1ehqp1355687671.ps tmp/1ehqp1355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/2w7i91355687671.ps tmp/2w7i91355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/3b79g1355687671.ps tmp/3b79g1355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/4r3j51355687671.ps tmp/4r3j51355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/5pa4d1355687671.ps tmp/5pa4d1355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/6a5y31355687671.ps tmp/6a5y31355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ard11355687671.ps tmp/7ard11355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/8tekr1355687671.ps tmp/8tekr1355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/9b5bv1355687671.ps tmp/9b5bv1355687671.png",intern=TRUE))
character(0)
> try(system("convert tmp/10bs051355687671.ps tmp/10bs051355687671.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.831 1.649 9.481