R version 2.9.0 (2009-04-17)
Copyright (C) 2009 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(20604.6,2.05,18714.9,2.03,18492.6,2.04,18183.6,2.03,19435.1,2.01,22686.8,2.01,20396.7,2.01,19233.6,2.01,22751,2.01,19864,2.01,17165.4,2.02,22309.7,2.02,21786.3,2.03,21927.6,2.05,20957.9,2.08,19726,2.07,21315.7,2.06,24771.5,2.05,22592.4,2.05,21942.1,2.05,23973.7,2.05,20815.7,2.05,19931.4,2.06,24436.8,2.06,22838.7,2.07,24465.3,2.07,23007.3,2.3,22720.8,2.31,23045.7,2.31,27198.5,2.53,22401.9,2.58,25122.7,2.59,26100.5,2.73,22904.9,2.82,22040.4,3,25981.5,3.04,26157.1,3.23,25975.4,3.32,22589.8,3.49,25370.4,3.57,25091.1,3.56,28760.9,3.72,24325.9,3.82,25821.7,3.82,27645.7,3.98,26296.9,4.06,24141.5,4.08,27268.1,4.19,29060.3,4.16,28226.4,4.17,23268.5,4.21,26938.2,4.21,27217.5,4.17,27540.5,4.19,29167.6,4.25,26671.5,4.25,30184,4.2,28422.3,4.33,23774.3,4.41,29601,4.56,28523.6,5.18,23622,3.42,21320.3,2.71,20423.6,2.29,21174.9,2,23050.2,1.64,21202.9,1.3,20476.4,1.08,23173.3,1,22468,1,19842.7,1),dim=c(2,71),dimnames=list(c('Y','X'),1:71))
> y <- array(NA,dim=c(2,71),dimnames=list(c('Y','X'),1:71))
> 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
Y X
1 20604.6 2.05
2 18714.9 2.03
3 18492.6 2.04
4 18183.6 2.03
5 19435.1 2.01
6 22686.8 2.01
7 20396.7 2.01
8 19233.6 2.01
9 22751.0 2.01
10 19864.0 2.01
11 17165.4 2.02
12 22309.7 2.02
13 21786.3 2.03
14 21927.6 2.05
15 20957.9 2.08
16 19726.0 2.07
17 21315.7 2.06
18 24771.5 2.05
19 22592.4 2.05
20 21942.1 2.05
21 23973.7 2.05
22 20815.7 2.05
23 19931.4 2.06
24 24436.8 2.06
25 22838.7 2.07
26 24465.3 2.07
27 23007.3 2.30
28 22720.8 2.31
29 23045.7 2.31
30 27198.5 2.53
31 22401.9 2.58
32 25122.7 2.59
33 26100.5 2.73
34 22904.9 2.82
35 22040.4 3.00
36 25981.5 3.04
37 26157.1 3.23
38 25975.4 3.32
39 22589.8 3.49
40 25370.4 3.57
41 25091.1 3.56
42 28760.9 3.72
43 24325.9 3.82
44 25821.7 3.82
45 27645.7 3.98
46 26296.9 4.06
47 24141.5 4.08
48 27268.1 4.19
49 29060.3 4.16
50 28226.4 4.17
51 23268.5 4.21
52 26938.2 4.21
53 27217.5 4.17
54 27540.5 4.19
55 29167.6 4.25
56 26671.5 4.25
57 30184.0 4.20
58 28422.3 4.33
59 23774.3 4.41
60 29601.0 4.56
61 28523.6 5.18
62 23622.0 3.42
63 21320.3 2.71
64 20423.6 2.29
65 21174.9 2.00
66 23050.2 1.64
67 21202.9 1.30
68 20476.4 1.08
69 23173.3 1.00
70 22468.0 1.00
71 19842.7 1.00
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
17180 2309
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4679.54 -1440.53 35.96 1345.57 4175.84
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17180.2 683.8 25.12 < 2e-16 ***
X 2309.3 230.0 10.04 3.93e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2012 on 69 degrees of freedom
Multiple R-squared: 0.5937, Adjusted R-squared: 0.5878
F-statistic: 100.8 on 1 and 69 DF, p-value: 3.934e-15
> 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.1828352 0.3656705 0.8171648
[2,] 0.5087637 0.9824726 0.4912363
[3,] 0.3661869 0.7323738 0.6338131
[4,] 0.2982951 0.5965903 0.7017049
[5,] 0.3738205 0.7476411 0.6261795
[6,] 0.2966885 0.5933770 0.7033115
[7,] 0.5133567 0.9732865 0.4866433
[8,] 0.5610368 0.8779264 0.4389632
[9,] 0.5662233 0.8675534 0.4337767
[10,] 0.5870331 0.8259339 0.4129669
[11,] 0.5249772 0.9500455 0.4750228
[12,] 0.4905940 0.9811879 0.5094060
[13,] 0.4378104 0.8756208 0.5621896
[14,] 0.6932080 0.6135840 0.3067920
[15,] 0.6648957 0.6702085 0.3351043
[16,] 0.6086139 0.7827721 0.3913861
[17,] 0.6595014 0.6809972 0.3404986
[18,] 0.6124116 0.7751769 0.3875884
[19,] 0.6222978 0.7554043 0.3777022
[20,] 0.6845058 0.6309884 0.3154942
[21,] 0.6289770 0.7420461 0.3710230
[22,] 0.6474835 0.7050331 0.3525165
[23,] 0.6541981 0.6916037 0.3458019
[24,] 0.6000815 0.7998370 0.3999185
[25,] 0.5317363 0.9365275 0.4682637
[26,] 0.5837437 0.8325127 0.4162563
[27,] 0.6446619 0.7106762 0.3553381
[28,] 0.5933877 0.8132245 0.4066123
[29,] 0.5649113 0.8701775 0.4350887
[30,] 0.6082031 0.7835937 0.3917969
[31,] 0.7141215 0.5717569 0.2858785
[32,] 0.6703717 0.6592565 0.3296283
[33,] 0.6186905 0.7626189 0.3813095
[34,] 0.5608825 0.8782351 0.4391175
[35,] 0.6917613 0.6164774 0.3082387
[36,] 0.6331283 0.7337434 0.3668717
[37,] 0.5741858 0.8516284 0.4258142
[38,] 0.6213282 0.7573436 0.3786718
[39,] 0.6305542 0.7388916 0.3694458
[40,] 0.5658384 0.8683231 0.4341616
[41,] 0.5124306 0.9751388 0.4875694
[42,] 0.4463607 0.8927214 0.5536393
[43,] 0.5039566 0.9920868 0.4960434
[44,] 0.4305105 0.8610211 0.5694895
[45,] 0.4374438 0.8748876 0.5625562
[46,] 0.3949481 0.7898961 0.6050519
[47,] 0.5886543 0.8226913 0.4113457
[48,] 0.5094364 0.9811271 0.4905636
[49,] 0.4295303 0.8590605 0.5704697
[50,] 0.3557153 0.7114307 0.6442847
[51,] 0.3639634 0.7279268 0.6360366
[52,] 0.2883517 0.5767034 0.7116483
[53,] 0.4641670 0.9283341 0.5358330
[54,] 0.4716177 0.9432354 0.5283823
[55,] 0.5811795 0.8376410 0.4188205
[56,] 0.7228970 0.5542059 0.2771030
[57,] 0.8818727 0.2362546 0.1181273
[58,] 0.8986599 0.2026802 0.1013401
[59,] 0.8328192 0.3343617 0.1671808
[60,] 0.7682455 0.4635089 0.2317545
[61,] 0.6915028 0.6169943 0.3084972
[62,] 0.6025103 0.7949795 0.3974897
> postscript(file="/var/www/html/rcomp/tmp/1kesp1258476022.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/2cdqr1258476022.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/356s61258476022.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/4it871258476022.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/5gldf1258476022.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 = 71
Frequency = 1
1 2 3 4 5 6
-1309.61425 -3153.12886 -3398.52156 -3684.42886 -2386.74348 864.95652
7 8 9 10 11 12
-1425.14348 -2588.24348 929.15652 -1957.84348 -4679.53617 464.76383
13 14 15 16 17 18
-81.72886 13.38575 -1025.59232 -2234.39963 -621.60694 2857.28575
19 20 21 22 23 24
678.18575 27.88575 2059.48575 -1098.51425 -2005.90694 2499.49306
25 26 27 28 29 30
878.30037 2504.90037 515.76848 206.17579 531.07579 4175.83659
31 32 33 34 35 36
-736.22687 1961.48044 2615.98277 -787.45145 -2067.61989 1781.10935
37 38 39 40 41 42
1517.94822 1128.41400 -2649.76175 -53.90328 -310.11059 2990.20636
43 44 45 46 47 48
-1675.72055 -179.92055 1274.59639 -258.94514 -2460.53052 412.04988
49 50 51 52 53 54
2273.52795 1416.53526 -3633.73550 35.96450 407.63526 684.44988
55 56 57 58 59 60
2172.99373 -323.10627 3304.85719 1242.95221 -3589.78932 1890.52031
61 62 63 64 65 66
-618.62653 -1455.91291 -2118.03185 -2044.83883 -623.85079 2082.78608
67 68 69 70 71
1020.63758 802.17678 3683.81831 2978.51831 353.21831
> postscript(file="/var/www/html/rcomp/tmp/6j7e41258476022.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 = 71
Frequency = 1
lag(myerror, k = 1) myerror
0 -1309.61425 NA
1 -3153.12886 -1309.61425
2 -3398.52156 -3153.12886
3 -3684.42886 -3398.52156
4 -2386.74348 -3684.42886
5 864.95652 -2386.74348
6 -1425.14348 864.95652
7 -2588.24348 -1425.14348
8 929.15652 -2588.24348
9 -1957.84348 929.15652
10 -4679.53617 -1957.84348
11 464.76383 -4679.53617
12 -81.72886 464.76383
13 13.38575 -81.72886
14 -1025.59232 13.38575
15 -2234.39963 -1025.59232
16 -621.60694 -2234.39963
17 2857.28575 -621.60694
18 678.18575 2857.28575
19 27.88575 678.18575
20 2059.48575 27.88575
21 -1098.51425 2059.48575
22 -2005.90694 -1098.51425
23 2499.49306 -2005.90694
24 878.30037 2499.49306
25 2504.90037 878.30037
26 515.76848 2504.90037
27 206.17579 515.76848
28 531.07579 206.17579
29 4175.83659 531.07579
30 -736.22687 4175.83659
31 1961.48044 -736.22687
32 2615.98277 1961.48044
33 -787.45145 2615.98277
34 -2067.61989 -787.45145
35 1781.10935 -2067.61989
36 1517.94822 1781.10935
37 1128.41400 1517.94822
38 -2649.76175 1128.41400
39 -53.90328 -2649.76175
40 -310.11059 -53.90328
41 2990.20636 -310.11059
42 -1675.72055 2990.20636
43 -179.92055 -1675.72055
44 1274.59639 -179.92055
45 -258.94514 1274.59639
46 -2460.53052 -258.94514
47 412.04988 -2460.53052
48 2273.52795 412.04988
49 1416.53526 2273.52795
50 -3633.73550 1416.53526
51 35.96450 -3633.73550
52 407.63526 35.96450
53 684.44988 407.63526
54 2172.99373 684.44988
55 -323.10627 2172.99373
56 3304.85719 -323.10627
57 1242.95221 3304.85719
58 -3589.78932 1242.95221
59 1890.52031 -3589.78932
60 -618.62653 1890.52031
61 -1455.91291 -618.62653
62 -2118.03185 -1455.91291
63 -2044.83883 -2118.03185
64 -623.85079 -2044.83883
65 2082.78608 -623.85079
66 1020.63758 2082.78608
67 802.17678 1020.63758
68 3683.81831 802.17678
69 2978.51831 3683.81831
70 353.21831 2978.51831
71 NA 353.21831
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3153.12886 -1309.61425
[2,] -3398.52156 -3153.12886
[3,] -3684.42886 -3398.52156
[4,] -2386.74348 -3684.42886
[5,] 864.95652 -2386.74348
[6,] -1425.14348 864.95652
[7,] -2588.24348 -1425.14348
[8,] 929.15652 -2588.24348
[9,] -1957.84348 929.15652
[10,] -4679.53617 -1957.84348
[11,] 464.76383 -4679.53617
[12,] -81.72886 464.76383
[13,] 13.38575 -81.72886
[14,] -1025.59232 13.38575
[15,] -2234.39963 -1025.59232
[16,] -621.60694 -2234.39963
[17,] 2857.28575 -621.60694
[18,] 678.18575 2857.28575
[19,] 27.88575 678.18575
[20,] 2059.48575 27.88575
[21,] -1098.51425 2059.48575
[22,] -2005.90694 -1098.51425
[23,] 2499.49306 -2005.90694
[24,] 878.30037 2499.49306
[25,] 2504.90037 878.30037
[26,] 515.76848 2504.90037
[27,] 206.17579 515.76848
[28,] 531.07579 206.17579
[29,] 4175.83659 531.07579
[30,] -736.22687 4175.83659
[31,] 1961.48044 -736.22687
[32,] 2615.98277 1961.48044
[33,] -787.45145 2615.98277
[34,] -2067.61989 -787.45145
[35,] 1781.10935 -2067.61989
[36,] 1517.94822 1781.10935
[37,] 1128.41400 1517.94822
[38,] -2649.76175 1128.41400
[39,] -53.90328 -2649.76175
[40,] -310.11059 -53.90328
[41,] 2990.20636 -310.11059
[42,] -1675.72055 2990.20636
[43,] -179.92055 -1675.72055
[44,] 1274.59639 -179.92055
[45,] -258.94514 1274.59639
[46,] -2460.53052 -258.94514
[47,] 412.04988 -2460.53052
[48,] 2273.52795 412.04988
[49,] 1416.53526 2273.52795
[50,] -3633.73550 1416.53526
[51,] 35.96450 -3633.73550
[52,] 407.63526 35.96450
[53,] 684.44988 407.63526
[54,] 2172.99373 684.44988
[55,] -323.10627 2172.99373
[56,] 3304.85719 -323.10627
[57,] 1242.95221 3304.85719
[58,] -3589.78932 1242.95221
[59,] 1890.52031 -3589.78932
[60,] -618.62653 1890.52031
[61,] -1455.91291 -618.62653
[62,] -2118.03185 -1455.91291
[63,] -2044.83883 -2118.03185
[64,] -623.85079 -2044.83883
[65,] 2082.78608 -623.85079
[66,] 1020.63758 2082.78608
[67,] 802.17678 1020.63758
[68,] 3683.81831 802.17678
[69,] 2978.51831 3683.81831
[70,] 353.21831 2978.51831
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3153.12886 -1309.61425
2 -3398.52156 -3153.12886
3 -3684.42886 -3398.52156
4 -2386.74348 -3684.42886
5 864.95652 -2386.74348
6 -1425.14348 864.95652
7 -2588.24348 -1425.14348
8 929.15652 -2588.24348
9 -1957.84348 929.15652
10 -4679.53617 -1957.84348
11 464.76383 -4679.53617
12 -81.72886 464.76383
13 13.38575 -81.72886
14 -1025.59232 13.38575
15 -2234.39963 -1025.59232
16 -621.60694 -2234.39963
17 2857.28575 -621.60694
18 678.18575 2857.28575
19 27.88575 678.18575
20 2059.48575 27.88575
21 -1098.51425 2059.48575
22 -2005.90694 -1098.51425
23 2499.49306 -2005.90694
24 878.30037 2499.49306
25 2504.90037 878.30037
26 515.76848 2504.90037
27 206.17579 515.76848
28 531.07579 206.17579
29 4175.83659 531.07579
30 -736.22687 4175.83659
31 1961.48044 -736.22687
32 2615.98277 1961.48044
33 -787.45145 2615.98277
34 -2067.61989 -787.45145
35 1781.10935 -2067.61989
36 1517.94822 1781.10935
37 1128.41400 1517.94822
38 -2649.76175 1128.41400
39 -53.90328 -2649.76175
40 -310.11059 -53.90328
41 2990.20636 -310.11059
42 -1675.72055 2990.20636
43 -179.92055 -1675.72055
44 1274.59639 -179.92055
45 -258.94514 1274.59639
46 -2460.53052 -258.94514
47 412.04988 -2460.53052
48 2273.52795 412.04988
49 1416.53526 2273.52795
50 -3633.73550 1416.53526
51 35.96450 -3633.73550
52 407.63526 35.96450
53 684.44988 407.63526
54 2172.99373 684.44988
55 -323.10627 2172.99373
56 3304.85719 -323.10627
57 1242.95221 3304.85719
58 -3589.78932 1242.95221
59 1890.52031 -3589.78932
60 -618.62653 1890.52031
61 -1455.91291 -618.62653
62 -2118.03185 -1455.91291
63 -2044.83883 -2118.03185
64 -623.85079 -2044.83883
65 2082.78608 -623.85079
66 1020.63758 2082.78608
67 802.17678 1020.63758
68 3683.81831 802.17678
69 2978.51831 3683.81831
70 353.21831 2978.51831
> 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/7p8k01258476022.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/81rg81258476022.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/9l0631258476022.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/10jfmv1258476022.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/11gihr1258476022.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/12rba21258476022.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/13comm1258476022.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/14l63d1258476022.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/15zyqi1258476022.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/16xx991258476022.tab")
+ }
>
> system("convert tmp/1kesp1258476022.ps tmp/1kesp1258476022.png")
> system("convert tmp/2cdqr1258476022.ps tmp/2cdqr1258476022.png")
> system("convert tmp/356s61258476022.ps tmp/356s61258476022.png")
> system("convert tmp/4it871258476022.ps tmp/4it871258476022.png")
> system("convert tmp/5gldf1258476022.ps tmp/5gldf1258476022.png")
> system("convert tmp/6j7e41258476022.ps tmp/6j7e41258476022.png")
> system("convert tmp/7p8k01258476022.ps tmp/7p8k01258476022.png")
> system("convert tmp/81rg81258476022.ps tmp/81rg81258476022.png")
> system("convert tmp/9l0631258476022.ps tmp/9l0631258476022.png")
> system("convert tmp/10jfmv1258476022.ps tmp/10jfmv1258476022.png")
>
>
> proc.time()
user system elapsed
2.564 1.589 3.478