R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
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(2514
+ ,2550
+ ,1512
+ ,1591
+ ,472
+ ,551
+ ,2537
+ ,2572
+ ,1517
+ ,1595
+ ,476
+ ,554
+ ,2564
+ ,2597
+ ,1525
+ ,1602
+ ,483
+ ,558
+ ,2595
+ ,2623
+ ,1540
+ ,1613
+ ,493
+ ,565
+ ,2617
+ ,2647
+ ,1547
+ ,1622
+ ,498
+ ,568
+ ,2638
+ ,2670
+ ,1547
+ ,1627
+ ,502
+ ,572
+ ,2657
+ ,2690
+ ,1547
+ ,1632
+ ,504
+ ,575
+ ,2668
+ ,2705
+ ,1547
+ ,1634
+ ,503
+ ,574
+ ,2683
+ ,2721
+ ,1546
+ ,1637
+ ,501
+ ,572
+ ,2687
+ ,2729
+ ,1533
+ ,1627
+ ,502
+ ,573
+ ,2705
+ ,2747
+ ,1538
+ ,1632
+ ,502
+ ,572
+ ,2717
+ ,2761
+ ,1543
+ ,1637
+ ,500
+ ,569
+ ,2728
+ ,2773
+ ,1549
+ ,1643
+ ,498
+ ,566
+ ,2741
+ ,2786
+ ,1556
+ ,1650
+ ,495
+ ,560
+ ,2752
+ ,2796
+ ,1559
+ ,1654
+ ,494
+ ,557
+ ,2759
+ ,2807
+ ,1559
+ ,1656
+ ,490
+ ,552
+ ,2767
+ ,2817
+ ,1563
+ ,1661
+ ,484
+ ,545
+ ,2774
+ ,2827
+ ,1563
+ ,1662
+ ,477
+ ,539
+ ,2781
+ ,2838
+ ,1564
+ ,1664
+ ,474
+ ,535
+ ,2788
+ ,2847
+ ,1564
+ ,1665
+ ,469
+ ,531
+ ,2789
+ ,2853
+ ,1557
+ ,1661
+ ,466
+ ,528
+ ,2795
+ ,2860
+ ,1554
+ ,1659
+ ,464
+ ,526
+ ,2798
+ ,2864
+ ,1552
+ ,1656
+ ,460
+ ,523
+ ,2801
+ ,2869
+ ,1552
+ ,1656
+ ,458
+ ,521
+ ,2803
+ ,2873
+ ,1551
+ ,1655
+ ,457
+ ,519
+ ,2808
+ ,2877
+ ,1552
+ ,1654
+ ,456
+ ,517
+ ,2813
+ ,2883
+ ,1554
+ ,1656
+ ,455
+ ,515
+ ,2826
+ ,2896
+ ,1567
+ ,1668
+ ,456
+ ,514
+ ,2835
+ ,2905
+ ,1572
+ ,1672
+ ,453
+ ,511
+ ,2849
+ ,2919
+ ,1579
+ ,1680
+ ,453
+ ,508
+ ,2862
+ ,2933
+ ,1588
+ ,1688
+ ,449
+ ,502
+ ,2877
+ ,2948
+ ,1597
+ ,1696
+ ,449
+ ,501
+ ,2888
+ ,2959
+ ,1603
+ ,1702
+ ,449
+ ,500
+ ,2897
+ ,2969
+ ,1607
+ ,1706
+ ,452
+ ,500
+ ,2902
+ ,2978
+ ,1607
+ ,1708
+ ,450
+ ,498
+ ,2911
+ ,2988
+ ,1609
+ ,1711
+ ,452
+ ,499
+ ,2917
+ ,2996
+ ,1612
+ ,1714
+ ,454
+ ,499
+ ,2924
+ ,3003
+ ,1615
+ ,1717
+ ,455
+ ,500
+ ,2930
+ ,3011
+ ,1619
+ ,1721
+ ,458
+ ,501
+ ,2935
+ ,3018
+ ,1622
+ ,1724
+ ,461
+ ,503
+ ,2945
+ ,3028
+ ,1628
+ ,1730
+ ,469
+ ,510
+ ,2957
+ ,3038
+ ,1634
+ ,1735
+ ,477
+ ,515
+ ,2967
+ ,3049
+ ,1640
+ ,1740
+ ,480
+ ,520
+ ,2980
+ ,3063
+ ,1648
+ ,1748
+ ,484
+ ,523
+ ,2997
+ ,3081
+ ,1657
+ ,1757
+ ,490
+ ,529
+ ,3017
+ ,3100
+ ,1668
+ ,1768
+ ,497
+ ,534
+ ,3040
+ ,3122
+ ,1678
+ ,1778
+ ,506
+ ,543
+ ,3064
+ ,3145
+ ,1687
+ ,1789
+ ,516
+ ,553
+ ,3085
+ ,3167
+ ,1700
+ ,1798
+ ,527
+ ,563
+ ,3113
+ ,3193
+ ,1714
+ ,1811
+ ,542
+ ,577)
+ ,dim=c(6
+ ,50)
+ ,dimnames=list(c('Vlaamsm'
+ ,'Vlaamsvr'
+ ,'Waalsm'
+ ,'Waalsvr'
+ ,'Brusselm'
+ ,'Brusselvr')
+ ,1:50))
> y <- array(NA,dim=c(6,50),dimnames=list(c('Vlaamsm','Vlaamsvr','Waalsm','Waalsvr','Brusselm','Brusselvr'),1:50))
> 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 = '3'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '3'
> #'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
Waalsm Vlaamsm Vlaamsvr Waalsvr Brusselm Brusselvr
1 1512 2514 2550 1591 472 551
2 1517 2537 2572 1595 476 554
3 1525 2564 2597 1602 483 558
4 1540 2595 2623 1613 493 565
5 1547 2617 2647 1622 498 568
6 1547 2638 2670 1627 502 572
7 1547 2657 2690 1632 504 575
8 1547 2668 2705 1634 503 574
9 1546 2683 2721 1637 501 572
10 1533 2687 2729 1627 502 573
11 1538 2705 2747 1632 502 572
12 1543 2717 2761 1637 500 569
13 1549 2728 2773 1643 498 566
14 1556 2741 2786 1650 495 560
15 1559 2752 2796 1654 494 557
16 1559 2759 2807 1656 490 552
17 1563 2767 2817 1661 484 545
18 1563 2774 2827 1662 477 539
19 1564 2781 2838 1664 474 535
20 1564 2788 2847 1665 469 531
21 1557 2789 2853 1661 466 528
22 1554 2795 2860 1659 464 526
23 1552 2798 2864 1656 460 523
24 1552 2801 2869 1656 458 521
25 1551 2803 2873 1655 457 519
26 1552 2808 2877 1654 456 517
27 1554 2813 2883 1656 455 515
28 1567 2826 2896 1668 456 514
29 1572 2835 2905 1672 453 511
30 1579 2849 2919 1680 453 508
31 1588 2862 2933 1688 449 502
32 1597 2877 2948 1696 449 501
33 1603 2888 2959 1702 449 500
34 1607 2897 2969 1706 452 500
35 1607 2902 2978 1708 450 498
36 1609 2911 2988 1711 452 499
37 1612 2917 2996 1714 454 499
38 1615 2924 3003 1717 455 500
39 1619 2930 3011 1721 458 501
40 1622 2935 3018 1724 461 503
41 1628 2945 3028 1730 469 510
42 1634 2957 3038 1735 477 515
43 1640 2967 3049 1740 480 520
44 1648 2980 3063 1748 484 523
45 1657 2997 3081 1757 490 529
46 1668 3017 3100 1768 497 534
47 1678 3040 3122 1778 506 543
48 1687 3064 3145 1789 516 553
49 1700 3085 3167 1798 527 563
50 1714 3113 3193 1811 542 577
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Vlaamsm Vlaamsvr Waalsvr Brusselm Brusselvr
-130.33984 0.03498 -0.20643 1.33218 0.33489 -0.35239
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.7399 -1.4688 -0.1194 1.4811 6.2085
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -130.33984 94.59758 -1.378 0.1752
Vlaamsm 0.03498 0.12758 0.274 0.7852
Vlaamsvr -0.20643 0.11476 -1.799 0.0789 .
Waalsvr 1.33218 0.07182 18.550 <2e-16 ***
Brusselm 0.33489 0.23696 1.413 0.1646
Brusselvr -0.35239 0.21137 -1.667 0.1026
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.639 on 44 degrees of freedom
Multiple R-squared: 0.9975, Adjusted R-squared: 0.9972
F-statistic: 3466 on 5 and 44 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.3682156 0.7364312915 0.6317843543
[2,] 0.3030028 0.6060056927 0.6969971537
[3,] 0.1939502 0.3879003864 0.8060498068
[4,] 0.1636525 0.3273050461 0.8363474769
[5,] 0.1610938 0.3221875283 0.8389062358
[6,] 0.5727050 0.8545899214 0.4272949607
[7,] 0.8642373 0.2715253066 0.1357626533
[8,] 0.8240043 0.3519914132 0.1759957066
[9,] 0.7497665 0.5004669141 0.2502334570
[10,] 0.7740212 0.4519576684 0.2259788342
[11,] 0.8749822 0.2500356570 0.1250178285
[12,] 0.9313954 0.1372092186 0.0686046093
[13,] 0.9451518 0.1096963395 0.0548481698
[14,] 0.9589244 0.0821512906 0.0410756453
[15,] 0.9798285 0.0403430324 0.0201715162
[16,] 0.9921305 0.0157390053 0.0078695026
[17,] 0.9977694 0.0044612145 0.0022306072
[18,] 0.9965204 0.0069591593 0.0034795796
[19,] 0.9942046 0.0115908937 0.0057954468
[20,] 0.9966848 0.0066303827 0.0033151913
[21,] 0.9979115 0.0041770181 0.0020885091
[22,] 0.9987091 0.0025817032 0.0012908516
[23,] 0.9994828 0.0010344836 0.0005172418
[24,] 0.9995274 0.0009452171 0.0004726085
[25,] 0.9989817 0.0020366475 0.0010183238
[26,] 0.9984928 0.0030143494 0.0015071747
[27,] 0.9968326 0.0063348747 0.0031674373
[28,] 0.9918653 0.0162693081 0.0081346541
[29,] 0.9799995 0.0400010069 0.0200005034
[30,] 0.9670315 0.0659370794 0.0329685397
[31,] 0.9785535 0.0428929501 0.0214464750
[32,] 0.9708568 0.0582863687 0.0291431844
[33,] 0.9175892 0.1648216058 0.0824108029
> postscript(file="/var/wessaorg/rcomp/tmp/1la1m1351950886.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/wessaorg/rcomp/tmp/2rp7q1351950886.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/wessaorg/rcomp/tmp/3a7231351950886.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/wessaorg/rcomp/tmp/4thgp1351950886.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/wessaorg/rcomp/tmp/5az5q1351950886.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 = 50
Frequency = 1
1 2 3 4 5 6
-2.61987017 0.50583330 2.46205464 6.20853078 4.78626382 2.20857240
7 8 9 10 11 12
-0.60105084 -0.57129008 -2.82472037 -0.97386528 0.09885206 0.52075242
13 14 15 16 17 18
0.23259128 -0.97357522 -2.34511868 -3.40603454 -4.73991961 -4.02279873
19 20 21 22 23 24
-4.06621450 -3.52052384 -4.04068652 -3.17620903 -0.17649441 0.71570501
25 26 27 28 29 30
1.43375179 4.04684619 4.07624687 2.63154785 3.79332464 1.47891985
31 32 33 34 35 36
1.48189011 2.04371415 1.58412279 1.00015666 -0.01626026 -0.58075907
37 38 39 40 41 42
-0.80555757 -0.58448812 -1.12397136 -1.15032475 -1.64136165 -1.57496455
43 44 45 46 47 48
0.44228719 -0.06235055 0.17400342 -0.83981676 -0.26733056 -1.83808283
49 50
2.81916536 3.79850726
> postscript(file="/var/wessaorg/rcomp/tmp/6m5911351950886.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 = 50
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.61987017 NA
1 0.50583330 -2.61987017
2 2.46205464 0.50583330
3 6.20853078 2.46205464
4 4.78626382 6.20853078
5 2.20857240 4.78626382
6 -0.60105084 2.20857240
7 -0.57129008 -0.60105084
8 -2.82472037 -0.57129008
9 -0.97386528 -2.82472037
10 0.09885206 -0.97386528
11 0.52075242 0.09885206
12 0.23259128 0.52075242
13 -0.97357522 0.23259128
14 -2.34511868 -0.97357522
15 -3.40603454 -2.34511868
16 -4.73991961 -3.40603454
17 -4.02279873 -4.73991961
18 -4.06621450 -4.02279873
19 -3.52052384 -4.06621450
20 -4.04068652 -3.52052384
21 -3.17620903 -4.04068652
22 -0.17649441 -3.17620903
23 0.71570501 -0.17649441
24 1.43375179 0.71570501
25 4.04684619 1.43375179
26 4.07624687 4.04684619
27 2.63154785 4.07624687
28 3.79332464 2.63154785
29 1.47891985 3.79332464
30 1.48189011 1.47891985
31 2.04371415 1.48189011
32 1.58412279 2.04371415
33 1.00015666 1.58412279
34 -0.01626026 1.00015666
35 -0.58075907 -0.01626026
36 -0.80555757 -0.58075907
37 -0.58448812 -0.80555757
38 -1.12397136 -0.58448812
39 -1.15032475 -1.12397136
40 -1.64136165 -1.15032475
41 -1.57496455 -1.64136165
42 0.44228719 -1.57496455
43 -0.06235055 0.44228719
44 0.17400342 -0.06235055
45 -0.83981676 0.17400342
46 -0.26733056 -0.83981676
47 -1.83808283 -0.26733056
48 2.81916536 -1.83808283
49 3.79850726 2.81916536
50 NA 3.79850726
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.50583330 -2.61987017
[2,] 2.46205464 0.50583330
[3,] 6.20853078 2.46205464
[4,] 4.78626382 6.20853078
[5,] 2.20857240 4.78626382
[6,] -0.60105084 2.20857240
[7,] -0.57129008 -0.60105084
[8,] -2.82472037 -0.57129008
[9,] -0.97386528 -2.82472037
[10,] 0.09885206 -0.97386528
[11,] 0.52075242 0.09885206
[12,] 0.23259128 0.52075242
[13,] -0.97357522 0.23259128
[14,] -2.34511868 -0.97357522
[15,] -3.40603454 -2.34511868
[16,] -4.73991961 -3.40603454
[17,] -4.02279873 -4.73991961
[18,] -4.06621450 -4.02279873
[19,] -3.52052384 -4.06621450
[20,] -4.04068652 -3.52052384
[21,] -3.17620903 -4.04068652
[22,] -0.17649441 -3.17620903
[23,] 0.71570501 -0.17649441
[24,] 1.43375179 0.71570501
[25,] 4.04684619 1.43375179
[26,] 4.07624687 4.04684619
[27,] 2.63154785 4.07624687
[28,] 3.79332464 2.63154785
[29,] 1.47891985 3.79332464
[30,] 1.48189011 1.47891985
[31,] 2.04371415 1.48189011
[32,] 1.58412279 2.04371415
[33,] 1.00015666 1.58412279
[34,] -0.01626026 1.00015666
[35,] -0.58075907 -0.01626026
[36,] -0.80555757 -0.58075907
[37,] -0.58448812 -0.80555757
[38,] -1.12397136 -0.58448812
[39,] -1.15032475 -1.12397136
[40,] -1.64136165 -1.15032475
[41,] -1.57496455 -1.64136165
[42,] 0.44228719 -1.57496455
[43,] -0.06235055 0.44228719
[44,] 0.17400342 -0.06235055
[45,] -0.83981676 0.17400342
[46,] -0.26733056 -0.83981676
[47,] -1.83808283 -0.26733056
[48,] 2.81916536 -1.83808283
[49,] 3.79850726 2.81916536
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.50583330 -2.61987017
2 2.46205464 0.50583330
3 6.20853078 2.46205464
4 4.78626382 6.20853078
5 2.20857240 4.78626382
6 -0.60105084 2.20857240
7 -0.57129008 -0.60105084
8 -2.82472037 -0.57129008
9 -0.97386528 -2.82472037
10 0.09885206 -0.97386528
11 0.52075242 0.09885206
12 0.23259128 0.52075242
13 -0.97357522 0.23259128
14 -2.34511868 -0.97357522
15 -3.40603454 -2.34511868
16 -4.73991961 -3.40603454
17 -4.02279873 -4.73991961
18 -4.06621450 -4.02279873
19 -3.52052384 -4.06621450
20 -4.04068652 -3.52052384
21 -3.17620903 -4.04068652
22 -0.17649441 -3.17620903
23 0.71570501 -0.17649441
24 1.43375179 0.71570501
25 4.04684619 1.43375179
26 4.07624687 4.04684619
27 2.63154785 4.07624687
28 3.79332464 2.63154785
29 1.47891985 3.79332464
30 1.48189011 1.47891985
31 2.04371415 1.48189011
32 1.58412279 2.04371415
33 1.00015666 1.58412279
34 -0.01626026 1.00015666
35 -0.58075907 -0.01626026
36 -0.80555757 -0.58075907
37 -0.58448812 -0.80555757
38 -1.12397136 -0.58448812
39 -1.15032475 -1.12397136
40 -1.64136165 -1.15032475
41 -1.57496455 -1.64136165
42 0.44228719 -1.57496455
43 -0.06235055 0.44228719
44 0.17400342 -0.06235055
45 -0.83981676 0.17400342
46 -0.26733056 -0.83981676
47 -1.83808283 -0.26733056
48 2.81916536 -1.83808283
49 3.79850726 2.81916536
> 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/wessaorg/rcomp/tmp/7htdj1351950886.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/wessaorg/rcomp/tmp/84gib1351950886.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/wessaorg/rcomp/tmp/9yrc71351950886.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/wessaorg/rcomp/tmp/10scnr1351950886.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11k6by1351950886.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/wessaorg/rcomp/tmp/12zxec1351950886.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/wessaorg/rcomp/tmp/13suu71351950887.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/wessaorg/rcomp/tmp/14nh891351950887.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/wessaorg/rcomp/tmp/15mzcy1351950887.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/wessaorg/rcomp/tmp/16ugr11351950887.tab")
+ }
>
> try(system("convert tmp/1la1m1351950886.ps tmp/1la1m1351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/2rp7q1351950886.ps tmp/2rp7q1351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/3a7231351950886.ps tmp/3a7231351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/4thgp1351950886.ps tmp/4thgp1351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/5az5q1351950886.ps tmp/5az5q1351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/6m5911351950886.ps tmp/6m5911351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/7htdj1351950886.ps tmp/7htdj1351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/84gib1351950886.ps tmp/84gib1351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/9yrc71351950886.ps tmp/9yrc71351950886.png",intern=TRUE))
character(0)
> try(system("convert tmp/10scnr1351950886.ps tmp/10scnr1351950886.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.808 1.109 7.255