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(501
+ ,134
+ ,368
+ ,6.7
+ ,8.5
+ ,8.7
+ ,485
+ ,124
+ ,361
+ ,6.8
+ ,8.4
+ ,8.6
+ ,464
+ ,113
+ ,351
+ ,6.7
+ ,8.4
+ ,8.6
+ ,460
+ ,109
+ ,351
+ ,6.6
+ ,8.3
+ ,8.5
+ ,467
+ ,109
+ ,358
+ ,6.4
+ ,8.2
+ ,8.5
+ ,460
+ ,106
+ ,354
+ ,6.3
+ ,8.2
+ ,8.5
+ ,448
+ ,101
+ ,347
+ ,6.3
+ ,8.1
+ ,8.5
+ ,443
+ ,98
+ ,345
+ ,6.5
+ ,8.1
+ ,8.5
+ ,436
+ ,93
+ ,343
+ ,6.5
+ ,8.1
+ ,8.5
+ ,431
+ ,91
+ ,340
+ ,6.4
+ ,8.1
+ ,8.5
+ ,484
+ ,122
+ ,362
+ ,6.2
+ ,8.1
+ ,8.5
+ ,510
+ ,139
+ ,370
+ ,6.2
+ ,8.1
+ ,8.6
+ ,513
+ ,140
+ ,373
+ ,6.5
+ ,8.1
+ ,8.6
+ ,503
+ ,132
+ ,371
+ ,7
+ ,8.2
+ ,8.6
+ ,471
+ ,117
+ ,354
+ ,7.2
+ ,8.2
+ ,8.7
+ ,471
+ ,114
+ ,357
+ ,7.3
+ ,8.3
+ ,8.7
+ ,476
+ ,113
+ ,363
+ ,7.4
+ ,8.2
+ ,8.7
+ ,475
+ ,110
+ ,364
+ ,7.4
+ ,8.3
+ ,8.8
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+ ,10.5
+ ,582
+ ,122
+ ,460
+ ,7.5
+ ,11.5
+ ,10.5
+ ,599
+ ,134
+ ,465
+ ,7.4
+ ,11.5
+ ,10.6
+ ,584
+ ,133
+ ,451
+ ,7.4
+ ,11.6
+ ,10.6)
+ ,dim=c(6
+ ,145)
+ ,dimnames=list(c('Totaal_werklozen'
+ ,'Jonger_dan_25_jaar'
+ ,'Vanaf_25_jaar'
+ ,'Belgie'
+ ,'Eurogebied'
+ ,'EU_27')
+ ,1:145))
> y <- array(NA,dim=c(6,145),dimnames=list(c('Totaal_werklozen','Jonger_dan_25_jaar','Vanaf_25_jaar','Belgie','Eurogebied','EU_27'),1:145))
> 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 = '1'
> 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
Totaal_werklozen Jonger_dan_25_jaar Vanaf_25_jaar Belgie Eurogebied EU_27
1 501 134 368 6.7 8.5 8.7
2 485 124 361 6.8 8.4 8.6
3 464 113 351 6.7 8.4 8.6
4 460 109 351 6.6 8.3 8.5
5 467 109 358 6.4 8.2 8.5
6 460 106 354 6.3 8.2 8.5
7 448 101 347 6.3 8.1 8.5
8 443 98 345 6.5 8.1 8.5
9 436 93 343 6.5 8.1 8.5
10 431 91 340 6.4 8.1 8.5
11 484 122 362 6.2 8.1 8.5
12 510 139 370 6.2 8.1 8.6
13 513 140 373 6.5 8.1 8.6
14 503 132 371 7.0 8.2 8.6
15 471 117 354 7.2 8.2 8.7
16 471 114 357 7.3 8.3 8.7
17 476 113 363 7.4 8.2 8.7
18 475 110 364 7.4 8.3 8.8
19 470 107 363 7.4 8.3 8.8
20 461 103 358 7.3 8.4 8.9
21 455 98 357 7.4 8.5 8.9
22 456 98 357 7.4 8.5 8.9
23 517 137 380 7.6 8.6 9.0
24 525 148 378 7.6 8.6 9.0
25 523 147 376 7.7 8.7 9.0
26 519 139 380 7.7 8.7 9.0
27 509 130 379 7.8 8.8 9.0
28 512 128 384 7.8 8.8 9.0
29 519 127 392 8.0 8.9 9.1
30 517 123 394 8.1 9.0 9.1
31 510 118 392 8.1 9.0 9.1
32 509 114 396 8.2 9.0 9.1
33 501 108 392 8.1 9.0 9.1
34 507 111 396 8.1 9.1 9.1
35 569 151 419 8.1 9.1 9.1
36 580 159 421 8.1 9.0 9.1
37 578 158 420 8.2 9.1 9.1
38 565 148 418 8.2 9.0 9.1
39 547 138 410 8.3 9.1 9.1
40 555 137 418 8.4 9.1 9.2
41 562 136 426 8.6 9.2 9.3
42 561 133 428 8.6 9.2 9.3
43 555 126 430 8.4 9.2 9.3
44 544 120 424 8.0 9.2 9.2
45 537 114 423 7.9 9.2 9.2
46 543 116 427 8.1 9.3 9.2
47 594 153 441 8.5 9.3 9.2
48 611 162 449 8.8 9.3 9.2
49 613 161 452 8.8 9.3 9.2
50 611 149 462 8.5 9.3 9.2
51 594 139 455 8.3 9.4 9.2
52 595 135 461 8.3 9.4 9.2
53 591 130 461 8.3 9.3 9.2
54 589 127 463 8.4 9.3 9.2
55 584 122 462 8.5 9.3 9.2
56 573 117 456 8.5 9.3 9.2
57 567 112 455 8.6 9.2 9.1
58 569 113 456 8.5 9.2 9.1
59 621 149 472 8.6 9.2 9.0
60 629 157 472 8.6 9.1 8.9
61 628 157 471 8.6 9.1 8.9
62 612 147 465 8.5 9.1 9.0
63 595 137 459 8.4 9.1 8.9
64 597 132 465 8.4 9.0 8.8
65 593 125 468 8.5 8.9 8.7
66 590 123 467 8.5 8.8 8.6
67 580 117 463 8.5 8.7 8.5
68 574 114 460 8.6 8.6 8.5
69 573 111 462 8.6 8.6 8.4
70 573 112 461 8.4 8.5 8.3
71 620 144 476 8.2 8.4 8.2
72 626 150 476 8.0 8.4 8.2
73 620 149 471 8.0 8.3 8.1
74 588 134 453 8.0 8.2 8.0
75 566 123 443 8.0 8.2 7.9
76 557 116 442 7.9 8.0 7.8
77 561 117 444 7.9 7.9 7.6
78 549 111 438 7.9 7.8 7.5
79 532 105 427 7.9 7.7 7.4
80 526 102 424 8.0 7.6 7.3
81 511 95 416 7.9 7.6 7.3
82 499 93 406 7.4 7.6 7.2
83 555 124 431 7.2 7.6 7.2
84 565 130 434 7.0 7.6 7.2
85 542 124 418 6.9 7.5 7.1
86 527 115 412 7.1 7.5 7.0
87 510 106 404 7.2 7.4 7.0
88 514 105 409 7.2 7.4 6.9
89 517 105 412 7.1 7.4 6.9
90 508 101 406 6.9 7.3 6.8
91 493 95 398 6.8 7.3 6.8
92 490 93 397 6.8 7.4 6.8
93 469 84 385 6.8 7.5 6.9
94 478 87 390 6.9 7.6 7.0
95 528 116 413 7.1 7.6 7.0
96 534 120 413 7.2 7.7 7.1
97 518 117 401 7.2 7.7 7.2
98 506 109 397 7.1 7.9 7.3
99 502 105 397 7.1 8.1 7.5
100 516 107 409 7.2 8.4 7.7
101 528 109 419 7.5 8.7 8.1
102 533 109 424 7.7 9.0 8.4
103 536 108 428 7.8 9.3 8.6
104 537 107 430 7.7 9.4 8.8
105 524 99 424 7.7 9.5 8.9
106 536 103 433 7.8 9.6 9.1
107 587 131 456 8.0 9.8 9.2
108 597 137 459 8.1 9.8 9.3
109 581 135 446 8.1 9.9 9.4
110 564 124 441 8.0 10.0 9.4
111 558 118 439 8.1 10.0 9.5
112 575 121 454 8.2 10.1 9.5
113 580 121 460 8.4 10.1 9.7
114 575 118 457 8.5 10.1 9.7
115 563 113 451 8.5 10.1 9.7
116 552 107 444 8.5 10.2 9.7
117 537 100 437 8.5 10.2 9.7
118 545 102 443 8.5 10.1 9.6
119 601 130 471 8.4 10.1 9.6
120 604 136 469 8.3 10.1 9.6
121 586 133 454 8.2 10.1 9.6
122 564 120 444 8.1 10.1 9.6
123 549 112 436 7.9 10.1 9.6
124 551 109 442 7.6 10.1 9.6
125 556 110 446 7.3 10.0 9.5
126 548 106 442 7.1 9.9 9.5
127 540 102 438 7.0 9.9 9.4
128 531 98 433 7.1 9.9 9.4
129 521 92 428 7.1 9.9 9.5
130 519 92 426 7.1 10.0 9.5
131 572 120 452 7.3 10.1 9.6
132 581 127 455 7.3 10.2 9.7
133 563 124 439 7.3 10.3 9.8
134 548 114 434 7.2 10.5 9.9
135 539 108 431 7.2 10.6 10.0
136 541 106 435 7.1 10.7 10.0
137 562 111 450 7.1 10.8 10.1
138 559 110 449 7.1 10.9 10.2
139 546 104 442 7.2 11.0 10.3
140 536 100 437 7.3 11.2 10.3
141 528 96 431 7.4 11.3 10.4
142 530 98 433 7.4 11.4 10.5
143 582 122 460 7.5 11.5 10.5
144 599 134 465 7.4 11.5 10.6
145 584 133 451 7.4 11.6 10.6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Jonger_dan_25_jaar Vanaf_25_jaar Belgie
1.25103 0.99382 1.00178 -0.11952
Eurogebied EU_27
-0.09040 0.05215
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.09713 -0.13280 -0.00238 0.13755 1.14938
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.251027 0.652478 1.917 0.0572 .
Jonger_dan_25_jaar 0.993824 0.003169 313.627 <2e-16 ***
Vanaf_25_jaar 1.001775 0.002749 364.437 <2e-16 ***
Belgie -0.119519 0.107818 -1.109 0.2695
Eurogebied -0.090404 0.203540 -0.444 0.6576
EU_27 0.052146 0.207940 0.251 0.8024
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5034 on 139 degrees of freedom
Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
F-statistic: 2.333e+05 on 5 and 139 DF, p-value: < 2.2e-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.131809268 0.263618535 0.8681907
[2,] 0.051771594 0.103543188 0.9482284
[3,] 0.019625023 0.039250047 0.9803750
[4,] 0.168193094 0.336386188 0.8318069
[5,] 0.150559481 0.301118961 0.8494405
[6,] 0.103051210 0.206102419 0.8969488
[7,] 0.064497342 0.128994683 0.9355027
[8,] 0.065154783 0.130309565 0.9348452
[9,] 0.046335197 0.092670393 0.9536648
[10,] 0.172829358 0.345658715 0.8271706
[11,] 0.156392897 0.312785795 0.8436071
[12,] 0.119270777 0.238541555 0.8807292
[13,] 0.081828202 0.163656404 0.9181718
[14,] 0.191051035 0.382102069 0.8089490
[15,] 0.146610635 0.293221269 0.8533894
[16,] 0.220511194 0.441022388 0.7794888
[17,] 0.226747326 0.453494653 0.7732527
[18,] 0.180830746 0.361661491 0.8191693
[19,] 0.139620244 0.279240487 0.8603798
[20,] 0.104859710 0.209719421 0.8951403
[21,] 0.080394984 0.160789968 0.9196050
[22,] 0.058445983 0.116891965 0.9415540
[23,] 0.041738187 0.083476374 0.9582618
[24,] 0.119228700 0.238457400 0.8807713
[25,] 0.257458930 0.514917861 0.7425411
[26,] 0.210428599 0.420857197 0.7895714
[27,] 0.244673586 0.489347173 0.7553264
[28,] 0.224043918 0.448087835 0.7759561
[29,] 0.211831366 0.423662731 0.7881686
[30,] 0.278525218 0.557050437 0.7214748
[31,] 0.313953410 0.627906821 0.6860466
[32,] 0.269631307 0.539262615 0.7303687
[33,] 0.225431783 0.450863566 0.7745682
[34,] 0.185765962 0.371531924 0.8142340
[35,] 0.323813034 0.647626068 0.6761870
[36,] 0.280217731 0.560435462 0.7197823
[37,] 0.237218065 0.474436129 0.7627819
[38,] 0.201988726 0.403977452 0.7980113
[39,] 0.197452905 0.394905810 0.8025471
[40,] 0.189752493 0.379504986 0.8102475
[41,] 0.169663676 0.339327352 0.8303363
[42,] 0.140523842 0.281047683 0.8594762
[43,] 0.115788803 0.231577606 0.8842112
[44,] 0.173430201 0.346860402 0.8265698
[45,] 0.142621162 0.285242325 0.8573788
[46,] 0.217521486 0.435042972 0.7824785
[47,] 0.184253009 0.368506018 0.8157470
[48,] 0.153352990 0.306705979 0.8466470
[49,] 0.125219759 0.250439518 0.8747802
[50,] 0.100973435 0.201946871 0.8990266
[51,] 0.084683024 0.169366048 0.9153170
[52,] 0.069439592 0.138879183 0.9305604
[53,] 0.056001542 0.112003083 0.9439985
[54,] 0.043719150 0.087438300 0.9562809
[55,] 0.073674180 0.147348360 0.9263258
[56,] 0.058152568 0.116305135 0.9418474
[57,] 0.044994507 0.089989015 0.9550055
[58,] 0.034419511 0.068839022 0.9655805
[59,] 0.026068547 0.052137094 0.9739315
[60,] 0.019815201 0.039630403 0.9801848
[61,] 0.014647071 0.029294142 0.9853529
[62,] 0.010652090 0.021304180 0.9893479
[63,] 0.007692609 0.015385218 0.9923074
[64,] 0.005509811 0.011019621 0.9944902
[65,] 0.003892205 0.007784409 0.9961078
[66,] 0.011223587 0.022447175 0.9887764
[67,] 0.008236573 0.016473145 0.9917634
[68,] 0.026840604 0.053681208 0.9731594
[69,] 0.020041455 0.040082910 0.9799585
[70,] 0.014768087 0.029536174 0.9852319
[71,] 0.010781748 0.021563496 0.9892183
[72,] 0.007792176 0.015584352 0.9922078
[73,] 0.005657587 0.011315174 0.9943424
[74,] 0.004201897 0.008403794 0.9957981
[75,] 0.002939708 0.005879416 0.9970603
[76,] 0.009502357 0.019004713 0.9904976
[77,] 0.006771659 0.013543318 0.9932283
[78,] 0.004755518 0.009511036 0.9952445
[79,] 0.003382326 0.006764651 0.9966177
[80,] 0.002338660 0.004677321 0.9976613
[81,] 0.001595767 0.003191533 0.9984042
[82,] 0.003369005 0.006738009 0.9966310
[83,] 0.002415262 0.004830524 0.9975847
[84,] 0.001702477 0.003404955 0.9982975
[85,] 0.001353937 0.002707874 0.9986461
[86,] 0.002304298 0.004608597 0.9976957
[87,] 0.007330324 0.014660648 0.9926697
[88,] 0.017113849 0.034227698 0.9828862
[89,] 0.012416011 0.024832022 0.9875840
[90,] 0.009057778 0.018115556 0.9909422
[91,] 0.006876892 0.013753784 0.9931231
[92,] 0.005135398 0.010270796 0.9948646
[93,] 0.003862990 0.007725980 0.9961370
[94,] 0.002955116 0.005910232 0.9970449
[95,] 0.002386459 0.004772919 0.9976135
[96,] 0.002089237 0.004178474 0.9979108
[97,] 0.003006004 0.006012008 0.9969940
[98,] 0.002272064 0.004544128 0.9977279
[99,] 0.001485158 0.002970315 0.9985148
[100,] 0.007481028 0.014962056 0.9925190
[101,] 0.005404003 0.010808007 0.9945960
[102,] 0.014461531 0.028923061 0.9855385
[103,] 0.030339969 0.060679939 0.9696600
[104,] 0.021979454 0.043958907 0.9780205
[105,] 0.031266677 0.062533353 0.9687333
[106,] 0.023133842 0.046267683 0.9768662
[107,] 0.048851790 0.097703580 0.9511482
[108,] 0.092092016 0.184184032 0.9079080
[109,] 0.069305386 0.138610773 0.9306946
[110,] 0.050662357 0.101324715 0.9493376
[111,] 0.046040866 0.092081733 0.9539591
[112,] 0.045635884 0.091271769 0.9543641
[113,] 0.069906062 0.139812124 0.9300939
[114,] 0.054169110 0.108338220 0.9458309
[115,] 0.093526278 0.187052556 0.9064737
[116,] 0.069888534 0.139777067 0.9301115
[117,] 0.048400205 0.096800409 0.9515998
[118,] 0.034025795 0.068051589 0.9659742
[119,] 0.026219219 0.052438437 0.9737808
[120,] 0.021512064 0.043024129 0.9784879
[121,] 0.024821431 0.049642861 0.9751786
[122,] 0.037427801 0.074855601 0.9625722
[123,] 0.027972211 0.055944421 0.9720278
[124,] 0.052952894 0.105905788 0.9470471
[125,] 0.031927232 0.063854463 0.9680728
[126,] 0.018223360 0.036446719 0.9817766
[127,] 0.016830885 0.033661770 0.9831691
[128,] 0.292978749 0.585957498 0.7070213
> postscript(file="/var/fisher/rcomp/tmp/1nw381352145794.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/2fi0k1352145794.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/3s7ut1352145794.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/4d3ou1352145794.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/5c7ve1352145794.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 = 145
Frequency = 1
1 2 3 4 5 6
-0.961174088 -0.002379837 -0.064514133 -0.104994928 -0.150364997 -0.173743802
7 8 9 10 11 12
-0.201237267 -0.192310471 -0.219639099 -0.238617245 -0.110124711 0.975447864
13 14 15 16 17 18
0.012154123 0.035098291 -0.008672103 -0.011532411 -0.025447313 0.958076035
19 20 21 22 23 24
-0.058676165 -0.082629856 -0.090741257 0.909258743 0.137015869 -0.791500429
25 26 27 28 29 30
0.226866365 0.170359751 0.137545269 0.116318166 0.123671152 0.116410185
31 32 33 34 35 36
0.089081557 -0.930770033 1.027323850 0.047791112 -0.746005647 0.290809895
37 38 39 40 41 42
0.307401577 -0.759846303 -0.786410770 0.199949875 0.207302861 0.185225325
43 44 45 46 47 48
-0.885459178 0.045543732 -0.001687721 0.036507653 0.287967361 0.365204224
49 50 51 52 53 54
0.353703116 0.225986920 0.161791515 -0.873562241 0.086518507 -0.923607088
55 56 57 58 59 60
0.059241114 0.039012934 0.018035364 0.010484081 0.221576595 0.267156989
61 62 63 64 65 66
0.268932101 0.200658499 -0.857185847 0.097458854 0.057029294 0.042627093
67 68 69 70 71 72
0.008847148 -0.001443284 -0.018306193 -0.038084965 0.105183355 0.118334095
73 74 75 76 77 78
0.117208114 1.052697805 0.007730079 -1.058543315 -0.054528913 -0.084758634
79 80 81 82 83 84
-0.106112793 -0.111188598 -0.152170036 -0.201315535 -0.078148338 0.929677065
85 86 87 88 89 90
-0.094753475 -0.110566225 -0.149035719 -0.158872424 -0.176149703 0.782068234
91 92 93 94 95 96
-0.252737433 -0.254273463 -0.284728280 0.740701183 -1.097125168 0.943355628
97 98 99 100 101 102
-0.059084964 -0.100476451 -0.117527991 -0.097833915 -0.061114984 -0.034609348
103 104 105 106 107 108
-0.019241685 -0.042308478 0.922761802 -0.057948040 0.110916008 1.149382609
109 110 111 112 113 114
0.163933299 -0.898036159 1.075196756 0.088089724 -0.909086321 0.089663646
115 116 117 118 119 120
-0.930564534 1.053847028 0.023042419 0.020917515 0.132184006 -0.839163087
121 122 123 124 125 126
-0.843015656 0.082498507 1.023389357 -0.041644455 -0.082250730 -0.132797646
127 128 129 130 131 132
-0.157137593 -0.161013172 0.805593138 0.818183761 -0.027317926 -0.985587098
133 134 135 136 137 138
0.028113159 -0.023854758 -0.051758273 -0.074121807 0.933956133 -0.066618754
139 140 141 142 143 144
-0.075469878 -1.061264660 0.940460645 -1.046912267 0.074370536 0.122437652
145
0.150153853
> postscript(file="/var/fisher/rcomp/tmp/6tp2r1352145794.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 = 145
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.961174088 NA
1 -0.002379837 -0.961174088
2 -0.064514133 -0.002379837
3 -0.104994928 -0.064514133
4 -0.150364997 -0.104994928
5 -0.173743802 -0.150364997
6 -0.201237267 -0.173743802
7 -0.192310471 -0.201237267
8 -0.219639099 -0.192310471
9 -0.238617245 -0.219639099
10 -0.110124711 -0.238617245
11 0.975447864 -0.110124711
12 0.012154123 0.975447864
13 0.035098291 0.012154123
14 -0.008672103 0.035098291
15 -0.011532411 -0.008672103
16 -0.025447313 -0.011532411
17 0.958076035 -0.025447313
18 -0.058676165 0.958076035
19 -0.082629856 -0.058676165
20 -0.090741257 -0.082629856
21 0.909258743 -0.090741257
22 0.137015869 0.909258743
23 -0.791500429 0.137015869
24 0.226866365 -0.791500429
25 0.170359751 0.226866365
26 0.137545269 0.170359751
27 0.116318166 0.137545269
28 0.123671152 0.116318166
29 0.116410185 0.123671152
30 0.089081557 0.116410185
31 -0.930770033 0.089081557
32 1.027323850 -0.930770033
33 0.047791112 1.027323850
34 -0.746005647 0.047791112
35 0.290809895 -0.746005647
36 0.307401577 0.290809895
37 -0.759846303 0.307401577
38 -0.786410770 -0.759846303
39 0.199949875 -0.786410770
40 0.207302861 0.199949875
41 0.185225325 0.207302861
42 -0.885459178 0.185225325
43 0.045543732 -0.885459178
44 -0.001687721 0.045543732
45 0.036507653 -0.001687721
46 0.287967361 0.036507653
47 0.365204224 0.287967361
48 0.353703116 0.365204224
49 0.225986920 0.353703116
50 0.161791515 0.225986920
51 -0.873562241 0.161791515
52 0.086518507 -0.873562241
53 -0.923607088 0.086518507
54 0.059241114 -0.923607088
55 0.039012934 0.059241114
56 0.018035364 0.039012934
57 0.010484081 0.018035364
58 0.221576595 0.010484081
59 0.267156989 0.221576595
60 0.268932101 0.267156989
61 0.200658499 0.268932101
62 -0.857185847 0.200658499
63 0.097458854 -0.857185847
64 0.057029294 0.097458854
65 0.042627093 0.057029294
66 0.008847148 0.042627093
67 -0.001443284 0.008847148
68 -0.018306193 -0.001443284
69 -0.038084965 -0.018306193
70 0.105183355 -0.038084965
71 0.118334095 0.105183355
72 0.117208114 0.118334095
73 1.052697805 0.117208114
74 0.007730079 1.052697805
75 -1.058543315 0.007730079
76 -0.054528913 -1.058543315
77 -0.084758634 -0.054528913
78 -0.106112793 -0.084758634
79 -0.111188598 -0.106112793
80 -0.152170036 -0.111188598
81 -0.201315535 -0.152170036
82 -0.078148338 -0.201315535
83 0.929677065 -0.078148338
84 -0.094753475 0.929677065
85 -0.110566225 -0.094753475
86 -0.149035719 -0.110566225
87 -0.158872424 -0.149035719
88 -0.176149703 -0.158872424
89 0.782068234 -0.176149703
90 -0.252737433 0.782068234
91 -0.254273463 -0.252737433
92 -0.284728280 -0.254273463
93 0.740701183 -0.284728280
94 -1.097125168 0.740701183
95 0.943355628 -1.097125168
96 -0.059084964 0.943355628
97 -0.100476451 -0.059084964
98 -0.117527991 -0.100476451
99 -0.097833915 -0.117527991
100 -0.061114984 -0.097833915
101 -0.034609348 -0.061114984
102 -0.019241685 -0.034609348
103 -0.042308478 -0.019241685
104 0.922761802 -0.042308478
105 -0.057948040 0.922761802
106 0.110916008 -0.057948040
107 1.149382609 0.110916008
108 0.163933299 1.149382609
109 -0.898036159 0.163933299
110 1.075196756 -0.898036159
111 0.088089724 1.075196756
112 -0.909086321 0.088089724
113 0.089663646 -0.909086321
114 -0.930564534 0.089663646
115 1.053847028 -0.930564534
116 0.023042419 1.053847028
117 0.020917515 0.023042419
118 0.132184006 0.020917515
119 -0.839163087 0.132184006
120 -0.843015656 -0.839163087
121 0.082498507 -0.843015656
122 1.023389357 0.082498507
123 -0.041644455 1.023389357
124 -0.082250730 -0.041644455
125 -0.132797646 -0.082250730
126 -0.157137593 -0.132797646
127 -0.161013172 -0.157137593
128 0.805593138 -0.161013172
129 0.818183761 0.805593138
130 -0.027317926 0.818183761
131 -0.985587098 -0.027317926
132 0.028113159 -0.985587098
133 -0.023854758 0.028113159
134 -0.051758273 -0.023854758
135 -0.074121807 -0.051758273
136 0.933956133 -0.074121807
137 -0.066618754 0.933956133
138 -0.075469878 -0.066618754
139 -1.061264660 -0.075469878
140 0.940460645 -1.061264660
141 -1.046912267 0.940460645
142 0.074370536 -1.046912267
143 0.122437652 0.074370536
144 0.150153853 0.122437652
145 NA 0.150153853
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.002379837 -0.961174088
[2,] -0.064514133 -0.002379837
[3,] -0.104994928 -0.064514133
[4,] -0.150364997 -0.104994928
[5,] -0.173743802 -0.150364997
[6,] -0.201237267 -0.173743802
[7,] -0.192310471 -0.201237267
[8,] -0.219639099 -0.192310471
[9,] -0.238617245 -0.219639099
[10,] -0.110124711 -0.238617245
[11,] 0.975447864 -0.110124711
[12,] 0.012154123 0.975447864
[13,] 0.035098291 0.012154123
[14,] -0.008672103 0.035098291
[15,] -0.011532411 -0.008672103
[16,] -0.025447313 -0.011532411
[17,] 0.958076035 -0.025447313
[18,] -0.058676165 0.958076035
[19,] -0.082629856 -0.058676165
[20,] -0.090741257 -0.082629856
[21,] 0.909258743 -0.090741257
[22,] 0.137015869 0.909258743
[23,] -0.791500429 0.137015869
[24,] 0.226866365 -0.791500429
[25,] 0.170359751 0.226866365
[26,] 0.137545269 0.170359751
[27,] 0.116318166 0.137545269
[28,] 0.123671152 0.116318166
[29,] 0.116410185 0.123671152
[30,] 0.089081557 0.116410185
[31,] -0.930770033 0.089081557
[32,] 1.027323850 -0.930770033
[33,] 0.047791112 1.027323850
[34,] -0.746005647 0.047791112
[35,] 0.290809895 -0.746005647
[36,] 0.307401577 0.290809895
[37,] -0.759846303 0.307401577
[38,] -0.786410770 -0.759846303
[39,] 0.199949875 -0.786410770
[40,] 0.207302861 0.199949875
[41,] 0.185225325 0.207302861
[42,] -0.885459178 0.185225325
[43,] 0.045543732 -0.885459178
[44,] -0.001687721 0.045543732
[45,] 0.036507653 -0.001687721
[46,] 0.287967361 0.036507653
[47,] 0.365204224 0.287967361
[48,] 0.353703116 0.365204224
[49,] 0.225986920 0.353703116
[50,] 0.161791515 0.225986920
[51,] -0.873562241 0.161791515
[52,] 0.086518507 -0.873562241
[53,] -0.923607088 0.086518507
[54,] 0.059241114 -0.923607088
[55,] 0.039012934 0.059241114
[56,] 0.018035364 0.039012934
[57,] 0.010484081 0.018035364
[58,] 0.221576595 0.010484081
[59,] 0.267156989 0.221576595
[60,] 0.268932101 0.267156989
[61,] 0.200658499 0.268932101
[62,] -0.857185847 0.200658499
[63,] 0.097458854 -0.857185847
[64,] 0.057029294 0.097458854
[65,] 0.042627093 0.057029294
[66,] 0.008847148 0.042627093
[67,] -0.001443284 0.008847148
[68,] -0.018306193 -0.001443284
[69,] -0.038084965 -0.018306193
[70,] 0.105183355 -0.038084965
[71,] 0.118334095 0.105183355
[72,] 0.117208114 0.118334095
[73,] 1.052697805 0.117208114
[74,] 0.007730079 1.052697805
[75,] -1.058543315 0.007730079
[76,] -0.054528913 -1.058543315
[77,] -0.084758634 -0.054528913
[78,] -0.106112793 -0.084758634
[79,] -0.111188598 -0.106112793
[80,] -0.152170036 -0.111188598
[81,] -0.201315535 -0.152170036
[82,] -0.078148338 -0.201315535
[83,] 0.929677065 -0.078148338
[84,] -0.094753475 0.929677065
[85,] -0.110566225 -0.094753475
[86,] -0.149035719 -0.110566225
[87,] -0.158872424 -0.149035719
[88,] -0.176149703 -0.158872424
[89,] 0.782068234 -0.176149703
[90,] -0.252737433 0.782068234
[91,] -0.254273463 -0.252737433
[92,] -0.284728280 -0.254273463
[93,] 0.740701183 -0.284728280
[94,] -1.097125168 0.740701183
[95,] 0.943355628 -1.097125168
[96,] -0.059084964 0.943355628
[97,] -0.100476451 -0.059084964
[98,] -0.117527991 -0.100476451
[99,] -0.097833915 -0.117527991
[100,] -0.061114984 -0.097833915
[101,] -0.034609348 -0.061114984
[102,] -0.019241685 -0.034609348
[103,] -0.042308478 -0.019241685
[104,] 0.922761802 -0.042308478
[105,] -0.057948040 0.922761802
[106,] 0.110916008 -0.057948040
[107,] 1.149382609 0.110916008
[108,] 0.163933299 1.149382609
[109,] -0.898036159 0.163933299
[110,] 1.075196756 -0.898036159
[111,] 0.088089724 1.075196756
[112,] -0.909086321 0.088089724
[113,] 0.089663646 -0.909086321
[114,] -0.930564534 0.089663646
[115,] 1.053847028 -0.930564534
[116,] 0.023042419 1.053847028
[117,] 0.020917515 0.023042419
[118,] 0.132184006 0.020917515
[119,] -0.839163087 0.132184006
[120,] -0.843015656 -0.839163087
[121,] 0.082498507 -0.843015656
[122,] 1.023389357 0.082498507
[123,] -0.041644455 1.023389357
[124,] -0.082250730 -0.041644455
[125,] -0.132797646 -0.082250730
[126,] -0.157137593 -0.132797646
[127,] -0.161013172 -0.157137593
[128,] 0.805593138 -0.161013172
[129,] 0.818183761 0.805593138
[130,] -0.027317926 0.818183761
[131,] -0.985587098 -0.027317926
[132,] 0.028113159 -0.985587098
[133,] -0.023854758 0.028113159
[134,] -0.051758273 -0.023854758
[135,] -0.074121807 -0.051758273
[136,] 0.933956133 -0.074121807
[137,] -0.066618754 0.933956133
[138,] -0.075469878 -0.066618754
[139,] -1.061264660 -0.075469878
[140,] 0.940460645 -1.061264660
[141,] -1.046912267 0.940460645
[142,] 0.074370536 -1.046912267
[143,] 0.122437652 0.074370536
[144,] 0.150153853 0.122437652
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.002379837 -0.961174088
2 -0.064514133 -0.002379837
3 -0.104994928 -0.064514133
4 -0.150364997 -0.104994928
5 -0.173743802 -0.150364997
6 -0.201237267 -0.173743802
7 -0.192310471 -0.201237267
8 -0.219639099 -0.192310471
9 -0.238617245 -0.219639099
10 -0.110124711 -0.238617245
11 0.975447864 -0.110124711
12 0.012154123 0.975447864
13 0.035098291 0.012154123
14 -0.008672103 0.035098291
15 -0.011532411 -0.008672103
16 -0.025447313 -0.011532411
17 0.958076035 -0.025447313
18 -0.058676165 0.958076035
19 -0.082629856 -0.058676165
20 -0.090741257 -0.082629856
21 0.909258743 -0.090741257
22 0.137015869 0.909258743
23 -0.791500429 0.137015869
24 0.226866365 -0.791500429
25 0.170359751 0.226866365
26 0.137545269 0.170359751
27 0.116318166 0.137545269
28 0.123671152 0.116318166
29 0.116410185 0.123671152
30 0.089081557 0.116410185
31 -0.930770033 0.089081557
32 1.027323850 -0.930770033
33 0.047791112 1.027323850
34 -0.746005647 0.047791112
35 0.290809895 -0.746005647
36 0.307401577 0.290809895
37 -0.759846303 0.307401577
38 -0.786410770 -0.759846303
39 0.199949875 -0.786410770
40 0.207302861 0.199949875
41 0.185225325 0.207302861
42 -0.885459178 0.185225325
43 0.045543732 -0.885459178
44 -0.001687721 0.045543732
45 0.036507653 -0.001687721
46 0.287967361 0.036507653
47 0.365204224 0.287967361
48 0.353703116 0.365204224
49 0.225986920 0.353703116
50 0.161791515 0.225986920
51 -0.873562241 0.161791515
52 0.086518507 -0.873562241
53 -0.923607088 0.086518507
54 0.059241114 -0.923607088
55 0.039012934 0.059241114
56 0.018035364 0.039012934
57 0.010484081 0.018035364
58 0.221576595 0.010484081
59 0.267156989 0.221576595
60 0.268932101 0.267156989
61 0.200658499 0.268932101
62 -0.857185847 0.200658499
63 0.097458854 -0.857185847
64 0.057029294 0.097458854
65 0.042627093 0.057029294
66 0.008847148 0.042627093
67 -0.001443284 0.008847148
68 -0.018306193 -0.001443284
69 -0.038084965 -0.018306193
70 0.105183355 -0.038084965
71 0.118334095 0.105183355
72 0.117208114 0.118334095
73 1.052697805 0.117208114
74 0.007730079 1.052697805
75 -1.058543315 0.007730079
76 -0.054528913 -1.058543315
77 -0.084758634 -0.054528913
78 -0.106112793 -0.084758634
79 -0.111188598 -0.106112793
80 -0.152170036 -0.111188598
81 -0.201315535 -0.152170036
82 -0.078148338 -0.201315535
83 0.929677065 -0.078148338
84 -0.094753475 0.929677065
85 -0.110566225 -0.094753475
86 -0.149035719 -0.110566225
87 -0.158872424 -0.149035719
88 -0.176149703 -0.158872424
89 0.782068234 -0.176149703
90 -0.252737433 0.782068234
91 -0.254273463 -0.252737433
92 -0.284728280 -0.254273463
93 0.740701183 -0.284728280
94 -1.097125168 0.740701183
95 0.943355628 -1.097125168
96 -0.059084964 0.943355628
97 -0.100476451 -0.059084964
98 -0.117527991 -0.100476451
99 -0.097833915 -0.117527991
100 -0.061114984 -0.097833915
101 -0.034609348 -0.061114984
102 -0.019241685 -0.034609348
103 -0.042308478 -0.019241685
104 0.922761802 -0.042308478
105 -0.057948040 0.922761802
106 0.110916008 -0.057948040
107 1.149382609 0.110916008
108 0.163933299 1.149382609
109 -0.898036159 0.163933299
110 1.075196756 -0.898036159
111 0.088089724 1.075196756
112 -0.909086321 0.088089724
113 0.089663646 -0.909086321
114 -0.930564534 0.089663646
115 1.053847028 -0.930564534
116 0.023042419 1.053847028
117 0.020917515 0.023042419
118 0.132184006 0.020917515
119 -0.839163087 0.132184006
120 -0.843015656 -0.839163087
121 0.082498507 -0.843015656
122 1.023389357 0.082498507
123 -0.041644455 1.023389357
124 -0.082250730 -0.041644455
125 -0.132797646 -0.082250730
126 -0.157137593 -0.132797646
127 -0.161013172 -0.157137593
128 0.805593138 -0.161013172
129 0.818183761 0.805593138
130 -0.027317926 0.818183761
131 -0.985587098 -0.027317926
132 0.028113159 -0.985587098
133 -0.023854758 0.028113159
134 -0.051758273 -0.023854758
135 -0.074121807 -0.051758273
136 0.933956133 -0.074121807
137 -0.066618754 0.933956133
138 -0.075469878 -0.066618754
139 -1.061264660 -0.075469878
140 0.940460645 -1.061264660
141 -1.046912267 0.940460645
142 0.074370536 -1.046912267
143 0.122437652 0.074370536
144 0.150153853 0.122437652
> 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/7kh4p1352145794.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/84hmq1352145794.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/9lswt1352145794.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/10lqjq1352145794.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/11y6ef1352145794.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/12a4931352145794.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/1388f31352145794.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/14lo691352145794.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/152szc1352145794.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/16m1b71352145794.tab")
+ }
>
> try(system("convert tmp/1nw381352145794.ps tmp/1nw381352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/2fi0k1352145794.ps tmp/2fi0k1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/3s7ut1352145794.ps tmp/3s7ut1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/4d3ou1352145794.ps tmp/4d3ou1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/5c7ve1352145794.ps tmp/5c7ve1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/6tp2r1352145794.ps tmp/6tp2r1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/7kh4p1352145794.ps tmp/7kh4p1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/84hmq1352145794.ps tmp/84hmq1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/9lswt1352145794.ps tmp/9lswt1352145794.png",intern=TRUE))
character(0)
> try(system("convert tmp/10lqjq1352145794.ps tmp/10lqjq1352145794.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.970 1.199 9.172