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(1635.25
+ ,8169.75
+ ,7977.64
+ ,10171
+ ,-14.9
+ ,-18
+ ,1.8
+ ,2.05
+ ,1833.42
+ ,7905.84
+ ,8334.59
+ ,9721
+ ,-16.2
+ ,-11
+ ,1.5
+ ,2.05
+ ,1910.43
+ ,8145.82
+ ,8623.36
+ ,9897
+ ,-14.4
+ ,-9
+ ,1
+ ,1.81
+ ,1959.67
+ ,8895.71
+ ,9098.03
+ ,9828
+ ,-17.3
+ ,-10
+ ,1.6
+ ,1.58
+ ,1969.6
+ ,9676.31
+ ,9154.34
+ ,9924
+ ,-15.7
+ ,-13
+ ,1.5
+ ,1.57
+ ,2061.41
+ ,9884.59
+ ,9284.73
+ ,10371
+ ,-12.6
+ ,-11
+ ,1.8
+ ,1.76
+ ,2093.48
+ ,10637.44
+ ,9492.49
+ ,10846
+ ,-9.4
+ ,-5
+ ,1.8
+ ,1.76
+ ,2120.88
+ ,10717.13
+ ,9682.35
+ ,10413
+ ,-8.1
+ ,-15
+ ,1.6
+ ,1.89
+ ,2174.56
+ ,10205.29
+ ,9762.12
+ ,10709
+ ,-5.4
+ ,-6
+ ,1.9
+ ,1.9
+ ,2196.72
+ ,10295.98
+ ,10124.63
+ ,10662
+ ,-4.6
+ ,-6
+ ,1.7
+ ,1.9
+ ,2350.44
+ ,10892.76
+ ,10540.05
+ ,10570
+ ,-4.9
+ ,-3
+ ,1.6
+ ,1.92
+ ,2440.25
+ ,10631.92
+ ,10601.61
+ ,10297
+ ,-4
+ ,-1
+ ,1.3
+ ,1.76
+ ,2408.64
+ ,11441.08
+ ,10323.73
+ ,10635
+ ,-3.1
+ ,-3
+ ,1.1
+ ,1.64
+ ,2472.81
+ ,11950.95
+ ,10418.4
+ ,10872
+ ,-1.3
+ ,-4
+ ,1.9
+ ,1.57
+ ,2407.6
+ ,11037.54
+ ,10092.96
+ ,10296
+ ,0
+ ,-6
+ ,2.6
+ ,1.69
+ ,2454.62
+ ,11527.72
+ ,10364.91
+ ,10383
+ ,-0.4
+ ,0
+ ,2.3
+ ,1.76
+ ,2448.05
+ ,11383.89
+ ,10152.09
+ ,10431
+ ,3
+ ,-4
+ ,2.4
+ ,1.89
+ ,2497.84
+ ,10989.34
+ ,10032.8
+ ,10574
+ ,0.4
+ ,-2
+ ,2.2
+ ,1.78
+ ,2645.64
+ ,11079.42
+ ,10204.59
+ ,10653
+ ,1.2
+ ,-2
+ ,2
+ ,1.88
+ ,2756.76
+ ,11028.93
+ ,10001.6
+ ,10805
+ ,0.6
+ ,-6
+ ,2.9
+ ,1.86
+ ,2849.27
+ ,10973
+ ,10411.75
+ ,10872
+ ,-1.3
+ ,-7
+ ,2.6
+ ,1.88
+ ,2921.44
+ ,11068.05
+ ,10673.38
+ ,10625
+ ,-3.2
+ ,-6
+ ,2.3
+ ,1.87
+ ,2981.85
+ ,11394.84
+ ,10539.51
+ ,10407
+ ,-1.8
+ ,-6
+ ,2.3
+ ,1.86
+ ,3080.58
+ ,11545.71
+ ,10723.78
+ ,10463
+ ,-3.6
+ ,-3
+ ,2.6
+ ,1.89
+ ,3106.22
+ ,11809.38
+ ,10682.06
+ ,10556
+ ,-4.2
+ ,-2
+ ,3.1
+ ,1.9
+ ,3119.31
+ ,11395.64
+ ,10283.19
+ ,10646
+ ,-6.9
+ ,-5
+ ,2.8
+ ,1.89
+ ,3061.26
+ ,11082.38
+ ,10377.18
+ ,10702
+ ,-8
+ ,-11
+ ,2.5
+ ,1.85
+ ,3097.31
+ ,11402.75
+ ,10486.64
+ ,11353
+ ,-7.5
+ ,-11
+ ,2.9
+ ,1.78
+ ,3161.69
+ ,11716.87
+ ,10545.38
+ ,11346
+ ,-8.2
+ ,-11
+ ,3.1
+ ,1.71
+ ,3257.16
+ ,12204.98
+ ,10554.27
+ ,11451
+ ,-7.6
+ ,-10
+ ,3.1
+ ,1.69
+ ,3277.01
+ ,12986.62
+ ,10532.54
+ ,11964
+ ,-3.7
+ ,-14
+ ,3.2
+ ,1.72
+ ,3295.32
+ ,13392.79
+ ,10324.31
+ ,12574
+ ,-1.7
+ ,-8
+ ,2.5
+ ,1.77
+ ,3363.99
+ ,14368.05
+ ,10695.25
+ ,13031
+ ,-0.7
+ ,-9
+ ,2.6
+ ,1.98
+ ,3494.17
+ ,15650.83
+ ,10827.81
+ ,13812
+ ,0.2
+ ,-5
+ ,2.9
+ ,2.2
+ ,3667.03
+ ,16102.64
+ ,10872.48
+ ,14544
+ ,0.6
+ ,-1
+ ,2.6
+ ,2.25
+ ,3813.06
+ ,16187.64
+ ,10971.19
+ ,14931
+ ,2.2
+ ,-2
+ ,2.4
+ ,2.24
+ ,3917.96
+ ,16311.54
+ ,11145.65
+ ,14886
+ ,3.3
+ ,-5
+ ,1.7
+ ,2.51
+ ,3895.51
+ ,17232.97
+ ,11234.68
+ ,16005
+ ,5.3
+ ,-4
+ ,2
+ ,2.79
+ ,3801.06
+ ,16397.83
+ ,11333.88
+ ,17064
+ ,5.5
+ ,-6
+ ,2.2
+ ,3.07
+ ,3570.12
+ ,14990.31
+ ,10997.97
+ ,15168
+ ,6.3
+ ,-2
+ ,1.9
+ ,3.08
+ ,3701.61
+ ,15147.55
+ ,11036.89
+ ,16050
+ ,7.7
+ ,-2
+ ,1.6
+ ,3.05
+ ,3862.27
+ ,15786.78
+ ,11257.35
+ ,15839
+ ,6.5
+ ,-2
+ ,1.6
+ ,3.08
+ ,3970.1
+ ,15934.09
+ ,11533.59
+ ,15137
+ ,5.5
+ ,-2
+ ,1.2
+ ,3.15
+ ,4138.52
+ ,16519.44
+ ,11963.12
+ ,14954
+ ,6.9
+ ,2
+ ,1.2
+ ,3.16
+ ,4199.75
+ ,16101.07
+ ,12185.15
+ ,15648
+ ,5.7
+ ,1
+ ,1.5
+ ,3.16
+ ,4290.89
+ ,16775.08
+ ,12377.62
+ ,15305
+ ,6.9
+ ,-8
+ ,1.6
+ ,3.19
+ ,4443.91
+ ,17286.32
+ ,12512.89
+ ,15579
+ ,6.1
+ ,-1
+ ,1.7
+ ,3.44
+ ,4502.64
+ ,17741.23
+ ,12631.48
+ ,16348
+ ,4.8
+ ,1
+ ,1.8
+ ,3.55
+ ,4356.98
+ ,17128.37
+ ,12268.53
+ ,15928
+ ,3.7
+ ,-1
+ ,1.8
+ ,3.6
+ ,4591.27
+ ,17460.53
+ ,12754.8
+ ,16171
+ ,5.8
+ ,2
+ ,1.8
+ ,3.62
+ ,4696.96
+ ,17611.14
+ ,13407.75
+ ,15937
+ ,6.8
+ ,2
+ ,1.3
+ ,3.69)
+ ,dim=c(8
+ ,51)
+ ,dimnames=list(c('BEL_20'
+ ,'Nikkei'
+ ,'DJ_Indust'
+ ,'Goudprijs'
+ ,'Conjunct_Seizoenzuiver'
+ ,'Cons_vertrouw'
+ ,'Alg_consumptie_index_BE'
+ ,'Gem_rente_kasbon_1j')
+ ,1:51))
> y <- array(NA,dim=c(8,51),dimnames=list(c('BEL_20','Nikkei','DJ_Indust','Goudprijs','Conjunct_Seizoenzuiver','Cons_vertrouw','Alg_consumptie_index_BE','Gem_rente_kasbon_1j'),1:51))
> 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
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
BEL_20 Nikkei DJ_Indust Goudprijs Conjunct_Seizoenzuiver Cons_vertrouw
1 1635.25 8169.75 7977.64 10171 -14.9 -18
2 1833.42 7905.84 8334.59 9721 -16.2 -11
3 1910.43 8145.82 8623.36 9897 -14.4 -9
4 1959.67 8895.71 9098.03 9828 -17.3 -10
5 1969.60 9676.31 9154.34 9924 -15.7 -13
6 2061.41 9884.59 9284.73 10371 -12.6 -11
7 2093.48 10637.44 9492.49 10846 -9.4 -5
8 2120.88 10717.13 9682.35 10413 -8.1 -15
9 2174.56 10205.29 9762.12 10709 -5.4 -6
10 2196.72 10295.98 10124.63 10662 -4.6 -6
11 2350.44 10892.76 10540.05 10570 -4.9 -3
12 2440.25 10631.92 10601.61 10297 -4.0 -1
13 2408.64 11441.08 10323.73 10635 -3.1 -3
14 2472.81 11950.95 10418.40 10872 -1.3 -4
15 2407.60 11037.54 10092.96 10296 0.0 -6
16 2454.62 11527.72 10364.91 10383 -0.4 0
17 2448.05 11383.89 10152.09 10431 3.0 -4
18 2497.84 10989.34 10032.80 10574 0.4 -2
19 2645.64 11079.42 10204.59 10653 1.2 -2
20 2756.76 11028.93 10001.60 10805 0.6 -6
21 2849.27 10973.00 10411.75 10872 -1.3 -7
22 2921.44 11068.05 10673.38 10625 -3.2 -6
23 2981.85 11394.84 10539.51 10407 -1.8 -6
24 3080.58 11545.71 10723.78 10463 -3.6 -3
25 3106.22 11809.38 10682.06 10556 -4.2 -2
26 3119.31 11395.64 10283.19 10646 -6.9 -5
27 3061.26 11082.38 10377.18 10702 -8.0 -11
28 3097.31 11402.75 10486.64 11353 -7.5 -11
29 3161.69 11716.87 10545.38 11346 -8.2 -11
30 3257.16 12204.98 10554.27 11451 -7.6 -10
31 3277.01 12986.62 10532.54 11964 -3.7 -14
32 3295.32 13392.79 10324.31 12574 -1.7 -8
33 3363.99 14368.05 10695.25 13031 -0.7 -9
34 3494.17 15650.83 10827.81 13812 0.2 -5
35 3667.03 16102.64 10872.48 14544 0.6 -1
36 3813.06 16187.64 10971.19 14931 2.2 -2
37 3917.96 16311.54 11145.65 14886 3.3 -5
38 3895.51 17232.97 11234.68 16005 5.3 -4
39 3801.06 16397.83 11333.88 17064 5.5 -6
40 3570.12 14990.31 10997.97 15168 6.3 -2
41 3701.61 15147.55 11036.89 16050 7.7 -2
42 3862.27 15786.78 11257.35 15839 6.5 -2
43 3970.10 15934.09 11533.59 15137 5.5 -2
44 4138.52 16519.44 11963.12 14954 6.9 2
45 4199.75 16101.07 12185.15 15648 5.7 1
46 4290.89 16775.08 12377.62 15305 6.9 -8
47 4443.91 17286.32 12512.89 15579 6.1 -1
48 4502.64 17741.23 12631.48 16348 4.8 1
49 4356.98 17128.37 12268.53 15928 3.7 -1
50 4591.27 17460.53 12754.80 16171 5.8 2
51 4696.96 17611.14 13407.75 15937 6.8 2
Alg_consumptie_index_BE Gem_rente_kasbon_1j M1 M2 M3 M4 M5 M6 M7 M8 M9 M10
1 1.8 2.05 1 0 0 0 0 0 0 0 0 0
2 1.5 2.05 0 1 0 0 0 0 0 0 0 0
3 1.0 1.81 0 0 1 0 0 0 0 0 0 0
4 1.6 1.58 0 0 0 1 0 0 0 0 0 0
5 1.5 1.57 0 0 0 0 1 0 0 0 0 0
6 1.8 1.76 0 0 0 0 0 1 0 0 0 0
7 1.8 1.76 0 0 0 0 0 0 1 0 0 0
8 1.6 1.89 0 0 0 0 0 0 0 1 0 0
9 1.9 1.90 0 0 0 0 0 0 0 0 1 0
10 1.7 1.90 0 0 0 0 0 0 0 0 0 1
11 1.6 1.92 0 0 0 0 0 0 0 0 0 0
12 1.3 1.76 0 0 0 0 0 0 0 0 0 0
13 1.1 1.64 1 0 0 0 0 0 0 0 0 0
14 1.9 1.57 0 1 0 0 0 0 0 0 0 0
15 2.6 1.69 0 0 1 0 0 0 0 0 0 0
16 2.3 1.76 0 0 0 1 0 0 0 0 0 0
17 2.4 1.89 0 0 0 0 1 0 0 0 0 0
18 2.2 1.78 0 0 0 0 0 1 0 0 0 0
19 2.0 1.88 0 0 0 0 0 0 1 0 0 0
20 2.9 1.86 0 0 0 0 0 0 0 1 0 0
21 2.6 1.88 0 0 0 0 0 0 0 0 1 0
22 2.3 1.87 0 0 0 0 0 0 0 0 0 1
23 2.3 1.86 0 0 0 0 0 0 0 0 0 0
24 2.6 1.89 0 0 0 0 0 0 0 0 0 0
25 3.1 1.90 1 0 0 0 0 0 0 0 0 0
26 2.8 1.89 0 1 0 0 0 0 0 0 0 0
27 2.5 1.85 0 0 1 0 0 0 0 0 0 0
28 2.9 1.78 0 0 0 1 0 0 0 0 0 0
29 3.1 1.71 0 0 0 0 1 0 0 0 0 0
30 3.1 1.69 0 0 0 0 0 1 0 0 0 0
31 3.2 1.72 0 0 0 0 0 0 1 0 0 0
32 2.5 1.77 0 0 0 0 0 0 0 1 0 0
33 2.6 1.98 0 0 0 0 0 0 0 0 1 0
34 2.9 2.20 0 0 0 0 0 0 0 0 0 1
35 2.6 2.25 0 0 0 0 0 0 0 0 0 0
36 2.4 2.24 0 0 0 0 0 0 0 0 0 0
37 1.7 2.51 1 0 0 0 0 0 0 0 0 0
38 2.0 2.79 0 1 0 0 0 0 0 0 0 0
39 2.2 3.07 0 0 1 0 0 0 0 0 0 0
40 1.9 3.08 0 0 0 1 0 0 0 0 0 0
41 1.6 3.05 0 0 0 0 1 0 0 0 0 0
42 1.6 3.08 0 0 0 0 0 1 0 0 0 0
43 1.2 3.15 0 0 0 0 0 0 1 0 0 0
44 1.2 3.16 0 0 0 0 0 0 0 1 0 0
45 1.5 3.16 0 0 0 0 0 0 0 0 1 0
46 1.6 3.19 0 0 0 0 0 0 0 0 0 1
47 1.7 3.44 0 0 0 0 0 0 0 0 0 0
48 1.8 3.55 0 0 0 0 0 0 0 0 0 0
49 1.8 3.60 1 0 0 0 0 0 0 0 0 0
50 1.8 3.62 0 1 0 0 0 0 0 0 0 0
51 1.3 3.69 0 0 1 0 0 0 0 0 0 0
M11
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 1
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 1
24 0
25 0
26 0
27 0
28 0
29 0
30 0
31 0
32 0
33 0
34 0
35 1
36 0
37 0
38 0
39 0
40 0
41 0
42 0
43 0
44 0
45 0
46 0
47 1
48 0
49 0
50 0
51 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Nikkei DJ_Indust
-4.163e+03 6.382e-02 4.024e-01
Goudprijs Conjunct_Seizoenzuiver Cons_vertrouw
9.635e-02 -1.496e+01 -4.080e+00
Alg_consumptie_index_BE Gem_rente_kasbon_1j M1
2.540e+02 1.833e+02 2.491e+01
M2 M3 M4
1.203e+01 -3.165e+01 -8.034e+01
M5 M6 M7
-4.723e+01 -4.401e+00 2.207e+01
M8 M9 M10
6.611e+01 -3.812e+01 -9.732e+01
M11
-3.386e+01
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-318.782 -88.379 9.269 102.022 324.065
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -4.163e+03 7.816e+02 -5.326 7.7e-06 ***
Nikkei 6.382e-02 6.639e-02 0.961 0.34362
DJ_Indust 4.023e-01 8.755e-02 4.596 6.4e-05 ***
Goudprijs 9.635e-02 7.518e-02 1.282 0.20921
Conjunct_Seizoenzuiver -1.496e+01 9.679e+00 -1.546 0.13203
Cons_vertrouw -4.080e+00 1.070e+01 -0.381 0.70561
Alg_consumptie_index_BE 2.540e+02 6.074e+01 4.181 0.00021 ***
Gem_rente_kasbon_1j 1.833e+02 1.419e+02 1.292 0.20561
M1 2.491e+01 1.316e+02 0.189 0.85100
M2 1.203e+01 1.275e+02 0.094 0.92540
M3 -3.165e+01 1.319e+02 -0.240 0.81197
M4 -8.034e+01 1.345e+02 -0.597 0.55450
M5 -4.723e+01 1.398e+02 -0.338 0.73770
M6 -4.401e+00 1.356e+02 -0.032 0.97432
M7 2.207e+01 1.367e+02 0.161 0.87275
M8 6.611e+01 1.440e+02 0.459 0.64936
M9 -3.812e+01 1.372e+02 -0.278 0.78295
M10 -9.732e+01 1.394e+02 -0.698 0.49023
M11 -3.386e+01 1.316e+02 -0.257 0.79854
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 182.2 on 32 degrees of freedom
Multiple R-squared: 0.9698, Adjusted R-squared: 0.9528
F-statistic: 57.04 on 18 and 32 DF, p-value: < 2.2e-16
> 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.9888829 2.223426e-02 1.111713e-02
[2,] 0.9996356 7.288007e-04 3.644004e-04
[3,] 0.9998067 3.866612e-04 1.933306e-04
[4,] 0.9999896 2.085894e-05 1.042947e-05
[5,] 0.9999960 8.077925e-06 4.038962e-06
[6,] 0.9999964 7.146953e-06 3.573477e-06
[7,] 0.9999545 9.099904e-05 4.549952e-05
[8,] 0.9999606 7.876167e-05 3.938084e-05
> postscript(file="/var/www/html/rcomp/tmp/1loma1291647418.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/html/rcomp/tmp/2wx3d1291647418.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/html/rcomp/tmp/3wx3d1291647418.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/html/rcomp/tmp/4wx3d1291647418.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/html/rcomp/tmp/5wx3d1291647418.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 = 51
Frequency = 1
1 2 3 4 5 6
-67.159649 145.771448 324.065084 32.119478 -33.860999 -150.176529
7 8 9 10 11 12
-249.629877 -300.411547 -171.361966 -174.353982 -250.976576 -49.707469
13 14 15 16 17 18
-0.536001 -184.437206 -149.720557 -121.236610 -85.417077 21.162758
19 20 21 22 23 24
104.438556 -8.424449 60.419337 157.932763 231.674817 110.999042
25 26 27 28 29 30
-30.987982 198.593325 203.586426 79.848554 19.672400 44.194967
31 32 33 34 35 36
-41.863352 154.512783 18.883402 -88.910360 -7.510871 94.713201
37 38 39 40 41 42
233.433845 -72.080248 -318.781691 9.268578 99.605676 84.818805
43 44 45 46 47 48
187.054674 154.323212 92.059227 105.331578 26.812630 -156.004773
49 50 51
-134.750213 -87.847319 -59.149263
> postscript(file="/var/www/html/rcomp/tmp/6po2g1291647418.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 = 51
Frequency = 1
lag(myerror, k = 1) myerror
0 -67.159649 NA
1 145.771448 -67.159649
2 324.065084 145.771448
3 32.119478 324.065084
4 -33.860999 32.119478
5 -150.176529 -33.860999
6 -249.629877 -150.176529
7 -300.411547 -249.629877
8 -171.361966 -300.411547
9 -174.353982 -171.361966
10 -250.976576 -174.353982
11 -49.707469 -250.976576
12 -0.536001 -49.707469
13 -184.437206 -0.536001
14 -149.720557 -184.437206
15 -121.236610 -149.720557
16 -85.417077 -121.236610
17 21.162758 -85.417077
18 104.438556 21.162758
19 -8.424449 104.438556
20 60.419337 -8.424449
21 157.932763 60.419337
22 231.674817 157.932763
23 110.999042 231.674817
24 -30.987982 110.999042
25 198.593325 -30.987982
26 203.586426 198.593325
27 79.848554 203.586426
28 19.672400 79.848554
29 44.194967 19.672400
30 -41.863352 44.194967
31 154.512783 -41.863352
32 18.883402 154.512783
33 -88.910360 18.883402
34 -7.510871 -88.910360
35 94.713201 -7.510871
36 233.433845 94.713201
37 -72.080248 233.433845
38 -318.781691 -72.080248
39 9.268578 -318.781691
40 99.605676 9.268578
41 84.818805 99.605676
42 187.054674 84.818805
43 154.323212 187.054674
44 92.059227 154.323212
45 105.331578 92.059227
46 26.812630 105.331578
47 -156.004773 26.812630
48 -134.750213 -156.004773
49 -87.847319 -134.750213
50 -59.149263 -87.847319
51 NA -59.149263
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 145.771448 -67.159649
[2,] 324.065084 145.771448
[3,] 32.119478 324.065084
[4,] -33.860999 32.119478
[5,] -150.176529 -33.860999
[6,] -249.629877 -150.176529
[7,] -300.411547 -249.629877
[8,] -171.361966 -300.411547
[9,] -174.353982 -171.361966
[10,] -250.976576 -174.353982
[11,] -49.707469 -250.976576
[12,] -0.536001 -49.707469
[13,] -184.437206 -0.536001
[14,] -149.720557 -184.437206
[15,] -121.236610 -149.720557
[16,] -85.417077 -121.236610
[17,] 21.162758 -85.417077
[18,] 104.438556 21.162758
[19,] -8.424449 104.438556
[20,] 60.419337 -8.424449
[21,] 157.932763 60.419337
[22,] 231.674817 157.932763
[23,] 110.999042 231.674817
[24,] -30.987982 110.999042
[25,] 198.593325 -30.987982
[26,] 203.586426 198.593325
[27,] 79.848554 203.586426
[28,] 19.672400 79.848554
[29,] 44.194967 19.672400
[30,] -41.863352 44.194967
[31,] 154.512783 -41.863352
[32,] 18.883402 154.512783
[33,] -88.910360 18.883402
[34,] -7.510871 -88.910360
[35,] 94.713201 -7.510871
[36,] 233.433845 94.713201
[37,] -72.080248 233.433845
[38,] -318.781691 -72.080248
[39,] 9.268578 -318.781691
[40,] 99.605676 9.268578
[41,] 84.818805 99.605676
[42,] 187.054674 84.818805
[43,] 154.323212 187.054674
[44,] 92.059227 154.323212
[45,] 105.331578 92.059227
[46,] 26.812630 105.331578
[47,] -156.004773 26.812630
[48,] -134.750213 -156.004773
[49,] -87.847319 -134.750213
[50,] -59.149263 -87.847319
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 145.771448 -67.159649
2 324.065084 145.771448
3 32.119478 324.065084
4 -33.860999 32.119478
5 -150.176529 -33.860999
6 -249.629877 -150.176529
7 -300.411547 -249.629877
8 -171.361966 -300.411547
9 -174.353982 -171.361966
10 -250.976576 -174.353982
11 -49.707469 -250.976576
12 -0.536001 -49.707469
13 -184.437206 -0.536001
14 -149.720557 -184.437206
15 -121.236610 -149.720557
16 -85.417077 -121.236610
17 21.162758 -85.417077
18 104.438556 21.162758
19 -8.424449 104.438556
20 60.419337 -8.424449
21 157.932763 60.419337
22 231.674817 157.932763
23 110.999042 231.674817
24 -30.987982 110.999042
25 198.593325 -30.987982
26 203.586426 198.593325
27 79.848554 203.586426
28 19.672400 79.848554
29 44.194967 19.672400
30 -41.863352 44.194967
31 154.512783 -41.863352
32 18.883402 154.512783
33 -88.910360 18.883402
34 -7.510871 -88.910360
35 94.713201 -7.510871
36 233.433845 94.713201
37 -72.080248 233.433845
38 -318.781691 -72.080248
39 9.268578 -318.781691
40 99.605676 9.268578
41 84.818805 99.605676
42 187.054674 84.818805
43 154.323212 187.054674
44 92.059227 154.323212
45 105.331578 92.059227
46 26.812630 105.331578
47 -156.004773 26.812630
48 -134.750213 -156.004773
49 -87.847319 -134.750213
50 -59.149263 -87.847319
> 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/7hxk11291647418.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/html/rcomp/tmp/8hxk11291647418.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/html/rcomp/tmp/9hxk11291647418.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/html/rcomp/tmp/10s7jm1291647418.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/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/11vpzs1291647418.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/12z7yf1291647418.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/13n9y11291647419.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/148ax71291647419.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/15usvv1291647419.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/168kb41291647419.tab")
+ }
>
> try(system("convert tmp/1loma1291647418.ps tmp/1loma1291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/2wx3d1291647418.ps tmp/2wx3d1291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/3wx3d1291647418.ps tmp/3wx3d1291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/4wx3d1291647418.ps tmp/4wx3d1291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/5wx3d1291647418.ps tmp/5wx3d1291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/6po2g1291647418.ps tmp/6po2g1291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/7hxk11291647418.ps tmp/7hxk11291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/8hxk11291647418.ps tmp/8hxk11291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/9hxk11291647418.ps tmp/9hxk11291647418.png",intern=TRUE))
character(0)
> try(system("convert tmp/10s7jm1291647418.ps tmp/10s7jm1291647418.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.380 1.703 5.872