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(8.30
+ ,3.00
+ ,3.10
+ ,4.28
+ ,2649.24
+ ,8.70
+ ,3.00
+ ,2.90
+ ,3.69
+ ,2579.39
+ ,8.90
+ ,7.00
+ ,2.40
+ ,3.54
+ ,2504.58
+ ,8.90
+ ,4.00
+ ,2.40
+ ,3.13
+ ,2462.32
+ ,8.10
+ ,-4.00
+ ,2.70
+ ,3.75
+ ,2467.38
+ ,8.00
+ ,-6.00
+ ,2.50
+ ,3.85
+ ,2446.66
+ ,8.30
+ ,8.00
+ ,2.10
+ ,3.66
+ ,2656.32
+ ,8.50
+ ,2.00
+ ,1.90
+ ,3.96
+ ,2626.15
+ ,8.70
+ ,-1.00
+ ,0.80
+ ,3.93
+ ,2482.60
+ ,8.60
+ ,-2.00
+ ,0.80
+ ,4.05
+ ,2539.91
+ ,8.30
+ ,0.00
+ ,0.30
+ ,4.19
+ ,2502.66
+ ,7.90
+ ,10.00
+ ,0.00
+ ,4.32
+ ,2466.92
+ ,7.90
+ ,3.00
+ ,-0.90
+ ,4.21
+ ,2513.17
+ ,8.10
+ ,6.00
+ ,-1.00
+ ,4.24
+ ,2443.27
+ ,8.30
+ ,7.00
+ ,-0.70
+ ,4.16
+ ,2293.41
+ ,8.10
+ ,-4.00
+ ,-1.70
+ ,4.19
+ ,2070.83
+ ,7.40
+ ,-5.00
+ ,-1.00
+ ,4.20
+ ,2029.60
+ ,7.30
+ ,-7.00
+ ,-0.20
+ ,4.46
+ ,2052.02
+ ,7.70
+ ,-10.00
+ ,0.70
+ ,4.63
+ ,1864.44
+ ,8.00
+ ,-21.00
+ ,0.60
+ ,4.33
+ ,1670.07
+ ,8.00
+ ,-22.00
+ ,1.90
+ ,4.40
+ ,1810.99
+ ,7.70
+ ,-16.00
+ ,2.10
+ ,4.58
+ ,1905.41
+ ,6.90
+ ,-25.00
+ ,2.70
+ ,4.52
+ ,1862.83
+ ,6.60
+ ,-22.00
+ ,3.20
+ ,4.04
+ ,2014.45
+ ,6.90
+ ,-22.00
+ ,4.80
+ ,4.16
+ ,2197.82
+ ,7.50
+ ,-19.00
+ ,5.50
+ ,4.73
+ ,2962.34
+ ,7.90
+ ,-21.00
+ ,5.40
+ ,4.81
+ ,3047.03
+ ,7.70
+ ,-31.00
+ ,5.90
+ ,4.75
+ ,3032.60
+ ,6.50
+ ,-28.00
+ ,5.80
+ ,4.90
+ ,3504.37
+ ,6.10
+ ,-23.00
+ ,5.10
+ ,5.12
+ ,3801.06
+ ,6.40
+ ,-17.00
+ ,4.10
+ ,4.95
+ ,3857.62
+ ,6.80
+ ,-12.00
+ ,4.40
+ ,4.76
+ ,3674.40
+ ,7.10
+ ,-14.00
+ ,3.60
+ ,4.69
+ ,3720.98
+ ,7.30
+ ,-18.00
+ ,3.50
+ ,4.58
+ ,3844.49
+ ,7.20
+ ,-16.00
+ ,3.10
+ ,4.55
+ ,4116.68
+ ,7.00
+ ,-22.00
+ ,2.90
+ ,4.71
+ ,4105.18
+ ,7.00
+ ,-9.00
+ ,2.20
+ ,4.67
+ ,4435.23
+ ,7.00
+ ,-10.00
+ ,1.40
+ ,4.57
+ ,4296.49
+ ,7.30
+ ,-10.00
+ ,1.20
+ ,4.68
+ ,4202.52
+ ,7.50
+ ,0.00
+ ,1.30
+ ,4.63
+ ,4562.84
+ ,7.20
+ ,3.00
+ ,1.30
+ ,4.60
+ ,4621.40
+ ,7.70
+ ,2.00
+ ,1.30
+ ,4.74
+ ,4696.96
+ ,8.00
+ ,4.00
+ ,1.80
+ ,4.56
+ ,4591.27
+ ,7.90
+ ,-3.00
+ ,1.80
+ ,4.38
+ ,4356.98
+ ,8.00
+ ,0.00
+ ,1.80
+ ,4.26
+ ,4502.64
+ ,8.00
+ ,-1.00
+ ,1.70
+ ,4.13
+ ,4443.91
+ ,7.90
+ ,-7.00
+ ,2.10
+ ,4.29
+ ,4290.89
+ ,7.90
+ ,2.00
+ ,2.00
+ ,4.11
+ ,4199.75
+ ,8.00
+ ,3.00
+ ,1.70
+ ,3.88
+ ,4138.52
+ ,8.10
+ ,-3.00
+ ,1.90
+ ,3.92
+ ,3970.10
+ ,8.10
+ ,-5.00
+ ,2.30
+ ,3.90
+ ,3862.27
+ ,8.20
+ ,0.00
+ ,2.40
+ ,4.06
+ ,3701.61
+ ,8.00
+ ,-3.00
+ ,2.50
+ ,4.22
+ ,3570.12
+ ,8.30
+ ,-7.00
+ ,2.80
+ ,4.36
+ ,3801.06
+ ,8.50
+ ,-7.00
+ ,2.60
+ ,4.28
+ ,3895.51
+ ,8.60
+ ,-7.00
+ ,2.20
+ ,4.27
+ ,3917.96
+ ,8.70
+ ,-4.00
+ ,2.80
+ ,4.04
+ ,3813.06
+ ,8.70
+ ,-3.00
+ ,2.80
+ ,3.71
+ ,3667.03
+ ,8.50
+ ,-6.00
+ ,2.80
+ ,3.71
+ ,3494.17
+ ,8.40
+ ,-10.00
+ ,2.30
+ ,3.51
+ ,3363.99)
+ ,dim=c(5
+ ,60)
+ ,dimnames=list(c('Werkloosheid'
+ ,'consumerconfidence'
+ ,'HICP'
+ ,'OLO12'
+ ,'Bel20')
+ ,1:60))
> y <- array(NA,dim=c(5,60),dimnames=list(c('Werkloosheid','consumerconfidence','HICP','OLO12','Bel20'),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 = 'Do not include Seasonal 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
Werkloosheid consumerconfidence HICP OLO12 Bel20
1 8.3 3 3.1 4.28 2649.24
2 8.7 3 2.9 3.69 2579.39
3 8.9 7 2.4 3.54 2504.58
4 8.9 4 2.4 3.13 2462.32
5 8.1 -4 2.7 3.75 2467.38
6 8.0 -6 2.5 3.85 2446.66
7 8.3 8 2.1 3.66 2656.32
8 8.5 2 1.9 3.96 2626.15
9 8.7 -1 0.8 3.93 2482.60
10 8.6 -2 0.8 4.05 2539.91
11 8.3 0 0.3 4.19 2502.66
12 7.9 10 0.0 4.32 2466.92
13 7.9 3 -0.9 4.21 2513.17
14 8.1 6 -1.0 4.24 2443.27
15 8.3 7 -0.7 4.16 2293.41
16 8.1 -4 -1.7 4.19 2070.83
17 7.4 -5 -1.0 4.20 2029.60
18 7.3 -7 -0.2 4.46 2052.02
19 7.7 -10 0.7 4.63 1864.44
20 8.0 -21 0.6 4.33 1670.07
21 8.0 -22 1.9 4.40 1810.99
22 7.7 -16 2.1 4.58 1905.41
23 6.9 -25 2.7 4.52 1862.83
24 6.6 -22 3.2 4.04 2014.45
25 6.9 -22 4.8 4.16 2197.82
26 7.5 -19 5.5 4.73 2962.34
27 7.9 -21 5.4 4.81 3047.03
28 7.7 -31 5.9 4.75 3032.60
29 6.5 -28 5.8 4.90 3504.37
30 6.1 -23 5.1 5.12 3801.06
31 6.4 -17 4.1 4.95 3857.62
32 6.8 -12 4.4 4.76 3674.40
33 7.1 -14 3.6 4.69 3720.98
34 7.3 -18 3.5 4.58 3844.49
35 7.2 -16 3.1 4.55 4116.68
36 7.0 -22 2.9 4.71 4105.18
37 7.0 -9 2.2 4.67 4435.23
38 7.0 -10 1.4 4.57 4296.49
39 7.3 -10 1.2 4.68 4202.52
40 7.5 0 1.3 4.63 4562.84
41 7.2 3 1.3 4.60 4621.40
42 7.7 2 1.3 4.74 4696.96
43 8.0 4 1.8 4.56 4591.27
44 7.9 -3 1.8 4.38 4356.98
45 8.0 0 1.8 4.26 4502.64
46 8.0 -1 1.7 4.13 4443.91
47 7.9 -7 2.1 4.29 4290.89
48 7.9 2 2.0 4.11 4199.75
49 8.0 3 1.7 3.88 4138.52
50 8.1 -3 1.9 3.92 3970.10
51 8.1 -5 2.3 3.90 3862.27
52 8.2 0 2.4 4.06 3701.61
53 8.0 -3 2.5 4.22 3570.12
54 8.3 -7 2.8 4.36 3801.06
55 8.5 -7 2.6 4.28 3895.51
56 8.6 -7 2.2 4.27 3917.96
57 8.7 -4 2.8 4.04 3813.06
58 8.7 -3 2.8 3.71 3667.03
59 8.5 -6 2.8 3.71 3494.17
60 8.4 -10 2.3 3.51 3363.99
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) consumerconfidence HICP OLO12
1.188e+01 2.437e-02 1.951e-02 -8.847e-01
Bel20
-4.629e-05
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.136411 -0.288949 0.002539 0.235468 0.825350
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.188e+01 7.000e-01 16.969 < 2e-16 ***
consumerconfidence 2.437e-02 9.285e-03 2.624 0.0112 *
HICP 1.951e-02 4.710e-02 0.414 0.6803
OLO12 -8.847e-01 1.850e-01 -4.782 1.34e-05 ***
Bel20 -4.629e-05 7.350e-05 -0.630 0.5314
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4188 on 55 degrees of freedom
Multiple R-squared: 0.6268, Adjusted R-squared: 0.5997
F-statistic: 23.1 on 4 and 55 DF, p-value: 3.076e-11
> 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.27146432 0.5429286435 0.7285356782
[2,] 0.17958704 0.3591740738 0.8204129631
[3,] 0.10627046 0.2125409293 0.8937295354
[4,] 0.10607397 0.2121479316 0.8939260342
[5,] 0.14894829 0.2978965873 0.8510517064
[6,] 0.14889103 0.2977820628 0.8511089686
[7,] 0.09013284 0.1802656840 0.9098671580
[8,] 0.06419042 0.1283808365 0.9358095817
[9,] 0.03759055 0.0751811026 0.9624094487
[10,] 0.05231609 0.1046321869 0.9476839065
[11,] 0.03709842 0.0741968441 0.9629015779
[12,] 0.04504723 0.0900944514 0.9549527743
[13,] 0.05548376 0.1109675115 0.9445162442
[14,] 0.05620447 0.1124089363 0.9437955318
[15,] 0.05073041 0.1014608118 0.9492695941
[16,] 0.12987370 0.2597473972 0.8701263014
[17,] 0.50752521 0.9849495798 0.4924747899
[18,] 0.75229295 0.4954141093 0.2477070547
[19,] 0.70427603 0.5914479314 0.2957239657
[20,] 0.75615826 0.4876834717 0.2438417359
[21,] 0.85732462 0.2853507510 0.1426753755
[22,] 0.90774427 0.1845114684 0.0922557342
[23,] 0.93715612 0.1256877653 0.0628438826
[24,] 0.94526516 0.1094696728 0.0547348364
[25,] 0.96958258 0.0608348350 0.0304174175
[26,] 0.97619230 0.0476154065 0.0238077033
[27,] 0.97329055 0.0534188965 0.0267094483
[28,] 0.97326141 0.0534771828 0.0267385914
[29,] 0.97746674 0.0450665181 0.0225332591
[30,] 0.99840312 0.0031937569 0.0015968784
[31,] 0.99951902 0.0009619675 0.0004809838
[32,] 0.99902491 0.0019501759 0.0009750879
[33,] 0.99785962 0.0042807586 0.0021403793
[34,] 0.99876366 0.0024726745 0.0012363373
[35,] 0.99765648 0.0046870401 0.0023435201
[36,] 0.99624380 0.0075123942 0.0037561971
[37,] 0.99224531 0.0155093787 0.0077546894
[38,] 0.98418414 0.0316317263 0.0158158631
[39,] 0.96894079 0.0621184244 0.0310592122
[40,] 0.97861460 0.0427708068 0.0213854034
[41,] 0.96857241 0.0628551721 0.0314275860
[42,] 0.93351147 0.1329770662 0.0664885331
[43,] 0.88078806 0.2384238899 0.1192119449
[44,] 0.99734912 0.0053017653 0.0026508826
[45,] 0.99579371 0.0084125823 0.0042062912
> postscript(file="/var/www/html/rcomp/tmp/105uo1291296682.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/205uo1291296682.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/3bet91291296682.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/4bet91291296682.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/5bet91291296682.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
0.19813640 0.07680870 0.05292971 -0.23867463 -0.30083462 -0.26068764
7 8 9 10 11 12
-0.45238914 0.16172850 0.42309780 0.45628458 0.23944888 -0.28498682
13 14 15 16 17 18
-0.19205239 -0.03989011 0.05217525 0.15593985 -0.52641365 -0.36222179
19 20 21 22 23 24
0.23503624 0.53058326 0.59803990 0.31157148 -0.33590482 -1.13641142
25 26 27 28 29 30
-0.75297091 0.29996913 0.82534989 0.80549280 -0.31110130 -0.61089222
31 32 33 34 35 36
-0.58535950 -0.48961999 -0.18505700 0.02275040 -0.13211754 -0.04099917
37 38 39 40 41 42
-0.36419847 -0.41912152 -0.02224811 -0.09540679 -0.49233328 0.15939311
43 44 45 46 47 48
0.23676208 0.13721862 0.06469758 -0.02672117 0.14613970 -0.23466686
49 50 51 52 53 54
-0.35950331 -0.08962198 -0.07138250 0.03896228 0.04557780 0.57173902
55 56 57 58 59 60
0.70923422 0.80923026 0.61608273 0.29299364 0.15808680 -0.01767193
> postscript(file="/var/www/html/rcomp/tmp/63nau1291296682.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 0.19813640 NA
1 0.07680870 0.19813640
2 0.05292971 0.07680870
3 -0.23867463 0.05292971
4 -0.30083462 -0.23867463
5 -0.26068764 -0.30083462
6 -0.45238914 -0.26068764
7 0.16172850 -0.45238914
8 0.42309780 0.16172850
9 0.45628458 0.42309780
10 0.23944888 0.45628458
11 -0.28498682 0.23944888
12 -0.19205239 -0.28498682
13 -0.03989011 -0.19205239
14 0.05217525 -0.03989011
15 0.15593985 0.05217525
16 -0.52641365 0.15593985
17 -0.36222179 -0.52641365
18 0.23503624 -0.36222179
19 0.53058326 0.23503624
20 0.59803990 0.53058326
21 0.31157148 0.59803990
22 -0.33590482 0.31157148
23 -1.13641142 -0.33590482
24 -0.75297091 -1.13641142
25 0.29996913 -0.75297091
26 0.82534989 0.29996913
27 0.80549280 0.82534989
28 -0.31110130 0.80549280
29 -0.61089222 -0.31110130
30 -0.58535950 -0.61089222
31 -0.48961999 -0.58535950
32 -0.18505700 -0.48961999
33 0.02275040 -0.18505700
34 -0.13211754 0.02275040
35 -0.04099917 -0.13211754
36 -0.36419847 -0.04099917
37 -0.41912152 -0.36419847
38 -0.02224811 -0.41912152
39 -0.09540679 -0.02224811
40 -0.49233328 -0.09540679
41 0.15939311 -0.49233328
42 0.23676208 0.15939311
43 0.13721862 0.23676208
44 0.06469758 0.13721862
45 -0.02672117 0.06469758
46 0.14613970 -0.02672117
47 -0.23466686 0.14613970
48 -0.35950331 -0.23466686
49 -0.08962198 -0.35950331
50 -0.07138250 -0.08962198
51 0.03896228 -0.07138250
52 0.04557780 0.03896228
53 0.57173902 0.04557780
54 0.70923422 0.57173902
55 0.80923026 0.70923422
56 0.61608273 0.80923026
57 0.29299364 0.61608273
58 0.15808680 0.29299364
59 -0.01767193 0.15808680
60 NA -0.01767193
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.07680870 0.19813640
[2,] 0.05292971 0.07680870
[3,] -0.23867463 0.05292971
[4,] -0.30083462 -0.23867463
[5,] -0.26068764 -0.30083462
[6,] -0.45238914 -0.26068764
[7,] 0.16172850 -0.45238914
[8,] 0.42309780 0.16172850
[9,] 0.45628458 0.42309780
[10,] 0.23944888 0.45628458
[11,] -0.28498682 0.23944888
[12,] -0.19205239 -0.28498682
[13,] -0.03989011 -0.19205239
[14,] 0.05217525 -0.03989011
[15,] 0.15593985 0.05217525
[16,] -0.52641365 0.15593985
[17,] -0.36222179 -0.52641365
[18,] 0.23503624 -0.36222179
[19,] 0.53058326 0.23503624
[20,] 0.59803990 0.53058326
[21,] 0.31157148 0.59803990
[22,] -0.33590482 0.31157148
[23,] -1.13641142 -0.33590482
[24,] -0.75297091 -1.13641142
[25,] 0.29996913 -0.75297091
[26,] 0.82534989 0.29996913
[27,] 0.80549280 0.82534989
[28,] -0.31110130 0.80549280
[29,] -0.61089222 -0.31110130
[30,] -0.58535950 -0.61089222
[31,] -0.48961999 -0.58535950
[32,] -0.18505700 -0.48961999
[33,] 0.02275040 -0.18505700
[34,] -0.13211754 0.02275040
[35,] -0.04099917 -0.13211754
[36,] -0.36419847 -0.04099917
[37,] -0.41912152 -0.36419847
[38,] -0.02224811 -0.41912152
[39,] -0.09540679 -0.02224811
[40,] -0.49233328 -0.09540679
[41,] 0.15939311 -0.49233328
[42,] 0.23676208 0.15939311
[43,] 0.13721862 0.23676208
[44,] 0.06469758 0.13721862
[45,] -0.02672117 0.06469758
[46,] 0.14613970 -0.02672117
[47,] -0.23466686 0.14613970
[48,] -0.35950331 -0.23466686
[49,] -0.08962198 -0.35950331
[50,] -0.07138250 -0.08962198
[51,] 0.03896228 -0.07138250
[52,] 0.04557780 0.03896228
[53,] 0.57173902 0.04557780
[54,] 0.70923422 0.57173902
[55,] 0.80923026 0.70923422
[56,] 0.61608273 0.80923026
[57,] 0.29299364 0.61608273
[58,] 0.15808680 0.29299364
[59,] -0.01767193 0.15808680
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.07680870 0.19813640
2 0.05292971 0.07680870
3 -0.23867463 0.05292971
4 -0.30083462 -0.23867463
5 -0.26068764 -0.30083462
6 -0.45238914 -0.26068764
7 0.16172850 -0.45238914
8 0.42309780 0.16172850
9 0.45628458 0.42309780
10 0.23944888 0.45628458
11 -0.28498682 0.23944888
12 -0.19205239 -0.28498682
13 -0.03989011 -0.19205239
14 0.05217525 -0.03989011
15 0.15593985 0.05217525
16 -0.52641365 0.15593985
17 -0.36222179 -0.52641365
18 0.23503624 -0.36222179
19 0.53058326 0.23503624
20 0.59803990 0.53058326
21 0.31157148 0.59803990
22 -0.33590482 0.31157148
23 -1.13641142 -0.33590482
24 -0.75297091 -1.13641142
25 0.29996913 -0.75297091
26 0.82534989 0.29996913
27 0.80549280 0.82534989
28 -0.31110130 0.80549280
29 -0.61089222 -0.31110130
30 -0.58535950 -0.61089222
31 -0.48961999 -0.58535950
32 -0.18505700 -0.48961999
33 0.02275040 -0.18505700
34 -0.13211754 0.02275040
35 -0.04099917 -0.13211754
36 -0.36419847 -0.04099917
37 -0.41912152 -0.36419847
38 -0.02224811 -0.41912152
39 -0.09540679 -0.02224811
40 -0.49233328 -0.09540679
41 0.15939311 -0.49233328
42 0.23676208 0.15939311
43 0.13721862 0.23676208
44 0.06469758 0.13721862
45 -0.02672117 0.06469758
46 0.14613970 -0.02672117
47 -0.23466686 0.14613970
48 -0.35950331 -0.23466686
49 -0.08962198 -0.35950331
50 -0.07138250 -0.08962198
51 0.03896228 -0.07138250
52 0.04557780 0.03896228
53 0.57173902 0.04557780
54 0.70923422 0.57173902
55 0.80923026 0.70923422
56 0.61608273 0.80923026
57 0.29299364 0.61608273
58 0.15808680 0.29299364
59 -0.01767193 0.15808680
> 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/7wfsx1291296682.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/8wfsx1291296682.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/9wfsx1291296682.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/1076r01291296682.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/11s6751291296682.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/12wp6b1291296682.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/13az4k1291296682.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/143q3n1291296682.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/15o92b1291296682.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/16kih21291296682.tab")
+ }
>
> try(system("convert tmp/105uo1291296682.ps tmp/105uo1291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/205uo1291296682.ps tmp/205uo1291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/3bet91291296682.ps tmp/3bet91291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/4bet91291296682.ps tmp/4bet91291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/5bet91291296682.ps tmp/5bet91291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/63nau1291296682.ps tmp/63nau1291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/7wfsx1291296682.ps tmp/7wfsx1291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/8wfsx1291296682.ps tmp/8wfsx1291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/9wfsx1291296682.ps tmp/9wfsx1291296682.png",intern=TRUE))
character(0)
> try(system("convert tmp/1076r01291296682.ps tmp/1076r01291296682.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.592 1.653 5.738