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(121.6,0,118.8,0,114.0,1,111.5,1,97.2,1,102.5,1,113.4,1,109.8,1,104.9,1,126.1,1,80.0,1,96.8,1,117.2,1,112.3,1,117.3,1,111.1,0,102.2,0,104.3,0,122.9,0,107.6,0,121.3,0,131.5,0,89.0,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,0,119.0,0,140.4,0,156.6,0,137.1,0,122.7,0,125.8,0,139.3,0,134.9,0,149.2,1,132.3,0,149.0,1,117.2,1,119.6,1,152.0,1,149.4,1,127.3,1,114.1,1,102.1,1,107.7,1,104.4,1,102.1,1,96.0,1,109.3,1,90.0,1,83.9,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 = '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
Promet Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 121.6 0 1 0 0 0 0 0 0 0 0 0 0 1
2 118.8 0 0 1 0 0 0 0 0 0 0 0 0 2
3 114.0 1 0 0 1 0 0 0 0 0 0 0 0 3
4 111.5 1 0 0 0 1 0 0 0 0 0 0 0 4
5 97.2 1 0 0 0 0 1 0 0 0 0 0 0 5
6 102.5 1 0 0 0 0 0 1 0 0 0 0 0 6
7 113.4 1 0 0 0 0 0 0 1 0 0 0 0 7
8 109.8 1 0 0 0 0 0 0 0 1 0 0 0 8
9 104.9 1 0 0 0 0 0 0 0 0 1 0 0 9
10 126.1 1 0 0 0 0 0 0 0 0 0 1 0 10
11 80.0 1 0 0 0 0 0 0 0 0 0 0 1 11
12 96.8 1 0 0 0 0 0 0 0 0 0 0 0 12
13 117.2 1 1 0 0 0 0 0 0 0 0 0 0 13
14 112.3 1 0 1 0 0 0 0 0 0 0 0 0 14
15 117.3 1 0 0 1 0 0 0 0 0 0 0 0 15
16 111.1 0 0 0 0 1 0 0 0 0 0 0 0 16
17 102.2 0 0 0 0 0 1 0 0 0 0 0 0 17
18 104.3 0 0 0 0 0 0 1 0 0 0 0 0 18
19 122.9 0 0 0 0 0 0 0 1 0 0 0 0 19
20 107.6 0 0 0 0 0 0 0 0 1 0 0 0 20
21 121.3 0 0 0 0 0 0 0 0 0 1 0 0 21
22 131.5 0 0 0 0 0 0 0 0 0 0 1 0 22
23 89.0 0 0 0 0 0 0 0 0 0 0 0 1 23
24 104.4 0 0 0 0 0 0 0 0 0 0 0 0 24
25 128.9 0 1 0 0 0 0 0 0 0 0 0 0 25
26 135.9 0 0 1 0 0 0 0 0 0 0 0 0 26
27 133.3 0 0 0 1 0 0 0 0 0 0 0 0 27
28 121.3 0 0 0 0 1 0 0 0 0 0 0 0 28
29 120.5 0 0 0 0 0 1 0 0 0 0 0 0 29
30 120.4 0 0 0 0 0 0 1 0 0 0 0 0 30
31 137.9 0 0 0 0 0 0 0 1 0 0 0 0 31
32 126.1 0 0 0 0 0 0 0 0 1 0 0 0 32
33 133.2 0 0 0 0 0 0 0 0 0 1 0 0 33
34 151.1 0 0 0 0 0 0 0 0 0 0 1 0 34
35 105.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 119.0 0 0 0 0 0 0 0 0 0 0 0 0 36
37 140.4 0 1 0 0 0 0 0 0 0 0 0 0 37
38 156.6 0 0 1 0 0 0 0 0 0 0 0 0 38
39 137.1 0 0 0 1 0 0 0 0 0 0 0 0 39
40 122.7 0 0 0 0 1 0 0 0 0 0 0 0 40
41 125.8 0 0 0 0 0 1 0 0 0 0 0 0 41
42 139.3 0 0 0 0 0 0 1 0 0 0 0 0 42
43 134.9 0 0 0 0 0 0 0 1 0 0 0 0 43
44 149.2 1 0 0 0 0 0 0 0 1 0 0 0 44
45 132.3 0 0 0 0 0 0 0 0 0 1 0 0 45
46 149.0 1 0 0 0 0 0 0 0 0 0 1 0 46
47 117.2 1 0 0 0 0 0 0 0 0 0 0 1 47
48 119.6 1 0 0 0 0 0 0 0 0 0 0 0 48
49 152.0 1 1 0 0 0 0 0 0 0 0 0 0 49
50 149.4 1 0 1 0 0 0 0 0 0 0 0 0 50
51 127.3 1 0 0 1 0 0 0 0 0 0 0 0 51
52 114.1 1 0 0 0 1 0 0 0 0 0 0 0 52
53 102.1 1 0 0 0 0 1 0 0 0 0 0 0 53
54 107.7 1 0 0 0 0 0 1 0 0 0 0 0 54
55 104.4 1 0 0 0 0 0 0 1 0 0 0 0 55
56 102.1 1 0 0 0 0 0 0 0 1 0 0 0 56
57 96.0 1 0 0 0 0 0 0 0 0 1 0 0 57
58 109.3 1 0 0 0 0 0 0 0 0 0 1 0 58
59 90.0 1 0 0 0 0 0 0 0 0 0 0 1 59
60 83.9 1 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) Dummy M1 M2 M3 M4
101.3097 -12.0625 28.1271 30.4108 23.7270 11.3581
M5 M6 M7 M8 M9 M10
4.4818 9.4655 17.0291 15.4053 11.2765 29.2527
M11 t
-8.2037 0.2963
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-26.3869 -7.0944 0.1997 6.1810 31.5091
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 101.30968 6.90312 14.676 < 2e-16 ***
Dummy -12.06248 3.39749 -3.550 0.000900 ***
M1 28.12711 8.18380 3.437 0.001259 **
M2 30.41078 8.17243 3.721 0.000539 ***
M3 23.72695 8.14276 2.914 0.005495 **
M4 11.35813 8.15319 1.393 0.170288
M5 4.48180 8.14532 0.550 0.584823
M6 9.46547 8.13862 1.163 0.250815
M7 17.02914 8.13310 2.094 0.041817 *
M8 15.40531 8.10427 1.901 0.063593 .
M9 11.27649 8.12561 1.388 0.171893
M10 29.25266 8.09715 3.613 0.000747 ***
M11 -8.20367 8.09537 -1.013 0.316180
t 0.29633 0.09808 3.021 0.004101 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 12.8 on 46 degrees of freedom
Multiple R-squared: 0.5884, Adjusted R-squared: 0.4721
F-statistic: 5.059 on 13 and 46 DF, p-value: 1.905e-05
> 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,] 6.034783e-03 1.206957e-02 0.9939652
[2,] 9.157533e-04 1.831507e-03 0.9990842
[3,] 5.420655e-04 1.084131e-03 0.9994579
[4,] 3.249423e-04 6.498846e-04 0.9996751
[5,] 1.017362e-03 2.034725e-03 0.9989826
[6,] 2.743158e-04 5.486315e-04 0.9997257
[7,] 1.160250e-04 2.320500e-04 0.9998840
[8,] 3.508994e-05 7.017987e-05 0.9999649
[9,] 3.005266e-05 6.010532e-05 0.9999699
[10,] 5.191945e-04 1.038389e-03 0.9994808
[11,] 4.457962e-04 8.915924e-04 0.9995542
[12,] 2.249051e-04 4.498102e-04 0.9997751
[13,] 4.240159e-04 8.480319e-04 0.9995760
[14,] 8.352923e-04 1.670585e-03 0.9991647
[15,] 7.497153e-04 1.499431e-03 0.9992503
[16,] 1.025514e-03 2.051028e-03 0.9989745
[17,] 1.126051e-03 2.252103e-03 0.9988739
[18,] 8.972991e-04 1.794598e-03 0.9991027
[19,] 4.544619e-03 9.089237e-03 0.9954554
[20,] 5.868644e-03 1.173729e-02 0.9941314
[21,] 5.387339e-02 1.077468e-01 0.9461266
[22,] 1.536301e-01 3.072602e-01 0.8463699
[23,] 2.223603e-01 4.447205e-01 0.7776397
[24,] 6.624846e-01 6.750308e-01 0.3375154
[25,] 6.495158e-01 7.009684e-01 0.3504842
[26,] 5.471074e-01 9.057852e-01 0.4528926
[27,] 4.345204e-01 8.690409e-01 0.5654796
> postscript(file="/var/www/html/rcomp/tmp/1p6cj1258622546.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/2lyrb1258622546.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/3aaod1258622546.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/4p50u1258622546.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/5uuqc1258622546.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
-8.133118e+00 -1.351312e+01 1.368644e-01 9.709360e+00 1.989360e+00
6 7 8 9 10
2.009360e+00 5.049360e+00 2.776864e+00 1.709360e+00 4.636864e+00
11 12 13 14 15
-4.303136e+00 3.996864e+00 -4.026577e+00 -1.150658e+01 -1.190722e-01
16 17 18 19 20
-6.309055e+00 -8.629055e+00 -1.180905e+01 -1.069055e+00 -1.504155e+01
21 22 23 24 25
2.490945e+00 -5.581550e+00 -1.092155e+01 -4.021550e+00 -7.944991e+00
26 27 28 29 30
-3.524991e+00 2.625132e-01 3.350088e-01 6.115009e+00 7.350088e-01
31 32 33 34 35
1.037501e+01 -9.748679e-02 1.083501e+01 1.046251e+01 1.522513e+00
36 37 38 39 40
7.022513e+00 -9.277745e-04 1.361907e+01 5.065766e-01 -1.820928e+00
41 42 43 44 45
7.859072e+00 1.607907e+01 3.819072e+00 3.150905e+01 6.379072e+00
46 47 48 49 50
1.686905e+01 2.222905e+01 1.612905e+01 2.010561e+01 1.492561e+01
51 52 53 54 55
-7.868820e-01 -1.914386e+00 -7.334386e+00 -7.014386e+00 -1.817439e+01
56 57 58 59 60
-1.914688e+01 -2.141439e+01 -2.638688e+01 -8.526882e+00 -2.312688e+01
> postscript(file="/var/www/html/rcomp/tmp/6o9ye1258622546.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 -8.133118e+00 NA
1 -1.351312e+01 -8.133118e+00
2 1.368644e-01 -1.351312e+01
3 9.709360e+00 1.368644e-01
4 1.989360e+00 9.709360e+00
5 2.009360e+00 1.989360e+00
6 5.049360e+00 2.009360e+00
7 2.776864e+00 5.049360e+00
8 1.709360e+00 2.776864e+00
9 4.636864e+00 1.709360e+00
10 -4.303136e+00 4.636864e+00
11 3.996864e+00 -4.303136e+00
12 -4.026577e+00 3.996864e+00
13 -1.150658e+01 -4.026577e+00
14 -1.190722e-01 -1.150658e+01
15 -6.309055e+00 -1.190722e-01
16 -8.629055e+00 -6.309055e+00
17 -1.180905e+01 -8.629055e+00
18 -1.069055e+00 -1.180905e+01
19 -1.504155e+01 -1.069055e+00
20 2.490945e+00 -1.504155e+01
21 -5.581550e+00 2.490945e+00
22 -1.092155e+01 -5.581550e+00
23 -4.021550e+00 -1.092155e+01
24 -7.944991e+00 -4.021550e+00
25 -3.524991e+00 -7.944991e+00
26 2.625132e-01 -3.524991e+00
27 3.350088e-01 2.625132e-01
28 6.115009e+00 3.350088e-01
29 7.350088e-01 6.115009e+00
30 1.037501e+01 7.350088e-01
31 -9.748679e-02 1.037501e+01
32 1.083501e+01 -9.748679e-02
33 1.046251e+01 1.083501e+01
34 1.522513e+00 1.046251e+01
35 7.022513e+00 1.522513e+00
36 -9.277745e-04 7.022513e+00
37 1.361907e+01 -9.277745e-04
38 5.065766e-01 1.361907e+01
39 -1.820928e+00 5.065766e-01
40 7.859072e+00 -1.820928e+00
41 1.607907e+01 7.859072e+00
42 3.819072e+00 1.607907e+01
43 3.150905e+01 3.819072e+00
44 6.379072e+00 3.150905e+01
45 1.686905e+01 6.379072e+00
46 2.222905e+01 1.686905e+01
47 1.612905e+01 2.222905e+01
48 2.010561e+01 1.612905e+01
49 1.492561e+01 2.010561e+01
50 -7.868820e-01 1.492561e+01
51 -1.914386e+00 -7.868820e-01
52 -7.334386e+00 -1.914386e+00
53 -7.014386e+00 -7.334386e+00
54 -1.817439e+01 -7.014386e+00
55 -1.914688e+01 -1.817439e+01
56 -2.141439e+01 -1.914688e+01
57 -2.638688e+01 -2.141439e+01
58 -8.526882e+00 -2.638688e+01
59 -2.312688e+01 -8.526882e+00
60 NA -2.312688e+01
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.351312e+01 -8.133118e+00
[2,] 1.368644e-01 -1.351312e+01
[3,] 9.709360e+00 1.368644e-01
[4,] 1.989360e+00 9.709360e+00
[5,] 2.009360e+00 1.989360e+00
[6,] 5.049360e+00 2.009360e+00
[7,] 2.776864e+00 5.049360e+00
[8,] 1.709360e+00 2.776864e+00
[9,] 4.636864e+00 1.709360e+00
[10,] -4.303136e+00 4.636864e+00
[11,] 3.996864e+00 -4.303136e+00
[12,] -4.026577e+00 3.996864e+00
[13,] -1.150658e+01 -4.026577e+00
[14,] -1.190722e-01 -1.150658e+01
[15,] -6.309055e+00 -1.190722e-01
[16,] -8.629055e+00 -6.309055e+00
[17,] -1.180905e+01 -8.629055e+00
[18,] -1.069055e+00 -1.180905e+01
[19,] -1.504155e+01 -1.069055e+00
[20,] 2.490945e+00 -1.504155e+01
[21,] -5.581550e+00 2.490945e+00
[22,] -1.092155e+01 -5.581550e+00
[23,] -4.021550e+00 -1.092155e+01
[24,] -7.944991e+00 -4.021550e+00
[25,] -3.524991e+00 -7.944991e+00
[26,] 2.625132e-01 -3.524991e+00
[27,] 3.350088e-01 2.625132e-01
[28,] 6.115009e+00 3.350088e-01
[29,] 7.350088e-01 6.115009e+00
[30,] 1.037501e+01 7.350088e-01
[31,] -9.748679e-02 1.037501e+01
[32,] 1.083501e+01 -9.748679e-02
[33,] 1.046251e+01 1.083501e+01
[34,] 1.522513e+00 1.046251e+01
[35,] 7.022513e+00 1.522513e+00
[36,] -9.277745e-04 7.022513e+00
[37,] 1.361907e+01 -9.277745e-04
[38,] 5.065766e-01 1.361907e+01
[39,] -1.820928e+00 5.065766e-01
[40,] 7.859072e+00 -1.820928e+00
[41,] 1.607907e+01 7.859072e+00
[42,] 3.819072e+00 1.607907e+01
[43,] 3.150905e+01 3.819072e+00
[44,] 6.379072e+00 3.150905e+01
[45,] 1.686905e+01 6.379072e+00
[46,] 2.222905e+01 1.686905e+01
[47,] 1.612905e+01 2.222905e+01
[48,] 2.010561e+01 1.612905e+01
[49,] 1.492561e+01 2.010561e+01
[50,] -7.868820e-01 1.492561e+01
[51,] -1.914386e+00 -7.868820e-01
[52,] -7.334386e+00 -1.914386e+00
[53,] -7.014386e+00 -7.334386e+00
[54,] -1.817439e+01 -7.014386e+00
[55,] -1.914688e+01 -1.817439e+01
[56,] -2.141439e+01 -1.914688e+01
[57,] -2.638688e+01 -2.141439e+01
[58,] -8.526882e+00 -2.638688e+01
[59,] -2.312688e+01 -8.526882e+00
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.351312e+01 -8.133118e+00
2 1.368644e-01 -1.351312e+01
3 9.709360e+00 1.368644e-01
4 1.989360e+00 9.709360e+00
5 2.009360e+00 1.989360e+00
6 5.049360e+00 2.009360e+00
7 2.776864e+00 5.049360e+00
8 1.709360e+00 2.776864e+00
9 4.636864e+00 1.709360e+00
10 -4.303136e+00 4.636864e+00
11 3.996864e+00 -4.303136e+00
12 -4.026577e+00 3.996864e+00
13 -1.150658e+01 -4.026577e+00
14 -1.190722e-01 -1.150658e+01
15 -6.309055e+00 -1.190722e-01
16 -8.629055e+00 -6.309055e+00
17 -1.180905e+01 -8.629055e+00
18 -1.069055e+00 -1.180905e+01
19 -1.504155e+01 -1.069055e+00
20 2.490945e+00 -1.504155e+01
21 -5.581550e+00 2.490945e+00
22 -1.092155e+01 -5.581550e+00
23 -4.021550e+00 -1.092155e+01
24 -7.944991e+00 -4.021550e+00
25 -3.524991e+00 -7.944991e+00
26 2.625132e-01 -3.524991e+00
27 3.350088e-01 2.625132e-01
28 6.115009e+00 3.350088e-01
29 7.350088e-01 6.115009e+00
30 1.037501e+01 7.350088e-01
31 -9.748679e-02 1.037501e+01
32 1.083501e+01 -9.748679e-02
33 1.046251e+01 1.083501e+01
34 1.522513e+00 1.046251e+01
35 7.022513e+00 1.522513e+00
36 -9.277745e-04 7.022513e+00
37 1.361907e+01 -9.277745e-04
38 5.065766e-01 1.361907e+01
39 -1.820928e+00 5.065766e-01
40 7.859072e+00 -1.820928e+00
41 1.607907e+01 7.859072e+00
42 3.819072e+00 1.607907e+01
43 3.150905e+01 3.819072e+00
44 6.379072e+00 3.150905e+01
45 1.686905e+01 6.379072e+00
46 2.222905e+01 1.686905e+01
47 1.612905e+01 2.222905e+01
48 2.010561e+01 1.612905e+01
49 1.492561e+01 2.010561e+01
50 -7.868820e-01 1.492561e+01
51 -1.914386e+00 -7.868820e-01
52 -7.334386e+00 -1.914386e+00
53 -7.014386e+00 -7.334386e+00
54 -1.817439e+01 -7.014386e+00
55 -1.914688e+01 -1.817439e+01
56 -2.141439e+01 -1.914688e+01
57 -2.638688e+01 -2.141439e+01
58 -8.526882e+00 -2.638688e+01
59 -2.312688e+01 -8.526882e+00
> 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/7sgkm1258622546.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/8f5gz1258622546.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/9x1ye1258622546.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/10nyg81258622546.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/115key1258622546.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/129j2g1258622546.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/13wrf41258622546.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/14hk0s1258622546.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/15h1k21258622546.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/16jrwb1258622546.tab")
+ }
>
> system("convert tmp/1p6cj1258622546.ps tmp/1p6cj1258622546.png")
> system("convert tmp/2lyrb1258622546.ps tmp/2lyrb1258622546.png")
> system("convert tmp/3aaod1258622546.ps tmp/3aaod1258622546.png")
> system("convert tmp/4p50u1258622546.ps tmp/4p50u1258622546.png")
> system("convert tmp/5uuqc1258622546.ps tmp/5uuqc1258622546.png")
> system("convert tmp/6o9ye1258622546.ps tmp/6o9ye1258622546.png")
> system("convert tmp/7sgkm1258622546.ps tmp/7sgkm1258622546.png")
> system("convert tmp/8f5gz1258622546.ps tmp/8f5gz1258622546.png")
> system("convert tmp/9x1ye1258622546.ps tmp/9x1ye1258622546.png")
> system("convert tmp/10nyg81258622546.ps tmp/10nyg81258622546.png")
>
>
> proc.time()
user system elapsed
2.384 1.522 3.428