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 = '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 t
1 8.3 3 3.1 4.28 2649.24 1
2 8.7 3 2.9 3.69 2579.39 2
3 8.9 7 2.4 3.54 2504.58 3
4 8.9 4 2.4 3.13 2462.32 4
5 8.1 -4 2.7 3.75 2467.38 5
6 8.0 -6 2.5 3.85 2446.66 6
7 8.3 8 2.1 3.66 2656.32 7
8 8.5 2 1.9 3.96 2626.15 8
9 8.7 -1 0.8 3.93 2482.60 9
10 8.6 -2 0.8 4.05 2539.91 10
11 8.3 0 0.3 4.19 2502.66 11
12 7.9 10 0.0 4.32 2466.92 12
13 7.9 3 -0.9 4.21 2513.17 13
14 8.1 6 -1.0 4.24 2443.27 14
15 8.3 7 -0.7 4.16 2293.41 15
16 8.1 -4 -1.7 4.19 2070.83 16
17 7.4 -5 -1.0 4.20 2029.60 17
18 7.3 -7 -0.2 4.46 2052.02 18
19 7.7 -10 0.7 4.63 1864.44 19
20 8.0 -21 0.6 4.33 1670.07 20
21 8.0 -22 1.9 4.40 1810.99 21
22 7.7 -16 2.1 4.58 1905.41 22
23 6.9 -25 2.7 4.52 1862.83 23
24 6.6 -22 3.2 4.04 2014.45 24
25 6.9 -22 4.8 4.16 2197.82 25
26 7.5 -19 5.5 4.73 2962.34 26
27 7.9 -21 5.4 4.81 3047.03 27
28 7.7 -31 5.9 4.75 3032.60 28
29 6.5 -28 5.8 4.90 3504.37 29
30 6.1 -23 5.1 5.12 3801.06 30
31 6.4 -17 4.1 4.95 3857.62 31
32 6.8 -12 4.4 4.76 3674.40 32
33 7.1 -14 3.6 4.69 3720.98 33
34 7.3 -18 3.5 4.58 3844.49 34
35 7.2 -16 3.1 4.55 4116.68 35
36 7.0 -22 2.9 4.71 4105.18 36
37 7.0 -9 2.2 4.67 4435.23 37
38 7.0 -10 1.4 4.57 4296.49 38
39 7.3 -10 1.2 4.68 4202.52 39
40 7.5 0 1.3 4.63 4562.84 40
41 7.2 3 1.3 4.60 4621.40 41
42 7.7 2 1.3 4.74 4696.96 42
43 8.0 4 1.8 4.56 4591.27 43
44 7.9 -3 1.8 4.38 4356.98 44
45 8.0 0 1.8 4.26 4502.64 45
46 8.0 -1 1.7 4.13 4443.91 46
47 7.9 -7 2.1 4.29 4290.89 47
48 7.9 2 2.0 4.11 4199.75 48
49 8.0 3 1.7 3.88 4138.52 49
50 8.1 -3 1.9 3.92 3970.10 50
51 8.1 -5 2.3 3.90 3862.27 51
52 8.2 0 2.4 4.06 3701.61 52
53 8.0 -3 2.5 4.22 3570.12 53
54 8.3 -7 2.8 4.36 3801.06 54
55 8.5 -7 2.6 4.28 3895.51 55
56 8.6 -7 2.2 4.27 3917.96 56
57 8.7 -4 2.8 4.04 3813.06 57
58 8.7 -3 2.8 3.71 3667.03 58
59 8.5 -6 2.8 3.71 3494.17 59
60 8.4 -10 2.3 3.51 3363.99 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) consumerconfidence HICP OLO12
11.3794637 0.0370833 0.0573712 -0.6802095
Bel20 t
-0.0002737 0.0121067
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.138362 -0.230201 0.008939 0.210830 0.853683
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.3794637 0.7112566 15.999 < 2e-16 ***
consumerconfidence 0.0370833 0.0106065 3.496 0.000952 ***
HICP 0.0573712 0.0484941 1.183 0.241970
OLO12 -0.6802095 0.2005278 -3.392 0.001304 **
Bel20 -0.0002737 0.0001238 -2.211 0.031258 *
t 0.0121067 0.0053991 2.242 0.029067 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4042 on 54 degrees of freedom
Multiple R-squared: 0.6586, Adjusted R-squared: 0.627
F-statistic: 20.84 on 5 and 54 DF, p-value: 1.549e-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.11125572 2.225114e-01 8.887443e-01
[2,] 0.04940340 9.880680e-02 9.505966e-01
[3,] 0.04020324 8.040649e-02 9.597968e-01
[4,] 0.01528609 3.057218e-02 9.847139e-01
[5,] 0.22184666 4.436933e-01 7.781533e-01
[6,] 0.14606666 2.921333e-01 8.539333e-01
[7,] 0.17810731 3.562146e-01 8.218927e-01
[8,] 0.13263109 2.652622e-01 8.673689e-01
[9,] 0.12004013 2.400803e-01 8.799599e-01
[10,] 0.08436128 1.687226e-01 9.156387e-01
[11,] 0.17464583 3.492917e-01 8.253542e-01
[12,] 0.23294984 4.658997e-01 7.670502e-01
[13,] 0.29286229 5.857246e-01 7.071377e-01
[14,] 0.29121488 5.824298e-01 7.087851e-01
[15,] 0.42494113 8.498823e-01 5.750589e-01
[16,] 0.55709801 8.858040e-01 4.429020e-01
[17,] 0.55046472 8.990706e-01 4.495353e-01
[18,] 0.65200824 6.959835e-01 3.479918e-01
[19,] 0.87958443 2.408311e-01 1.204156e-01
[20,] 0.99817513 3.649744e-03 1.824872e-03
[21,] 0.99943893 1.122150e-03 5.610749e-04
[22,] 0.99997663 4.673428e-05 2.336714e-05
[23,] 0.99999530 9.396742e-06 4.698371e-06
[24,] 0.99999533 9.341803e-06 4.670901e-06
[25,] 0.99999080 1.840796e-05 9.203981e-06
[26,] 0.99999694 6.125180e-06 3.062590e-06
[27,] 0.99999665 6.694653e-06 3.347327e-06
[28,] 0.99999143 1.714727e-05 8.573635e-06
[29,] 0.99998907 2.185863e-05 1.092932e-05
[30,] 0.99998316 3.368326e-05 1.684163e-05
[31,] 0.99997962 4.076325e-05 2.038163e-05
[32,] 0.99995698 8.604419e-05 4.302210e-05
[33,] 0.99999864 2.724746e-06 1.362373e-06
[34,] 0.99999778 4.434304e-06 2.217152e-06
[35,] 0.99999413 1.174225e-05 5.871126e-06
[36,] 0.99999311 1.377161e-05 6.885806e-06
[37,] 0.99997257 5.486380e-05 2.743190e-05
[38,] 0.99988533 2.293392e-04 1.146696e-04
[39,] 0.99957240 8.551929e-04 4.275964e-04
[40,] 0.99958147 8.370620e-04 4.185310e-04
[41,] 0.99998145 3.709821e-05 1.854911e-05
[42,] 0.99991663 1.667325e-04 8.336624e-05
[43,] 0.99997284 5.431655e-05 2.715828e-05
> postscript(file="/var/www/html/rcomp/tmp/139wl1291303017.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/2w0do1291303017.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/3w0do1291303017.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/4w0do1291303017.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/569u91291303017.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.25574463 0.23467000 0.18040814 -0.01090151 -0.12043832 -0.08455449
7 8 9 10 11 12
-0.36473305 0.25293934 0.55549371 0.57778165 0.30522763 -0.38185580
13 14 15 16 17 18
-0.14490942 -0.06125483 -0.02309088 0.18957416 -0.53009198 -0.43093802
19 20 21 22 23 24
0.08086453 0.52514767 0.56172735 0.16392786 -0.40131895 -1.13836209
25 26 27 28 29 30
-0.81044767 0.22301074 0.76840485 0.85368333 -0.23277740 -0.55928819
31 32 33 34 35 36
-0.53667820 -0.53080140 -0.15770992 0.14323632 0.03400583 0.16155902
37 38 39 40 41 42
-0.22934173 -0.26446344 0.08400677 -0.04005798 -0.46779252 0.17309479
43 44 45 46 47 48
0.20676995 0.16768150 0.10256808 0.02877965 0.18317494 -0.30432782
49 50 51 52 53 54
-0.40951383 -0.12948456 -0.13349130 -0.17189206 -0.20564236 0.37181227
55 56 57 58 59 60
0.54261476 0.65279917 0.40985966 0.09623089 -0.05193914 -0.15870033
> postscript(file="/var/www/html/rcomp/tmp/669u91291303017.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.25574463 NA
1 0.23467000 0.25574463
2 0.18040814 0.23467000
3 -0.01090151 0.18040814
4 -0.12043832 -0.01090151
5 -0.08455449 -0.12043832
6 -0.36473305 -0.08455449
7 0.25293934 -0.36473305
8 0.55549371 0.25293934
9 0.57778165 0.55549371
10 0.30522763 0.57778165
11 -0.38185580 0.30522763
12 -0.14490942 -0.38185580
13 -0.06125483 -0.14490942
14 -0.02309088 -0.06125483
15 0.18957416 -0.02309088
16 -0.53009198 0.18957416
17 -0.43093802 -0.53009198
18 0.08086453 -0.43093802
19 0.52514767 0.08086453
20 0.56172735 0.52514767
21 0.16392786 0.56172735
22 -0.40131895 0.16392786
23 -1.13836209 -0.40131895
24 -0.81044767 -1.13836209
25 0.22301074 -0.81044767
26 0.76840485 0.22301074
27 0.85368333 0.76840485
28 -0.23277740 0.85368333
29 -0.55928819 -0.23277740
30 -0.53667820 -0.55928819
31 -0.53080140 -0.53667820
32 -0.15770992 -0.53080140
33 0.14323632 -0.15770992
34 0.03400583 0.14323632
35 0.16155902 0.03400583
36 -0.22934173 0.16155902
37 -0.26446344 -0.22934173
38 0.08400677 -0.26446344
39 -0.04005798 0.08400677
40 -0.46779252 -0.04005798
41 0.17309479 -0.46779252
42 0.20676995 0.17309479
43 0.16768150 0.20676995
44 0.10256808 0.16768150
45 0.02877965 0.10256808
46 0.18317494 0.02877965
47 -0.30432782 0.18317494
48 -0.40951383 -0.30432782
49 -0.12948456 -0.40951383
50 -0.13349130 -0.12948456
51 -0.17189206 -0.13349130
52 -0.20564236 -0.17189206
53 0.37181227 -0.20564236
54 0.54261476 0.37181227
55 0.65279917 0.54261476
56 0.40985966 0.65279917
57 0.09623089 0.40985966
58 -0.05193914 0.09623089
59 -0.15870033 -0.05193914
60 NA -0.15870033
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.23467000 0.25574463
[2,] 0.18040814 0.23467000
[3,] -0.01090151 0.18040814
[4,] -0.12043832 -0.01090151
[5,] -0.08455449 -0.12043832
[6,] -0.36473305 -0.08455449
[7,] 0.25293934 -0.36473305
[8,] 0.55549371 0.25293934
[9,] 0.57778165 0.55549371
[10,] 0.30522763 0.57778165
[11,] -0.38185580 0.30522763
[12,] -0.14490942 -0.38185580
[13,] -0.06125483 -0.14490942
[14,] -0.02309088 -0.06125483
[15,] 0.18957416 -0.02309088
[16,] -0.53009198 0.18957416
[17,] -0.43093802 -0.53009198
[18,] 0.08086453 -0.43093802
[19,] 0.52514767 0.08086453
[20,] 0.56172735 0.52514767
[21,] 0.16392786 0.56172735
[22,] -0.40131895 0.16392786
[23,] -1.13836209 -0.40131895
[24,] -0.81044767 -1.13836209
[25,] 0.22301074 -0.81044767
[26,] 0.76840485 0.22301074
[27,] 0.85368333 0.76840485
[28,] -0.23277740 0.85368333
[29,] -0.55928819 -0.23277740
[30,] -0.53667820 -0.55928819
[31,] -0.53080140 -0.53667820
[32,] -0.15770992 -0.53080140
[33,] 0.14323632 -0.15770992
[34,] 0.03400583 0.14323632
[35,] 0.16155902 0.03400583
[36,] -0.22934173 0.16155902
[37,] -0.26446344 -0.22934173
[38,] 0.08400677 -0.26446344
[39,] -0.04005798 0.08400677
[40,] -0.46779252 -0.04005798
[41,] 0.17309479 -0.46779252
[42,] 0.20676995 0.17309479
[43,] 0.16768150 0.20676995
[44,] 0.10256808 0.16768150
[45,] 0.02877965 0.10256808
[46,] 0.18317494 0.02877965
[47,] -0.30432782 0.18317494
[48,] -0.40951383 -0.30432782
[49,] -0.12948456 -0.40951383
[50,] -0.13349130 -0.12948456
[51,] -0.17189206 -0.13349130
[52,] -0.20564236 -0.17189206
[53,] 0.37181227 -0.20564236
[54,] 0.54261476 0.37181227
[55,] 0.65279917 0.54261476
[56,] 0.40985966 0.65279917
[57,] 0.09623089 0.40985966
[58,] -0.05193914 0.09623089
[59,] -0.15870033 -0.05193914
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.23467000 0.25574463
2 0.18040814 0.23467000
3 -0.01090151 0.18040814
4 -0.12043832 -0.01090151
5 -0.08455449 -0.12043832
6 -0.36473305 -0.08455449
7 0.25293934 -0.36473305
8 0.55549371 0.25293934
9 0.57778165 0.55549371
10 0.30522763 0.57778165
11 -0.38185580 0.30522763
12 -0.14490942 -0.38185580
13 -0.06125483 -0.14490942
14 -0.02309088 -0.06125483
15 0.18957416 -0.02309088
16 -0.53009198 0.18957416
17 -0.43093802 -0.53009198
18 0.08086453 -0.43093802
19 0.52514767 0.08086453
20 0.56172735 0.52514767
21 0.16392786 0.56172735
22 -0.40131895 0.16392786
23 -1.13836209 -0.40131895
24 -0.81044767 -1.13836209
25 0.22301074 -0.81044767
26 0.76840485 0.22301074
27 0.85368333 0.76840485
28 -0.23277740 0.85368333
29 -0.55928819 -0.23277740
30 -0.53667820 -0.55928819
31 -0.53080140 -0.53667820
32 -0.15770992 -0.53080140
33 0.14323632 -0.15770992
34 0.03400583 0.14323632
35 0.16155902 0.03400583
36 -0.22934173 0.16155902
37 -0.26446344 -0.22934173
38 0.08400677 -0.26446344
39 -0.04005798 0.08400677
40 -0.46779252 -0.04005798
41 0.17309479 -0.46779252
42 0.20676995 0.17309479
43 0.16768150 0.20676995
44 0.10256808 0.16768150
45 0.02877965 0.10256808
46 0.18317494 0.02877965
47 -0.30432782 0.18317494
48 -0.40951383 -0.30432782
49 -0.12948456 -0.40951383
50 -0.13349130 -0.12948456
51 -0.17189206 -0.13349130
52 -0.20564236 -0.17189206
53 0.37181227 -0.20564236
54 0.54261476 0.37181227
55 0.65279917 0.54261476
56 0.40985966 0.65279917
57 0.09623089 0.40985966
58 -0.05193914 0.09623089
59 -0.15870033 -0.05193914
> 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/7h1bt1291303017.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/8h1bt1291303017.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/99sbw1291303017.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/109sbw1291303017.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/11dt9k1291303017.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/12ztqq1291303017.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/13ncnk1291303017.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/14gl451291303017.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/1514kt1291303017.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/16863w1291303018.tab")
+ }
>
> try(system("convert tmp/139wl1291303017.ps tmp/139wl1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/2w0do1291303017.ps tmp/2w0do1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/3w0do1291303017.ps tmp/3w0do1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/4w0do1291303017.ps tmp/4w0do1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/569u91291303017.ps tmp/569u91291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/669u91291303017.ps tmp/669u91291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/7h1bt1291303017.ps tmp/7h1bt1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/8h1bt1291303017.ps tmp/8h1bt1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/99sbw1291303017.ps tmp/99sbw1291303017.png",intern=TRUE))
character(0)
> try(system("convert tmp/109sbw1291303017.ps tmp/109sbw1291303017.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.543 1.613 5.693