R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(0,8,17,2,6,-2,3,23,3,7,-4,3,24,1,4,-4,7,27,1,3,-7,4,31,0,0,-9,-4,40,1,6,-13,-6,47,-1,3,-8,8,43,2,1,-13,2,60,2,6,-15,-1,64,0,5,-15,-2,65,1,7,-15,0,65,1,4,-10,10,55,3,3,-12,3,57,3,6,-11,6,57,1,6,-11,7,57,1,5,-17,-4,65,-2,2,-18,-5,69,1,3,-19,-7,70,1,-2,-22,-10,71,-1,-4,-24,-21,71,-4,0,-24,-22,73,-2,1,-20,-16,68,-1,4,-25,-25,65,-5,-3,-22,-22,57,-4,-3,-17,-22,41,-5,0,-9,-19,21,0,6,-11,-21,21,-2,-1,-13,-31,17,-4,0,-11,-28,9,-6,-1,-9,-23,11,-2,1,-7,-17,6,-2,-4,-3,-12,-2,-2,-1,-3,-14,0,1,-1,-6,-18,5,-2,0,-4,-16,3,0,3,-8,-22,7,-1,0,-1,-9,4,2,8,-2,-10,8,3,8,-2,-10,9,2,8,-1,0,14,3,8,1,3,12,4,11,2,2,12,5,13,2,4,7,5,5,-1,-3,15,4,12,1,0,14,5,13,-1,-1,19,6,9,-8,-7,39,4,11,1,2,12,6,7,2,3,11,6,12,-2,-3,17,3,11,-2,-5,16,5,10,-2,0,25,5,13,-2,-3,24,5,14,-6,-7,28,3,10,-4,-7,25,5,13,-5,-7,31,5,12,-2,-4,24,6,13,-1,-3,24,6,17,-5,-6,33,5,15),dim=c(5,60),dimnames=list(c('indicator','economie','werkloosheid','finaciƫn','spaarvermogen'),1:60))
> y <- array(NA,dim=c(5,60),dimnames=list(c('indicator','economie','werkloosheid','finaciƫn','spaarvermogen'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par20 = ''
> par19 = ''
> par18 = ''
> par17 = ''
> par16 = ''
> par15 = ''
> par14 = ''
> par13 = ''
> par12 = ''
> par11 = ''
> par10 = ''
> par9 = ''
> par8 = ''
> par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '3'
> library(lattice)
> library(lmtest)
Loading required package: zoo
> 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 indicator economie finaci\303\253n spaarvermogen
1 17 0 8 2 6
2 23 -2 3 3 7
3 24 -4 3 1 4
4 27 -4 7 1 3
5 31 -7 4 0 0
6 40 -9 -4 1 6
7 47 -13 -6 -1 3
8 43 -8 8 2 1
9 60 -13 2 2 6
10 64 -15 -1 0 5
11 65 -15 -2 1 7
12 65 -15 0 1 4
13 55 -10 10 3 3
14 57 -12 3 3 6
15 57 -11 6 1 6
16 57 -11 7 1 5
17 65 -17 -4 -2 2
18 69 -18 -5 1 3
19 70 -19 -7 1 -2
20 71 -22 -10 -1 -4
21 71 -24 -21 -4 0
22 73 -24 -22 -2 1
23 68 -20 -16 -1 4
24 65 -25 -25 -5 -3
25 57 -22 -22 -4 -3
26 41 -17 -22 -5 0
27 21 -9 -19 0 6
28 21 -11 -21 -2 -1
29 17 -13 -31 -4 0
30 9 -11 -28 -6 -1
31 11 -9 -23 -2 1
32 6 -7 -17 -2 -4
33 -2 -3 -12 -2 -1
34 0 -3 -14 1 -1
35 5 -6 -18 -2 0
36 3 -4 -16 0 3
37 7 -8 -22 -1 0
38 4 -1 -9 2 8
39 8 -2 -10 3 8
40 9 -2 -10 2 8
41 14 -1 0 3 8
42 12 1 3 4 11
43 12 2 2 5 13
44 7 2 4 5 5
45 15 -1 -3 4 12
46 14 1 0 5 13
47 19 -1 -1 6 9
48 39 -8 -7 4 11
49 12 1 2 6 7
50 11 2 3 6 12
51 17 -2 -3 3 11
52 16 -2 -5 5 10
53 25 -2 0 5 13
54 24 -2 -3 5 14
55 28 -6 -7 3 10
56 25 -4 -7 5 13
57 31 -5 -7 5 12
58 24 -2 -4 6 13
59 24 -1 -3 6 17
60 33 -5 -6 5 15
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) indicator economie `finaci\303\253n`
0.6639 -3.9411 1.0008 1.0374
spaarvermogen
0.8881
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.3998 -1.1801 0.1226 0.8558 2.2002
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.66391 0.46210 1.437 0.156
indicator -3.94106 0.03100 -127.139 < 2e-16 ***
economie 1.00077 0.02299 43.533 < 2e-16 ***
`finaci\303\253n` 1.03741 0.13360 7.765 2.11e-10 ***
spaarvermogen 0.88812 0.05912 15.022 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.228 on 55 degrees of freedom
Multiple R-squared: 0.9974, Adjusted R-squared: 0.9972
F-statistic: 5209 on 4 and 55 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.007008777 0.01401755 0.9929912
[2,] 0.079396705 0.15879341 0.9206033
[3,] 0.306307987 0.61261597 0.6936920
[4,] 0.197311548 0.39462310 0.8026885
[5,] 0.180442034 0.36088407 0.8195580
[6,] 0.116141486 0.23228297 0.8838585
[7,] 0.410780302 0.82156060 0.5892197
[8,] 0.328756526 0.65751305 0.6712435
[9,] 0.253187880 0.50637576 0.7468121
[10,] 0.324530108 0.64906022 0.6754699
[11,] 0.263561895 0.52712379 0.7364381
[12,] 0.650184736 0.69963053 0.3498153
[13,] 0.736190956 0.52761809 0.2638090
[14,] 0.676523929 0.64695214 0.3234761
[15,] 0.608442562 0.78311488 0.3915574
[16,] 0.690281371 0.61943726 0.3097186
[17,] 0.746021506 0.50795699 0.2539785
[18,] 0.778811726 0.44237655 0.2211883
[19,] 0.737426603 0.52514679 0.2625734
[20,] 0.822543781 0.35491244 0.1774562
[21,] 0.804938715 0.39012257 0.1950613
[22,] 0.748796925 0.50240615 0.2512031
[23,] 0.717767801 0.56446440 0.2822322
[24,] 0.677319350 0.64536130 0.3226807
[25,] 0.625319023 0.74936195 0.3746810
[26,] 0.611949980 0.77610004 0.3880500
[27,] 0.609086367 0.78182727 0.3909136
[28,] 0.706301419 0.58739716 0.2936986
[29,] 0.682541697 0.63491661 0.3174583
[30,] 0.723326672 0.55334666 0.2766733
[31,] 0.666379041 0.66724192 0.3336210
[32,] 0.648657076 0.70268585 0.3513429
[33,] 0.763519221 0.47296156 0.2364808
[34,] 0.726393565 0.54721287 0.2736064
[35,] 0.701109721 0.59778056 0.2988903
[36,] 0.658802207 0.68239559 0.3411978
[37,] 0.637672188 0.72465562 0.3623278
[38,] 0.562288329 0.87542334 0.4377117
[39,] 0.553552470 0.89289506 0.4464475
[40,] 0.491477010 0.98295402 0.5085230
[41,] 0.400365678 0.80073136 0.5996343
[42,] 0.436742023 0.87348405 0.5632580
[43,] 0.431078685 0.86215737 0.5689213
[44,] 0.367369503 0.73473901 0.6326305
[45,] 0.380106748 0.76021350 0.6198933
> postscript(file="/var/wessaorg/rcomp/tmp/1dd261322164563.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/wessaorg/rcomp/tmp/2d5jq1322164563.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/wessaorg/rcomp/tmp/33yi41322164563.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/wessaorg/rcomp/tmp/4k4571322164563.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/wessaorg/rcomp/tmp/5f1121322164563.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.92638602 2.12260433 -0.02033864 -0.13530690 -1.25439833 1.50353805
7 8 9 10 11 12
-0.51997617 -0.16147677 -1.30273073 0.78040304 -0.03247087 0.63034390
13 14 15 16 17 18
-0.85878170 -2.39985185 0.61370335 0.50105096 1.63977593 -1.30084949
19 20 21 22 23 24
2.20023466 -1.76956959 0.91654875 0.95438766 2.01222080 -1.31965557
25 26 27 28 29 30
-1.53620546 0.54213048 -1.44747589 0.96360330 0.27590162 0.11863396
31 32 33 34 35 36
-0.92897677 0.38910446 0.48511630 1.37443998 0.77845574 -0.08014519
37 38 39 40 41 42
-2.13797833 -0.77778745 -0.75547981 1.28192693 -0.82214179 -1.64410793
43 44 45 46 47 48
0.48407573 0.58748831 -1.40971092 0.54456206 1.17829037 -0.10590656
49 50 51 52 53 54
0.83432878 -1.66598341 -1.42524218 -1.61039220 -0.27861066 0.83558564
55 56 57 58 59 60
-1.29826510 -1.15532213 1.79173986 1.68707041 1.07487779 0.12660922
> postscript(file="/var/wessaorg/rcomp/tmp/6ec1x1322164563.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.92638602 NA
1 2.12260433 0.92638602
2 -0.02033864 2.12260433
3 -0.13530690 -0.02033864
4 -1.25439833 -0.13530690
5 1.50353805 -1.25439833
6 -0.51997617 1.50353805
7 -0.16147677 -0.51997617
8 -1.30273073 -0.16147677
9 0.78040304 -1.30273073
10 -0.03247087 0.78040304
11 0.63034390 -0.03247087
12 -0.85878170 0.63034390
13 -2.39985185 -0.85878170
14 0.61370335 -2.39985185
15 0.50105096 0.61370335
16 1.63977593 0.50105096
17 -1.30084949 1.63977593
18 2.20023466 -1.30084949
19 -1.76956959 2.20023466
20 0.91654875 -1.76956959
21 0.95438766 0.91654875
22 2.01222080 0.95438766
23 -1.31965557 2.01222080
24 -1.53620546 -1.31965557
25 0.54213048 -1.53620546
26 -1.44747589 0.54213048
27 0.96360330 -1.44747589
28 0.27590162 0.96360330
29 0.11863396 0.27590162
30 -0.92897677 0.11863396
31 0.38910446 -0.92897677
32 0.48511630 0.38910446
33 1.37443998 0.48511630
34 0.77845574 1.37443998
35 -0.08014519 0.77845574
36 -2.13797833 -0.08014519
37 -0.77778745 -2.13797833
38 -0.75547981 -0.77778745
39 1.28192693 -0.75547981
40 -0.82214179 1.28192693
41 -1.64410793 -0.82214179
42 0.48407573 -1.64410793
43 0.58748831 0.48407573
44 -1.40971092 0.58748831
45 0.54456206 -1.40971092
46 1.17829037 0.54456206
47 -0.10590656 1.17829037
48 0.83432878 -0.10590656
49 -1.66598341 0.83432878
50 -1.42524218 -1.66598341
51 -1.61039220 -1.42524218
52 -0.27861066 -1.61039220
53 0.83558564 -0.27861066
54 -1.29826510 0.83558564
55 -1.15532213 -1.29826510
56 1.79173986 -1.15532213
57 1.68707041 1.79173986
58 1.07487779 1.68707041
59 0.12660922 1.07487779
60 NA 0.12660922
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.12260433 0.92638602
[2,] -0.02033864 2.12260433
[3,] -0.13530690 -0.02033864
[4,] -1.25439833 -0.13530690
[5,] 1.50353805 -1.25439833
[6,] -0.51997617 1.50353805
[7,] -0.16147677 -0.51997617
[8,] -1.30273073 -0.16147677
[9,] 0.78040304 -1.30273073
[10,] -0.03247087 0.78040304
[11,] 0.63034390 -0.03247087
[12,] -0.85878170 0.63034390
[13,] -2.39985185 -0.85878170
[14,] 0.61370335 -2.39985185
[15,] 0.50105096 0.61370335
[16,] 1.63977593 0.50105096
[17,] -1.30084949 1.63977593
[18,] 2.20023466 -1.30084949
[19,] -1.76956959 2.20023466
[20,] 0.91654875 -1.76956959
[21,] 0.95438766 0.91654875
[22,] 2.01222080 0.95438766
[23,] -1.31965557 2.01222080
[24,] -1.53620546 -1.31965557
[25,] 0.54213048 -1.53620546
[26,] -1.44747589 0.54213048
[27,] 0.96360330 -1.44747589
[28,] 0.27590162 0.96360330
[29,] 0.11863396 0.27590162
[30,] -0.92897677 0.11863396
[31,] 0.38910446 -0.92897677
[32,] 0.48511630 0.38910446
[33,] 1.37443998 0.48511630
[34,] 0.77845574 1.37443998
[35,] -0.08014519 0.77845574
[36,] -2.13797833 -0.08014519
[37,] -0.77778745 -2.13797833
[38,] -0.75547981 -0.77778745
[39,] 1.28192693 -0.75547981
[40,] -0.82214179 1.28192693
[41,] -1.64410793 -0.82214179
[42,] 0.48407573 -1.64410793
[43,] 0.58748831 0.48407573
[44,] -1.40971092 0.58748831
[45,] 0.54456206 -1.40971092
[46,] 1.17829037 0.54456206
[47,] -0.10590656 1.17829037
[48,] 0.83432878 -0.10590656
[49,] -1.66598341 0.83432878
[50,] -1.42524218 -1.66598341
[51,] -1.61039220 -1.42524218
[52,] -0.27861066 -1.61039220
[53,] 0.83558564 -0.27861066
[54,] -1.29826510 0.83558564
[55,] -1.15532213 -1.29826510
[56,] 1.79173986 -1.15532213
[57,] 1.68707041 1.79173986
[58,] 1.07487779 1.68707041
[59,] 0.12660922 1.07487779
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.12260433 0.92638602
2 -0.02033864 2.12260433
3 -0.13530690 -0.02033864
4 -1.25439833 -0.13530690
5 1.50353805 -1.25439833
6 -0.51997617 1.50353805
7 -0.16147677 -0.51997617
8 -1.30273073 -0.16147677
9 0.78040304 -1.30273073
10 -0.03247087 0.78040304
11 0.63034390 -0.03247087
12 -0.85878170 0.63034390
13 -2.39985185 -0.85878170
14 0.61370335 -2.39985185
15 0.50105096 0.61370335
16 1.63977593 0.50105096
17 -1.30084949 1.63977593
18 2.20023466 -1.30084949
19 -1.76956959 2.20023466
20 0.91654875 -1.76956959
21 0.95438766 0.91654875
22 2.01222080 0.95438766
23 -1.31965557 2.01222080
24 -1.53620546 -1.31965557
25 0.54213048 -1.53620546
26 -1.44747589 0.54213048
27 0.96360330 -1.44747589
28 0.27590162 0.96360330
29 0.11863396 0.27590162
30 -0.92897677 0.11863396
31 0.38910446 -0.92897677
32 0.48511630 0.38910446
33 1.37443998 0.48511630
34 0.77845574 1.37443998
35 -0.08014519 0.77845574
36 -2.13797833 -0.08014519
37 -0.77778745 -2.13797833
38 -0.75547981 -0.77778745
39 1.28192693 -0.75547981
40 -0.82214179 1.28192693
41 -1.64410793 -0.82214179
42 0.48407573 -1.64410793
43 0.58748831 0.48407573
44 -1.40971092 0.58748831
45 0.54456206 -1.40971092
46 1.17829037 0.54456206
47 -0.10590656 1.17829037
48 0.83432878 -0.10590656
49 -1.66598341 0.83432878
50 -1.42524218 -1.66598341
51 -1.61039220 -1.42524218
52 -0.27861066 -1.61039220
53 0.83558564 -0.27861066
54 -1.29826510 0.83558564
55 -1.15532213 -1.29826510
56 1.79173986 -1.15532213
57 1.68707041 1.79173986
58 1.07487779 1.68707041
59 0.12660922 1.07487779
> 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/wessaorg/rcomp/tmp/77p3c1322164563.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/wessaorg/rcomp/tmp/83ukh1322164563.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/wessaorg/rcomp/tmp/97nok1322164563.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/wessaorg/rcomp/tmp/10t7bw1322164563.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/115t1q1322164563.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/wessaorg/rcomp/tmp/12y7yd1322164563.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/wessaorg/rcomp/tmp/138zgn1322164563.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/wessaorg/rcomp/tmp/14chlj1322164563.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/wessaorg/rcomp/tmp/156pva1322164563.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/wessaorg/rcomp/tmp/16jgrq1322164563.tab")
+ }
>
> try(system("convert tmp/1dd261322164563.ps tmp/1dd261322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/2d5jq1322164563.ps tmp/2d5jq1322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/33yi41322164563.ps tmp/33yi41322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/4k4571322164563.ps tmp/4k4571322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/5f1121322164563.ps tmp/5f1121322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ec1x1322164563.ps tmp/6ec1x1322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/77p3c1322164563.ps tmp/77p3c1322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/83ukh1322164563.ps tmp/83ukh1322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/97nok1322164563.ps tmp/97nok1322164563.png",intern=TRUE))
character(0)
> try(system("convert tmp/10t7bw1322164563.ps tmp/10t7bw1322164563.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.282 0.494 3.806