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(-14,-20,36,-2,3,-7,-8,24,1,5,-9,-15,22,-1,4,-9,-13,17,-1,-4,-4,-6,8,-2,-1,-3,0,12,-1,3,1,5,5,1,2,-1,-1,6,0,2,-2,-5,5,-2,2,1,4,8,3,6,-3,-3,15,0,6,-2,3,16,0,6,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),dim=c(5,60),dimnames=list(c('consumentenvertrouwen','economie','Werkloosheid','Financiën','Spaarvermogen'),1:60))
> y <- array(NA,dim=c(5,60),dimnames=list(c('consumentenvertrouwen','economie','Werkloosheid','Financië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])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '5'
> 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
Spaarvermogen consumentenvertrouwen economie Werkloosheid Financi\353n
1 3 -14 -20 36 -2
2 5 -7 -8 24 1
3 4 -9 -15 22 -1
4 -4 -9 -13 17 -1
5 -1 -4 -6 8 -2
6 3 -3 0 12 -1
7 2 1 5 5 1
8 2 -1 -1 6 0
9 2 -2 -5 5 -2
10 6 1 4 8 3
11 6 -3 -3 15 0
12 6 -2 3 16 0
13 6 0 8 17 2
14 7 -2 3 23 3
15 4 -4 3 24 1
16 3 -4 7 27 1
17 0 -7 4 31 0
18 6 -9 -4 40 1
19 3 -13 -6 47 -1
20 1 -8 8 43 2
21 6 -13 2 60 2
22 5 -15 -1 64 0
23 7 -15 -2 65 1
24 4 -15 0 65 1
25 3 -10 10 55 3
26 6 -12 3 57 3
27 6 -11 6 57 1
28 5 -11 7 57 1
29 2 -17 -4 65 -2
30 3 -18 -5 69 1
31 -2 -19 -7 70 1
32 -4 -22 -10 71 -1
33 0 -24 -21 71 -4
34 1 -24 -22 73 -2
35 4 -20 -16 68 -1
36 -3 -25 -25 65 -5
37 -3 -22 -22 57 -4
38 0 -17 -22 41 -5
39 6 -9 -19 21 0
40 -1 -11 -21 21 -2
41 0 -13 -31 17 -4
42 -1 -11 -28 9 -6
43 1 -9 -23 11 -2
44 -4 -7 -17 6 -2
45 -1 -3 -12 -2 -2
46 -1 -3 -14 0 1
47 0 -6 -18 5 -2
48 3 -4 -16 3 0
49 0 -8 -22 7 -1
50 8 -1 -9 4 2
51 8 -2 -10 8 3
52 8 -2 -10 9 2
53 8 -1 0 14 3
54 11 1 3 12 4
55 13 2 2 12 5
56 5 2 4 7 5
57 12 -1 -3 15 4
58 13 1 0 14 5
59 9 -1 -1 19 6
60 11 -8 -7 39 4
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) consumentenvertrouwen economie
0.04934 3.52320 -0.91084
Werkloosheid `Financi\353n`
0.89240 -0.62101
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.3314 -0.8613 0.0328 0.8068 2.1904
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.04934 0.38748 0.127 0.899133
consumentenvertrouwen 3.52320 0.23779 14.816 < 2e-16 ***
economie -0.91084 0.06236 -14.606 < 2e-16 ***
Werkloosheid 0.89240 0.06073 14.696 < 2e-16 ***
`Financi\353n` -0.62101 0.16145 -3.847 0.000314 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.22 on 55 degrees of freedom
Multiple R-squared: 0.9224, Adjusted R-squared: 0.9168
F-statistic: 163.5 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.77568031 0.4486394 0.2243197
[2,] 0.65230663 0.6953867 0.3476934
[3,] 0.53122490 0.9375502 0.4687751
[4,] 0.39701506 0.7940301 0.6029849
[5,] 0.29691040 0.5938208 0.7030896
[6,] 0.49462879 0.9892576 0.5053712
[7,] 0.72356326 0.5528735 0.2764367
[8,] 0.65329053 0.6934189 0.3467095
[9,] 0.57588369 0.8482326 0.4241163
[10,] 0.48825007 0.9765001 0.5117499
[11,] 0.48739424 0.9747885 0.5126058
[12,] 0.40502570 0.8100514 0.5949743
[13,] 0.36167757 0.7233551 0.6383224
[14,] 0.34307268 0.6861454 0.6569273
[15,] 0.27932561 0.5586512 0.7206744
[16,] 0.21821635 0.4364327 0.7817837
[17,] 0.18581806 0.3716361 0.8141819
[18,] 0.13499828 0.2699966 0.8650017
[19,] 0.19851282 0.3970256 0.8014872
[20,] 0.14603194 0.2920639 0.8539681
[21,] 0.10423127 0.2084625 0.8957687
[22,] 0.09628886 0.1925777 0.9037111
[23,] 0.07980811 0.1596162 0.9201919
[24,] 0.51317635 0.9736473 0.4868236
[25,] 0.45014256 0.9002851 0.5498574
[26,] 0.38521095 0.7704219 0.6147890
[27,] 0.35991281 0.7198256 0.6400872
[28,] 0.51307744 0.9738451 0.4869226
[29,] 0.45919803 0.9183961 0.5408020
[30,] 0.41843807 0.8368761 0.5815619
[31,] 0.34907680 0.6981536 0.6509232
[32,] 0.37603430 0.7520686 0.6239657
[33,] 0.42207505 0.8441501 0.5779249
[34,] 0.35186579 0.7037316 0.6481342
[35,] 0.27915936 0.5583187 0.7208406
[36,] 0.22329284 0.4465857 0.7767072
[37,] 0.22447235 0.4489447 0.7755276
[38,] 0.20105349 0.4021070 0.7989465
[39,] 0.32572949 0.6514590 0.6742705
[40,] 0.51122823 0.9775435 0.4887718
[41,] 0.49539339 0.9907868 0.5046066
[42,] 0.40430635 0.8086127 0.5956936
[43,] 0.31055601 0.6211120 0.6894440
[44,] 0.45874460 0.9174892 0.5412554
[45,] 0.56549971 0.8690006 0.4345003
> postscript(file="/var/wessaorg/rcomp/tmp/1xjzl1323943315.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/2mn7x1323943315.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/3cdzz1323943315.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/4440k1323943315.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/5c2ff1323943315.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.69023192 1.52975155 1.74304772 0.02672355 -0.80281127 2.19043766
7 8 9 10 11 12
-0.85933285 -0.79138301 -1.26116861 0.79465822 0.40173726 1.45117104
13 14 15 16 17 18
-0.69140241 -1.93258398 -0.02061747 -0.05446268 0.59200101 -1.05889539
19 20 21 22 23 24
0.72339067 -0.70821560 1.27194523 -0.22580308 0.59197307 -0.58634989
25 26 27 28 29 30
0.07207389 1.95779989 -0.07491099 -0.16407247 -1.04635212 0.85945119
31 32 33 34 35 36
-3.33142804 0.37122049 -0.46465136 -0.91826053 -1.46300647 1.14857627
37 38 39 40 41 42
1.07171162 0.11310549 1.61310785 -1.40420292 -0.13862278 0.44466684
43 44 45 46 47 48
0.65172250 -1.46764274 -0.86704235 -2.61047560 -1.00927906 -0.20716878
49 50 51 52 53 54
1.22997692 0.94873724 0.61251169 -0.90090250 0.84330074 1.93523510
55 56 57 58 59 60
0.12221345 -1.59411072 1.83939986 0.03893447 -1.66649328 0.44083455
> postscript(file="/var/wessaorg/rcomp/tmp/6g2i91323943315.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.69023192 NA
1 1.52975155 0.69023192
2 1.74304772 1.52975155
3 0.02672355 1.74304772
4 -0.80281127 0.02672355
5 2.19043766 -0.80281127
6 -0.85933285 2.19043766
7 -0.79138301 -0.85933285
8 -1.26116861 -0.79138301
9 0.79465822 -1.26116861
10 0.40173726 0.79465822
11 1.45117104 0.40173726
12 -0.69140241 1.45117104
13 -1.93258398 -0.69140241
14 -0.02061747 -1.93258398
15 -0.05446268 -0.02061747
16 0.59200101 -0.05446268
17 -1.05889539 0.59200101
18 0.72339067 -1.05889539
19 -0.70821560 0.72339067
20 1.27194523 -0.70821560
21 -0.22580308 1.27194523
22 0.59197307 -0.22580308
23 -0.58634989 0.59197307
24 0.07207389 -0.58634989
25 1.95779989 0.07207389
26 -0.07491099 1.95779989
27 -0.16407247 -0.07491099
28 -1.04635212 -0.16407247
29 0.85945119 -1.04635212
30 -3.33142804 0.85945119
31 0.37122049 -3.33142804
32 -0.46465136 0.37122049
33 -0.91826053 -0.46465136
34 -1.46300647 -0.91826053
35 1.14857627 -1.46300647
36 1.07171162 1.14857627
37 0.11310549 1.07171162
38 1.61310785 0.11310549
39 -1.40420292 1.61310785
40 -0.13862278 -1.40420292
41 0.44466684 -0.13862278
42 0.65172250 0.44466684
43 -1.46764274 0.65172250
44 -0.86704235 -1.46764274
45 -2.61047560 -0.86704235
46 -1.00927906 -2.61047560
47 -0.20716878 -1.00927906
48 1.22997692 -0.20716878
49 0.94873724 1.22997692
50 0.61251169 0.94873724
51 -0.90090250 0.61251169
52 0.84330074 -0.90090250
53 1.93523510 0.84330074
54 0.12221345 1.93523510
55 -1.59411072 0.12221345
56 1.83939986 -1.59411072
57 0.03893447 1.83939986
58 -1.66649328 0.03893447
59 0.44083455 -1.66649328
60 NA 0.44083455
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.52975155 0.69023192
[2,] 1.74304772 1.52975155
[3,] 0.02672355 1.74304772
[4,] -0.80281127 0.02672355
[5,] 2.19043766 -0.80281127
[6,] -0.85933285 2.19043766
[7,] -0.79138301 -0.85933285
[8,] -1.26116861 -0.79138301
[9,] 0.79465822 -1.26116861
[10,] 0.40173726 0.79465822
[11,] 1.45117104 0.40173726
[12,] -0.69140241 1.45117104
[13,] -1.93258398 -0.69140241
[14,] -0.02061747 -1.93258398
[15,] -0.05446268 -0.02061747
[16,] 0.59200101 -0.05446268
[17,] -1.05889539 0.59200101
[18,] 0.72339067 -1.05889539
[19,] -0.70821560 0.72339067
[20,] 1.27194523 -0.70821560
[21,] -0.22580308 1.27194523
[22,] 0.59197307 -0.22580308
[23,] -0.58634989 0.59197307
[24,] 0.07207389 -0.58634989
[25,] 1.95779989 0.07207389
[26,] -0.07491099 1.95779989
[27,] -0.16407247 -0.07491099
[28,] -1.04635212 -0.16407247
[29,] 0.85945119 -1.04635212
[30,] -3.33142804 0.85945119
[31,] 0.37122049 -3.33142804
[32,] -0.46465136 0.37122049
[33,] -0.91826053 -0.46465136
[34,] -1.46300647 -0.91826053
[35,] 1.14857627 -1.46300647
[36,] 1.07171162 1.14857627
[37,] 0.11310549 1.07171162
[38,] 1.61310785 0.11310549
[39,] -1.40420292 1.61310785
[40,] -0.13862278 -1.40420292
[41,] 0.44466684 -0.13862278
[42,] 0.65172250 0.44466684
[43,] -1.46764274 0.65172250
[44,] -0.86704235 -1.46764274
[45,] -2.61047560 -0.86704235
[46,] -1.00927906 -2.61047560
[47,] -0.20716878 -1.00927906
[48,] 1.22997692 -0.20716878
[49,] 0.94873724 1.22997692
[50,] 0.61251169 0.94873724
[51,] -0.90090250 0.61251169
[52,] 0.84330074 -0.90090250
[53,] 1.93523510 0.84330074
[54,] 0.12221345 1.93523510
[55,] -1.59411072 0.12221345
[56,] 1.83939986 -1.59411072
[57,] 0.03893447 1.83939986
[58,] -1.66649328 0.03893447
[59,] 0.44083455 -1.66649328
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.52975155 0.69023192
2 1.74304772 1.52975155
3 0.02672355 1.74304772
4 -0.80281127 0.02672355
5 2.19043766 -0.80281127
6 -0.85933285 2.19043766
7 -0.79138301 -0.85933285
8 -1.26116861 -0.79138301
9 0.79465822 -1.26116861
10 0.40173726 0.79465822
11 1.45117104 0.40173726
12 -0.69140241 1.45117104
13 -1.93258398 -0.69140241
14 -0.02061747 -1.93258398
15 -0.05446268 -0.02061747
16 0.59200101 -0.05446268
17 -1.05889539 0.59200101
18 0.72339067 -1.05889539
19 -0.70821560 0.72339067
20 1.27194523 -0.70821560
21 -0.22580308 1.27194523
22 0.59197307 -0.22580308
23 -0.58634989 0.59197307
24 0.07207389 -0.58634989
25 1.95779989 0.07207389
26 -0.07491099 1.95779989
27 -0.16407247 -0.07491099
28 -1.04635212 -0.16407247
29 0.85945119 -1.04635212
30 -3.33142804 0.85945119
31 0.37122049 -3.33142804
32 -0.46465136 0.37122049
33 -0.91826053 -0.46465136
34 -1.46300647 -0.91826053
35 1.14857627 -1.46300647
36 1.07171162 1.14857627
37 0.11310549 1.07171162
38 1.61310785 0.11310549
39 -1.40420292 1.61310785
40 -0.13862278 -1.40420292
41 0.44466684 -0.13862278
42 0.65172250 0.44466684
43 -1.46764274 0.65172250
44 -0.86704235 -1.46764274
45 -2.61047560 -0.86704235
46 -1.00927906 -2.61047560
47 -0.20716878 -1.00927906
48 1.22997692 -0.20716878
49 0.94873724 1.22997692
50 0.61251169 0.94873724
51 -0.90090250 0.61251169
52 0.84330074 -0.90090250
53 1.93523510 0.84330074
54 0.12221345 1.93523510
55 -1.59411072 0.12221345
56 1.83939986 -1.59411072
57 0.03893447 1.83939986
58 -1.66649328 0.03893447
59 0.44083455 -1.66649328
> 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/7qirn1323943315.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/8dcmb1323943315.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/9wlxi1323943315.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/1084gl1323943315.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/11hfkm1323943315.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/12kl6x1323943315.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/13nmc41323943315.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/14pudf1323943315.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/15d53q1323943315.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/16ip2e1323943315.tab")
+ }
>
> try(system("convert tmp/1xjzl1323943315.ps tmp/1xjzl1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/2mn7x1323943315.ps tmp/2mn7x1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/3cdzz1323943315.ps tmp/3cdzz1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/4440k1323943315.ps tmp/4440k1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/5c2ff1323943315.ps tmp/5c2ff1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/6g2i91323943315.ps tmp/6g2i91323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/7qirn1323943315.ps tmp/7qirn1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dcmb1323943315.ps tmp/8dcmb1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/9wlxi1323943315.ps tmp/9wlxi1323943315.png",intern=TRUE))
character(0)
> try(system("convert tmp/1084gl1323943315.ps tmp/1084gl1323943315.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.116 0.580 3.733