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(24
+ ,14
+ ,11
+ ,12
+ ,24
+ ,26
+ ,25
+ ,11
+ ,7
+ ,8
+ ,25
+ ,23
+ ,17
+ ,6
+ ,17
+ ,8
+ ,30
+ ,25
+ ,18
+ ,12
+ ,10
+ ,8
+ ,19
+ ,23
+ ,18
+ ,8
+ ,12
+ ,9
+ ,22
+ ,19
+ ,16
+ ,10
+ ,12
+ ,7
+ ,22
+ ,29
+ ,20
+ ,10
+ ,11
+ ,4
+ ,25
+ ,25
+ ,16
+ ,11
+ ,11
+ ,11
+ ,23
+ ,21
+ ,18
+ ,16
+ ,12
+ ,7
+ ,17
+ ,22
+ ,17
+ ,11
+ ,13
+ ,7
+ ,21
+ ,25
+ ,23
+ ,13
+ ,14
+ ,12
+ ,19
+ ,24
+ ,30
+ ,12
+ ,16
+ ,10
+ ,19
+ ,18
+ ,23
+ ,8
+ ,11
+ ,10
+ ,15
+ ,22
+ ,18
+ ,12
+ ,10
+ ,8
+ ,16
+ ,15
+ ,15
+ ,11
+ ,11
+ ,8
+ ,23
+ ,22
+ ,12
+ ,4
+ ,15
+ ,4
+ ,27
+ ,28
+ ,21
+ ,9
+ ,9
+ ,9
+ ,22
+ ,20
+ ,15
+ ,8
+ ,11
+ ,8
+ ,14
+ ,12
+ ,20
+ ,8
+ ,17
+ ,7
+ ,22
+ ,24
+ ,31
+ ,14
+ ,17
+ ,11
+ ,23
+ ,20
+ ,27
+ ,15
+ ,11
+ ,9
+ ,23
+ ,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:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> par3 <- 'No 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
YT X1 X2 X3 X4 X5\r
1 24 14 11 12 24 26
2 25 11 7 8 25 23
3 17 6 17 8 30 25
4 18 12 10 8 19 23
5 18 8 12 9 22 19
6 16 10 12 7 22 29
7 20 10 11 4 25 25
8 16 11 11 11 23 21
9 18 16 12 7 17 22
10 17 11 13 7 21 25
11 23 13 14 12 19 24
12 30 12 16 10 19 18
13 23 8 11 10 15 22
14 18 12 10 8 16 15
15 15 11 11 8 23 22
16 12 4 15 4 27 28
17 21 9 9 9 22 20
18 15 8 11 8 14 12
19 20 8 17 7 22 24
20 31 14 17 11 23 20
21 27 15 11 9 23 21
22 34 16 18 11 21 20
23 21 9 14 13 19 21
24 31 14 10 8 18 23
25 19 11 11 8 20 28
26 16 8 15 9 23 24
27 20 9 15 6 25 24
28 21 9 13 9 19 24
29 22 9 16 9 24 23
30 17 9 13 6 22 23
31 24 10 9 6 25 29
32 25 16 18 16 26 24
33 26 11 18 5 29 18
34 25 8 12 7 32 25
35 17 9 17 9 25 21
36 32 16 9 6 29 26
37 33 11 9 6 28 22
38 13 16 12 5 17 22
39 32 12 18 12 28 22
40 25 12 12 7 29 23
41 29 14 18 10 26 30
42 22 9 14 9 25 23
43 18 10 15 8 14 17
44 17 9 16 5 25 23
45 20 10 10 8 26 23
46 15 12 11 8 20 25
47 20 14 14 10 18 24
48 33 14 9 6 32 24
49 29 10 12 8 25 23
50 23 14 17 7 25 21
51 26 16 5 4 23 24
52 18 9 12 8 21 24
53 20 10 12 8 20 28
54 11 6 6 4 15 16
55 28 8 24 20 30 20
56 26 13 12 8 24 29
57 22 10 12 8 26 27
58 17 8 14 6 24 22
59 12 7 7 4 22 28
60 14 15 13 8 14 16
61 17 9 12 9 24 25
62 21 10 13 6 24 24
63 19 12 14 7 24 28
64 18 13 8 9 24 24
65 10 10 11 5 19 23
66 29 11 9 5 31 30
67 31 8 11 8 22 24
68 19 9 13 8 27 21
69 9 13 10 6 19 25
70 20 11 11 8 25 25
71 28 8 12 7 20 22
72 19 9 9 7 21 23
73 30 9 15 9 27 26
74 29 15 18 11 23 23
75 26 9 15 6 25 25
76 23 10 12 8 20 21
77 13 14 13 6 21 25
78 21 12 14 9 22 24
79 19 12 10 8 23 29
80 28 11 13 6 25 22
81 23 14 13 10 25 27
82 18 6 11 8 17 26
83 21 12 13 8 19 22
84 20 8 16 10 25 24
85 23 14 8 5 19 27
86 21 11 16 7 20 24
87 21 10 11 5 26 24
88 15 14 9 8 23 29
89 28 12 16 14 27 22
90 19 10 12 7 17 21
91 26 14 14 8 17 24
92 10 5 8 6 19 24
93 16 11 9 5 17 23
94 22 10 15 6 22 20
95 19 9 11 10 21 27
96 31 10 21 12 32 26
97 31 16 14 9 21 25
98 29 13 18 12 21 21
99 19 9 12 7 18 21
100 22 10 13 8 18 19
101 23 10 15 10 23 21
102 15 7 12 6 19 21
103 20 9 19 10 20 16
104 18 8 15 10 21 22
105 23 14 11 10 20 29
106 25 14 11 5 17 15
107 21 8 10 7 18 17
108 24 9 13 10 19 15
109 25 14 15 11 22 21
110 17 14 12 6 15 21
111 13 8 12 7 14 19
112 28 8 16 12 18 24
113 21 8 9 11 24 20
114 25 7 18 11 35 17
115 9 6 8 11 29 23
116 16 8 13 5 21 24
117 19 6 17 8 25 14
118 17 11 9 6 20 19
119 25 14 15 9 22 24
120 20 11 8 4 13 13
121 29 11 7 4 26 22
122 14 11 12 7 17 16
123 22 14 14 11 25 19
124 15 8 6 6 20 25
125 19 20 8 7 19 25
126 20 11 17 8 21 23
127 15 8 10 4 22 24
128 20 11 11 8 24 26
129 18 10 14 9 21 26
130 33 14 11 8 26 25
131 22 11 13 11 24 18
132 16 9 12 8 16 21
133 17 9 11 5 23 26
134 16 8 9 4 18 23
135 21 10 12 8 16 23
136 26 13 20 10 26 22
137 18 13 12 6 19 20
138 18 12 13 9 21 13
139 17 8 12 9 21 24
140 22 13 12 13 22 15
141 30 14 9 9 23 14
142 30 12 15 10 29 22
143 24 14 24 20 21 10
144 21 15 7 5 21 24
145 21 13 17 11 23 22
146 29 16 11 6 27 24
147 31 9 17 9 25 19
148 20 9 11 7 21 20
149 16 9 12 9 10 13
150 22 8 14 10 20 20
151 20 7 11 9 26 22
152 28 16 16 8 24 24
153 38 11 21 7 29 29
154 22 9 14 6 19 12
155 20 11 20 13 24 20
156 17 9 13 6 19 21
157 28 14 11 8 24 24
158 22 13 15 10 22 22
159 31 16 19 16 17 20
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X1 X2 X3 X4 `X5\\r`
-1.9716 0.8101 0.2513 0.1885 0.5661 -0.1157
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.7273 -2.4896 -0.3354 2.7482 12.5424
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.97156 3.05291 -0.646 0.5194
X1 0.81012 0.13033 6.216 4.63e-09 ***
X2 0.25125 0.13276 1.893 0.0603 .
X3 0.18852 0.16826 1.120 0.2643
X4 0.56606 0.09581 5.908 2.17e-08 ***
`X5\\r` -0.11572 0.10302 -1.123 0.2631
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.478 on 153 degrees of freedom
Multiple R-squared: 0.4072, Adjusted R-squared: 0.3878
F-statistic: 21.02 on 5 and 153 DF, p-value: 5.863e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.21139602 0.42279205 0.78860398
[2,] 0.10207638 0.20415275 0.89792362
[3,] 0.22723804 0.45447608 0.77276196
[4,] 0.65168824 0.69662353 0.34831176
[5,] 0.66730723 0.66538553 0.33269277
[6,] 0.64201541 0.71596917 0.35798459
[7,] 0.64742133 0.70515734 0.35257867
[8,] 0.58200717 0.83598566 0.41799283
[9,] 0.49744168 0.99488336 0.50255832
[10,] 0.46685372 0.93370744 0.53314628
[11,] 0.40318516 0.80637032 0.59681484
[12,] 0.43760922 0.87521843 0.56239078
[13,] 0.39690153 0.79380305 0.60309847
[14,] 0.40077797 0.80155594 0.59922203
[15,] 0.33876995 0.67753990 0.66123005
[16,] 0.60334157 0.79331686 0.39665843
[17,] 0.53355120 0.93289760 0.46644880
[18,] 0.50354402 0.99291195 0.49645598
[19,] 0.44173100 0.88346200 0.55826900
[20,] 0.39518317 0.79036634 0.60481683
[21,] 0.33497752 0.66995504 0.66502248
[22,] 0.28291897 0.56583794 0.71708103
[23,] 0.34290182 0.68580363 0.65709818
[24,] 0.40423207 0.80846414 0.59576793
[25,] 0.36039888 0.72079776 0.63960112
[26,] 0.37063137 0.74126275 0.62936863
[27,] 0.38530715 0.77061431 0.61469285
[28,] 0.37594970 0.75189940 0.62405030
[29,] 0.55498970 0.89002059 0.44501030
[30,] 0.75846575 0.48306851 0.24153425
[31,] 0.75451794 0.49096412 0.24548206
[32,] 0.71262005 0.57475991 0.28737995
[33,] 0.68761372 0.62477255 0.31238628
[34,] 0.63817358 0.72365284 0.36182642
[35,] 0.58957534 0.82084931 0.41042466
[36,] 0.57618727 0.84762547 0.42381273
[37,] 0.54173755 0.91652491 0.45826245
[38,] 0.56383049 0.87233902 0.43616951
[39,] 0.52281043 0.95437914 0.47718957
[40,] 0.51322634 0.97354733 0.48677366
[41,] 0.57811910 0.84376180 0.42188090
[42,] 0.55720457 0.88559087 0.44279543
[43,] 0.52183261 0.95633478 0.47816739
[44,] 0.47251870 0.94503740 0.52748130
[45,] 0.43438802 0.86877605 0.56561198
[46,] 0.38759744 0.77519488 0.61240256
[47,] 0.34479943 0.68959887 0.65520057
[48,] 0.31767947 0.63535895 0.68232053
[49,] 0.27475216 0.54950432 0.72524784
[50,] 0.25110592 0.50221185 0.74889408
[51,] 0.23143432 0.46286864 0.76856568
[52,] 0.29014408 0.58028816 0.70985592
[53,] 0.27849719 0.55699437 0.72150281
[54,] 0.24124896 0.48249792 0.75875104
[55,] 0.22867512 0.45735025 0.77132488
[56,] 0.26253626 0.52507253 0.73746374
[57,] 0.33883841 0.67767683 0.66116159
[58,] 0.34155928 0.68311856 0.65844072
[59,] 0.67452622 0.65094756 0.32547378
[60,] 0.66729815 0.66540370 0.33270185
[61,] 0.84420684 0.31158632 0.15579316
[62,] 0.82447819 0.35104362 0.17552181
[63,] 0.93052850 0.13894300 0.06947150
[64,] 0.91423753 0.17152494 0.08576247
[65,] 0.93742258 0.12515485 0.06257742
[66,] 0.92557432 0.14885136 0.07442568
[67,] 0.92732204 0.14535591 0.07267796
[68,] 0.92100240 0.15799519 0.07899760
[69,] 0.97009612 0.05980775 0.02990388
[70,] 0.96273712 0.07452575 0.03726288
[71,] 0.95532211 0.08935577 0.04467789
[72,] 0.95800107 0.08399786 0.04199893
[73,] 0.95032724 0.09934552 0.04967276
[74,] 0.95000977 0.09998046 0.04999023
[75,] 0.93718938 0.12562125 0.06281062
[76,] 0.92442952 0.15114097 0.07557048
[77,] 0.91595167 0.16809665 0.08404833
[78,] 0.90065318 0.19869364 0.09934682
[79,] 0.87971004 0.24057992 0.12028996
[80,] 0.92372740 0.15254520 0.07627260
[81,] 0.90779495 0.18441010 0.09220505
[82,] 0.88852103 0.22295794 0.11147897
[83,] 0.89034851 0.21930298 0.10965149
[84,] 0.87972329 0.24055341 0.12027671
[85,] 0.85848639 0.28302722 0.14151361
[86,] 0.83180233 0.33639533 0.16819767
[87,] 0.79989174 0.40021652 0.20010826
[88,] 0.77136359 0.45727282 0.22863641
[89,] 0.79044571 0.41910859 0.20955429
[90,] 0.78525342 0.42949317 0.21474658
[91,] 0.75131570 0.49736860 0.24868430
[92,] 0.72777236 0.54445529 0.27222764
[93,] 0.68641586 0.62716827 0.31358414
[94,] 0.64866958 0.70266083 0.35133042
[95,] 0.61068874 0.77862253 0.38931126
[96,] 0.56891251 0.86217497 0.43108749
[97,] 0.52334826 0.95330348 0.47665174
[98,] 0.50374480 0.99251039 0.49625520
[99,] 0.50060150 0.99879701 0.49939850
[100,] 0.51206689 0.97586622 0.48793311
[101,] 0.46197061 0.92394121 0.53802939
[102,] 0.43887195 0.87774391 0.56112805
[103,] 0.39924511 0.79849022 0.60075489
[104,] 0.62246400 0.75507199 0.37753600
[105,] 0.61435043 0.77129914 0.38564957
[106,] 0.58601223 0.82797553 0.41398777
[107,] 0.78799506 0.42400989 0.21200494
[108,] 0.76600284 0.46799432 0.23399716
[109,] 0.75505328 0.48989343 0.24494672
[110,] 0.72831003 0.54337994 0.27168997
[111,] 0.68052172 0.63895655 0.31947828
[112,] 0.68982169 0.62035663 0.31017831
[113,] 0.74125046 0.51749909 0.25874954
[114,] 0.74631109 0.50737782 0.25368891
[115,] 0.75206646 0.49586709 0.24793354
[116,] 0.70272287 0.59455427 0.29727713
[117,] 0.74667194 0.50665613 0.25332806
[118,] 0.71971018 0.56057965 0.28028982
[119,] 0.70972070 0.58055860 0.29027930
[120,] 0.67602968 0.64794064 0.32397032
[121,] 0.65088096 0.69823809 0.34911904
[122,] 0.72046223 0.55907554 0.27953777
[123,] 0.66698606 0.66602789 0.33301394
[124,] 0.60623021 0.78753957 0.39376979
[125,] 0.60589517 0.78820965 0.39410483
[126,] 0.54696478 0.90607044 0.45303522
[127,] 0.50621248 0.98757504 0.49378752
[128,] 0.47886978 0.95773956 0.52113022
[129,] 0.48514335 0.97028670 0.51485665
[130,] 0.52873349 0.94253303 0.47126651
[131,] 0.46164830 0.92329660 0.53835170
[132,] 0.38750892 0.77501784 0.61249108
[133,] 0.50039899 0.99920202 0.49960101
[134,] 0.44773143 0.89546286 0.55226857
[135,] 0.37798976 0.75597952 0.62201024
[136,] 0.29800985 0.59601969 0.70199015
[137,] 0.35526328 0.71052655 0.64473672
[138,] 0.26295088 0.52590175 0.73704912
[139,] 0.34057334 0.68114667 0.65942666
[140,] 0.23492127 0.46984254 0.76507873
[141,] 0.14607797 0.29215595 0.85392203
[142,] 0.09191941 0.18383883 0.90808059
> postscript(file="/var/fisher/rcomp/tmp/1b7141353332309.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/2b14x1353332309.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/3wqnn1353332309.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/4cjwg1353332309.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/5em761353332309.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 = 159
Frequency = 1
1 2 3 4 5 6
-0.97306965 3.30317248 -5.75762753 -1.86432396 -1.47592131 -3.56194532
7 8 9 10 11 12
-0.90620471 -6.36670620 -4.40239954 -3.52013359 0.68218064 7.67252311
13 14 15 16 17 18
7.89642341 -1.09187945 -6.68543104 -5.83544542 1.58343372 -0.31766159
19 20 21 22 23 24
0.22344200 4.57967991 1.76983335 6.84030690 1.38700368 10.08149182
25 26 27 28 29 30
-0.29292415 -4.21715322 -1.59385095 2.73948872 0.03968511 -2.50886805
31 32 33 34 35 36
3.68213985 -5.46973622 -0.73791368 0.93478062 -6.00907079 4.20997728
37 38 39 40 41 42
9.36378971 -9.02536193 4.16126995 -0.83896049 1.97593809 -0.02387250
43 44 45 46 47 48
0.63566868 -4.77230448 -2.20652862 -5.45020489 -2.18484145 4.90059439
49 50 51 52 53 54
6.85702899 -3.68265576 2.75698069 -0.95286850 1.26594676 -0.79025918
55 56 57 58 59 60
-0.97747114 2.68703270 -0.24616086 -3.19784550 -3.42546609 -7.02816544
61 62 63 64 65 66
-3.72386300 -0.33540345 -3.93254992 -5.07506540 -7.92977211 4.77986400
67 68 69 70 71 72
12.54244481 -3.94766720 -11.06597338 -2.47040444 10.38040215 0.87369237
73 74 75 76 77 78
6.93990050 1.86545801 4.52186780 3.45591557 -9.76198833 -1.64033287
79 80 81 82 83 84
-2.43427076 5.05696974 -2.54888532 4.22445539 0.26619649 -1.78905525
85 86 87 88 89 90
3.04636559 0.17645168 -0.77650707 -7.80326620 0.85280436 1.34262882
91 92 93 94 95 96
4.75826097 -3.19818879 -1.10525980 0.83134401 0.26850372 2.22637389
97 98 99 100 101 102
5.80095262 4.19788038 1.58668852 3.10535412 0.62692272 -1.17060845
103 104 105 106 107 108
-1.44836644 -1.50497988 1.01538343 4.03610951 4.43644527 4.50950124
109 110 111 112 113 114
-0.23602934 -2.57722082 -1.57036519 9.79636083 0.88439100 -3.14063607
115 116 117 118 119 120
-11.72727421 -1.82844117 -2.20020963 -2.45484801 0.48816450 4.44158444
121 122 123 124 125 126
7.37546414 -5.04608941 -4.91440766 -0.57640121 -6.42285660 -1.94510428
127 128 129 130 131 132
-2.45222637 -1.78862089 -2.22258154 7.53315720 -1.78243444 -0.46970066
133 134 135 136 137 138
-2.03675063 0.94756774 3.95161231 -1.64219453 -3.14707429 -5.09592061
139 140 141 142 143 144
-1.33126279 -2.74349408 5.27243388 2.72600355 -5.90082233 -0.99179118
145 146 147 148 149 150
-4.37875809 1.60816222 7.75949173 1.02402894 1.81241949 3.08090105
151 152 153 154 155 156
-0.33164622 0.67305104 11.40419406 2.66516664 -5.68680977 -1.04211109
157 158 159
3.54956808 -2.12166727 4.91071853
> postscript(file="/var/fisher/rcomp/tmp/60px91353332309.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 = 159
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.97306965 NA
1 3.30317248 -0.97306965
2 -5.75762753 3.30317248
3 -1.86432396 -5.75762753
4 -1.47592131 -1.86432396
5 -3.56194532 -1.47592131
6 -0.90620471 -3.56194532
7 -6.36670620 -0.90620471
8 -4.40239954 -6.36670620
9 -3.52013359 -4.40239954
10 0.68218064 -3.52013359
11 7.67252311 0.68218064
12 7.89642341 7.67252311
13 -1.09187945 7.89642341
14 -6.68543104 -1.09187945
15 -5.83544542 -6.68543104
16 1.58343372 -5.83544542
17 -0.31766159 1.58343372
18 0.22344200 -0.31766159
19 4.57967991 0.22344200
20 1.76983335 4.57967991
21 6.84030690 1.76983335
22 1.38700368 6.84030690
23 10.08149182 1.38700368
24 -0.29292415 10.08149182
25 -4.21715322 -0.29292415
26 -1.59385095 -4.21715322
27 2.73948872 -1.59385095
28 0.03968511 2.73948872
29 -2.50886805 0.03968511
30 3.68213985 -2.50886805
31 -5.46973622 3.68213985
32 -0.73791368 -5.46973622
33 0.93478062 -0.73791368
34 -6.00907079 0.93478062
35 4.20997728 -6.00907079
36 9.36378971 4.20997728
37 -9.02536193 9.36378971
38 4.16126995 -9.02536193
39 -0.83896049 4.16126995
40 1.97593809 -0.83896049
41 -0.02387250 1.97593809
42 0.63566868 -0.02387250
43 -4.77230448 0.63566868
44 -2.20652862 -4.77230448
45 -5.45020489 -2.20652862
46 -2.18484145 -5.45020489
47 4.90059439 -2.18484145
48 6.85702899 4.90059439
49 -3.68265576 6.85702899
50 2.75698069 -3.68265576
51 -0.95286850 2.75698069
52 1.26594676 -0.95286850
53 -0.79025918 1.26594676
54 -0.97747114 -0.79025918
55 2.68703270 -0.97747114
56 -0.24616086 2.68703270
57 -3.19784550 -0.24616086
58 -3.42546609 -3.19784550
59 -7.02816544 -3.42546609
60 -3.72386300 -7.02816544
61 -0.33540345 -3.72386300
62 -3.93254992 -0.33540345
63 -5.07506540 -3.93254992
64 -7.92977211 -5.07506540
65 4.77986400 -7.92977211
66 12.54244481 4.77986400
67 -3.94766720 12.54244481
68 -11.06597338 -3.94766720
69 -2.47040444 -11.06597338
70 10.38040215 -2.47040444
71 0.87369237 10.38040215
72 6.93990050 0.87369237
73 1.86545801 6.93990050
74 4.52186780 1.86545801
75 3.45591557 4.52186780
76 -9.76198833 3.45591557
77 -1.64033287 -9.76198833
78 -2.43427076 -1.64033287
79 5.05696974 -2.43427076
80 -2.54888532 5.05696974
81 4.22445539 -2.54888532
82 0.26619649 4.22445539
83 -1.78905525 0.26619649
84 3.04636559 -1.78905525
85 0.17645168 3.04636559
86 -0.77650707 0.17645168
87 -7.80326620 -0.77650707
88 0.85280436 -7.80326620
89 1.34262882 0.85280436
90 4.75826097 1.34262882
91 -3.19818879 4.75826097
92 -1.10525980 -3.19818879
93 0.83134401 -1.10525980
94 0.26850372 0.83134401
95 2.22637389 0.26850372
96 5.80095262 2.22637389
97 4.19788038 5.80095262
98 1.58668852 4.19788038
99 3.10535412 1.58668852
100 0.62692272 3.10535412
101 -1.17060845 0.62692272
102 -1.44836644 -1.17060845
103 -1.50497988 -1.44836644
104 1.01538343 -1.50497988
105 4.03610951 1.01538343
106 4.43644527 4.03610951
107 4.50950124 4.43644527
108 -0.23602934 4.50950124
109 -2.57722082 -0.23602934
110 -1.57036519 -2.57722082
111 9.79636083 -1.57036519
112 0.88439100 9.79636083
113 -3.14063607 0.88439100
114 -11.72727421 -3.14063607
115 -1.82844117 -11.72727421
116 -2.20020963 -1.82844117
117 -2.45484801 -2.20020963
118 0.48816450 -2.45484801
119 4.44158444 0.48816450
120 7.37546414 4.44158444
121 -5.04608941 7.37546414
122 -4.91440766 -5.04608941
123 -0.57640121 -4.91440766
124 -6.42285660 -0.57640121
125 -1.94510428 -6.42285660
126 -2.45222637 -1.94510428
127 -1.78862089 -2.45222637
128 -2.22258154 -1.78862089
129 7.53315720 -2.22258154
130 -1.78243444 7.53315720
131 -0.46970066 -1.78243444
132 -2.03675063 -0.46970066
133 0.94756774 -2.03675063
134 3.95161231 0.94756774
135 -1.64219453 3.95161231
136 -3.14707429 -1.64219453
137 -5.09592061 -3.14707429
138 -1.33126279 -5.09592061
139 -2.74349408 -1.33126279
140 5.27243388 -2.74349408
141 2.72600355 5.27243388
142 -5.90082233 2.72600355
143 -0.99179118 -5.90082233
144 -4.37875809 -0.99179118
145 1.60816222 -4.37875809
146 7.75949173 1.60816222
147 1.02402894 7.75949173
148 1.81241949 1.02402894
149 3.08090105 1.81241949
150 -0.33164622 3.08090105
151 0.67305104 -0.33164622
152 11.40419406 0.67305104
153 2.66516664 11.40419406
154 -5.68680977 2.66516664
155 -1.04211109 -5.68680977
156 3.54956808 -1.04211109
157 -2.12166727 3.54956808
158 4.91071853 -2.12166727
159 NA 4.91071853
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.30317248 -0.97306965
[2,] -5.75762753 3.30317248
[3,] -1.86432396 -5.75762753
[4,] -1.47592131 -1.86432396
[5,] -3.56194532 -1.47592131
[6,] -0.90620471 -3.56194532
[7,] -6.36670620 -0.90620471
[8,] -4.40239954 -6.36670620
[9,] -3.52013359 -4.40239954
[10,] 0.68218064 -3.52013359
[11,] 7.67252311 0.68218064
[12,] 7.89642341 7.67252311
[13,] -1.09187945 7.89642341
[14,] -6.68543104 -1.09187945
[15,] -5.83544542 -6.68543104
[16,] 1.58343372 -5.83544542
[17,] -0.31766159 1.58343372
[18,] 0.22344200 -0.31766159
[19,] 4.57967991 0.22344200
[20,] 1.76983335 4.57967991
[21,] 6.84030690 1.76983335
[22,] 1.38700368 6.84030690
[23,] 10.08149182 1.38700368
[24,] -0.29292415 10.08149182
[25,] -4.21715322 -0.29292415
[26,] -1.59385095 -4.21715322
[27,] 2.73948872 -1.59385095
[28,] 0.03968511 2.73948872
[29,] -2.50886805 0.03968511
[30,] 3.68213985 -2.50886805
[31,] -5.46973622 3.68213985
[32,] -0.73791368 -5.46973622
[33,] 0.93478062 -0.73791368
[34,] -6.00907079 0.93478062
[35,] 4.20997728 -6.00907079
[36,] 9.36378971 4.20997728
[37,] -9.02536193 9.36378971
[38,] 4.16126995 -9.02536193
[39,] -0.83896049 4.16126995
[40,] 1.97593809 -0.83896049
[41,] -0.02387250 1.97593809
[42,] 0.63566868 -0.02387250
[43,] -4.77230448 0.63566868
[44,] -2.20652862 -4.77230448
[45,] -5.45020489 -2.20652862
[46,] -2.18484145 -5.45020489
[47,] 4.90059439 -2.18484145
[48,] 6.85702899 4.90059439
[49,] -3.68265576 6.85702899
[50,] 2.75698069 -3.68265576
[51,] -0.95286850 2.75698069
[52,] 1.26594676 -0.95286850
[53,] -0.79025918 1.26594676
[54,] -0.97747114 -0.79025918
[55,] 2.68703270 -0.97747114
[56,] -0.24616086 2.68703270
[57,] -3.19784550 -0.24616086
[58,] -3.42546609 -3.19784550
[59,] -7.02816544 -3.42546609
[60,] -3.72386300 -7.02816544
[61,] -0.33540345 -3.72386300
[62,] -3.93254992 -0.33540345
[63,] -5.07506540 -3.93254992
[64,] -7.92977211 -5.07506540
[65,] 4.77986400 -7.92977211
[66,] 12.54244481 4.77986400
[67,] -3.94766720 12.54244481
[68,] -11.06597338 -3.94766720
[69,] -2.47040444 -11.06597338
[70,] 10.38040215 -2.47040444
[71,] 0.87369237 10.38040215
[72,] 6.93990050 0.87369237
[73,] 1.86545801 6.93990050
[74,] 4.52186780 1.86545801
[75,] 3.45591557 4.52186780
[76,] -9.76198833 3.45591557
[77,] -1.64033287 -9.76198833
[78,] -2.43427076 -1.64033287
[79,] 5.05696974 -2.43427076
[80,] -2.54888532 5.05696974
[81,] 4.22445539 -2.54888532
[82,] 0.26619649 4.22445539
[83,] -1.78905525 0.26619649
[84,] 3.04636559 -1.78905525
[85,] 0.17645168 3.04636559
[86,] -0.77650707 0.17645168
[87,] -7.80326620 -0.77650707
[88,] 0.85280436 -7.80326620
[89,] 1.34262882 0.85280436
[90,] 4.75826097 1.34262882
[91,] -3.19818879 4.75826097
[92,] -1.10525980 -3.19818879
[93,] 0.83134401 -1.10525980
[94,] 0.26850372 0.83134401
[95,] 2.22637389 0.26850372
[96,] 5.80095262 2.22637389
[97,] 4.19788038 5.80095262
[98,] 1.58668852 4.19788038
[99,] 3.10535412 1.58668852
[100,] 0.62692272 3.10535412
[101,] -1.17060845 0.62692272
[102,] -1.44836644 -1.17060845
[103,] -1.50497988 -1.44836644
[104,] 1.01538343 -1.50497988
[105,] 4.03610951 1.01538343
[106,] 4.43644527 4.03610951
[107,] 4.50950124 4.43644527
[108,] -0.23602934 4.50950124
[109,] -2.57722082 -0.23602934
[110,] -1.57036519 -2.57722082
[111,] 9.79636083 -1.57036519
[112,] 0.88439100 9.79636083
[113,] -3.14063607 0.88439100
[114,] -11.72727421 -3.14063607
[115,] -1.82844117 -11.72727421
[116,] -2.20020963 -1.82844117
[117,] -2.45484801 -2.20020963
[118,] 0.48816450 -2.45484801
[119,] 4.44158444 0.48816450
[120,] 7.37546414 4.44158444
[121,] -5.04608941 7.37546414
[122,] -4.91440766 -5.04608941
[123,] -0.57640121 -4.91440766
[124,] -6.42285660 -0.57640121
[125,] -1.94510428 -6.42285660
[126,] -2.45222637 -1.94510428
[127,] -1.78862089 -2.45222637
[128,] -2.22258154 -1.78862089
[129,] 7.53315720 -2.22258154
[130,] -1.78243444 7.53315720
[131,] -0.46970066 -1.78243444
[132,] -2.03675063 -0.46970066
[133,] 0.94756774 -2.03675063
[134,] 3.95161231 0.94756774
[135,] -1.64219453 3.95161231
[136,] -3.14707429 -1.64219453
[137,] -5.09592061 -3.14707429
[138,] -1.33126279 -5.09592061
[139,] -2.74349408 -1.33126279
[140,] 5.27243388 -2.74349408
[141,] 2.72600355 5.27243388
[142,] -5.90082233 2.72600355
[143,] -0.99179118 -5.90082233
[144,] -4.37875809 -0.99179118
[145,] 1.60816222 -4.37875809
[146,] 7.75949173 1.60816222
[147,] 1.02402894 7.75949173
[148,] 1.81241949 1.02402894
[149,] 3.08090105 1.81241949
[150,] -0.33164622 3.08090105
[151,] 0.67305104 -0.33164622
[152,] 11.40419406 0.67305104
[153,] 2.66516664 11.40419406
[154,] -5.68680977 2.66516664
[155,] -1.04211109 -5.68680977
[156,] 3.54956808 -1.04211109
[157,] -2.12166727 3.54956808
[158,] 4.91071853 -2.12166727
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.30317248 -0.97306965
2 -5.75762753 3.30317248
3 -1.86432396 -5.75762753
4 -1.47592131 -1.86432396
5 -3.56194532 -1.47592131
6 -0.90620471 -3.56194532
7 -6.36670620 -0.90620471
8 -4.40239954 -6.36670620
9 -3.52013359 -4.40239954
10 0.68218064 -3.52013359
11 7.67252311 0.68218064
12 7.89642341 7.67252311
13 -1.09187945 7.89642341
14 -6.68543104 -1.09187945
15 -5.83544542 -6.68543104
16 1.58343372 -5.83544542
17 -0.31766159 1.58343372
18 0.22344200 -0.31766159
19 4.57967991 0.22344200
20 1.76983335 4.57967991
21 6.84030690 1.76983335
22 1.38700368 6.84030690
23 10.08149182 1.38700368
24 -0.29292415 10.08149182
25 -4.21715322 -0.29292415
26 -1.59385095 -4.21715322
27 2.73948872 -1.59385095
28 0.03968511 2.73948872
29 -2.50886805 0.03968511
30 3.68213985 -2.50886805
31 -5.46973622 3.68213985
32 -0.73791368 -5.46973622
33 0.93478062 -0.73791368
34 -6.00907079 0.93478062
35 4.20997728 -6.00907079
36 9.36378971 4.20997728
37 -9.02536193 9.36378971
38 4.16126995 -9.02536193
39 -0.83896049 4.16126995
40 1.97593809 -0.83896049
41 -0.02387250 1.97593809
42 0.63566868 -0.02387250
43 -4.77230448 0.63566868
44 -2.20652862 -4.77230448
45 -5.45020489 -2.20652862
46 -2.18484145 -5.45020489
47 4.90059439 -2.18484145
48 6.85702899 4.90059439
49 -3.68265576 6.85702899
50 2.75698069 -3.68265576
51 -0.95286850 2.75698069
52 1.26594676 -0.95286850
53 -0.79025918 1.26594676
54 -0.97747114 -0.79025918
55 2.68703270 -0.97747114
56 -0.24616086 2.68703270
57 -3.19784550 -0.24616086
58 -3.42546609 -3.19784550
59 -7.02816544 -3.42546609
60 -3.72386300 -7.02816544
61 -0.33540345 -3.72386300
62 -3.93254992 -0.33540345
63 -5.07506540 -3.93254992
64 -7.92977211 -5.07506540
65 4.77986400 -7.92977211
66 12.54244481 4.77986400
67 -3.94766720 12.54244481
68 -11.06597338 -3.94766720
69 -2.47040444 -11.06597338
70 10.38040215 -2.47040444
71 0.87369237 10.38040215
72 6.93990050 0.87369237
73 1.86545801 6.93990050
74 4.52186780 1.86545801
75 3.45591557 4.52186780
76 -9.76198833 3.45591557
77 -1.64033287 -9.76198833
78 -2.43427076 -1.64033287
79 5.05696974 -2.43427076
80 -2.54888532 5.05696974
81 4.22445539 -2.54888532
82 0.26619649 4.22445539
83 -1.78905525 0.26619649
84 3.04636559 -1.78905525
85 0.17645168 3.04636559
86 -0.77650707 0.17645168
87 -7.80326620 -0.77650707
88 0.85280436 -7.80326620
89 1.34262882 0.85280436
90 4.75826097 1.34262882
91 -3.19818879 4.75826097
92 -1.10525980 -3.19818879
93 0.83134401 -1.10525980
94 0.26850372 0.83134401
95 2.22637389 0.26850372
96 5.80095262 2.22637389
97 4.19788038 5.80095262
98 1.58668852 4.19788038
99 3.10535412 1.58668852
100 0.62692272 3.10535412
101 -1.17060845 0.62692272
102 -1.44836644 -1.17060845
103 -1.50497988 -1.44836644
104 1.01538343 -1.50497988
105 4.03610951 1.01538343
106 4.43644527 4.03610951
107 4.50950124 4.43644527
108 -0.23602934 4.50950124
109 -2.57722082 -0.23602934
110 -1.57036519 -2.57722082
111 9.79636083 -1.57036519
112 0.88439100 9.79636083
113 -3.14063607 0.88439100
114 -11.72727421 -3.14063607
115 -1.82844117 -11.72727421
116 -2.20020963 -1.82844117
117 -2.45484801 -2.20020963
118 0.48816450 -2.45484801
119 4.44158444 0.48816450
120 7.37546414 4.44158444
121 -5.04608941 7.37546414
122 -4.91440766 -5.04608941
123 -0.57640121 -4.91440766
124 -6.42285660 -0.57640121
125 -1.94510428 -6.42285660
126 -2.45222637 -1.94510428
127 -1.78862089 -2.45222637
128 -2.22258154 -1.78862089
129 7.53315720 -2.22258154
130 -1.78243444 7.53315720
131 -0.46970066 -1.78243444
132 -2.03675063 -0.46970066
133 0.94756774 -2.03675063
134 3.95161231 0.94756774
135 -1.64219453 3.95161231
136 -3.14707429 -1.64219453
137 -5.09592061 -3.14707429
138 -1.33126279 -5.09592061
139 -2.74349408 -1.33126279
140 5.27243388 -2.74349408
141 2.72600355 5.27243388
142 -5.90082233 2.72600355
143 -0.99179118 -5.90082233
144 -4.37875809 -0.99179118
145 1.60816222 -4.37875809
146 7.75949173 1.60816222
147 1.02402894 7.75949173
148 1.81241949 1.02402894
149 3.08090105 1.81241949
150 -0.33164622 3.08090105
151 0.67305104 -0.33164622
152 11.40419406 0.67305104
153 2.66516664 11.40419406
154 -5.68680977 2.66516664
155 -1.04211109 -5.68680977
156 3.54956808 -1.04211109
157 -2.12166727 3.54956808
158 4.91071853 -2.12166727
> 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/72zfs1353332309.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/8jon71353332309.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/93pvb1353332309.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/10q8ae1353332309.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/11ywdj1353332309.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/12yo4k1353332309.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/13680i1353332309.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/14u8ym1353332309.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/15jzkn1353332309.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/16ugo51353332309.tab")
+ }
>
> try(system("convert tmp/1b7141353332309.ps tmp/1b7141353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/2b14x1353332309.ps tmp/2b14x1353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/3wqnn1353332309.ps tmp/3wqnn1353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/4cjwg1353332309.ps tmp/4cjwg1353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/5em761353332309.ps tmp/5em761353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/60px91353332309.ps tmp/60px91353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/72zfs1353332309.ps tmp/72zfs1353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/8jon71353332309.ps tmp/8jon71353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/93pvb1353332309.ps tmp/93pvb1353332309.png",intern=TRUE))
character(0)
> try(system("convert tmp/10q8ae1353332309.ps tmp/10q8ae1353332309.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.888 1.402 9.290