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(120.9,0,0,119.6,0,0,125.9,0,0,116.1,0,0,107.5,0,0,116.7,0,0,112.5,0,0,113,0,0,126.4,0,0,114.1,0,0,112.5,0,0,112.4,0,0,113.1,0,0,116.3,0,0,111.7,0,0,118.8,0,0,116.5,0,0,125.1,0,0,113.1,0,0,119.6,0,0,114.4,0,0,114,0,0,117.8,0,0,117,0,0,120.9,0,0,115,0,0,117.3,0,0,119.4,0,0,114.9,0,0,125.8,0,0,117.6,0,0,117.6,0,0,114.9,0,0,121.9,0,0,117,0,1,106.4,0,1,110.5,0,1,113.6,0,1,114.2,0,1,125.4,0,1,124.6,0,1,120.2,0,1,120.8,0,1,111.4,0,1,124.1,0,1,120.2,0,1,125.5,0,1,116,1,0,117,1,0,105.7,1,0,102,1,0,106.4,1,0,96.9,1,0,107.6,1,0,98.8,1,0,101.1,1,0,105.7,1,0,104.6,1,0,103.2,1,0,101.6,1,0),dim=c(3,60),dimnames=list(c('ChemischeNijverheid','Dummy_1_tijdenscrisis','Dummy_2_voorcrisis'),1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('ChemischeNijverheid','Dummy_1_tijdenscrisis','Dummy_2_voorcrisis'),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
ChemischeNijverheid Dummy_1_tijdenscrisis Dummy_2_voorcrisis M1 M2 M3 M4 M5
1 120.9 0 0 1 0 0 0 0
2 119.6 0 0 0 1 0 0 0
3 125.9 0 0 0 0 1 0 0
4 116.1 0 0 0 0 0 1 0
5 107.5 0 0 0 0 0 0 1
6 116.7 0 0 0 0 0 0 0
7 112.5 0 0 0 0 0 0 0
8 113.0 0 0 0 0 0 0 0
9 126.4 0 0 0 0 0 0 0
10 114.1 0 0 0 0 0 0 0
11 112.5 0 0 0 0 0 0 0
12 112.4 0 0 0 0 0 0 0
13 113.1 0 0 1 0 0 0 0
14 116.3 0 0 0 1 0 0 0
15 111.7 0 0 0 0 1 0 0
16 118.8 0 0 0 0 0 1 0
17 116.5 0 0 0 0 0 0 1
18 125.1 0 0 0 0 0 0 0
19 113.1 0 0 0 0 0 0 0
20 119.6 0 0 0 0 0 0 0
21 114.4 0 0 0 0 0 0 0
22 114.0 0 0 0 0 0 0 0
23 117.8 0 0 0 0 0 0 0
24 117.0 0 0 0 0 0 0 0
25 120.9 0 0 1 0 0 0 0
26 115.0 0 0 0 1 0 0 0
27 117.3 0 0 0 0 1 0 0
28 119.4 0 0 0 0 0 1 0
29 114.9 0 0 0 0 0 0 1
30 125.8 0 0 0 0 0 0 0
31 117.6 0 0 0 0 0 0 0
32 117.6 0 0 0 0 0 0 0
33 114.9 0 0 0 0 0 0 0
34 121.9 0 0 0 0 0 0 0
35 117.0 0 1 0 0 0 0 0
36 106.4 0 1 0 0 0 0 0
37 110.5 0 1 1 0 0 0 0
38 113.6 0 1 0 1 0 0 0
39 114.2 0 1 0 0 1 0 0
40 125.4 0 1 0 0 0 1 0
41 124.6 0 1 0 0 0 0 1
42 120.2 0 1 0 0 0 0 0
43 120.8 0 1 0 0 0 0 0
44 111.4 0 1 0 0 0 0 0
45 124.1 0 1 0 0 0 0 0
46 120.2 0 1 0 0 0 0 0
47 125.5 0 1 0 0 0 0 0
48 116.0 1 0 0 0 0 0 0
49 117.0 1 0 1 0 0 0 0
50 105.7 1 0 0 1 0 0 0
51 102.0 1 0 0 0 1 0 0
52 106.4 1 0 0 0 0 1 0
53 96.9 1 0 0 0 0 0 1
54 107.6 1 0 0 0 0 0 0
55 98.8 1 0 0 0 0 0 0
56 101.1 1 0 0 0 0 0 0
57 105.7 1 0 0 0 0 0 0
58 104.6 1 0 0 0 0 0 0
59 103.2 1 0 0 0 0 0 0
60 101.6 1 0 0 0 0 0 0
M6 M7 M8 M9 M10 M11 t
1 0 0 0 0 0 0 1
2 0 0 0 0 0 0 2
3 0 0 0 0 0 0 3
4 0 0 0 0 0 0 4
5 0 0 0 0 0 0 5
6 1 0 0 0 0 0 6
7 0 1 0 0 0 0 7
8 0 0 1 0 0 0 8
9 0 0 0 1 0 0 9
10 0 0 0 0 1 0 10
11 0 0 0 0 0 1 11
12 0 0 0 0 0 0 12
13 0 0 0 0 0 0 13
14 0 0 0 0 0 0 14
15 0 0 0 0 0 0 15
16 0 0 0 0 0 0 16
17 0 0 0 0 0 0 17
18 1 0 0 0 0 0 18
19 0 1 0 0 0 0 19
20 0 0 1 0 0 0 20
21 0 0 0 1 0 0 21
22 0 0 0 0 1 0 22
23 0 0 0 0 0 1 23
24 0 0 0 0 0 0 24
25 0 0 0 0 0 0 25
26 0 0 0 0 0 0 26
27 0 0 0 0 0 0 27
28 0 0 0 0 0 0 28
29 0 0 0 0 0 0 29
30 1 0 0 0 0 0 30
31 0 1 0 0 0 0 31
32 0 0 1 0 0 0 32
33 0 0 0 1 0 0 33
34 0 0 0 0 1 0 34
35 0 0 0 0 0 1 35
36 0 0 0 0 0 0 36
37 0 0 0 0 0 0 37
38 0 0 0 0 0 0 38
39 0 0 0 0 0 0 39
40 0 0 0 0 0 0 40
41 0 0 0 0 0 0 41
42 1 0 0 0 0 0 42
43 0 1 0 0 0 0 43
44 0 0 1 0 0 0 44
45 0 0 0 1 0 0 45
46 0 0 0 0 1 0 46
47 0 0 0 0 0 1 47
48 0 0 0 0 0 0 48
49 0 0 0 0 0 0 49
50 0 0 0 0 0 0 50
51 0 0 0 0 0 0 51
52 0 0 0 0 0 0 52
53 0 0 0 0 0 0 53
54 1 0 0 0 0 0 54
55 0 1 0 0 0 0 55
56 0 0 1 0 0 0 56
57 0 0 0 1 0 0 57
58 0 0 0 0 1 0 58
59 0 0 0 0 0 1 59
60 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_1_tijdenscrisis Dummy_2_voorcrisis
114.04589 -14.25947 -0.64304
M1 M2 M3
3.70176 1.19325 1.30473
M4 M5 M6
4.23622 -0.97230 5.95919
M7 M8 M9
-0.62932 -0.71784 3.77365
M10 M11 t
1.56513 1.86523 0.06851
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.4694 -2.7186 -0.8383 2.4672 12.9249
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 114.04589 2.96791 38.426 < 2e-16 ***
Dummy_1_tijdenscrisis -14.25947 3.83939 -3.714 0.000561 ***
Dummy_2_voorcrisis -0.64304 2.80276 -0.229 0.819575
M1 3.70176 3.39026 1.092 0.280696
M2 1.19325 3.38202 0.353 0.725871
M3 1.30473 3.37636 0.386 0.700999
M4 4.23622 3.37329 1.256 0.215665
M5 -0.97230 3.37280 -0.288 0.774460
M6 5.95919 3.37491 1.766 0.084225 .
M7 -0.62932 3.37960 -0.186 0.853115
M8 -0.71784 3.38687 -0.212 0.833105
M9 3.77365 3.39670 1.111 0.272480
M10 1.56513 3.40906 0.459 0.648365
M11 1.86523 3.38404 0.551 0.584235
t 0.06851 0.09351 0.733 0.467529
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.304 on 45 degrees of freedom
Multiple R-squared: 0.5882, Adjusted R-squared: 0.46
F-statistic: 4.591 on 14 and 45 DF, p-value: 4.539e-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,] 0.89496966 0.21006068 0.1050303
[2,] 0.80587886 0.38824228 0.1941211
[3,] 0.76363574 0.47272853 0.2363643
[4,] 0.78210309 0.43579383 0.2178969
[5,] 0.68918322 0.62163356 0.3108168
[6,] 0.61427666 0.77144667 0.3857233
[7,] 0.52206672 0.95586655 0.4779333
[8,] 0.42440415 0.84880830 0.5755958
[9,] 0.33376283 0.66752566 0.6662372
[10,] 0.24435702 0.48871404 0.7556430
[11,] 0.17531824 0.35063647 0.8246818
[12,] 0.12275894 0.24551788 0.8772411
[13,] 0.08980195 0.17960390 0.9101981
[14,] 0.05896758 0.11793516 0.9410324
[15,] 0.03735097 0.07470194 0.9626490
[16,] 0.03308467 0.06616934 0.9669153
[17,] 0.02460993 0.04921986 0.9753901
[18,] 0.01412921 0.02825842 0.9858708
[19,] 0.08213504 0.16427009 0.9178650
[20,] 0.47866480 0.95732960 0.5213352
[21,] 0.54532031 0.90935938 0.4546797
[22,] 0.50260012 0.99479976 0.4973999
[23,] 0.45266874 0.90533748 0.5473313
[24,] 0.68744437 0.62511126 0.3125556
[25,] 0.59411016 0.81177968 0.4058898
> postscript(file="/var/www/html/rcomp/tmp/1m9x01261152454.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/2l9851261152454.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/3saw81261152454.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/4wpmd1261152454.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/5v0xp1261152454.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
3.08383450 4.22383450 10.34383450 -2.45616550 -5.91616550 -3.71616550
7 8 9 10 11 12
-1.39616550 -0.87616550 7.96383450 -2.19616550 -4.16477273 -2.46805944
13 14 15 16 17 18
-5.53833333 0.10166667 -4.67833333 -0.57833333 2.26166667 3.86166667
19 20 21 22 23 24
-1.61833333 4.90166667 -4.85833333 -3.11833333 0.31305944 1.30977273
25 26 27 28 29 30
1.43949883 -2.02050117 0.09949883 -0.80050117 -0.16050117 3.73949883
31 32 33 34 35 36
2.05949883 2.07949883 -5.18050117 3.95949883 -0.66607226 -9.46935897
37 38 39 40 41 42
-9.13963287 -3.59963287 -3.17963287 5.02036713 9.36036713 -2.03963287
43 44 45 46 47 48
5.08036713 -4.29963287 3.84036713 2.08036713 7.01175991 12.92490676
49 50 51 52 53 54
10.15463287 1.29463287 -2.58536713 -1.18536713 -5.54536713 -1.84536713
55 56 57 58 59 60
-4.12536713 -1.80536713 -1.76536713 -0.72536713 -2.49397436 -2.29726107
> postscript(file="/var/www/html/rcomp/tmp/6pknm1261152454.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 3.08383450 NA
1 4.22383450 3.08383450
2 10.34383450 4.22383450
3 -2.45616550 10.34383450
4 -5.91616550 -2.45616550
5 -3.71616550 -5.91616550
6 -1.39616550 -3.71616550
7 -0.87616550 -1.39616550
8 7.96383450 -0.87616550
9 -2.19616550 7.96383450
10 -4.16477273 -2.19616550
11 -2.46805944 -4.16477273
12 -5.53833333 -2.46805944
13 0.10166667 -5.53833333
14 -4.67833333 0.10166667
15 -0.57833333 -4.67833333
16 2.26166667 -0.57833333
17 3.86166667 2.26166667
18 -1.61833333 3.86166667
19 4.90166667 -1.61833333
20 -4.85833333 4.90166667
21 -3.11833333 -4.85833333
22 0.31305944 -3.11833333
23 1.30977273 0.31305944
24 1.43949883 1.30977273
25 -2.02050117 1.43949883
26 0.09949883 -2.02050117
27 -0.80050117 0.09949883
28 -0.16050117 -0.80050117
29 3.73949883 -0.16050117
30 2.05949883 3.73949883
31 2.07949883 2.05949883
32 -5.18050117 2.07949883
33 3.95949883 -5.18050117
34 -0.66607226 3.95949883
35 -9.46935897 -0.66607226
36 -9.13963287 -9.46935897
37 -3.59963287 -9.13963287
38 -3.17963287 -3.59963287
39 5.02036713 -3.17963287
40 9.36036713 5.02036713
41 -2.03963287 9.36036713
42 5.08036713 -2.03963287
43 -4.29963287 5.08036713
44 3.84036713 -4.29963287
45 2.08036713 3.84036713
46 7.01175991 2.08036713
47 12.92490676 7.01175991
48 10.15463287 12.92490676
49 1.29463287 10.15463287
50 -2.58536713 1.29463287
51 -1.18536713 -2.58536713
52 -5.54536713 -1.18536713
53 -1.84536713 -5.54536713
54 -4.12536713 -1.84536713
55 -1.80536713 -4.12536713
56 -1.76536713 -1.80536713
57 -0.72536713 -1.76536713
58 -2.49397436 -0.72536713
59 -2.29726107 -2.49397436
60 NA -2.29726107
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 4.22383450 3.08383450
[2,] 10.34383450 4.22383450
[3,] -2.45616550 10.34383450
[4,] -5.91616550 -2.45616550
[5,] -3.71616550 -5.91616550
[6,] -1.39616550 -3.71616550
[7,] -0.87616550 -1.39616550
[8,] 7.96383450 -0.87616550
[9,] -2.19616550 7.96383450
[10,] -4.16477273 -2.19616550
[11,] -2.46805944 -4.16477273
[12,] -5.53833333 -2.46805944
[13,] 0.10166667 -5.53833333
[14,] -4.67833333 0.10166667
[15,] -0.57833333 -4.67833333
[16,] 2.26166667 -0.57833333
[17,] 3.86166667 2.26166667
[18,] -1.61833333 3.86166667
[19,] 4.90166667 -1.61833333
[20,] -4.85833333 4.90166667
[21,] -3.11833333 -4.85833333
[22,] 0.31305944 -3.11833333
[23,] 1.30977273 0.31305944
[24,] 1.43949883 1.30977273
[25,] -2.02050117 1.43949883
[26,] 0.09949883 -2.02050117
[27,] -0.80050117 0.09949883
[28,] -0.16050117 -0.80050117
[29,] 3.73949883 -0.16050117
[30,] 2.05949883 3.73949883
[31,] 2.07949883 2.05949883
[32,] -5.18050117 2.07949883
[33,] 3.95949883 -5.18050117
[34,] -0.66607226 3.95949883
[35,] -9.46935897 -0.66607226
[36,] -9.13963287 -9.46935897
[37,] -3.59963287 -9.13963287
[38,] -3.17963287 -3.59963287
[39,] 5.02036713 -3.17963287
[40,] 9.36036713 5.02036713
[41,] -2.03963287 9.36036713
[42,] 5.08036713 -2.03963287
[43,] -4.29963287 5.08036713
[44,] 3.84036713 -4.29963287
[45,] 2.08036713 3.84036713
[46,] 7.01175991 2.08036713
[47,] 12.92490676 7.01175991
[48,] 10.15463287 12.92490676
[49,] 1.29463287 10.15463287
[50,] -2.58536713 1.29463287
[51,] -1.18536713 -2.58536713
[52,] -5.54536713 -1.18536713
[53,] -1.84536713 -5.54536713
[54,] -4.12536713 -1.84536713
[55,] -1.80536713 -4.12536713
[56,] -1.76536713 -1.80536713
[57,] -0.72536713 -1.76536713
[58,] -2.49397436 -0.72536713
[59,] -2.29726107 -2.49397436
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 4.22383450 3.08383450
2 10.34383450 4.22383450
3 -2.45616550 10.34383450
4 -5.91616550 -2.45616550
5 -3.71616550 -5.91616550
6 -1.39616550 -3.71616550
7 -0.87616550 -1.39616550
8 7.96383450 -0.87616550
9 -2.19616550 7.96383450
10 -4.16477273 -2.19616550
11 -2.46805944 -4.16477273
12 -5.53833333 -2.46805944
13 0.10166667 -5.53833333
14 -4.67833333 0.10166667
15 -0.57833333 -4.67833333
16 2.26166667 -0.57833333
17 3.86166667 2.26166667
18 -1.61833333 3.86166667
19 4.90166667 -1.61833333
20 -4.85833333 4.90166667
21 -3.11833333 -4.85833333
22 0.31305944 -3.11833333
23 1.30977273 0.31305944
24 1.43949883 1.30977273
25 -2.02050117 1.43949883
26 0.09949883 -2.02050117
27 -0.80050117 0.09949883
28 -0.16050117 -0.80050117
29 3.73949883 -0.16050117
30 2.05949883 3.73949883
31 2.07949883 2.05949883
32 -5.18050117 2.07949883
33 3.95949883 -5.18050117
34 -0.66607226 3.95949883
35 -9.46935897 -0.66607226
36 -9.13963287 -9.46935897
37 -3.59963287 -9.13963287
38 -3.17963287 -3.59963287
39 5.02036713 -3.17963287
40 9.36036713 5.02036713
41 -2.03963287 9.36036713
42 5.08036713 -2.03963287
43 -4.29963287 5.08036713
44 3.84036713 -4.29963287
45 2.08036713 3.84036713
46 7.01175991 2.08036713
47 12.92490676 7.01175991
48 10.15463287 12.92490676
49 1.29463287 10.15463287
50 -2.58536713 1.29463287
51 -1.18536713 -2.58536713
52 -5.54536713 -1.18536713
53 -1.84536713 -5.54536713
54 -4.12536713 -1.84536713
55 -1.80536713 -4.12536713
56 -1.76536713 -1.80536713
57 -0.72536713 -1.76536713
58 -2.49397436 -0.72536713
59 -2.29726107 -2.49397436
> 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/7zjsn1261152454.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/8boof1261152454.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/9dwvs1261152454.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/10al7o1261152454.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/11igh21261152454.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/12alwq1261152454.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/1301m61261152455.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/140g9y1261152455.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/15tikx1261152455.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/16mjke1261152455.tab")
+ }
>
> try(system("convert tmp/1m9x01261152454.ps tmp/1m9x01261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/2l9851261152454.ps tmp/2l9851261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/3saw81261152454.ps tmp/3saw81261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/4wpmd1261152454.ps tmp/4wpmd1261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/5v0xp1261152454.ps tmp/5v0xp1261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/6pknm1261152454.ps tmp/6pknm1261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/7zjsn1261152454.ps tmp/7zjsn1261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/8boof1261152454.ps tmp/8boof1261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/9dwvs1261152454.ps tmp/9dwvs1261152454.png",intern=TRUE))
character(0)
> try(system("convert tmp/10al7o1261152454.ps tmp/10al7o1261152454.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.403 1.592 3.698