R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(8.1,9.9,11.5,23.4,25.4,27.9,26.1,18.8,14.1,11.5,15.8,12.4,4.5,-2.2,-4.2,-9.4,-14.5,-17.9,-15.1,-15.2,-15.7,-18,-18.1,-13.5,-9.9,-4.8,-1.7,-0.1,2.2,10.2,7.6,10.8,3.8,11,10.8,20.1,14.9,13,10.9,9.6,4,-1.1,-7.7,-8.9,-8,-7.1,-5.3,-2.5,-2.4,-2.9,-4.8,-7.2,1.7,2.2,13.4,12.3,13.7,4.4,-2.5),dim=c(1,59),dimnames=list(c('registraties_personenwagens'),1:59))
> y <- array(NA,dim=c(1,59),dimnames=list(c('registraties_personenwagens'),1:59))
> 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 = 'Include Monthly Dummies'
> par1 = '1'
> 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
registraties_personenwagens M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 8.1 1 0 0 0 0 0 0 0 0 0 0 1
2 9.9 0 1 0 0 0 0 0 0 0 0 0 2
3 11.5 0 0 1 0 0 0 0 0 0 0 0 3
4 23.4 0 0 0 1 0 0 0 0 0 0 0 4
5 25.4 0 0 0 0 1 0 0 0 0 0 0 5
6 27.9 0 0 0 0 0 1 0 0 0 0 0 6
7 26.1 0 0 0 0 0 0 1 0 0 0 0 7
8 18.8 0 0 0 0 0 0 0 1 0 0 0 8
9 14.1 0 0 0 0 0 0 0 0 1 0 0 9
10 11.5 0 0 0 0 0 0 0 0 0 1 0 10
11 15.8 0 0 0 0 0 0 0 0 0 0 1 11
12 12.4 0 0 0 0 0 0 0 0 0 0 0 12
13 4.5 1 0 0 0 0 0 0 0 0 0 0 13
14 -2.2 0 1 0 0 0 0 0 0 0 0 0 14
15 -4.2 0 0 1 0 0 0 0 0 0 0 0 15
16 -9.4 0 0 0 1 0 0 0 0 0 0 0 16
17 -14.5 0 0 0 0 1 0 0 0 0 0 0 17
18 -17.9 0 0 0 0 0 1 0 0 0 0 0 18
19 -15.1 0 0 0 0 0 0 1 0 0 0 0 19
20 -15.2 0 0 0 0 0 0 0 1 0 0 0 20
21 -15.7 0 0 0 0 0 0 0 0 1 0 0 21
22 -18.0 0 0 0 0 0 0 0 0 0 1 0 22
23 -18.1 0 0 0 0 0 0 0 0 0 0 1 23
24 -13.5 0 0 0 0 0 0 0 0 0 0 0 24
25 -9.9 1 0 0 0 0 0 0 0 0 0 0 25
26 -4.8 0 1 0 0 0 0 0 0 0 0 0 26
27 -1.7 0 0 1 0 0 0 0 0 0 0 0 27
28 -0.1 0 0 0 1 0 0 0 0 0 0 0 28
29 2.2 0 0 0 0 1 0 0 0 0 0 0 29
30 10.2 0 0 0 0 0 1 0 0 0 0 0 30
31 7.6 0 0 0 0 0 0 1 0 0 0 0 31
32 10.8 0 0 0 0 0 0 0 1 0 0 0 32
33 3.8 0 0 0 0 0 0 0 0 1 0 0 33
34 11.0 0 0 0 0 0 0 0 0 0 1 0 34
35 10.8 0 0 0 0 0 0 0 0 0 0 1 35
36 20.1 0 0 0 0 0 0 0 0 0 0 0 36
37 14.9 1 0 0 0 0 0 0 0 0 0 0 37
38 13.0 0 1 0 0 0 0 0 0 0 0 0 38
39 10.9 0 0 1 0 0 0 0 0 0 0 0 39
40 9.6 0 0 0 1 0 0 0 0 0 0 0 40
41 4.0 0 0 0 0 1 0 0 0 0 0 0 41
42 -1.1 0 0 0 0 0 1 0 0 0 0 0 42
43 -7.7 0 0 0 0 0 0 1 0 0 0 0 43
44 -8.9 0 0 0 0 0 0 0 1 0 0 0 44
45 -8.0 0 0 0 0 0 0 0 0 1 0 0 45
46 -7.1 0 0 0 0 0 0 0 0 0 1 0 46
47 -5.3 0 0 0 0 0 0 0 0 0 0 1 47
48 -2.5 0 0 0 0 0 0 0 0 0 0 0 48
49 -2.4 1 0 0 0 0 0 0 0 0 0 0 49
50 -2.9 0 1 0 0 0 0 0 0 0 0 0 50
51 -4.8 0 0 1 0 0 0 0 0 0 0 0 51
52 -7.2 0 0 0 1 0 0 0 0 0 0 0 52
53 1.7 0 0 0 0 1 0 0 0 0 0 0 53
54 2.2 0 0 0 0 0 1 0 0 0 0 0 54
55 13.4 0 0 0 0 0 0 1 0 0 0 0 55
56 12.3 0 0 0 0 0 0 0 1 0 0 0 56
57 13.7 0 0 0 0 0 0 0 0 1 0 0 57
58 4.4 0 0 0 0 0 0 0 0 0 1 0 58
59 -2.5 0 0 0 0 0 0 0 0 0 0 1 59
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) M1 M2 M3 M4 M5
8.3565 -1.7903 -2.0892 -2.2082 -1.1471 -0.5061
M6 M7 M8 M9 M10 M11
0.1350 0.8761 -0.2829 -2.1218 -3.2008 -3.2797
t
-0.1411
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-23.853 -7.237 1.325 9.694 20.255
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.3565 7.2451 1.153 0.255
M1 -1.7903 8.8246 -0.203 0.840
M2 -2.0892 8.8193 -0.237 0.814
M3 -2.2082 8.8151 -0.250 0.803
M4 -1.1471 8.8122 -0.130 0.897
M5 -0.5061 8.8104 -0.057 0.954
M6 0.1350 8.8098 0.015 0.988
M7 0.8761 8.8104 0.099 0.921
M8 -0.2829 8.8122 -0.032 0.975
M9 -2.1218 8.8151 -0.241 0.811
M10 -3.2008 8.8193 -0.363 0.718
M11 -3.2797 8.8246 -0.372 0.712
t -0.1411 0.1021 -1.382 0.174
Residual standard error: 13.13 on 46 degrees of freedom
Multiple R-squared: 0.05379, Adjusted R-squared: -0.193
F-statistic: 0.2179 on 12 and 46 DF, p-value: 0.9967
> 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.3952721 0.79054423 0.60472789
[2,] 0.5357507 0.92849864 0.46424932
[3,] 0.6502566 0.69948670 0.34974335
[4,] 0.6255292 0.74894151 0.37447075
[5,] 0.5432935 0.91341299 0.45670650
[6,] 0.4542739 0.90854772 0.54572614
[7,] 0.3934769 0.78695390 0.60652305
[8,] 0.3572360 0.71447210 0.64276395
[9,] 0.3596559 0.71931177 0.64034411
[10,] 0.6083541 0.78329184 0.39164592
[11,] 0.7773029 0.44539417 0.22269709
[12,] 0.8447135 0.31057306 0.15528653
[13,] 0.8486431 0.30271372 0.15135686
[14,] 0.8518447 0.29631067 0.14815534
[15,] 0.8713757 0.25724859 0.12862430
[16,] 0.8549172 0.29016568 0.14508284
[17,] 0.8526743 0.29465135 0.14732568
[18,] 0.8210175 0.35796491 0.17898245
[19,] 0.8176855 0.36462898 0.18231449
[20,] 0.8097798 0.38044034 0.19022017
[21,] 0.8646016 0.27079672 0.13539836
[22,] 0.8805924 0.23881528 0.11940764
[23,] 0.8919886 0.21602277 0.10801138
[24,] 0.9159401 0.16811983 0.08405991
[25,] 0.9720566 0.05588686 0.02794343
[26,] 0.9728022 0.05439569 0.02719785
[27,] 0.9624288 0.07514231 0.03757115
[28,] 0.9121288 0.17574235 0.08787117
> postscript(file="/var/www/rcomp/tmp/176jt1292957336.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/rcomp/tmp/276jt1292957336.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/rcomp/tmp/376jt1292957336.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/rcomp/tmp/4zfie1292957336.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/rcomp/tmp/5zfie1292957336.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 = 59
Frequency = 1
1 2 3 4 5 6
1.6747826 3.9147826 5.7747826 16.7547826 18.2547826 20.2547826
7 8 9 10 11 12
17.8547826 11.8547826 9.1347826 7.7547826 12.2747826 5.7360870
13 14 15 16 17 18
-0.2326087 -6.4926087 -8.2326087 -14.3526087 -19.9526087 -23.8526087
19 20 21 22 23 24
-21.6526087 -20.4526087 -18.9726087 -20.0526087 -19.9326087 -18.4713043
25 26 27 28 29 30
-12.9400000 -7.4000000 -4.0400000 -3.3600000 -1.5600000 5.9400000
31 32 33 34 35 36
2.7400000 7.2400000 2.2200000 10.6400000 10.6600000 16.8213043
37 38 39 40 41 42
13.5526087 12.0926087 10.2526087 8.0326087 1.9326087 -3.6673913
43 44 45 46 47 48
-10.8673913 -10.7673913 -7.8873913 -5.7673913 -3.7473913 -4.0860870
49 50 51 52 53 54
-2.0547826 -2.1147826 -3.7547826 -7.0747826 1.3252174 1.3252174
55 56 57 58 59
11.9252174 12.1252174 15.5052174 7.4252174 0.7452174
> postscript(file="/var/www/rcomp/tmp/6zfie1292957336.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 = 59
Frequency = 1
lag(myerror, k = 1) myerror
0 1.6747826 NA
1 3.9147826 1.6747826
2 5.7747826 3.9147826
3 16.7547826 5.7747826
4 18.2547826 16.7547826
5 20.2547826 18.2547826
6 17.8547826 20.2547826
7 11.8547826 17.8547826
8 9.1347826 11.8547826
9 7.7547826 9.1347826
10 12.2747826 7.7547826
11 5.7360870 12.2747826
12 -0.2326087 5.7360870
13 -6.4926087 -0.2326087
14 -8.2326087 -6.4926087
15 -14.3526087 -8.2326087
16 -19.9526087 -14.3526087
17 -23.8526087 -19.9526087
18 -21.6526087 -23.8526087
19 -20.4526087 -21.6526087
20 -18.9726087 -20.4526087
21 -20.0526087 -18.9726087
22 -19.9326087 -20.0526087
23 -18.4713043 -19.9326087
24 -12.9400000 -18.4713043
25 -7.4000000 -12.9400000
26 -4.0400000 -7.4000000
27 -3.3600000 -4.0400000
28 -1.5600000 -3.3600000
29 5.9400000 -1.5600000
30 2.7400000 5.9400000
31 7.2400000 2.7400000
32 2.2200000 7.2400000
33 10.6400000 2.2200000
34 10.6600000 10.6400000
35 16.8213043 10.6600000
36 13.5526087 16.8213043
37 12.0926087 13.5526087
38 10.2526087 12.0926087
39 8.0326087 10.2526087
40 1.9326087 8.0326087
41 -3.6673913 1.9326087
42 -10.8673913 -3.6673913
43 -10.7673913 -10.8673913
44 -7.8873913 -10.7673913
45 -5.7673913 -7.8873913
46 -3.7473913 -5.7673913
47 -4.0860870 -3.7473913
48 -2.0547826 -4.0860870
49 -2.1147826 -2.0547826
50 -3.7547826 -2.1147826
51 -7.0747826 -3.7547826
52 1.3252174 -7.0747826
53 1.3252174 1.3252174
54 11.9252174 1.3252174
55 12.1252174 11.9252174
56 15.5052174 12.1252174
57 7.4252174 15.5052174
58 0.7452174 7.4252174
59 NA 0.7452174
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.9147826 1.6747826
[2,] 5.7747826 3.9147826
[3,] 16.7547826 5.7747826
[4,] 18.2547826 16.7547826
[5,] 20.2547826 18.2547826
[6,] 17.8547826 20.2547826
[7,] 11.8547826 17.8547826
[8,] 9.1347826 11.8547826
[9,] 7.7547826 9.1347826
[10,] 12.2747826 7.7547826
[11,] 5.7360870 12.2747826
[12,] -0.2326087 5.7360870
[13,] -6.4926087 -0.2326087
[14,] -8.2326087 -6.4926087
[15,] -14.3526087 -8.2326087
[16,] -19.9526087 -14.3526087
[17,] -23.8526087 -19.9526087
[18,] -21.6526087 -23.8526087
[19,] -20.4526087 -21.6526087
[20,] -18.9726087 -20.4526087
[21,] -20.0526087 -18.9726087
[22,] -19.9326087 -20.0526087
[23,] -18.4713043 -19.9326087
[24,] -12.9400000 -18.4713043
[25,] -7.4000000 -12.9400000
[26,] -4.0400000 -7.4000000
[27,] -3.3600000 -4.0400000
[28,] -1.5600000 -3.3600000
[29,] 5.9400000 -1.5600000
[30,] 2.7400000 5.9400000
[31,] 7.2400000 2.7400000
[32,] 2.2200000 7.2400000
[33,] 10.6400000 2.2200000
[34,] 10.6600000 10.6400000
[35,] 16.8213043 10.6600000
[36,] 13.5526087 16.8213043
[37,] 12.0926087 13.5526087
[38,] 10.2526087 12.0926087
[39,] 8.0326087 10.2526087
[40,] 1.9326087 8.0326087
[41,] -3.6673913 1.9326087
[42,] -10.8673913 -3.6673913
[43,] -10.7673913 -10.8673913
[44,] -7.8873913 -10.7673913
[45,] -5.7673913 -7.8873913
[46,] -3.7473913 -5.7673913
[47,] -4.0860870 -3.7473913
[48,] -2.0547826 -4.0860870
[49,] -2.1147826 -2.0547826
[50,] -3.7547826 -2.1147826
[51,] -7.0747826 -3.7547826
[52,] 1.3252174 -7.0747826
[53,] 1.3252174 1.3252174
[54,] 11.9252174 1.3252174
[55,] 12.1252174 11.9252174
[56,] 15.5052174 12.1252174
[57,] 7.4252174 15.5052174
[58,] 0.7452174 7.4252174
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.9147826 1.6747826
2 5.7747826 3.9147826
3 16.7547826 5.7747826
4 18.2547826 16.7547826
5 20.2547826 18.2547826
6 17.8547826 20.2547826
7 11.8547826 17.8547826
8 9.1347826 11.8547826
9 7.7547826 9.1347826
10 12.2747826 7.7547826
11 5.7360870 12.2747826
12 -0.2326087 5.7360870
13 -6.4926087 -0.2326087
14 -8.2326087 -6.4926087
15 -14.3526087 -8.2326087
16 -19.9526087 -14.3526087
17 -23.8526087 -19.9526087
18 -21.6526087 -23.8526087
19 -20.4526087 -21.6526087
20 -18.9726087 -20.4526087
21 -20.0526087 -18.9726087
22 -19.9326087 -20.0526087
23 -18.4713043 -19.9326087
24 -12.9400000 -18.4713043
25 -7.4000000 -12.9400000
26 -4.0400000 -7.4000000
27 -3.3600000 -4.0400000
28 -1.5600000 -3.3600000
29 5.9400000 -1.5600000
30 2.7400000 5.9400000
31 7.2400000 2.7400000
32 2.2200000 7.2400000
33 10.6400000 2.2200000
34 10.6600000 10.6400000
35 16.8213043 10.6600000
36 13.5526087 16.8213043
37 12.0926087 13.5526087
38 10.2526087 12.0926087
39 8.0326087 10.2526087
40 1.9326087 8.0326087
41 -3.6673913 1.9326087
42 -10.8673913 -3.6673913
43 -10.7673913 -10.8673913
44 -7.8873913 -10.7673913
45 -5.7673913 -7.8873913
46 -3.7473913 -5.7673913
47 -4.0860870 -3.7473913
48 -2.0547826 -4.0860870
49 -2.1147826 -2.0547826
50 -3.7547826 -2.1147826
51 -7.0747826 -3.7547826
52 1.3252174 -7.0747826
53 1.3252174 1.3252174
54 11.9252174 1.3252174
55 12.1252174 11.9252174
56 15.5052174 12.1252174
57 7.4252174 15.5052174
58 0.7452174 7.4252174
> 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/rcomp/tmp/7s6hh1292957336.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/rcomp/tmp/8s6hh1292957336.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/rcomp/tmp/93yyk1292957336.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/rcomp/tmp/103yyk1292957336.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11oyf81292957336.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/rcomp/tmp/12rzdw1292957336.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/rcomp/tmp/13g0ap1292957336.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/rcomp/tmp/1499ra1292957336.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/rcomp/tmp/15c98y1292957336.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/rcomp/tmp/16qjop1292957336.tab")
+ }
>
> try(system("convert tmp/176jt1292957336.ps tmp/176jt1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/276jt1292957336.ps tmp/276jt1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/376jt1292957336.ps tmp/376jt1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/4zfie1292957336.ps tmp/4zfie1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zfie1292957336.ps tmp/5zfie1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/6zfie1292957336.ps tmp/6zfie1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/7s6hh1292957336.ps tmp/7s6hh1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/8s6hh1292957336.ps tmp/8s6hh1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/93yyk1292957336.ps tmp/93yyk1292957336.png",intern=TRUE))
character(0)
> try(system("convert tmp/103yyk1292957336.ps tmp/103yyk1292957336.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.980 0.810 3.763