R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
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(7
+ ,41
+ ,38
+ ,14
+ ,12
+ ,3
+ ,5
+ ,39
+ ,32
+ ,18
+ ,11
+ ,5
+ ,5
+ ,30
+ ,35
+ ,11
+ ,14
+ ,4
+ ,5
+ ,31
+ ,33
+ ,12
+ ,12
+ ,4
+ ,8
+ ,34
+ ,37
+ ,16
+ ,21
+ ,5
+ ,6
+ ,35
+ ,29
+ ,18
+ ,12
+ ,5
+ ,5
+ ,39
+ ,31
+ ,14
+ ,22
+ ,2
+ ,6
+ ,34
+ ,36
+ ,14
+ ,11
+ ,5
+ ,5
+ ,36
+ ,35
+ ,15
+ ,10
+ ,4
+ ,4
+ ,37
+ ,38
+ ,15
+ ,13
+ ,4
+ ,6
+ ,38
+ ,31
+ ,17
+ ,10
+ ,5
+ ,5
+ ,36
+ ,34
+ ,19
+ ,8
+ ,3
+ ,5
+ ,38
+ ,35
+ ,10
+ ,15
+ ,5
+ ,6
+ ,39
+ ,38
+ ,16
+ ,14
+ ,3
+ ,7
+ ,33
+ ,37
+ ,18
+ ,10
+ ,5
+ ,6
+ ,32
+ ,33
+ ,14
+ ,14
+ ,3
+ ,7
+ ,36
+ ,32
+ ,14
+ ,14
+ ,4
+ ,6
+ ,38
+ ,38
+ ,17
+ ,11
+ ,5
+ ,8
+ ,39
+ ,38
+ ,14
+ ,10
+ ,4
+ ,7
+ ,32
+ ,32
+ ,16
+ ,13
+ ,3
+ ,5
+ ,32
+ ,33
+ ,18
+ ,7
+ ,4
+ ,5
+ ,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'X_3t'
+ ,'X_4t'
+ ,'X_5t'
+ ,'Y_t
')
+ ,1:162))
> y <- array(NA,dim=c(6,162),dimnames=list(c('X_1t','X_2t','X_3t','X_4t','X_5t','Y_t
'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '6'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '6'
> #'GNU S' R Code compiled by R2WASP v. 1.2.327 ()
> #Author: root
> #To cite this work: Wessa P., (2013), Multiple Regression (v1.0.29) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_multipleregression.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following objects 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
Y_t\r\r X_1t X_2t X_3t X_4t X_5t
1 3 7 41 38 14 12
2 5 5 39 32 18 11
3 4 5 30 35 11 14
4 4 5 31 33 12 12
5 5 8 34 37 16 21
6 5 6 35 29 18 12
7 2 5 39 31 14 22
8 5 6 34 36 14 11
9 4 5 36 35 15 10
10 4 4 37 38 15 13
11 5 6 38 31 17 10
12 3 5 36 34 19 8
13 5 5 38 35 10 15
14 3 6 39 38 16 14
15 5 7 33 37 18 10
16 3 6 32 33 14 14
17 4 7 36 32 14 14
18 5 6 38 38 17 11
19 4 8 39 38 14 10
20 3 7 32 32 16 13
21 4 5 32 33 18 7
22 4 5 31 31 11 14
23 3 7 39 38 14 12
24 3 7 37 39 12 14
25 4 5 39 32 17 11
26 5 4 41 32 9 9
27 4 10 36 35 16 11
28 4 6 33 37 14 15
29 4 5 33 33 15 14
30 4 5 34 33 11 13
31 4 5 31 28 16 9
32 3 5 27 32 13 15
33 4 6 37 31 17 10
34 5 5 34 37 15 11
35 4 5 34 30 14 13
36 4 5 32 33 16 8
37 3 5 29 31 9 20
38 4 5 36 33 15 12
39 4 5 29 31 17 10
40 4 5 35 33 13 10
41 5 5 37 32 15 9
42 4 7 34 33 16 14
43 3 5 38 32 16 8
44 3 6 35 33 12 14
45 4 7 38 28 12 11
46 4 7 37 35 11 13
47 4 5 38 39 15 9
48 5 5 33 34 15 11
49 4 4 36 38 17 15
50 5 5 38 32 13 11
51 4 4 32 38 16 10
52 4 5 32 30 14 14
53 4 5 32 33 11 18
54 4 7 34 38 12 14
55 4 5 32 32 12 11
56 5 5 37 32 15 12
57 4 6 39 34 16 13
58 4 4 29 34 15 9
59 4 6 37 36 12 10
60 4 6 35 34 12 15
61 3 5 30 28 8 20
62 4 7 38 34 13 12
63 5 6 34 35 11 12
64 1 8 31 35 14 14
65 3 7 34 31 15 13
66 5 5 35 37 10 11
67 4 6 36 35 11 17
68 4 6 30 27 12 12
69 3 5 39 40 15 13
70 4 5 35 37 15 14
71 4 5 38 36 14 13
72 3 5 31 38 16 15
73 5 4 34 39 15 13
74 4 6 38 41 15 10
75 5 6 34 27 13 11
76 4 6 39 30 12 19
77 4 6 37 37 17 13
78 4 7 34 31 13 17
79 4 5 28 31 15 13
80 3 7 37 27 13 9
81 5 6 33 36 15 11
82 NA 5 37 38 16 10
83 5 5 35 37 15 9
84 4 4 37 33 16 12
85 4 8 32 34 15 12
86 5 8 33 31 14 13
87 4 5 38 39 15 13
88 4 5 33 34 14 12
89 3 6 29 32 13 15
90 4 4 33 33 7 22
91 4 5 31 36 17 13
92 3 5 36 32 13 15
93 5 5 35 41 15 13
94 5 5 32 28 14 15
95 5 6 29 30 13 10
96 4 6 39 36 16 11
97 4 5 37 35 12 16
98 4 6 35 31 14 11
99 4 5 37 34 17 11
100 4 7 32 36 15 10
101 4 5 38 36 17 10
102 4 6 37 35 12 16
103 5 6 36 37 16 12
104 4 6 32 28 11 11
105 4 4 33 39 15 16
106 3 5 40 32 9 19
107 5 5 38 35 16 11
108 4 7 41 39 15 16
109 3 6 36 35 10 15
110 2 9 43 42 10 24
111 5 6 30 34 15 14
112 4 6 31 33 11 15
113 5 5 32 41 13 11
114 1 6 32 33 14 15
115 5 5 37 34 18 12
116 5 8 37 32 16 10
117 3 7 33 40 14 14
118 4 5 34 40 14 13
119 5 7 33 35 14 9
120 5 6 38 36 14 15
121 3 6 33 37 12 15
122 4 9 31 27 14 14
123 5 7 38 39 15 11
124 4 6 37 38 15 8
125 4 5 33 31 15 11
126 4 5 31 33 13 11
127 5 6 39 32 17 8
128 4 6 44 39 17 10
129 5 7 33 36 19 11
130 4 5 35 33 15 13
131 4 5 32 33 13 11
132 4 5 28 32 9 20
133 4 6 40 37 15 10
134 3 4 27 30 15 15
135 4 5 37 38 15 12
136 5 7 32 29 16 14
137 3 5 28 22 11 23
138 4 7 34 35 14 14
139 3 7 30 35 11 16
140 4 6 35 34 15 11
141 3 5 31 35 13 12
142 3 8 32 34 15 10
143 5 5 30 34 16 14
144 5 5 30 35 14 12
145 5 5 31 23 15 12
146 5 6 40 31 16 11
147 5 4 32 27 16 12
148 4 5 36 36 11 13
149 4 5 32 31 12 11
150 4 7 35 32 9 19
151 5 6 38 39 16 12
152 5 7 42 37 13 17
153 4 10 34 38 16 9
154 4 6 35 39 12 12
155 4 8 35 34 9 19
156 5 4 33 31 13 18
157 3 5 36 32 13 15
158 4 6 32 37 14 14
159 5 7 33 36 19 11
160 5 7 34 32 13 9
161 5 6 32 35 12 18
162 5 6 34 36 13 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X_1t X_2t X_3t X_4t X_5t
4.73467 -0.06827 0.01293 -0.00887 0.02916 -0.06423
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.89069 -0.38977 -0.05244 0.66854 1.58257
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.73467 0.95271 4.970 1.76e-06 ***
X_1t -0.06827 0.05260 -1.298 0.19629
X_2t 0.01293 0.01941 0.666 0.50636
X_3t -0.00887 0.01838 -0.483 0.63005
X_4t 0.02916 0.03095 0.942 0.34771
X_5t -0.06424 0.02270 -2.829 0.00529 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.7622 on 155 degrees of freedom
(1 observation deleted due to missingness)
Multiple R-squared: 0.1117, Adjusted R-squared: 0.08308
F-statistic: 3.899 on 5 and 155 DF, p-value: 0.00234
> 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.19929055 0.39858111 0.80070945
[2,] 0.10943106 0.21886212 0.89056894
[3,] 0.08362446 0.16724892 0.91637554
[4,] 0.91495793 0.17008415 0.08504207
[5,] 0.97523552 0.04952896 0.02476448
[6,] 0.97007305 0.05985390 0.02992695
[7,] 0.95353079 0.09293842 0.04646921
[8,] 0.97986540 0.04026920 0.02013460
[9,] 0.97059738 0.05880525 0.02940262
[10,] 0.96943516 0.06112968 0.03056484
[11,] 0.95975566 0.08048869 0.04024434
[12,] 0.97786641 0.04426719 0.02213359
[13,] 0.97043994 0.05912013 0.02956006
[14,] 0.95651838 0.08696324 0.04348162
[15,] 0.96418313 0.07163373 0.03581687
[16,] 0.96254690 0.07490621 0.03745310
[17,] 0.94801817 0.10396365 0.05198183
[18,] 0.95098678 0.09802643 0.04901322
[19,] 0.93275846 0.13448308 0.06724154
[20,] 0.91096722 0.17806557 0.08903278
[21,] 0.88305214 0.23389572 0.11694786
[22,] 0.84984918 0.30030164 0.15015082
[23,] 0.82319285 0.35361430 0.17680715
[24,] 0.82690545 0.34618909 0.17309455
[25,] 0.79155409 0.41689182 0.20844591
[26,] 0.80029278 0.39941443 0.19970722
[27,] 0.75784408 0.48431185 0.24215592
[28,] 0.72181098 0.55637804 0.27818902
[29,] 0.68409375 0.63181249 0.31590625
[30,] 0.63410114 0.73179772 0.36589886
[31,] 0.58520168 0.82959665 0.41479832
[32,] 0.53436952 0.93126096 0.46563048
[33,] 0.51951644 0.96096711 0.48048356
[34,] 0.46681272 0.93362543 0.53318728
[35,] 0.59903560 0.80192880 0.40096440
[36,] 0.61042369 0.77915262 0.38957631
[37,] 0.56077747 0.87844506 0.43922253
[38,] 0.50954812 0.98090376 0.49045188
[39,] 0.46737038 0.93474076 0.53262962
[40,] 0.48134662 0.96269325 0.51865338
[41,] 0.43226902 0.86453803 0.56773098
[42,] 0.44336502 0.88673005 0.55663498
[43,] 0.40126736 0.80253472 0.59873264
[44,] 0.35487745 0.70975489 0.64512255
[45,] 0.32072869 0.64145739 0.67927131
[46,] 0.27940259 0.55880517 0.72059741
[47,] 0.24010544 0.48021089 0.75989456
[48,] 0.24978653 0.49957307 0.75021347
[49,] 0.21357803 0.42715606 0.78642197
[50,] 0.18592668 0.37185336 0.81407332
[51,] 0.15643035 0.31286069 0.84356965
[52,] 0.12997642 0.25995284 0.87002358
[53,] 0.11364224 0.22728448 0.88635776
[54,] 0.09192438 0.18384875 0.90807562
[55,] 0.10817681 0.21635362 0.89182319
[56,] 0.56477219 0.87045563 0.43522781
[57,] 0.58964269 0.82071463 0.41035731
[58,] 0.60779474 0.78441053 0.39220526
[59,] 0.56944272 0.86111456 0.43055728
[60,] 0.52620212 0.94759577 0.47379788
[61,] 0.58736069 0.82527862 0.41263931
[62,] 0.54281793 0.91436413 0.45718207
[63,] 0.49771308 0.99542617 0.50228692
[64,] 0.52334342 0.95331315 0.47665658
[65,] 0.53714787 0.92570426 0.46285213
[66,] 0.49530394 0.99060787 0.50469606
[67,] 0.50813072 0.98373856 0.49186928
[68,] 0.46906782 0.93813563 0.53093218
[69,] 0.43074947 0.86149893 0.56925053
[70,] 0.39586058 0.79172115 0.60413942
[71,] 0.35714248 0.71428496 0.64285752
[72,] 0.43608378 0.87216755 0.56391622
[73,] 0.45203338 0.90406676 0.54796662
[74,] 0.43799888 0.87599777 0.56200112
[75,] 0.40589923 0.81179846 0.59410077
[76,] 0.36723513 0.73447027 0.63276487
[77,] 0.41731327 0.83462653 0.58268673
[78,] 0.37518753 0.75037506 0.62481247
[79,] 0.33434277 0.66868554 0.66565723
[80,] 0.34434458 0.68868916 0.65565542
[81,] 0.33572246 0.67144492 0.66427754
[82,] 0.30367481 0.60734962 0.69632519
[83,] 0.33630770 0.67261540 0.66369230
[84,] 0.35122246 0.70244492 0.64877754
[85,] 0.37785114 0.75570228 0.62214886
[86,] 0.38721707 0.77443414 0.61278293
[87,] 0.35366761 0.70733521 0.64633239
[88,] 0.31161061 0.62322122 0.68838939
[89,] 0.27540122 0.55080243 0.72459878
[90,] 0.25611961 0.51223922 0.74388039
[91,] 0.22217687 0.44435374 0.77782313
[92,] 0.20903975 0.41807950 0.79096025
[93,] 0.17785042 0.35570084 0.82214958
[94,] 0.17749124 0.35498248 0.82250876
[95,] 0.14807868 0.29615736 0.85192132
[96,] 0.12240856 0.24481713 0.87759144
[97,] 0.11531613 0.23063227 0.88468387
[98,] 0.10482100 0.20964201 0.89517900
[99,] 0.08564560 0.17129121 0.91435440
[100,] 0.08545405 0.17090810 0.91454595
[101,] 0.12754404 0.25508808 0.87245596
[102,] 0.14660498 0.29320996 0.85339502
[103,] 0.12215330 0.24430660 0.87784670
[104,] 0.14768220 0.29536440 0.85231780
[105,] 0.82526996 0.34946008 0.17473004
[106,] 0.80213279 0.39573442 0.19786721
[107,] 0.78755691 0.42488619 0.21244309
[108,] 0.82037306 0.35925389 0.17962694
[109,] 0.78376272 0.43247457 0.21623728
[110,] 0.81106742 0.37786516 0.18893258
[111,] 0.80955602 0.38088797 0.19044398
[112,] 0.83086910 0.33826180 0.16913090
[113,] 0.79822842 0.40354316 0.20177158
[114,] 0.79207321 0.41585358 0.20792679
[115,] 0.75555218 0.48889563 0.24444782
[116,] 0.71542530 0.56914940 0.28457470
[117,] 0.66455405 0.67089190 0.33544595
[118,] 0.62198651 0.75602697 0.37801349
[119,] 0.65236818 0.69526364 0.34763182
[120,] 0.61399484 0.77201031 0.38600516
[121,] 0.57881418 0.84237163 0.42118582
[122,] 0.51772921 0.96454158 0.48227079
[123,] 0.49157804 0.98315609 0.50842196
[124,] 0.48948629 0.97897258 0.51051371
[125,] 0.57321170 0.85357659 0.42678830
[126,] 0.57274310 0.85451381 0.42725690
[127,] 0.55753585 0.88492830 0.44246415
[128,] 0.65379623 0.69240754 0.34620377
[129,] 0.59905405 0.80189189 0.40094595
[130,] 0.61372988 0.77254024 0.38627012
[131,] 0.56508213 0.86983575 0.43491787
[132,] 0.68910340 0.62179320 0.31089660
[133,] 0.84578499 0.30843001 0.15421501
[134,] 0.79754721 0.40490558 0.20245279
[135,] 0.77971485 0.44057031 0.22028515
[136,] 0.71506806 0.56986388 0.28493194
[137,] 0.63701536 0.72596928 0.36298464
[138,] 0.55473484 0.89053032 0.44526516
[139,] 0.45278450 0.90556900 0.54721550
[140,] 0.34878346 0.69756692 0.65121654
[141,] 0.25728051 0.51456102 0.74271949
[142,] 0.18932133 0.37864266 0.81067867
[143,] 0.37337235 0.74674469 0.62662765
[144,] 0.27432905 0.54865811 0.72567095
[145,] 0.18240432 0.36480863 0.81759568
> postscript(file="/var/fisher/rcomp/tmp/14ssd1383234912.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)
Warning message:
In x[, 1] - mysum$resid :
longer object length is not a multiple of shorter object length
> grid()
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/2oa7m1383234912.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/3cq561383234912.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/4934o1383234912.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/59wmu1383234912.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 = 161
Frequency = 1
1 2 3 4 5 6
-1.08711888 0.56811730 0.10787159 -0.08042167 1.58257428 0.72572157
7 8 9 10 11 12
-1.61754419 0.85312844 -0.34325702 -0.20513954 0.60536567 -1.59722143
13 14 15 16 17 18
1.09784347 -1.05937630 0.76233589 -0.95492196 0.05276815 0.73169026
19 20 21 22 23 24
-0.12146421 -1.01806949 -0.58946052 0.05946437 -1.06126409 -0.83975722
25 26 27 28 29 30
-0.40272653 0.60792858 0.03316998 0.13186536 -0.06527519 -0.02581280
31 32 33 34 35 36
-0.43410079 -0.87403353 -0.38170693 0.76457257 -0.13989117 -0.46691330
37 38 39 40 41 42
-0.47095916 -0.23252716 -0.34655741 -0.28975720 0.55297082 0.02918056
43 44 45 46 47 48
-1.55334764 -0.93539182 -0.14295881 0.08968423 -0.39786688 0.75089010
49 50 51 52 53 54
-0.12205470 0.72682554 -0.36236339 -0.04980149 0.32121645 0.19015502
55 56 57 58 59 60
-0.16645391 0.74567549 -0.15909101 -0.39413975 -0.19157630 0.13771303
61 62 63 64 65 66
-0.48134026 -0.05466035 0.99596188 -2.78771534 -1.02363807 0.89742602
67 68 69 70 71 72
0.29128154 -0.05244435 -1.14498476 -0.05565015 -0.13838102 -0.95999189
73 74 75 76 77 78
0.84251261 -0.24762242 0.80245500 0.30746317 -0.13578252 0.29161382
79 80 81 83 84 85
-0.08261300 -1.29652731 0.83689967 0.62317540 -0.34288038 0.03286136
86 87 88 89 90 91
1.08671515 -0.14092732 -0.15571884 -0.83161867 0.61358363 -0.13535775
92 93 94 95 96 97
-0.99038011 0.91559478 0.99669349 0.82946697 -0.26982088 0.11669342
98 99 100 101 102 103
-0.20414874 -0.35913183 -0.14613817 -0.41855420 0.18496308 0.84206616
104 105 106 107 108 109
-0.10450791 0.04814468 -0.66852546 0.66596690 0.14953447 -0.80803208
110 111 112 113 114 115
-1.05351118 1.05064662 0.20970883 0.88421953 -2.89068707 0.67594690
116 117 118 119 120 121
0.79285851 -0.83749001 -0.05119161 0.79698576 1.05835841 -0.80982231
122 123 124 125 126 127
0.20959466 0.86714221 -0.38977468 -0.27571977 -0.17381272 0.47283845
128 129 130 131 132 133
-0.40123906 0.78854465 -0.15536487 -0.18674012 0.55083820 -0.30895704
134 135 136 137 138 139
-1.01835544 -0.20110477 1.01955553 -0.40346904 0.10523281 -0.62711931
140 141 142 143 144 145
-0.20669504 -1.09183792 -1.09560842 0.95322079 0.89193331 0.74341026
146 147 148 149 150 151
0.67290194 0.66853687 -0.02505772 -0.17532387 0.53265084 0.83395127
152 153 154 155 156 157
1.24141438 -0.04283514 -0.01064186 0.61866041 1.16396714 -0.99038011
158 159 160 161 162
0.08055786 0.78854465 0.78660466 1.37806985 1.20345906
> postscript(file="/var/fisher/rcomp/tmp/6aoks1383234912.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 = 161
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.08711888 NA
1 0.56811730 -1.08711888
2 0.10787159 0.56811730
3 -0.08042167 0.10787159
4 1.58257428 -0.08042167
5 0.72572157 1.58257428
6 -1.61754419 0.72572157
7 0.85312844 -1.61754419
8 -0.34325702 0.85312844
9 -0.20513954 -0.34325702
10 0.60536567 -0.20513954
11 -1.59722143 0.60536567
12 1.09784347 -1.59722143
13 -1.05937630 1.09784347
14 0.76233589 -1.05937630
15 -0.95492196 0.76233589
16 0.05276815 -0.95492196
17 0.73169026 0.05276815
18 -0.12146421 0.73169026
19 -1.01806949 -0.12146421
20 -0.58946052 -1.01806949
21 0.05946437 -0.58946052
22 -1.06126409 0.05946437
23 -0.83975722 -1.06126409
24 -0.40272653 -0.83975722
25 0.60792858 -0.40272653
26 0.03316998 0.60792858
27 0.13186536 0.03316998
28 -0.06527519 0.13186536
29 -0.02581280 -0.06527519
30 -0.43410079 -0.02581280
31 -0.87403353 -0.43410079
32 -0.38170693 -0.87403353
33 0.76457257 -0.38170693
34 -0.13989117 0.76457257
35 -0.46691330 -0.13989117
36 -0.47095916 -0.46691330
37 -0.23252716 -0.47095916
38 -0.34655741 -0.23252716
39 -0.28975720 -0.34655741
40 0.55297082 -0.28975720
41 0.02918056 0.55297082
42 -1.55334764 0.02918056
43 -0.93539182 -1.55334764
44 -0.14295881 -0.93539182
45 0.08968423 -0.14295881
46 -0.39786688 0.08968423
47 0.75089010 -0.39786688
48 -0.12205470 0.75089010
49 0.72682554 -0.12205470
50 -0.36236339 0.72682554
51 -0.04980149 -0.36236339
52 0.32121645 -0.04980149
53 0.19015502 0.32121645
54 -0.16645391 0.19015502
55 0.74567549 -0.16645391
56 -0.15909101 0.74567549
57 -0.39413975 -0.15909101
58 -0.19157630 -0.39413975
59 0.13771303 -0.19157630
60 -0.48134026 0.13771303
61 -0.05466035 -0.48134026
62 0.99596188 -0.05466035
63 -2.78771534 0.99596188
64 -1.02363807 -2.78771534
65 0.89742602 -1.02363807
66 0.29128154 0.89742602
67 -0.05244435 0.29128154
68 -1.14498476 -0.05244435
69 -0.05565015 -1.14498476
70 -0.13838102 -0.05565015
71 -0.95999189 -0.13838102
72 0.84251261 -0.95999189
73 -0.24762242 0.84251261
74 0.80245500 -0.24762242
75 0.30746317 0.80245500
76 -0.13578252 0.30746317
77 0.29161382 -0.13578252
78 -0.08261300 0.29161382
79 -1.29652731 -0.08261300
80 0.83689967 -1.29652731
81 0.62317540 0.83689967
82 -0.34288038 0.62317540
83 0.03286136 -0.34288038
84 1.08671515 0.03286136
85 -0.14092732 1.08671515
86 -0.15571884 -0.14092732
87 -0.83161867 -0.15571884
88 0.61358363 -0.83161867
89 -0.13535775 0.61358363
90 -0.99038011 -0.13535775
91 0.91559478 -0.99038011
92 0.99669349 0.91559478
93 0.82946697 0.99669349
94 -0.26982088 0.82946697
95 0.11669342 -0.26982088
96 -0.20414874 0.11669342
97 -0.35913183 -0.20414874
98 -0.14613817 -0.35913183
99 -0.41855420 -0.14613817
100 0.18496308 -0.41855420
101 0.84206616 0.18496308
102 -0.10450791 0.84206616
103 0.04814468 -0.10450791
104 -0.66852546 0.04814468
105 0.66596690 -0.66852546
106 0.14953447 0.66596690
107 -0.80803208 0.14953447
108 -1.05351118 -0.80803208
109 1.05064662 -1.05351118
110 0.20970883 1.05064662
111 0.88421953 0.20970883
112 -2.89068707 0.88421953
113 0.67594690 -2.89068707
114 0.79285851 0.67594690
115 -0.83749001 0.79285851
116 -0.05119161 -0.83749001
117 0.79698576 -0.05119161
118 1.05835841 0.79698576
119 -0.80982231 1.05835841
120 0.20959466 -0.80982231
121 0.86714221 0.20959466
122 -0.38977468 0.86714221
123 -0.27571977 -0.38977468
124 -0.17381272 -0.27571977
125 0.47283845 -0.17381272
126 -0.40123906 0.47283845
127 0.78854465 -0.40123906
128 -0.15536487 0.78854465
129 -0.18674012 -0.15536487
130 0.55083820 -0.18674012
131 -0.30895704 0.55083820
132 -1.01835544 -0.30895704
133 -0.20110477 -1.01835544
134 1.01955553 -0.20110477
135 -0.40346904 1.01955553
136 0.10523281 -0.40346904
137 -0.62711931 0.10523281
138 -0.20669504 -0.62711931
139 -1.09183792 -0.20669504
140 -1.09560842 -1.09183792
141 0.95322079 -1.09560842
142 0.89193331 0.95322079
143 0.74341026 0.89193331
144 0.67290194 0.74341026
145 0.66853687 0.67290194
146 -0.02505772 0.66853687
147 -0.17532387 -0.02505772
148 0.53265084 -0.17532387
149 0.83395127 0.53265084
150 1.24141438 0.83395127
151 -0.04283514 1.24141438
152 -0.01064186 -0.04283514
153 0.61866041 -0.01064186
154 1.16396714 0.61866041
155 -0.99038011 1.16396714
156 0.08055786 -0.99038011
157 0.78854465 0.08055786
158 0.78660466 0.78854465
159 1.37806985 0.78660466
160 1.20345906 1.37806985
161 NA 1.20345906
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.56811730 -1.08711888
[2,] 0.10787159 0.56811730
[3,] -0.08042167 0.10787159
[4,] 1.58257428 -0.08042167
[5,] 0.72572157 1.58257428
[6,] -1.61754419 0.72572157
[7,] 0.85312844 -1.61754419
[8,] -0.34325702 0.85312844
[9,] -0.20513954 -0.34325702
[10,] 0.60536567 -0.20513954
[11,] -1.59722143 0.60536567
[12,] 1.09784347 -1.59722143
[13,] -1.05937630 1.09784347
[14,] 0.76233589 -1.05937630
[15,] -0.95492196 0.76233589
[16,] 0.05276815 -0.95492196
[17,] 0.73169026 0.05276815
[18,] -0.12146421 0.73169026
[19,] -1.01806949 -0.12146421
[20,] -0.58946052 -1.01806949
[21,] 0.05946437 -0.58946052
[22,] -1.06126409 0.05946437
[23,] -0.83975722 -1.06126409
[24,] -0.40272653 -0.83975722
[25,] 0.60792858 -0.40272653
[26,] 0.03316998 0.60792858
[27,] 0.13186536 0.03316998
[28,] -0.06527519 0.13186536
[29,] -0.02581280 -0.06527519
[30,] -0.43410079 -0.02581280
[31,] -0.87403353 -0.43410079
[32,] -0.38170693 -0.87403353
[33,] 0.76457257 -0.38170693
[34,] -0.13989117 0.76457257
[35,] -0.46691330 -0.13989117
[36,] -0.47095916 -0.46691330
[37,] -0.23252716 -0.47095916
[38,] -0.34655741 -0.23252716
[39,] -0.28975720 -0.34655741
[40,] 0.55297082 -0.28975720
[41,] 0.02918056 0.55297082
[42,] -1.55334764 0.02918056
[43,] -0.93539182 -1.55334764
[44,] -0.14295881 -0.93539182
[45,] 0.08968423 -0.14295881
[46,] -0.39786688 0.08968423
[47,] 0.75089010 -0.39786688
[48,] -0.12205470 0.75089010
[49,] 0.72682554 -0.12205470
[50,] -0.36236339 0.72682554
[51,] -0.04980149 -0.36236339
[52,] 0.32121645 -0.04980149
[53,] 0.19015502 0.32121645
[54,] -0.16645391 0.19015502
[55,] 0.74567549 -0.16645391
[56,] -0.15909101 0.74567549
[57,] -0.39413975 -0.15909101
[58,] -0.19157630 -0.39413975
[59,] 0.13771303 -0.19157630
[60,] -0.48134026 0.13771303
[61,] -0.05466035 -0.48134026
[62,] 0.99596188 -0.05466035
[63,] -2.78771534 0.99596188
[64,] -1.02363807 -2.78771534
[65,] 0.89742602 -1.02363807
[66,] 0.29128154 0.89742602
[67,] -0.05244435 0.29128154
[68,] -1.14498476 -0.05244435
[69,] -0.05565015 -1.14498476
[70,] -0.13838102 -0.05565015
[71,] -0.95999189 -0.13838102
[72,] 0.84251261 -0.95999189
[73,] -0.24762242 0.84251261
[74,] 0.80245500 -0.24762242
[75,] 0.30746317 0.80245500
[76,] -0.13578252 0.30746317
[77,] 0.29161382 -0.13578252
[78,] -0.08261300 0.29161382
[79,] -1.29652731 -0.08261300
[80,] 0.83689967 -1.29652731
[81,] 0.62317540 0.83689967
[82,] -0.34288038 0.62317540
[83,] 0.03286136 -0.34288038
[84,] 1.08671515 0.03286136
[85,] -0.14092732 1.08671515
[86,] -0.15571884 -0.14092732
[87,] -0.83161867 -0.15571884
[88,] 0.61358363 -0.83161867
[89,] -0.13535775 0.61358363
[90,] -0.99038011 -0.13535775
[91,] 0.91559478 -0.99038011
[92,] 0.99669349 0.91559478
[93,] 0.82946697 0.99669349
[94,] -0.26982088 0.82946697
[95,] 0.11669342 -0.26982088
[96,] -0.20414874 0.11669342
[97,] -0.35913183 -0.20414874
[98,] -0.14613817 -0.35913183
[99,] -0.41855420 -0.14613817
[100,] 0.18496308 -0.41855420
[101,] 0.84206616 0.18496308
[102,] -0.10450791 0.84206616
[103,] 0.04814468 -0.10450791
[104,] -0.66852546 0.04814468
[105,] 0.66596690 -0.66852546
[106,] 0.14953447 0.66596690
[107,] -0.80803208 0.14953447
[108,] -1.05351118 -0.80803208
[109,] 1.05064662 -1.05351118
[110,] 0.20970883 1.05064662
[111,] 0.88421953 0.20970883
[112,] -2.89068707 0.88421953
[113,] 0.67594690 -2.89068707
[114,] 0.79285851 0.67594690
[115,] -0.83749001 0.79285851
[116,] -0.05119161 -0.83749001
[117,] 0.79698576 -0.05119161
[118,] 1.05835841 0.79698576
[119,] -0.80982231 1.05835841
[120,] 0.20959466 -0.80982231
[121,] 0.86714221 0.20959466
[122,] -0.38977468 0.86714221
[123,] -0.27571977 -0.38977468
[124,] -0.17381272 -0.27571977
[125,] 0.47283845 -0.17381272
[126,] -0.40123906 0.47283845
[127,] 0.78854465 -0.40123906
[128,] -0.15536487 0.78854465
[129,] -0.18674012 -0.15536487
[130,] 0.55083820 -0.18674012
[131,] -0.30895704 0.55083820
[132,] -1.01835544 -0.30895704
[133,] -0.20110477 -1.01835544
[134,] 1.01955553 -0.20110477
[135,] -0.40346904 1.01955553
[136,] 0.10523281 -0.40346904
[137,] -0.62711931 0.10523281
[138,] -0.20669504 -0.62711931
[139,] -1.09183792 -0.20669504
[140,] -1.09560842 -1.09183792
[141,] 0.95322079 -1.09560842
[142,] 0.89193331 0.95322079
[143,] 0.74341026 0.89193331
[144,] 0.67290194 0.74341026
[145,] 0.66853687 0.67290194
[146,] -0.02505772 0.66853687
[147,] -0.17532387 -0.02505772
[148,] 0.53265084 -0.17532387
[149,] 0.83395127 0.53265084
[150,] 1.24141438 0.83395127
[151,] -0.04283514 1.24141438
[152,] -0.01064186 -0.04283514
[153,] 0.61866041 -0.01064186
[154,] 1.16396714 0.61866041
[155,] -0.99038011 1.16396714
[156,] 0.08055786 -0.99038011
[157,] 0.78854465 0.08055786
[158,] 0.78660466 0.78854465
[159,] 1.37806985 0.78660466
[160,] 1.20345906 1.37806985
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.56811730 -1.08711888
2 0.10787159 0.56811730
3 -0.08042167 0.10787159
4 1.58257428 -0.08042167
5 0.72572157 1.58257428
6 -1.61754419 0.72572157
7 0.85312844 -1.61754419
8 -0.34325702 0.85312844
9 -0.20513954 -0.34325702
10 0.60536567 -0.20513954
11 -1.59722143 0.60536567
12 1.09784347 -1.59722143
13 -1.05937630 1.09784347
14 0.76233589 -1.05937630
15 -0.95492196 0.76233589
16 0.05276815 -0.95492196
17 0.73169026 0.05276815
18 -0.12146421 0.73169026
19 -1.01806949 -0.12146421
20 -0.58946052 -1.01806949
21 0.05946437 -0.58946052
22 -1.06126409 0.05946437
23 -0.83975722 -1.06126409
24 -0.40272653 -0.83975722
25 0.60792858 -0.40272653
26 0.03316998 0.60792858
27 0.13186536 0.03316998
28 -0.06527519 0.13186536
29 -0.02581280 -0.06527519
30 -0.43410079 -0.02581280
31 -0.87403353 -0.43410079
32 -0.38170693 -0.87403353
33 0.76457257 -0.38170693
34 -0.13989117 0.76457257
35 -0.46691330 -0.13989117
36 -0.47095916 -0.46691330
37 -0.23252716 -0.47095916
38 -0.34655741 -0.23252716
39 -0.28975720 -0.34655741
40 0.55297082 -0.28975720
41 0.02918056 0.55297082
42 -1.55334764 0.02918056
43 -0.93539182 -1.55334764
44 -0.14295881 -0.93539182
45 0.08968423 -0.14295881
46 -0.39786688 0.08968423
47 0.75089010 -0.39786688
48 -0.12205470 0.75089010
49 0.72682554 -0.12205470
50 -0.36236339 0.72682554
51 -0.04980149 -0.36236339
52 0.32121645 -0.04980149
53 0.19015502 0.32121645
54 -0.16645391 0.19015502
55 0.74567549 -0.16645391
56 -0.15909101 0.74567549
57 -0.39413975 -0.15909101
58 -0.19157630 -0.39413975
59 0.13771303 -0.19157630
60 -0.48134026 0.13771303
61 -0.05466035 -0.48134026
62 0.99596188 -0.05466035
63 -2.78771534 0.99596188
64 -1.02363807 -2.78771534
65 0.89742602 -1.02363807
66 0.29128154 0.89742602
67 -0.05244435 0.29128154
68 -1.14498476 -0.05244435
69 -0.05565015 -1.14498476
70 -0.13838102 -0.05565015
71 -0.95999189 -0.13838102
72 0.84251261 -0.95999189
73 -0.24762242 0.84251261
74 0.80245500 -0.24762242
75 0.30746317 0.80245500
76 -0.13578252 0.30746317
77 0.29161382 -0.13578252
78 -0.08261300 0.29161382
79 -1.29652731 -0.08261300
80 0.83689967 -1.29652731
81 0.62317540 0.83689967
82 -0.34288038 0.62317540
83 0.03286136 -0.34288038
84 1.08671515 0.03286136
85 -0.14092732 1.08671515
86 -0.15571884 -0.14092732
87 -0.83161867 -0.15571884
88 0.61358363 -0.83161867
89 -0.13535775 0.61358363
90 -0.99038011 -0.13535775
91 0.91559478 -0.99038011
92 0.99669349 0.91559478
93 0.82946697 0.99669349
94 -0.26982088 0.82946697
95 0.11669342 -0.26982088
96 -0.20414874 0.11669342
97 -0.35913183 -0.20414874
98 -0.14613817 -0.35913183
99 -0.41855420 -0.14613817
100 0.18496308 -0.41855420
101 0.84206616 0.18496308
102 -0.10450791 0.84206616
103 0.04814468 -0.10450791
104 -0.66852546 0.04814468
105 0.66596690 -0.66852546
106 0.14953447 0.66596690
107 -0.80803208 0.14953447
108 -1.05351118 -0.80803208
109 1.05064662 -1.05351118
110 0.20970883 1.05064662
111 0.88421953 0.20970883
112 -2.89068707 0.88421953
113 0.67594690 -2.89068707
114 0.79285851 0.67594690
115 -0.83749001 0.79285851
116 -0.05119161 -0.83749001
117 0.79698576 -0.05119161
118 1.05835841 0.79698576
119 -0.80982231 1.05835841
120 0.20959466 -0.80982231
121 0.86714221 0.20959466
122 -0.38977468 0.86714221
123 -0.27571977 -0.38977468
124 -0.17381272 -0.27571977
125 0.47283845 -0.17381272
126 -0.40123906 0.47283845
127 0.78854465 -0.40123906
128 -0.15536487 0.78854465
129 -0.18674012 -0.15536487
130 0.55083820 -0.18674012
131 -0.30895704 0.55083820
132 -1.01835544 -0.30895704
133 -0.20110477 -1.01835544
134 1.01955553 -0.20110477
135 -0.40346904 1.01955553
136 0.10523281 -0.40346904
137 -0.62711931 0.10523281
138 -0.20669504 -0.62711931
139 -1.09183792 -0.20669504
140 -1.09560842 -1.09183792
141 0.95322079 -1.09560842
142 0.89193331 0.95322079
143 0.74341026 0.89193331
144 0.67290194 0.74341026
145 0.66853687 0.67290194
146 -0.02505772 0.66853687
147 -0.17532387 -0.02505772
148 0.53265084 -0.17532387
149 0.83395127 0.53265084
150 1.24141438 0.83395127
151 -0.04283514 1.24141438
152 -0.01064186 -0.04283514
153 0.61866041 -0.01064186
154 1.16396714 0.61866041
155 -0.99038011 1.16396714
156 0.08055786 -0.99038011
157 0.78854465 0.08055786
158 0.78660466 0.78854465
159 1.37806985 0.78660466
160 1.20345906 1.37806985
> 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/7sup51383234912.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/8t5yh1383234912.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/9bxnf1383234912.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/108uu21383234912.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, signif(mysum$coefficients[i,1],6), 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/11mhwi1383234912.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,signif(mysum$coefficients[i,1],6))
+ a<-table.element(a, signif(mysum$coefficients[i,2],6))
+ a<-table.element(a, signif(mysum$coefficients[i,3],4))
+ a<-table.element(a, signif(mysum$coefficients[i,4],6))
+ a<-table.element(a, signif(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/fisher/rcomp/tmp/12dkej1383234912.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, signif(sqrt(mysum$r.squared),6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, signif(mysum$r.squared,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, signif(mysum$adj.r.squared,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[1],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[2],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[3],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, signif(1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]),6))
> 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, signif(mysum$sigma,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, signif(sum(myerror*myerror),6))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/fisher/rcomp/tmp/13fgnk1383234912.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,signif(x[i],6))
+ a<-table.element(a,signif(x[i]-mysum$resid[i],6))
+ a<-table.element(a,signif(mysum$resid[i],6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/fisher/rcomp/tmp/14079j1383234912.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,signif(gqarr[mypoint-kp3+1,1],6))
+ a<-table.element(a,signif(gqarr[mypoint-kp3+1,2],6))
+ a<-table.element(a,signif(gqarr[mypoint-kp3+1,3],6))
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/fisher/rcomp/tmp/15lgz51383234912.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,signif(numsignificant1,6))
+ a<-table.element(a,signif(numsignificant1/numgqtests,6))
+ 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,signif(numsignificant5,6))
+ a<-table.element(a,signif(numsignificant5/numgqtests,6))
+ 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,signif(numsignificant10,6))
+ a<-table.element(a,signif(numsignificant10/numgqtests,6))
+ 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/1644d51383234912.tab")
+ }
>
> try(system("convert tmp/14ssd1383234912.ps tmp/14ssd1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/2oa7m1383234912.ps tmp/2oa7m1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/3cq561383234912.ps tmp/3cq561383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/4934o1383234912.ps tmp/4934o1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/59wmu1383234912.ps tmp/59wmu1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/6aoks1383234912.ps tmp/6aoks1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/7sup51383234912.ps tmp/7sup51383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/8t5yh1383234912.ps tmp/8t5yh1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/9bxnf1383234912.ps tmp/9bxnf1383234912.png",intern=TRUE))
character(0)
> try(system("convert tmp/108uu21383234912.ps tmp/108uu21383234912.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.271 1.168 8.447