R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(112.3,1,117.3,1,111.1,1,102.2,1,104.3,1,122.9,0,107.6,0,121.3,0,131.5,0,89,0,104.4,0,128.9,0,135.9,0,133.3,0,121.3,0,120.5,0,120.4,0,137.9,0,126.1,0,133.2,0,151.1,0,105,0,119,0,140.4,0,156.6,1,137.1,1,122.7,1,125.8,1,139.3,1,134.9,1,149.2,1,132.3,1,149,1,117.2,1,119.6,1,152,1,149.4,1,127.3,1,114.1,1,102.1,1,107.7,1,104.4,1,102.1,1,96,1,109.3,1,90,1,83.9,1,112,1,114.3,1,103.6,1,91.7,1,80.8,1,87.2,1,109.2,1,102.7,1,95.1,1,117.5,1,85.1,1,92.1,1,113.5,1),dim=c(2,60),dimnames=list(c('Promet','Dummy'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Promet','Dummy'),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 = 'No 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
> 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
Promet Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 112.3 1 1 0 0 0 0 0 0 0 0 0 0
2 117.3 1 0 1 0 0 0 0 0 0 0 0 0
3 111.1 1 0 0 1 0 0 0 0 0 0 0 0
4 102.2 1 0 0 0 1 0 0 0 0 0 0 0
5 104.3 1 0 0 0 0 1 0 0 0 0 0 0
6 122.9 0 0 0 0 0 0 1 0 0 0 0 0
7 107.6 0 0 0 0 0 0 0 1 0 0 0 0
8 121.3 0 0 0 0 0 0 0 0 1 0 0 0
9 131.5 0 0 0 0 0 0 0 0 0 1 0 0
10 89.0 0 0 0 0 0 0 0 0 0 0 1 0
11 104.4 0 0 0 0 0 0 0 0 0 0 0 1
12 128.9 0 0 0 0 0 0 0 0 0 0 0 0
13 135.9 0 1 0 0 0 0 0 0 0 0 0 0
14 133.3 0 0 1 0 0 0 0 0 0 0 0 0
15 121.3 0 0 0 1 0 0 0 0 0 0 0 0
16 120.5 0 0 0 0 1 0 0 0 0 0 0 0
17 120.4 0 0 0 0 0 1 0 0 0 0 0 0
18 137.9 0 0 0 0 0 0 1 0 0 0 0 0
19 126.1 0 0 0 0 0 0 0 1 0 0 0 0
20 133.2 0 0 0 0 0 0 0 0 1 0 0 0
21 151.1 0 0 0 0 0 0 0 0 0 1 0 0
22 105.0 0 0 0 0 0 0 0 0 0 0 1 0
23 119.0 0 0 0 0 0 0 0 0 0 0 0 1
24 140.4 0 0 0 0 0 0 0 0 0 0 0 0
25 156.6 1 1 0 0 0 0 0 0 0 0 0 0
26 137.1 1 0 1 0 0 0 0 0 0 0 0 0
27 122.7 1 0 0 1 0 0 0 0 0 0 0 0
28 125.8 1 0 0 0 1 0 0 0 0 0 0 0
29 139.3 1 0 0 0 0 1 0 0 0 0 0 0
30 134.9 1 0 0 0 0 0 1 0 0 0 0 0
31 149.2 1 0 0 0 0 0 0 1 0 0 0 0
32 132.3 1 0 0 0 0 0 0 0 1 0 0 0
33 149.0 1 0 0 0 0 0 0 0 0 1 0 0
34 117.2 1 0 0 0 0 0 0 0 0 0 1 0
35 119.6 1 0 0 0 0 0 0 0 0 0 0 1
36 152.0 1 0 0 0 0 0 0 0 0 0 0 0
37 149.4 1 1 0 0 0 0 0 0 0 0 0 0
38 127.3 1 0 1 0 0 0 0 0 0 0 0 0
39 114.1 1 0 0 1 0 0 0 0 0 0 0 0
40 102.1 1 0 0 0 1 0 0 0 0 0 0 0
41 107.7 1 0 0 0 0 1 0 0 0 0 0 0
42 104.4 1 0 0 0 0 0 1 0 0 0 0 0
43 102.1 1 0 0 0 0 0 0 1 0 0 0 0
44 96.0 1 0 0 0 0 0 0 0 1 0 0 0
45 109.3 1 0 0 0 0 0 0 0 0 1 0 0
46 90.0 1 0 0 0 0 0 0 0 0 0 1 0
47 83.9 1 0 0 0 0 0 0 0 0 0 0 1
48 112.0 1 0 0 0 0 0 0 0 0 0 0 0
49 114.3 1 1 0 0 0 0 0 0 0 0 0 0
50 103.6 1 0 1 0 0 0 0 0 0 0 0 0
51 91.7 1 0 0 1 0 0 0 0 0 0 0 0
52 80.8 1 0 0 0 1 0 0 0 0 0 0 0
53 87.2 1 0 0 0 0 1 0 0 0 0 0 0
54 109.2 1 0 0 0 0 0 1 0 0 0 0 0
55 102.7 1 0 0 0 0 0 0 1 0 0 0 0
56 95.1 1 0 0 0 0 0 0 0 1 0 0 0
57 117.5 1 0 0 0 0 0 0 0 0 1 0 0
58 85.1 1 0 0 0 0 0 0 0 0 0 1 0
59 92.1 1 0 0 0 0 0 0 0 0 0 0 1
60 113.5 1 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dummy M1 M2 M3 M4
135.548 -10.313 6.403 -3.577 -15.117 -21.017
M5 M6 M7 M8 M9 M10
-15.517 -7.500 -11.820 -13.780 2.320 -32.100
M11
-25.560
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-23.417 -11.420 -2.067 10.247 35.785
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 135.548 7.859 17.249 < 2e-16 ***
Dummy -10.313 4.663 -2.212 0.03190 *
M1 6.403 10.427 0.614 0.54216
M2 -3.577 10.427 -0.343 0.73306
M3 -15.117 10.427 -1.450 0.15375
M4 -21.017 10.427 -2.016 0.04958 *
M5 -15.517 10.427 -1.488 0.14338
M6 -7.500 10.385 -0.722 0.47377
M7 -11.820 10.385 -1.138 0.26083
M8 -13.780 10.385 -1.327 0.19096
M9 2.320 10.385 0.223 0.82420
M10 -32.100 10.385 -3.091 0.00335 **
M11 -25.560 10.385 -2.461 0.01758 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 16.42 on 47 degrees of freedom
Multiple R-squared: 0.403, Adjusted R-squared: 0.2506
F-statistic: 2.644 on 12 and 47 DF, p-value: 0.00865
> 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.012377507 0.024755015 0.987622493
[2,] 0.002092631 0.004185261 0.997907369
[3,] 0.005921704 0.011843407 0.994078296
[4,] 0.010933315 0.021866631 0.989066685
[5,] 0.006502509 0.013005019 0.993497491
[6,] 0.008351333 0.016702665 0.991648667
[7,] 0.006515635 0.013031271 0.993484365
[8,] 0.004378641 0.008757282 0.995621359
[9,] 0.002360976 0.004721952 0.997639024
[10,] 0.031191665 0.062383330 0.968808335
[11,] 0.027237518 0.054475036 0.972762482
[12,] 0.018720507 0.037441013 0.981279493
[13,] 0.021560382 0.043120764 0.978439618
[14,] 0.052947307 0.105894614 0.947052693
[15,] 0.043559025 0.087118051 0.956440975
[16,] 0.133352792 0.266705583 0.866647208
[17,] 0.156020848 0.312041696 0.843979152
[18,] 0.194503947 0.389007894 0.805496053
[19,] 0.241340907 0.482681814 0.758659093
[20,] 0.302966819 0.605933637 0.697033181
[21,] 0.573073934 0.853852133 0.426926066
[22,] 0.782072419 0.435855162 0.217927581
[23,] 0.841749055 0.316501890 0.158250945
[24,] 0.901800683 0.196398634 0.098199317
[25,] 0.960977112 0.078045776 0.039022888
[26,] 0.996312998 0.007374005 0.003687002
[27,] 0.993260429 0.013479143 0.006739571
[28,] 0.980101495 0.039797010 0.019898505
[29,] 0.944822715 0.110354569 0.055177285
> postscript(file="/var/www/rcomp/tmp/1yob81292962790.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/www/rcomp/tmp/2qfsa1292962790.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/www/rcomp/tmp/3qfsa1292962790.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/www/rcomp/tmp/4qfsa1292962790.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/www/rcomp/tmp/5169v1292962790.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 = 60
Frequency = 1
1 2 3 4 5 6
-19.3374194 -4.3574194 0.9825806 -2.0174194 -5.4174194 -5.1477419
7 8 9 10 11 12
-16.1277419 -0.4677419 -6.3677419 -14.4477419 -5.5877419 -6.6477419
13 14 15 16 17 18
-6.0503226 1.3296774 0.8696774 5.9696774 0.3696774 9.8522581
19 20 21 22 23 24
2.3722581 11.4322581 13.2322581 1.5522581 9.0122581 4.8522581
25 26 27 28 29 30
24.9625806 15.4425806 12.5825806 21.5825806 29.5825806 17.1651613
31 32 33 34 35 36
35.7851613 20.8451613 21.4451613 24.0651613 19.9251613 26.7651613
37 38 39 40 41 42
17.7625806 5.6425806 3.9825806 -2.1174194 -2.0174194 -13.3348387
43 44 45 46 47 48
-11.3148387 -15.4548387 -18.2548387 -3.1348387 -15.7748387 -13.2348387
49 50 51 52 53 54
-17.3374194 -18.0574194 -18.4174194 -23.4174194 -22.5174194 -8.5348387
55 56 57 58 59 60
-10.7148387 -16.3548387 -10.0548387 -8.0348387 -7.5748387 -11.7348387
> postscript(file="/var/www/rcomp/tmp/6169v1292962790.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -19.3374194 NA
1 -4.3574194 -19.3374194
2 0.9825806 -4.3574194
3 -2.0174194 0.9825806
4 -5.4174194 -2.0174194
5 -5.1477419 -5.4174194
6 -16.1277419 -5.1477419
7 -0.4677419 -16.1277419
8 -6.3677419 -0.4677419
9 -14.4477419 -6.3677419
10 -5.5877419 -14.4477419
11 -6.6477419 -5.5877419
12 -6.0503226 -6.6477419
13 1.3296774 -6.0503226
14 0.8696774 1.3296774
15 5.9696774 0.8696774
16 0.3696774 5.9696774
17 9.8522581 0.3696774
18 2.3722581 9.8522581
19 11.4322581 2.3722581
20 13.2322581 11.4322581
21 1.5522581 13.2322581
22 9.0122581 1.5522581
23 4.8522581 9.0122581
24 24.9625806 4.8522581
25 15.4425806 24.9625806
26 12.5825806 15.4425806
27 21.5825806 12.5825806
28 29.5825806 21.5825806
29 17.1651613 29.5825806
30 35.7851613 17.1651613
31 20.8451613 35.7851613
32 21.4451613 20.8451613
33 24.0651613 21.4451613
34 19.9251613 24.0651613
35 26.7651613 19.9251613
36 17.7625806 26.7651613
37 5.6425806 17.7625806
38 3.9825806 5.6425806
39 -2.1174194 3.9825806
40 -2.0174194 -2.1174194
41 -13.3348387 -2.0174194
42 -11.3148387 -13.3348387
43 -15.4548387 -11.3148387
44 -18.2548387 -15.4548387
45 -3.1348387 -18.2548387
46 -15.7748387 -3.1348387
47 -13.2348387 -15.7748387
48 -17.3374194 -13.2348387
49 -18.0574194 -17.3374194
50 -18.4174194 -18.0574194
51 -23.4174194 -18.4174194
52 -22.5174194 -23.4174194
53 -8.5348387 -22.5174194
54 -10.7148387 -8.5348387
55 -16.3548387 -10.7148387
56 -10.0548387 -16.3548387
57 -8.0348387 -10.0548387
58 -7.5748387 -8.0348387
59 -11.7348387 -7.5748387
60 NA -11.7348387
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -4.3574194 -19.3374194
[2,] 0.9825806 -4.3574194
[3,] -2.0174194 0.9825806
[4,] -5.4174194 -2.0174194
[5,] -5.1477419 -5.4174194
[6,] -16.1277419 -5.1477419
[7,] -0.4677419 -16.1277419
[8,] -6.3677419 -0.4677419
[9,] -14.4477419 -6.3677419
[10,] -5.5877419 -14.4477419
[11,] -6.6477419 -5.5877419
[12,] -6.0503226 -6.6477419
[13,] 1.3296774 -6.0503226
[14,] 0.8696774 1.3296774
[15,] 5.9696774 0.8696774
[16,] 0.3696774 5.9696774
[17,] 9.8522581 0.3696774
[18,] 2.3722581 9.8522581
[19,] 11.4322581 2.3722581
[20,] 13.2322581 11.4322581
[21,] 1.5522581 13.2322581
[22,] 9.0122581 1.5522581
[23,] 4.8522581 9.0122581
[24,] 24.9625806 4.8522581
[25,] 15.4425806 24.9625806
[26,] 12.5825806 15.4425806
[27,] 21.5825806 12.5825806
[28,] 29.5825806 21.5825806
[29,] 17.1651613 29.5825806
[30,] 35.7851613 17.1651613
[31,] 20.8451613 35.7851613
[32,] 21.4451613 20.8451613
[33,] 24.0651613 21.4451613
[34,] 19.9251613 24.0651613
[35,] 26.7651613 19.9251613
[36,] 17.7625806 26.7651613
[37,] 5.6425806 17.7625806
[38,] 3.9825806 5.6425806
[39,] -2.1174194 3.9825806
[40,] -2.0174194 -2.1174194
[41,] -13.3348387 -2.0174194
[42,] -11.3148387 -13.3348387
[43,] -15.4548387 -11.3148387
[44,] -18.2548387 -15.4548387
[45,] -3.1348387 -18.2548387
[46,] -15.7748387 -3.1348387
[47,] -13.2348387 -15.7748387
[48,] -17.3374194 -13.2348387
[49,] -18.0574194 -17.3374194
[50,] -18.4174194 -18.0574194
[51,] -23.4174194 -18.4174194
[52,] -22.5174194 -23.4174194
[53,] -8.5348387 -22.5174194
[54,] -10.7148387 -8.5348387
[55,] -16.3548387 -10.7148387
[56,] -10.0548387 -16.3548387
[57,] -8.0348387 -10.0548387
[58,] -7.5748387 -8.0348387
[59,] -11.7348387 -7.5748387
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -4.3574194 -19.3374194
2 0.9825806 -4.3574194
3 -2.0174194 0.9825806
4 -5.4174194 -2.0174194
5 -5.1477419 -5.4174194
6 -16.1277419 -5.1477419
7 -0.4677419 -16.1277419
8 -6.3677419 -0.4677419
9 -14.4477419 -6.3677419
10 -5.5877419 -14.4477419
11 -6.6477419 -5.5877419
12 -6.0503226 -6.6477419
13 1.3296774 -6.0503226
14 0.8696774 1.3296774
15 5.9696774 0.8696774
16 0.3696774 5.9696774
17 9.8522581 0.3696774
18 2.3722581 9.8522581
19 11.4322581 2.3722581
20 13.2322581 11.4322581
21 1.5522581 13.2322581
22 9.0122581 1.5522581
23 4.8522581 9.0122581
24 24.9625806 4.8522581
25 15.4425806 24.9625806
26 12.5825806 15.4425806
27 21.5825806 12.5825806
28 29.5825806 21.5825806
29 17.1651613 29.5825806
30 35.7851613 17.1651613
31 20.8451613 35.7851613
32 21.4451613 20.8451613
33 24.0651613 21.4451613
34 19.9251613 24.0651613
35 26.7651613 19.9251613
36 17.7625806 26.7651613
37 5.6425806 17.7625806
38 3.9825806 5.6425806
39 -2.1174194 3.9825806
40 -2.0174194 -2.1174194
41 -13.3348387 -2.0174194
42 -11.3148387 -13.3348387
43 -15.4548387 -11.3148387
44 -18.2548387 -15.4548387
45 -3.1348387 -18.2548387
46 -15.7748387 -3.1348387
47 -13.2348387 -15.7748387
48 -17.3374194 -13.2348387
49 -18.0574194 -17.3374194
50 -18.4174194 -18.0574194
51 -23.4174194 -18.4174194
52 -22.5174194 -23.4174194
53 -8.5348387 -22.5174194
54 -10.7148387 -8.5348387
55 -16.3548387 -10.7148387
56 -10.0548387 -16.3548387
57 -8.0348387 -10.0548387
58 -7.5748387 -8.0348387
59 -11.7348387 -7.5748387
> 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/rcomp/tmp/7uxqg1292962790.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/www/rcomp/tmp/8uxqg1292962790.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/www/rcomp/tmp/946p11292962790.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/www/rcomp/tmp/10xg741292962790.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11iy5a1292962790.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/rcomp/tmp/12tpnv1292962790.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/rcomp/tmp/13i9271292962790.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/rcomp/tmp/14tija1292962790.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/rcomp/tmp/15w0hx1292962790.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/rcomp/tmp/16asxo1292962790.tab")
+ }
>
> try(system("convert tmp/1yob81292962790.ps tmp/1yob81292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qfsa1292962790.ps tmp/2qfsa1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/3qfsa1292962790.ps tmp/3qfsa1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/4qfsa1292962790.ps tmp/4qfsa1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/5169v1292962790.ps tmp/5169v1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/6169v1292962790.ps tmp/6169v1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/7uxqg1292962790.ps tmp/7uxqg1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/8uxqg1292962790.ps tmp/8uxqg1292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/946p11292962790.ps tmp/946p11292962790.png",intern=TRUE))
character(0)
> try(system("convert tmp/10xg741292962790.ps tmp/10xg741292962790.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.030 0.830 3.851