R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(124.9,1487.6,132,1320.9,151.4,1514,108.9,1290.9,121.3,1392.5,123.4,1288.2,90.3,1304.4,79.3,1297.8,117.2,1211,116.9,1454,120.8,1405.7,96.1,1160.8,100.8,1492.1,105.3,1263,116.1,1376.3,112.8,1368.6,114.5,1427.6,117.2,1339.8,77.1,1248.3,80.1,1309.8,120.3,1424,133.4,1590.5,109.4,1423.1,93.2,1355.3,91.2,1515,99.2,1385.6,108.2,1430,101.5,1494.2,106.9,1580.9,104.4,1369.8,77.9,1407.5,60,1388.3,99.5,1478.5,95,1630.4,105.6,1413.5,102.5,1493.8,93.3,1641.3,97.3,1465,127,1725.1,111.7,1628.4,96.4,1679.8,133,1876,72.2,1669.4,95.8,1712.4,124.1,1768.8,127.6,1820.5,110.7,1776.2,104.6,1693.7,112.7,1799.1,115.3,1917.5,139.4,1887.2,119,1787.8,97.4,1803.8,154,2196.4,81.5,1759.5,88.8,2002.6,127.7,2056.8,105.1,1851.1,114.9,1984.3,106.4,1725.3,104.5,2096.6,121.6,1792.2,141.4,2029.9,99,1785.3,126.7,2026.5,134.1,1930.8,81.3,1845.5,88.6,1943.1,132.7,2066.8,132.9,2354.4,134.4,2190.7,103.7,1929.6),dim=c(2,72),dimnames=list(c('transport','Import'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('transport','Import'),1:72))
> 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'
> #'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.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
transport Import
1 124.9 1487.6
2 132.0 1320.9
3 151.4 1514.0
4 108.9 1290.9
5 121.3 1392.5
6 123.4 1288.2
7 90.3 1304.4
8 79.3 1297.8
9 117.2 1211.0
10 116.9 1454.0
11 120.8 1405.7
12 96.1 1160.8
13 100.8 1492.1
14 105.3 1263.0
15 116.1 1376.3
16 112.8 1368.6
17 114.5 1427.6
18 117.2 1339.8
19 77.1 1248.3
20 80.1 1309.8
21 120.3 1424.0
22 133.4 1590.5
23 109.4 1423.1
24 93.2 1355.3
25 91.2 1515.0
26 99.2 1385.6
27 108.2 1430.0
28 101.5 1494.2
29 106.9 1580.9
30 104.4 1369.8
31 77.9 1407.5
32 60.0 1388.3
33 99.5 1478.5
34 95.0 1630.4
35 105.6 1413.5
36 102.5 1493.8
37 93.3 1641.3
38 97.3 1465.0
39 127.0 1725.1
40 111.7 1628.4
41 96.4 1679.8
42 133.0 1876.0
43 72.2 1669.4
44 95.8 1712.4
45 124.1 1768.8
46 127.6 1820.5
47 110.7 1776.2
48 104.6 1693.7
49 112.7 1799.1
50 115.3 1917.5
51 139.4 1887.2
52 119.0 1787.8
53 97.4 1803.8
54 154.0 2196.4
55 81.5 1759.5
56 88.8 2002.6
57 127.7 2056.8
58 105.1 1851.1
59 114.9 1984.3
60 106.4 1725.3
61 104.5 2096.6
62 121.6 1792.2
63 141.4 2029.9
64 99.0 1785.3
65 126.7 2026.5
66 134.1 1930.8
67 81.3 1845.5
68 88.6 1943.1
69 132.7 2066.8
70 132.9 2354.4
71 134.4 2190.7
72 103.7 1929.6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Import
68.43848 0.02504
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-43.2051 -13.3217 0.4329 12.6765 45.0471
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 68.438484 12.493067 5.478 6.35e-07 ***
Import 0.025043 0.007544 3.320 0.00143 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 17.75 on 70 degrees of freedom
Multiple R-squared: 0.136, Adjusted R-squared: 0.1237
F-statistic: 11.02 on 1 and 70 DF, p-value: 0.001434
> 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.4038708 0.8077415 0.5961292
[2,] 0.2828558 0.5657115 0.7171442
[3,] 0.5171908 0.9656185 0.4828092
[4,] 0.7257439 0.5485122 0.2742561
[5,] 0.7605344 0.4789313 0.2394656
[6,] 0.7123603 0.5752793 0.2876397
[7,] 0.6404085 0.7191831 0.3595915
[8,] 0.5445861 0.9108278 0.4554139
[9,] 0.6467122 0.7065755 0.3532878
[10,] 0.5667719 0.8664563 0.4332281
[11,] 0.5006061 0.9987878 0.4993939
[12,] 0.4338467 0.8676934 0.5661533
[13,] 0.3766139 0.7532279 0.6233861
[14,] 0.3441895 0.6883789 0.6558105
[15,] 0.4482020 0.8964040 0.5517980
[16,] 0.5403742 0.9192515 0.4596258
[17,] 0.5130975 0.9738051 0.4869025
[18,] 0.5238201 0.9523598 0.4761799
[19,] 0.4877125 0.9754249 0.5122875
[20,] 0.4762709 0.9525417 0.5237291
[21,] 0.5998283 0.8003433 0.4001717
[22,] 0.5605066 0.8789867 0.4394934
[23,] 0.5232311 0.9535379 0.4767689
[24,] 0.5046310 0.9907381 0.4953690
[25,] 0.4797898 0.9595796 0.5202102
[26,] 0.4504016 0.9008033 0.5495984
[27,] 0.5434896 0.9130209 0.4565104
[28,] 0.8076293 0.3847414 0.1923707
[29,] 0.7717533 0.4564934 0.2282467
[30,] 0.7626506 0.4746988 0.2373494
[31,] 0.7316088 0.5367824 0.2683912
[32,] 0.6882790 0.6234419 0.3117210
[33,] 0.6672623 0.6654753 0.3327377
[34,] 0.6178618 0.7642763 0.3821382
[35,] 0.6334817 0.7330366 0.3665183
[36,] 0.5985937 0.8028126 0.4014063
[37,] 0.5571386 0.8857228 0.4428614
[38,] 0.5690041 0.8619919 0.4309959
[39,] 0.7273244 0.5453512 0.2726756
[40,] 0.6881809 0.6236382 0.3118191
[41,] 0.6802865 0.6394269 0.3197135
[42,] 0.6832516 0.6334968 0.3167484
[43,] 0.6227020 0.7545959 0.3772980
[44,] 0.5615190 0.8769621 0.4384810
[45,] 0.4984623 0.9969246 0.5015377
[46,] 0.4247629 0.8495258 0.5752371
[47,] 0.5428388 0.9143223 0.4571612
[48,] 0.5346336 0.9307327 0.4653664
[49,] 0.4788831 0.9577661 0.5211169
[50,] 0.5521821 0.8956357 0.4478179
[51,] 0.6064593 0.7870815 0.3935407
[52,] 0.7424808 0.5150384 0.2575192
[53,] 0.6780467 0.6439066 0.3219533
[54,] 0.5984285 0.8031429 0.4015715
[55,] 0.5057690 0.9884619 0.4942310
[56,] 0.4204399 0.8408798 0.5795601
[57,] 0.4305526 0.8611051 0.5694474
[58,] 0.4438011 0.8876022 0.5561989
[59,] 0.5251753 0.9496495 0.4748247
[60,] 0.4154853 0.8309706 0.5845147
[61,] 0.3364630 0.6729260 0.6635370
[62,] 0.6334514 0.7330972 0.3665486
[63,] 0.5522589 0.8954821 0.4477411
> postscript(file="/var/www/html/rcomp/tmp/19ies1229556775.ps",horizontal=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/www/html/rcomp/tmp/2ymt31229556775.ps",horizontal=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/www/html/rcomp/tmp/3n07s1229556775.ps",horizontal=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/www/html/rcomp/tmp/411s41229556775.ps",horizontal=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/www/html/rcomp/tmp/55wle1229556775.ps",horizontal=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 = 72
Frequency = 1
1 2 3 4 5 6
19.2082215 30.4828142 45.0470983 8.1340907 17.9897678 22.7017055
7 8 9 10 11 12
-10.8039837 -21.6387029 18.4349902 12.0496511 17.1592062 -1.4078739
13 14 15 16 17 18
-5.0044699 5.2327777 13.1954571 10.0882847 10.3107744 15.2095101
19 20 21 22 23 24
-22.5990968 -21.1392135 16.2009276 25.1313434 5.3234658 -9.1786494
25 26 27 28 29 30
-15.1779443 -3.9374386 3.9506723 -4.3570593 -1.1282482 1.6582336
31 32 33 34 35 36
-25.7858704 -43.2050535 -5.9638913 -14.2678543 1.7638743 -3.3470423
37 38 39 40 41 42
-16.2408181 -7.8258169 15.3606164 2.4822308 -14.1049562 17.5816960
43 44 45 46 47 48
-38.0445137 -15.5213432 11.3662571 13.5715574 -2.2190578 -6.2530476
49 50 51 52 53 54
-0.7925321 -1.1575698 23.7012194 5.7904487 -16.2102321 30.5580637
55 56 57 58 59 60
-31.0008472 -29.7886906 7.7540033 -9.6947446 -3.2304119 -5.2443921
61 62 63 64 65 66
-16.4426901 8.2802615 22.1276479 -14.1469449 7.5127925 17.3093644
67 68 69 70 71 72
-33.3545063 -28.4986590 12.5035779 5.5013411 11.1008062 -13.0605846
> postscript(file="/var/www/html/rcomp/tmp/6sbpe1229556775.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 19.2082215 NA
1 30.4828142 19.2082215
2 45.0470983 30.4828142
3 8.1340907 45.0470983
4 17.9897678 8.1340907
5 22.7017055 17.9897678
6 -10.8039837 22.7017055
7 -21.6387029 -10.8039837
8 18.4349902 -21.6387029
9 12.0496511 18.4349902
10 17.1592062 12.0496511
11 -1.4078739 17.1592062
12 -5.0044699 -1.4078739
13 5.2327777 -5.0044699
14 13.1954571 5.2327777
15 10.0882847 13.1954571
16 10.3107744 10.0882847
17 15.2095101 10.3107744
18 -22.5990968 15.2095101
19 -21.1392135 -22.5990968
20 16.2009276 -21.1392135
21 25.1313434 16.2009276
22 5.3234658 25.1313434
23 -9.1786494 5.3234658
24 -15.1779443 -9.1786494
25 -3.9374386 -15.1779443
26 3.9506723 -3.9374386
27 -4.3570593 3.9506723
28 -1.1282482 -4.3570593
29 1.6582336 -1.1282482
30 -25.7858704 1.6582336
31 -43.2050535 -25.7858704
32 -5.9638913 -43.2050535
33 -14.2678543 -5.9638913
34 1.7638743 -14.2678543
35 -3.3470423 1.7638743
36 -16.2408181 -3.3470423
37 -7.8258169 -16.2408181
38 15.3606164 -7.8258169
39 2.4822308 15.3606164
40 -14.1049562 2.4822308
41 17.5816960 -14.1049562
42 -38.0445137 17.5816960
43 -15.5213432 -38.0445137
44 11.3662571 -15.5213432
45 13.5715574 11.3662571
46 -2.2190578 13.5715574
47 -6.2530476 -2.2190578
48 -0.7925321 -6.2530476
49 -1.1575698 -0.7925321
50 23.7012194 -1.1575698
51 5.7904487 23.7012194
52 -16.2102321 5.7904487
53 30.5580637 -16.2102321
54 -31.0008472 30.5580637
55 -29.7886906 -31.0008472
56 7.7540033 -29.7886906
57 -9.6947446 7.7540033
58 -3.2304119 -9.6947446
59 -5.2443921 -3.2304119
60 -16.4426901 -5.2443921
61 8.2802615 -16.4426901
62 22.1276479 8.2802615
63 -14.1469449 22.1276479
64 7.5127925 -14.1469449
65 17.3093644 7.5127925
66 -33.3545063 17.3093644
67 -28.4986590 -33.3545063
68 12.5035779 -28.4986590
69 5.5013411 12.5035779
70 11.1008062 5.5013411
71 -13.0605846 11.1008062
72 NA -13.0605846
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 30.4828142 19.2082215
[2,] 45.0470983 30.4828142
[3,] 8.1340907 45.0470983
[4,] 17.9897678 8.1340907
[5,] 22.7017055 17.9897678
[6,] -10.8039837 22.7017055
[7,] -21.6387029 -10.8039837
[8,] 18.4349902 -21.6387029
[9,] 12.0496511 18.4349902
[10,] 17.1592062 12.0496511
[11,] -1.4078739 17.1592062
[12,] -5.0044699 -1.4078739
[13,] 5.2327777 -5.0044699
[14,] 13.1954571 5.2327777
[15,] 10.0882847 13.1954571
[16,] 10.3107744 10.0882847
[17,] 15.2095101 10.3107744
[18,] -22.5990968 15.2095101
[19,] -21.1392135 -22.5990968
[20,] 16.2009276 -21.1392135
[21,] 25.1313434 16.2009276
[22,] 5.3234658 25.1313434
[23,] -9.1786494 5.3234658
[24,] -15.1779443 -9.1786494
[25,] -3.9374386 -15.1779443
[26,] 3.9506723 -3.9374386
[27,] -4.3570593 3.9506723
[28,] -1.1282482 -4.3570593
[29,] 1.6582336 -1.1282482
[30,] -25.7858704 1.6582336
[31,] -43.2050535 -25.7858704
[32,] -5.9638913 -43.2050535
[33,] -14.2678543 -5.9638913
[34,] 1.7638743 -14.2678543
[35,] -3.3470423 1.7638743
[36,] -16.2408181 -3.3470423
[37,] -7.8258169 -16.2408181
[38,] 15.3606164 -7.8258169
[39,] 2.4822308 15.3606164
[40,] -14.1049562 2.4822308
[41,] 17.5816960 -14.1049562
[42,] -38.0445137 17.5816960
[43,] -15.5213432 -38.0445137
[44,] 11.3662571 -15.5213432
[45,] 13.5715574 11.3662571
[46,] -2.2190578 13.5715574
[47,] -6.2530476 -2.2190578
[48,] -0.7925321 -6.2530476
[49,] -1.1575698 -0.7925321
[50,] 23.7012194 -1.1575698
[51,] 5.7904487 23.7012194
[52,] -16.2102321 5.7904487
[53,] 30.5580637 -16.2102321
[54,] -31.0008472 30.5580637
[55,] -29.7886906 -31.0008472
[56,] 7.7540033 -29.7886906
[57,] -9.6947446 7.7540033
[58,] -3.2304119 -9.6947446
[59,] -5.2443921 -3.2304119
[60,] -16.4426901 -5.2443921
[61,] 8.2802615 -16.4426901
[62,] 22.1276479 8.2802615
[63,] -14.1469449 22.1276479
[64,] 7.5127925 -14.1469449
[65,] 17.3093644 7.5127925
[66,] -33.3545063 17.3093644
[67,] -28.4986590 -33.3545063
[68,] 12.5035779 -28.4986590
[69,] 5.5013411 12.5035779
[70,] 11.1008062 5.5013411
[71,] -13.0605846 11.1008062
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 30.4828142 19.2082215
2 45.0470983 30.4828142
3 8.1340907 45.0470983
4 17.9897678 8.1340907
5 22.7017055 17.9897678
6 -10.8039837 22.7017055
7 -21.6387029 -10.8039837
8 18.4349902 -21.6387029
9 12.0496511 18.4349902
10 17.1592062 12.0496511
11 -1.4078739 17.1592062
12 -5.0044699 -1.4078739
13 5.2327777 -5.0044699
14 13.1954571 5.2327777
15 10.0882847 13.1954571
16 10.3107744 10.0882847
17 15.2095101 10.3107744
18 -22.5990968 15.2095101
19 -21.1392135 -22.5990968
20 16.2009276 -21.1392135
21 25.1313434 16.2009276
22 5.3234658 25.1313434
23 -9.1786494 5.3234658
24 -15.1779443 -9.1786494
25 -3.9374386 -15.1779443
26 3.9506723 -3.9374386
27 -4.3570593 3.9506723
28 -1.1282482 -4.3570593
29 1.6582336 -1.1282482
30 -25.7858704 1.6582336
31 -43.2050535 -25.7858704
32 -5.9638913 -43.2050535
33 -14.2678543 -5.9638913
34 1.7638743 -14.2678543
35 -3.3470423 1.7638743
36 -16.2408181 -3.3470423
37 -7.8258169 -16.2408181
38 15.3606164 -7.8258169
39 2.4822308 15.3606164
40 -14.1049562 2.4822308
41 17.5816960 -14.1049562
42 -38.0445137 17.5816960
43 -15.5213432 -38.0445137
44 11.3662571 -15.5213432
45 13.5715574 11.3662571
46 -2.2190578 13.5715574
47 -6.2530476 -2.2190578
48 -0.7925321 -6.2530476
49 -1.1575698 -0.7925321
50 23.7012194 -1.1575698
51 5.7904487 23.7012194
52 -16.2102321 5.7904487
53 30.5580637 -16.2102321
54 -31.0008472 30.5580637
55 -29.7886906 -31.0008472
56 7.7540033 -29.7886906
57 -9.6947446 7.7540033
58 -3.2304119 -9.6947446
59 -5.2443921 -3.2304119
60 -16.4426901 -5.2443921
61 8.2802615 -16.4426901
62 22.1276479 8.2802615
63 -14.1469449 22.1276479
64 7.5127925 -14.1469449
65 17.3093644 7.5127925
66 -33.3545063 17.3093644
67 -28.4986590 -33.3545063
68 12.5035779 -28.4986590
69 5.5013411 12.5035779
70 11.1008062 5.5013411
71 -13.0605846 11.1008062
> 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/www/html/rcomp/tmp/7ee7r1229556775.ps",horizontal=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/www/html/rcomp/tmp/82uo11229556775.ps",horizontal=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/www/html/rcomp/tmp/9yz821229556775.ps",horizontal=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/www/html/rcomp/tmp/10vvtr1229556775.ps",horizontal=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/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/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/www/html/rcomp/tmp/11a0az1229556775.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/www/html/rcomp/tmp/1236cn1229556775.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/www/html/rcomp/tmp/13pj5p1229556775.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/www/html/rcomp/tmp/14rm1c1229556775.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/www/html/rcomp/tmp/15m45a1229556776.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/www/html/rcomp/tmp/16dcv71229556776.tab")
+ }
>
> system("convert tmp/19ies1229556775.ps tmp/19ies1229556775.png")
> system("convert tmp/2ymt31229556775.ps tmp/2ymt31229556775.png")
> system("convert tmp/3n07s1229556775.ps tmp/3n07s1229556775.png")
> system("convert tmp/411s41229556775.ps tmp/411s41229556775.png")
> system("convert tmp/55wle1229556775.ps tmp/55wle1229556775.png")
> system("convert tmp/6sbpe1229556775.ps tmp/6sbpe1229556775.png")
> system("convert tmp/7ee7r1229556775.ps tmp/7ee7r1229556775.png")
> system("convert tmp/82uo11229556775.ps tmp/82uo11229556775.png")
> system("convert tmp/9yz821229556775.ps tmp/9yz821229556775.png")
> system("convert tmp/10vvtr1229556775.ps tmp/10vvtr1229556775.png")
>
>
> proc.time()
user system elapsed
2.688 1.612 3.181