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(17823.2,0,17872,0,17420.4,0,16704.4,0,15991.2,0,15583.6,0,19123.5,0,17838.7,0,17209.4,0,18586.5,0,16258.1,0,15141.6,0,19202.1,0,17746.5,0,19090.1,1,18040.3,1,17515.5,1,17751.8,1,21072.4,1,17170,1,19439.5,1,19795.4,1,17574.9,1,16165.4,1,19464.6,1,19932.1,1,19961.2,1,17343.4,1,18924.2,1,18574.1,1,21350.6,1,18594.6,1,19832.1,1,20844.4,1,19640.2,1,17735.4,1,19813.6,1,22160,1,20664.3,1,17877.4,1,20906.5,1,21164.1,1,21374.4,1,22952.3,1,21343.5,1,23899.3,1,22392.9,1,18274.1,1,22786.7,1,22321.5,1,17842.2,1,16373.5,1,15933.8,0,16446.1,0,17729,0,16643,0,16196.7,0,18252.1,0,17570.4,0,15836.8,0),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 17823.2 0 1 0 0 0 0 0 0 0 0 0 0 1
2 17872.0 0 0 1 0 0 0 0 0 0 0 0 0 2
3 17420.4 0 0 0 1 0 0 0 0 0 0 0 0 3
4 16704.4 0 0 0 0 1 0 0 0 0 0 0 0 4
5 15991.2 0 0 0 0 0 1 0 0 0 0 0 0 5
6 15583.6 0 0 0 0 0 0 1 0 0 0 0 0 6
7 19123.5 0 0 0 0 0 0 0 1 0 0 0 0 7
8 17838.7 0 0 0 0 0 0 0 0 1 0 0 0 8
9 17209.4 0 0 0 0 0 0 0 0 0 1 0 0 9
10 18586.5 0 0 0 0 0 0 0 0 0 0 1 0 10
11 16258.1 0 0 0 0 0 0 0 0 0 0 0 1 11
12 15141.6 0 0 0 0 0 0 0 0 0 0 0 0 12
13 19202.1 0 1 0 0 0 0 0 0 0 0 0 0 13
14 17746.5 0 0 1 0 0 0 0 0 0 0 0 0 14
15 19090.1 1 0 0 1 0 0 0 0 0 0 0 0 15
16 18040.3 1 0 0 0 1 0 0 0 0 0 0 0 16
17 17515.5 1 0 0 0 0 1 0 0 0 0 0 0 17
18 17751.8 1 0 0 0 0 0 1 0 0 0 0 0 18
19 21072.4 1 0 0 0 0 0 0 1 0 0 0 0 19
20 17170.0 1 0 0 0 0 0 0 0 1 0 0 0 20
21 19439.5 1 0 0 0 0 0 0 0 0 1 0 0 21
22 19795.4 1 0 0 0 0 0 0 0 0 0 1 0 22
23 17574.9 1 0 0 0 0 0 0 0 0 0 0 1 23
24 16165.4 1 0 0 0 0 0 0 0 0 0 0 0 24
25 19464.6 1 1 0 0 0 0 0 0 0 0 0 0 25
26 19932.1 1 0 1 0 0 0 0 0 0 0 0 0 26
27 19961.2 1 0 0 1 0 0 0 0 0 0 0 0 27
28 17343.4 1 0 0 0 1 0 0 0 0 0 0 0 28
29 18924.2 1 0 0 0 0 1 0 0 0 0 0 0 29
30 18574.1 1 0 0 0 0 0 1 0 0 0 0 0 30
31 21350.6 1 0 0 0 0 0 0 1 0 0 0 0 31
32 18594.6 1 0 0 0 0 0 0 0 1 0 0 0 32
33 19832.1 1 0 0 0 0 0 0 0 0 1 0 0 33
34 20844.4 1 0 0 0 0 0 0 0 0 0 1 0 34
35 19640.2 1 0 0 0 0 0 0 0 0 0 0 1 35
36 17735.4 1 0 0 0 0 0 0 0 0 0 0 0 36
37 19813.6 1 1 0 0 0 0 0 0 0 0 0 0 37
38 22160.0 1 0 1 0 0 0 0 0 0 0 0 0 38
39 20664.3 1 0 0 1 0 0 0 0 0 0 0 0 39
40 17877.4 1 0 0 0 1 0 0 0 0 0 0 0 40
41 20906.5 1 0 0 0 0 1 0 0 0 0 0 0 41
42 21164.1 1 0 0 0 0 0 1 0 0 0 0 0 42
43 21374.4 1 0 0 0 0 0 0 1 0 0 0 0 43
44 22952.3 1 0 0 0 0 0 0 0 1 0 0 0 44
45 21343.5 1 0 0 0 0 0 0 0 0 1 0 0 45
46 23899.3 1 0 0 0 0 0 0 0 0 0 1 0 46
47 22392.9 1 0 0 0 0 0 0 0 0 0 0 1 47
48 18274.1 1 0 0 0 0 0 0 0 0 0 0 0 48
49 22786.7 1 1 0 0 0 0 0 0 0 0 0 0 49
50 22321.5 1 0 1 0 0 0 0 0 0 0 0 0 50
51 17842.2 1 0 0 1 0 0 0 0 0 0 0 0 51
52 16373.5 1 0 0 0 1 0 0 0 0 0 0 0 52
53 15933.8 0 0 0 0 0 1 0 0 0 0 0 0 53
54 16446.1 0 0 0 0 0 0 1 0 0 0 0 0 54
55 17729.0 0 0 0 0 0 0 0 1 0 0 0 0 55
56 16643.0 0 0 0 0 0 0 0 0 1 0 0 0 56
57 16196.7 0 0 0 0 0 0 0 0 0 1 0 0 57
58 18252.1 0 0 0 0 0 0 0 0 0 0 1 0 58
59 17570.4 0 0 0 0 0 0 0 0 0 0 0 1 59
60 15836.8 0 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
14512.33 2551.16 3366.93 3538.99 2001.66 257.49
M5 M6 M7 M8 M9 M10
1337.84 1371.22 3580.94 2074.35 2222.55 3677.53
M11 t
2072.96 16.32
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2294.30 -864.46 -30.08 557.97 3096.24
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 14512.33 702.70 20.652 < 2e-16 ***
X 2551.16 368.65 6.920 1.20e-08 ***
M1 3366.93 840.81 4.004 0.000225 ***
M2 3538.99 839.47 4.216 0.000115 ***
M3 2001.66 843.51 2.373 0.021879 *
M4 257.49 842.21 0.306 0.761184
M5 1337.84 836.21 1.600 0.116472
M6 1371.22 835.38 1.641 0.107529
M7 3580.94 834.68 4.290 9.08e-05 ***
M8 2074.35 834.10 2.487 0.016575 *
M9 2222.55 833.65 2.666 0.010555 *
M10 3677.53 833.33 4.413 6.11e-05 ***
M11 2072.96 833.14 2.488 0.016525 *
t 16.32 10.34 1.578 0.121348
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1317 on 46 degrees of freedom
Multiple R-squared: 0.692, Adjusted R-squared: 0.6049
F-statistic: 7.949 on 13 and 46 DF, p-value: 5.562e-08
> 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.0660899385 0.132179877 0.9339101
[2,] 0.0304357823 0.060871565 0.9695642
[3,] 0.0108817507 0.021763501 0.9891182
[4,] 0.1134562463 0.226912493 0.8865438
[5,] 0.0780344225 0.156068845 0.9219656
[6,] 0.0409738006 0.081947601 0.9590262
[7,] 0.0250422425 0.050084485 0.9749578
[8,] 0.0131405753 0.026281151 0.9868594
[9,] 0.0079250005 0.015850001 0.9920750
[10,] 0.0046864706 0.009372941 0.9953135
[11,] 0.0033855078 0.006771016 0.9966145
[12,] 0.0064701601 0.012940320 0.9935298
[13,] 0.0055218126 0.011043625 0.9944782
[14,] 0.0036919504 0.007383901 0.9963080
[15,] 0.0018095642 0.003619128 0.9981904
[16,] 0.0019309777 0.003861955 0.9980690
[17,] 0.0008365374 0.001673075 0.9991635
[18,] 0.0006378260 0.001275652 0.9993622
[19,] 0.0022672619 0.004534524 0.9977327
[20,] 0.0024856063 0.004971213 0.9975144
[21,] 0.0589222790 0.117844558 0.9410777
[22,] 0.1818479064 0.363695813 0.8181521
[23,] 0.1465838161 0.293167632 0.8534162
[24,] 0.1251039620 0.250207924 0.8748960
[25,] 0.1128385414 0.225677083 0.8871615
[26,] 0.0962951778 0.192590356 0.9037048
[27,] 0.0829801962 0.165960392 0.9170198
> postscript(file="/var/www/html/rcomp/tmp/1943r1258561300.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/2jouq1258561300.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/3gmgd1258561300.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/4xft71258561300.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/58kju1258561300.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 = 60
Frequency = 1
1 2 3 4 5 6
-72.390731 -211.970731 857.440470 1869.280470 59.409269 -397.890731
7 8 9 10 11 12
915.969269 1121.429269 327.609269 233.409269 -506.750731 433.389269
13 14 15 16 17 18
1110.631436 -533.348564 -219.893368 458.146632 -1163.324569 -976.724569
19 20 21 22 23 24
117.835431 -2294.304569 -189.324569 -1304.724569 -1936.984569 -1289.844569
25 26 27 28 29 30
-1373.902402 -1094.782402 455.328799 -434.631201 49.497598 -350.302402
31 32 33 34 35 36
200.157598 -1065.582402 7.397598 -451.602402 -67.562402 84.277598
37 38 39 40 41 42
-1220.780235 937.239765 962.550966 -96.509034 1835.919765 2043.819765
43 44 45 46 47 48
28.079765 3096.239765 1322.919765 2407.419765 2489.259765 427.099765
49 50 51 52 53 54
1556.441932 902.861932 -2055.426867 -1796.286867 -781.502063 -318.902063
55 56 57 58 59 60
-1262.042063 -857.782063 -1468.602063 -884.502063 22.037937 345.077937
> postscript(file="/var/www/html/rcomp/tmp/6lhzp1258561300.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -72.390731 NA
1 -211.970731 -72.390731
2 857.440470 -211.970731
3 1869.280470 857.440470
4 59.409269 1869.280470
5 -397.890731 59.409269
6 915.969269 -397.890731
7 1121.429269 915.969269
8 327.609269 1121.429269
9 233.409269 327.609269
10 -506.750731 233.409269
11 433.389269 -506.750731
12 1110.631436 433.389269
13 -533.348564 1110.631436
14 -219.893368 -533.348564
15 458.146632 -219.893368
16 -1163.324569 458.146632
17 -976.724569 -1163.324569
18 117.835431 -976.724569
19 -2294.304569 117.835431
20 -189.324569 -2294.304569
21 -1304.724569 -189.324569
22 -1936.984569 -1304.724569
23 -1289.844569 -1936.984569
24 -1373.902402 -1289.844569
25 -1094.782402 -1373.902402
26 455.328799 -1094.782402
27 -434.631201 455.328799
28 49.497598 -434.631201
29 -350.302402 49.497598
30 200.157598 -350.302402
31 -1065.582402 200.157598
32 7.397598 -1065.582402
33 -451.602402 7.397598
34 -67.562402 -451.602402
35 84.277598 -67.562402
36 -1220.780235 84.277598
37 937.239765 -1220.780235
38 962.550966 937.239765
39 -96.509034 962.550966
40 1835.919765 -96.509034
41 2043.819765 1835.919765
42 28.079765 2043.819765
43 3096.239765 28.079765
44 1322.919765 3096.239765
45 2407.419765 1322.919765
46 2489.259765 2407.419765
47 427.099765 2489.259765
48 1556.441932 427.099765
49 902.861932 1556.441932
50 -2055.426867 902.861932
51 -1796.286867 -2055.426867
52 -781.502063 -1796.286867
53 -318.902063 -781.502063
54 -1262.042063 -318.902063
55 -857.782063 -1262.042063
56 -1468.602063 -857.782063
57 -884.502063 -1468.602063
58 22.037937 -884.502063
59 345.077937 22.037937
60 NA 345.077937
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -211.970731 -72.390731
[2,] 857.440470 -211.970731
[3,] 1869.280470 857.440470
[4,] 59.409269 1869.280470
[5,] -397.890731 59.409269
[6,] 915.969269 -397.890731
[7,] 1121.429269 915.969269
[8,] 327.609269 1121.429269
[9,] 233.409269 327.609269
[10,] -506.750731 233.409269
[11,] 433.389269 -506.750731
[12,] 1110.631436 433.389269
[13,] -533.348564 1110.631436
[14,] -219.893368 -533.348564
[15,] 458.146632 -219.893368
[16,] -1163.324569 458.146632
[17,] -976.724569 -1163.324569
[18,] 117.835431 -976.724569
[19,] -2294.304569 117.835431
[20,] -189.324569 -2294.304569
[21,] -1304.724569 -189.324569
[22,] -1936.984569 -1304.724569
[23,] -1289.844569 -1936.984569
[24,] -1373.902402 -1289.844569
[25,] -1094.782402 -1373.902402
[26,] 455.328799 -1094.782402
[27,] -434.631201 455.328799
[28,] 49.497598 -434.631201
[29,] -350.302402 49.497598
[30,] 200.157598 -350.302402
[31,] -1065.582402 200.157598
[32,] 7.397598 -1065.582402
[33,] -451.602402 7.397598
[34,] -67.562402 -451.602402
[35,] 84.277598 -67.562402
[36,] -1220.780235 84.277598
[37,] 937.239765 -1220.780235
[38,] 962.550966 937.239765
[39,] -96.509034 962.550966
[40,] 1835.919765 -96.509034
[41,] 2043.819765 1835.919765
[42,] 28.079765 2043.819765
[43,] 3096.239765 28.079765
[44,] 1322.919765 3096.239765
[45,] 2407.419765 1322.919765
[46,] 2489.259765 2407.419765
[47,] 427.099765 2489.259765
[48,] 1556.441932 427.099765
[49,] 902.861932 1556.441932
[50,] -2055.426867 902.861932
[51,] -1796.286867 -2055.426867
[52,] -781.502063 -1796.286867
[53,] -318.902063 -781.502063
[54,] -1262.042063 -318.902063
[55,] -857.782063 -1262.042063
[56,] -1468.602063 -857.782063
[57,] -884.502063 -1468.602063
[58,] 22.037937 -884.502063
[59,] 345.077937 22.037937
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -211.970731 -72.390731
2 857.440470 -211.970731
3 1869.280470 857.440470
4 59.409269 1869.280470
5 -397.890731 59.409269
6 915.969269 -397.890731
7 1121.429269 915.969269
8 327.609269 1121.429269
9 233.409269 327.609269
10 -506.750731 233.409269
11 433.389269 -506.750731
12 1110.631436 433.389269
13 -533.348564 1110.631436
14 -219.893368 -533.348564
15 458.146632 -219.893368
16 -1163.324569 458.146632
17 -976.724569 -1163.324569
18 117.835431 -976.724569
19 -2294.304569 117.835431
20 -189.324569 -2294.304569
21 -1304.724569 -189.324569
22 -1936.984569 -1304.724569
23 -1289.844569 -1936.984569
24 -1373.902402 -1289.844569
25 -1094.782402 -1373.902402
26 455.328799 -1094.782402
27 -434.631201 455.328799
28 49.497598 -434.631201
29 -350.302402 49.497598
30 200.157598 -350.302402
31 -1065.582402 200.157598
32 7.397598 -1065.582402
33 -451.602402 7.397598
34 -67.562402 -451.602402
35 84.277598 -67.562402
36 -1220.780235 84.277598
37 937.239765 -1220.780235
38 962.550966 937.239765
39 -96.509034 962.550966
40 1835.919765 -96.509034
41 2043.819765 1835.919765
42 28.079765 2043.819765
43 3096.239765 28.079765
44 1322.919765 3096.239765
45 2407.419765 1322.919765
46 2489.259765 2407.419765
47 427.099765 2489.259765
48 1556.441932 427.099765
49 902.861932 1556.441932
50 -2055.426867 902.861932
51 -1796.286867 -2055.426867
52 -781.502063 -1796.286867
53 -318.902063 -781.502063
54 -1262.042063 -318.902063
55 -857.782063 -1262.042063
56 -1468.602063 -857.782063
57 -884.502063 -1468.602063
58 22.037937 -884.502063
59 345.077937 22.037937
> 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/7zpdg1258561300.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/898jv1258561300.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/9if0t1258561300.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/10zfib1258561300.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/11l3j71258561300.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/12i9w81258561300.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/130n1q1258561300.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/14dd1t1258561300.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/15kiit1258561300.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/16l28r1258561300.tab")
+ }
> system("convert tmp/1943r1258561300.ps tmp/1943r1258561300.png")
> system("convert tmp/2jouq1258561300.ps tmp/2jouq1258561300.png")
> system("convert tmp/3gmgd1258561300.ps tmp/3gmgd1258561300.png")
> system("convert tmp/4xft71258561300.ps tmp/4xft71258561300.png")
> system("convert tmp/58kju1258561300.ps tmp/58kju1258561300.png")
> system("convert tmp/6lhzp1258561300.ps tmp/6lhzp1258561300.png")
> system("convert tmp/7zpdg1258561300.ps tmp/7zpdg1258561300.png")
> system("convert tmp/898jv1258561300.ps tmp/898jv1258561300.png")
> system("convert tmp/9if0t1258561300.ps tmp/9if0t1258561300.png")
> system("convert tmp/10zfib1258561300.ps tmp/10zfib1258561300.png")
>
>
> proc.time()
user system elapsed
2.476 1.592 7.333