R version 2.13.0 (2011-04-13)
Copyright (C) 2011 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,0,117.3,0,111.1,1,102.2,1,104.3,1,122.9,1,107.6,1,121.3,1,131.5,1,89,1,104.4,1,128.9,1,135.9,1,133.3,1,121.3,1,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,0,137.1,0,122.7,0,125.8,0,139.3,0,134.9,0,149.2,0,132.3,0,149,0,117.2,0,119.6,0,152,0,149.4,0,127.3,0,114.1,0,102.1,0,107.7,0,104.4,0,102.1,0,96,1,109.3,0,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'
> 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 0 1 0 0 0 0 0 0 0 0 0 0
2 117.3 0 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 1 0 0 0 0 0 1 0 0 0 0 0
7 107.6 1 0 0 0 0 0 0 1 0 0 0 0
8 121.3 1 0 0 0 0 0 0 0 1 0 0 0
9 131.5 1 0 0 0 0 0 0 0 0 1 0 0
10 89.0 1 0 0 0 0 0 0 0 0 0 1 0
11 104.4 1 0 0 0 0 0 0 0 0 0 0 1
12 128.9 1 0 0 0 0 0 0 0 0 0 0 0
13 135.9 1 1 0 0 0 0 0 0 0 0 0 0
14 133.3 1 0 1 0 0 0 0 0 0 0 0 0
15 121.3 1 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 0 1 0 0 0 0 0 0 0 0 0 0
26 137.1 0 0 1 0 0 0 0 0 0 0 0 0
27 122.7 0 0 0 1 0 0 0 0 0 0 0 0
28 125.8 0 0 0 0 1 0 0 0 0 0 0 0
29 139.3 0 0 0 0 0 1 0 0 0 0 0 0
30 134.9 0 0 0 0 0 0 1 0 0 0 0 0
31 149.2 0 0 0 0 0 0 0 1 0 0 0 0
32 132.3 0 0 0 0 0 0 0 0 1 0 0 0
33 149.0 0 0 0 0 0 0 0 0 0 1 0 0
34 117.2 0 0 0 0 0 0 0 0 0 0 1 0
35 119.6 0 0 0 0 0 0 0 0 0 0 0 1
36 152.0 0 0 0 0 0 0 0 0 0 0 0 0
37 149.4 0 1 0 0 0 0 0 0 0 0 0 0
38 127.3 0 0 1 0 0 0 0 0 0 0 0 0
39 114.1 0 0 0 1 0 0 0 0 0 0 0 0
40 102.1 0 0 0 0 1 0 0 0 0 0 0 0
41 107.7 0 0 0 0 0 1 0 0 0 0 0 0
42 104.4 0 0 0 0 0 0 1 0 0 0 0 0
43 102.1 0 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 0 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
140.9958 -19.3931 0.4614 -9.5186 -17.1800 -26.9586
M5 M6 M7 M8 M9 M10
-21.4586 -11.3786 -15.6986 -13.7800 -1.5586 -32.1000
M11
-25.5600
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-30.1372 -8.7638 0.8328 8.2881 23.9028
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 140.9958 6.4075 22.005 < 2e-16 ***
Dummy -19.3931 3.5597 -5.448 1.82e-06 ***
M1 0.4614 8.5730 0.054 0.957307
M2 -9.5186 8.5730 -1.110 0.272516
M3 -17.1800 8.5434 -2.011 0.050090 .
M4 -26.9586 8.5730 -3.145 0.002881 **
M5 -21.4586 8.5730 -2.503 0.015846 *
M6 -11.3786 8.5730 -1.327 0.190832
M7 -15.6986 8.5730 -1.831 0.073417 .
M8 -13.7800 8.5434 -1.613 0.113451
M9 -1.5586 8.5730 -0.182 0.856517
M10 -32.1000 8.5434 -3.757 0.000474 ***
M11 -25.5600 8.5434 -2.992 0.004407 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 13.51 on 47 degrees of freedom
Multiple R-squared: 0.596, Adjusted R-squared: 0.4929
F-statistic: 5.779 on 12 and 47 DF, p-value: 5.271e-06
> 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.7017533 0.596493378 0.298246689
[2,] 0.6966478 0.606704335 0.303352167
[3,] 0.6428454 0.714309259 0.357154629
[4,] 0.5839705 0.832058915 0.416029457
[5,] 0.4739414 0.947882836 0.526058582
[6,] 0.4356281 0.871256243 0.564371878
[7,] 0.3565612 0.713122389 0.643438805
[8,] 0.2653314 0.530662737 0.734668631
[9,] 0.1852946 0.370589224 0.814705388
[10,] 0.3226466 0.645293263 0.677353369
[11,] 0.2500270 0.500053992 0.749973004
[12,] 0.1823196 0.364639243 0.817680378
[13,] 0.1704630 0.340925936 0.829537032
[14,] 0.2885374 0.577074820 0.711462590
[15,] 0.2433855 0.486771025 0.756614487
[16,] 0.5544232 0.891153637 0.445576819
[17,] 0.5113894 0.977221285 0.488610643
[18,] 0.6081243 0.783751328 0.391875664
[19,] 0.5792548 0.841490322 0.420745161
[20,] 0.5437630 0.912473984 0.456236992
[21,] 0.7008218 0.598356338 0.299178169
[22,] 0.8098598 0.380280372 0.190140186
[23,] 0.8094361 0.381127847 0.190563924
[24,] 0.8430874 0.313825145 0.156912573
[25,] 0.9166796 0.166640711 0.083320356
[26,] 0.9973597 0.005280527 0.002640263
[27,] 0.9938939 0.012212183 0.006106092
[28,] 0.9896259 0.020748155 0.010374078
[29,] 0.9641405 0.071718931 0.035859465
> postscript(file="/var/wessaorg/rcomp/tmp/1x3en1322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2bkt21322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3iw321322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4uqsq1322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/54rrw1322331393.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
-29.1572222 -14.1772222 6.6772222 7.5558333 4.1558333 12.6758333
7 8 9 10 11 12
1.6958333 13.4772222 11.4558333 -0.5027778 8.3572222 7.2972222
13 14 15 16 17 18
13.8358333 21.2158333 16.8772222 6.4627778 0.8627778 8.2827778
19 20 21 22 23 24
0.8027778 5.9841667 11.6627778 -3.8958333 3.5641667 -0.5958333
25 26 27 28 29 30
15.1427778 5.6227778 -1.1158333 11.7627778 19.7627778 5.2827778
31 32 33 34 35 36
23.9027778 5.0841667 9.5627778 8.3041667 4.1641667 11.0041667
37 38 39 40 41 42
7.9427778 -4.1772222 -9.7158333 -11.9372222 -11.8372222 -25.2172222
43 44 45 46 47 48
-23.1972222 -11.8227778 -30.1372222 0.4972222 -12.1427778 -9.6027778
49 50 51 52 53 54
-7.7641667 -8.4841667 -12.7227778 -13.8441667 -12.9441667 -1.0241667
55 56 57 58 59 60
-3.2041667 -12.7227778 -2.5441667 -4.4027778 -3.9427778 -8.1027778
> postscript(file="/var/wessaorg/rcomp/tmp/6ucvd1322331393.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 -29.1572222 NA
1 -14.1772222 -29.1572222
2 6.6772222 -14.1772222
3 7.5558333 6.6772222
4 4.1558333 7.5558333
5 12.6758333 4.1558333
6 1.6958333 12.6758333
7 13.4772222 1.6958333
8 11.4558333 13.4772222
9 -0.5027778 11.4558333
10 8.3572222 -0.5027778
11 7.2972222 8.3572222
12 13.8358333 7.2972222
13 21.2158333 13.8358333
14 16.8772222 21.2158333
15 6.4627778 16.8772222
16 0.8627778 6.4627778
17 8.2827778 0.8627778
18 0.8027778 8.2827778
19 5.9841667 0.8027778
20 11.6627778 5.9841667
21 -3.8958333 11.6627778
22 3.5641667 -3.8958333
23 -0.5958333 3.5641667
24 15.1427778 -0.5958333
25 5.6227778 15.1427778
26 -1.1158333 5.6227778
27 11.7627778 -1.1158333
28 19.7627778 11.7627778
29 5.2827778 19.7627778
30 23.9027778 5.2827778
31 5.0841667 23.9027778
32 9.5627778 5.0841667
33 8.3041667 9.5627778
34 4.1641667 8.3041667
35 11.0041667 4.1641667
36 7.9427778 11.0041667
37 -4.1772222 7.9427778
38 -9.7158333 -4.1772222
39 -11.9372222 -9.7158333
40 -11.8372222 -11.9372222
41 -25.2172222 -11.8372222
42 -23.1972222 -25.2172222
43 -11.8227778 -23.1972222
44 -30.1372222 -11.8227778
45 0.4972222 -30.1372222
46 -12.1427778 0.4972222
47 -9.6027778 -12.1427778
48 -7.7641667 -9.6027778
49 -8.4841667 -7.7641667
50 -12.7227778 -8.4841667
51 -13.8441667 -12.7227778
52 -12.9441667 -13.8441667
53 -1.0241667 -12.9441667
54 -3.2041667 -1.0241667
55 -12.7227778 -3.2041667
56 -2.5441667 -12.7227778
57 -4.4027778 -2.5441667
58 -3.9427778 -4.4027778
59 -8.1027778 -3.9427778
60 NA -8.1027778
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -14.1772222 -29.1572222
[2,] 6.6772222 -14.1772222
[3,] 7.5558333 6.6772222
[4,] 4.1558333 7.5558333
[5,] 12.6758333 4.1558333
[6,] 1.6958333 12.6758333
[7,] 13.4772222 1.6958333
[8,] 11.4558333 13.4772222
[9,] -0.5027778 11.4558333
[10,] 8.3572222 -0.5027778
[11,] 7.2972222 8.3572222
[12,] 13.8358333 7.2972222
[13,] 21.2158333 13.8358333
[14,] 16.8772222 21.2158333
[15,] 6.4627778 16.8772222
[16,] 0.8627778 6.4627778
[17,] 8.2827778 0.8627778
[18,] 0.8027778 8.2827778
[19,] 5.9841667 0.8027778
[20,] 11.6627778 5.9841667
[21,] -3.8958333 11.6627778
[22,] 3.5641667 -3.8958333
[23,] -0.5958333 3.5641667
[24,] 15.1427778 -0.5958333
[25,] 5.6227778 15.1427778
[26,] -1.1158333 5.6227778
[27,] 11.7627778 -1.1158333
[28,] 19.7627778 11.7627778
[29,] 5.2827778 19.7627778
[30,] 23.9027778 5.2827778
[31,] 5.0841667 23.9027778
[32,] 9.5627778 5.0841667
[33,] 8.3041667 9.5627778
[34,] 4.1641667 8.3041667
[35,] 11.0041667 4.1641667
[36,] 7.9427778 11.0041667
[37,] -4.1772222 7.9427778
[38,] -9.7158333 -4.1772222
[39,] -11.9372222 -9.7158333
[40,] -11.8372222 -11.9372222
[41,] -25.2172222 -11.8372222
[42,] -23.1972222 -25.2172222
[43,] -11.8227778 -23.1972222
[44,] -30.1372222 -11.8227778
[45,] 0.4972222 -30.1372222
[46,] -12.1427778 0.4972222
[47,] -9.6027778 -12.1427778
[48,] -7.7641667 -9.6027778
[49,] -8.4841667 -7.7641667
[50,] -12.7227778 -8.4841667
[51,] -13.8441667 -12.7227778
[52,] -12.9441667 -13.8441667
[53,] -1.0241667 -12.9441667
[54,] -3.2041667 -1.0241667
[55,] -12.7227778 -3.2041667
[56,] -2.5441667 -12.7227778
[57,] -4.4027778 -2.5441667
[58,] -3.9427778 -4.4027778
[59,] -8.1027778 -3.9427778
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -14.1772222 -29.1572222
2 6.6772222 -14.1772222
3 7.5558333 6.6772222
4 4.1558333 7.5558333
5 12.6758333 4.1558333
6 1.6958333 12.6758333
7 13.4772222 1.6958333
8 11.4558333 13.4772222
9 -0.5027778 11.4558333
10 8.3572222 -0.5027778
11 7.2972222 8.3572222
12 13.8358333 7.2972222
13 21.2158333 13.8358333
14 16.8772222 21.2158333
15 6.4627778 16.8772222
16 0.8627778 6.4627778
17 8.2827778 0.8627778
18 0.8027778 8.2827778
19 5.9841667 0.8027778
20 11.6627778 5.9841667
21 -3.8958333 11.6627778
22 3.5641667 -3.8958333
23 -0.5958333 3.5641667
24 15.1427778 -0.5958333
25 5.6227778 15.1427778
26 -1.1158333 5.6227778
27 11.7627778 -1.1158333
28 19.7627778 11.7627778
29 5.2827778 19.7627778
30 23.9027778 5.2827778
31 5.0841667 23.9027778
32 9.5627778 5.0841667
33 8.3041667 9.5627778
34 4.1641667 8.3041667
35 11.0041667 4.1641667
36 7.9427778 11.0041667
37 -4.1772222 7.9427778
38 -9.7158333 -4.1772222
39 -11.9372222 -9.7158333
40 -11.8372222 -11.9372222
41 -25.2172222 -11.8372222
42 -23.1972222 -25.2172222
43 -11.8227778 -23.1972222
44 -30.1372222 -11.8227778
45 0.4972222 -30.1372222
46 -12.1427778 0.4972222
47 -9.6027778 -12.1427778
48 -7.7641667 -9.6027778
49 -8.4841667 -7.7641667
50 -12.7227778 -8.4841667
51 -13.8441667 -12.7227778
52 -12.9441667 -13.8441667
53 -1.0241667 -12.9441667
54 -3.2041667 -1.0241667
55 -12.7227778 -3.2041667
56 -2.5441667 -12.7227778
57 -4.4027778 -2.5441667
58 -3.9427778 -4.4027778
59 -8.1027778 -3.9427778
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/7flig1322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/8rp8p1322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9smd31322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/10666p1322331393.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/1139ry1322331393.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12zkp41322331393.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13bg061322331393.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14twk81322331394.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15h2o91322331394.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/16rxyk1322331394.tab")
+ }
>
> try(system("convert tmp/1x3en1322331393.ps tmp/1x3en1322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/2bkt21322331393.ps tmp/2bkt21322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/3iw321322331393.ps tmp/3iw321322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/4uqsq1322331393.ps tmp/4uqsq1322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/54rrw1322331393.ps tmp/54rrw1322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ucvd1322331393.ps tmp/6ucvd1322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/7flig1322331393.ps tmp/7flig1322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/8rp8p1322331393.ps tmp/8rp8p1322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/9smd31322331393.ps tmp/9smd31322331393.png",intern=TRUE))
character(0)
> try(system("convert tmp/10666p1322331393.ps tmp/10666p1322331393.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.191 0.498 3.739