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(25.6,7.4,1.8,23.7,7.1,2.7,22,6.8,2.3,21.3,6.9,1.9,20.7,7.2,2,20.4,7.4,2.3,20.3,7.3,2.8,20.4,6.9,2.4,19.8,6.9,2.3,19.5,6.8,2.7,23.1,7.1,2.7,23.5,7.2,2.9,23.5,7.1,3,22.9,7,2.2,21.9,6.9,2.3,21.5,7.1,2.8,20.5,7.3,2.8,20.2,7.5,2.8,19.4,7.5,2.2,19.2,7.5,2.6,18.8,7.3,2.8,18.8,7,2.5,22.6,6.7,2.4,23.3,6.5,2.3,23,6.5,1.9,21.4,6.5,1.7,19.9,6.6,2,18.8,6.8,2.1,18.6,6.9,1.7,18.4,6.9,1.8,18.6,6.8,1.8,19.9,6.8,1.8,19.2,6.5,1.3,18.4,6.1,1.3,21.1,6.1,1.3,20.5,5.9,1.2,19.1,5.7,1.4,18.1,5.9,2.2,17,5.9,2.9,17.1,6.1,3.1,17.4,6.3,3.5,16.8,6.2,3.6,15.3,5.9,4.4,14.3,5.7,4.1,13.4,5.4,5.1,15.3,5.6,5.8,22.1,6.2,5.9,23.7,6.3,5.4,22.2,6,5.5,19.5,5.6,4.8,16.6,5.5,3.2,17.3,5.9,2.7,19.8,6.5,2.1,21.2,6.8,1.9,21.5,6.8,0.6,20.6,6.5,0.7,19.1,6.2,-0.2,19.6,6.2,-1,23.5,6.5,-1.7,24,6.7,-0.7),dim=c(3,60),dimnames=list(c('W<25j','W>25j','Inflatie'),1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('W<25j','W>25j','Inflatie'),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 = 'Include Monthly 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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0 52
53 19.8 6.5 2.1 0 0 0 0 1 0 0 0 0 0 0 53
54 21.2 6.8 1.9 0 0 0 0 0 1 0 0 0 0 0 54
55 21.5 6.8 0.6 0 0 0 0 0 0 1 0 0 0 0 55
56 20.6 6.5 0.7 0 0 0 0 0 0 0 1 0 0 0 56
57 19.1 6.2 -0.2 0 0 0 0 0 0 0 0 1 0 0 57
58 19.6 6.2 -1.0 0 0 0 0 0 0 0 0 0 1 0 58
59 23.5 6.5 -1.7 0 0 0 0 0 0 0 0 0 0 1 59
60 24.0 6.7 -0.7 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `W>25j` Inflatie M1 M2 M3
-0.85985 3.54483 -0.17161 0.03973 -1.12624 -2.54489
M4 M5 M6 M7 M8 M9
-3.63953 -4.48059 -4.92702 -5.00448 -4.54462 -4.62640
M10 M11 t
-3.97237 -0.50581 0.03135
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.16254 -0.74217 -0.08957 0.78987 1.64941
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.85985 3.74945 -0.229 0.81966
`W>25j` 3.54483 0.48463 7.315 3.49e-09 ***
Inflatie -0.17161 0.11330 -1.515 0.13685
M1 0.03973 0.72345 0.055 0.95645
M2 -1.12624 0.72972 -1.543 0.12974
M3 -2.54489 0.73571 -3.459 0.00120 **
M4 -3.63953 0.71615 -5.082 7.00e-06 ***
M5 -4.48059 0.71785 -6.242 1.37e-07 ***
M6 -4.92702 0.72960 -6.753 2.37e-08 ***
M7 -5.00448 0.72062 -6.945 1.23e-08 ***
M8 -4.54462 0.71190 -6.384 8.39e-08 ***
M9 -4.62640 0.71322 -6.487 5.90e-08 ***
M10 -3.97237 0.71849 -5.529 1.55e-06 ***
M11 -0.50581 0.71041 -0.712 0.48014
t 0.03135 0.01438 2.180 0.03456 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.123 on 45 degrees of freedom
Multiple R-squared: 0.8506, Adjusted R-squared: 0.8041
F-statistic: 18.3 on 14 and 45 DF, p-value: 4.453e-14
> 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,] 3.816490e-05 7.632979e-05 0.9999618
[2,] 3.209671e-02 6.419342e-02 0.9679033
[3,] 1.538242e-01 3.076484e-01 0.8461758
[4,] 1.314584e-01 2.629168e-01 0.8685416
[5,] 1.151930e-01 2.303859e-01 0.8848070
[6,] 6.728089e-02 1.345618e-01 0.9327191
[7,] 5.317453e-02 1.063491e-01 0.9468255
[8,] 3.863316e-02 7.726632e-02 0.9613668
[9,] 3.204276e-02 6.408553e-02 0.9679572
[10,] 2.734107e-02 5.468214e-02 0.9726589
[11,] 4.695357e-02 9.390714e-02 0.9530464
[12,] 3.641198e-02 7.282397e-02 0.9635880
[13,] 3.108629e-02 6.217259e-02 0.9689137
[14,] 2.620481e-02 5.240962e-02 0.9737952
[15,] 6.401442e-02 1.280288e-01 0.9359856
[16,] 6.849323e-02 1.369865e-01 0.9315068
[17,] 6.336565e-02 1.267313e-01 0.9366343
[18,] 6.836542e-02 1.367308e-01 0.9316346
[19,] 3.263294e-01 6.526589e-01 0.6736706
[20,] 6.706289e-01 6.587422e-01 0.3293711
[21,] 6.446068e-01 7.107865e-01 0.3553932
[22,] 5.664411e-01 8.671178e-01 0.4335589
[23,] 4.849712e-01 9.699424e-01 0.5150288
[24,] 5.380297e-01 9.239407e-01 0.4619703
[25,] 4.845458e-01 9.690916e-01 0.5154542
> postscript(file="/var/www/html/rcomp/tmp/1zs7x1264493838.ps",horizontal=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/2z8vy1264493838.ps",horizontal=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/3yisj1264493838.ps",horizontal=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/4rhyv1264493838.ps",horizontal=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/5hvjz1264493838.ps",horizontal=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.46590032 0.91841733 1.60052686 1.54069583 0.70412074 0.16171999
7 8 9 10 11 12
0.54811686 1.50620129 0.93947372 0.37722020 -0.58413466 -1.04145718
13 14 15 16 17 18
-0.74088832 0.01092874 0.76987560 0.81000834 -0.08924423 -0.68312734
19 20 21 22 23 24
-1.53998241 -2.16254489 -1.76882351 -1.44223593 -0.09385178 0.76079325
25 26 27 28 29 30
0.32107488 -0.17862665 -0.59432482 -1.32283522 -1.13624763 -0.90400336
31 32 33 34 35 36
-0.30341042 0.50538396 0.83346314 0.76601638 -0.03188858 -0.47724356
37 38 39 40 41 42
-1.20503061 -1.64209089 -1.23466262 -0.74601223 -0.27662166 -0.08989409
43 44 45 46 47 48
-0.34304827 -1.17676965 -0.79127868 -0.16549974 1.02685629 1.64940827
49 50 51 52 53 54
1.15894373 0.89137147 -0.54141502 -0.28185673 0.79799279 1.51530481
55 56 57 58 59 60
1.63832424 1.32772930 0.78716534 0.46449910 -0.31698126 -0.89150079
> postscript(file="/var/www/html/rcomp/tmp/6r0cz1264493838.ps",horizontal=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.46590032 NA
1 0.91841733 0.46590032
2 1.60052686 0.91841733
3 1.54069583 1.60052686
4 0.70412074 1.54069583
5 0.16171999 0.70412074
6 0.54811686 0.16171999
7 1.50620129 0.54811686
8 0.93947372 1.50620129
9 0.37722020 0.93947372
10 -0.58413466 0.37722020
11 -1.04145718 -0.58413466
12 -0.74088832 -1.04145718
13 0.01092874 -0.74088832
14 0.76987560 0.01092874
15 0.81000834 0.76987560
16 -0.08924423 0.81000834
17 -0.68312734 -0.08924423
18 -1.53998241 -0.68312734
19 -2.16254489 -1.53998241
20 -1.76882351 -2.16254489
21 -1.44223593 -1.76882351
22 -0.09385178 -1.44223593
23 0.76079325 -0.09385178
24 0.32107488 0.76079325
25 -0.17862665 0.32107488
26 -0.59432482 -0.17862665
27 -1.32283522 -0.59432482
28 -1.13624763 -1.32283522
29 -0.90400336 -1.13624763
30 -0.30341042 -0.90400336
31 0.50538396 -0.30341042
32 0.83346314 0.50538396
33 0.76601638 0.83346314
34 -0.03188858 0.76601638
35 -0.47724356 -0.03188858
36 -1.20503061 -0.47724356
37 -1.64209089 -1.20503061
38 -1.23466262 -1.64209089
39 -0.74601223 -1.23466262
40 -0.27662166 -0.74601223
41 -0.08989409 -0.27662166
42 -0.34304827 -0.08989409
43 -1.17676965 -0.34304827
44 -0.79127868 -1.17676965
45 -0.16549974 -0.79127868
46 1.02685629 -0.16549974
47 1.64940827 1.02685629
48 1.15894373 1.64940827
49 0.89137147 1.15894373
50 -0.54141502 0.89137147
51 -0.28185673 -0.54141502
52 0.79799279 -0.28185673
53 1.51530481 0.79799279
54 1.63832424 1.51530481
55 1.32772930 1.63832424
56 0.78716534 1.32772930
57 0.46449910 0.78716534
58 -0.31698126 0.46449910
59 -0.89150079 -0.31698126
60 NA -0.89150079
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.91841733 0.46590032
[2,] 1.60052686 0.91841733
[3,] 1.54069583 1.60052686
[4,] 0.70412074 1.54069583
[5,] 0.16171999 0.70412074
[6,] 0.54811686 0.16171999
[7,] 1.50620129 0.54811686
[8,] 0.93947372 1.50620129
[9,] 0.37722020 0.93947372
[10,] -0.58413466 0.37722020
[11,] -1.04145718 -0.58413466
[12,] -0.74088832 -1.04145718
[13,] 0.01092874 -0.74088832
[14,] 0.76987560 0.01092874
[15,] 0.81000834 0.76987560
[16,] -0.08924423 0.81000834
[17,] -0.68312734 -0.08924423
[18,] -1.53998241 -0.68312734
[19,] -2.16254489 -1.53998241
[20,] -1.76882351 -2.16254489
[21,] -1.44223593 -1.76882351
[22,] -0.09385178 -1.44223593
[23,] 0.76079325 -0.09385178
[24,] 0.32107488 0.76079325
[25,] -0.17862665 0.32107488
[26,] -0.59432482 -0.17862665
[27,] -1.32283522 -0.59432482
[28,] -1.13624763 -1.32283522
[29,] -0.90400336 -1.13624763
[30,] -0.30341042 -0.90400336
[31,] 0.50538396 -0.30341042
[32,] 0.83346314 0.50538396
[33,] 0.76601638 0.83346314
[34,] -0.03188858 0.76601638
[35,] -0.47724356 -0.03188858
[36,] -1.20503061 -0.47724356
[37,] -1.64209089 -1.20503061
[38,] -1.23466262 -1.64209089
[39,] -0.74601223 -1.23466262
[40,] -0.27662166 -0.74601223
[41,] -0.08989409 -0.27662166
[42,] -0.34304827 -0.08989409
[43,] -1.17676965 -0.34304827
[44,] -0.79127868 -1.17676965
[45,] -0.16549974 -0.79127868
[46,] 1.02685629 -0.16549974
[47,] 1.64940827 1.02685629
[48,] 1.15894373 1.64940827
[49,] 0.89137147 1.15894373
[50,] -0.54141502 0.89137147
[51,] -0.28185673 -0.54141502
[52,] 0.79799279 -0.28185673
[53,] 1.51530481 0.79799279
[54,] 1.63832424 1.51530481
[55,] 1.32772930 1.63832424
[56,] 0.78716534 1.32772930
[57,] 0.46449910 0.78716534
[58,] -0.31698126 0.46449910
[59,] -0.89150079 -0.31698126
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.91841733 0.46590032
2 1.60052686 0.91841733
3 1.54069583 1.60052686
4 0.70412074 1.54069583
5 0.16171999 0.70412074
6 0.54811686 0.16171999
7 1.50620129 0.54811686
8 0.93947372 1.50620129
9 0.37722020 0.93947372
10 -0.58413466 0.37722020
11 -1.04145718 -0.58413466
12 -0.74088832 -1.04145718
13 0.01092874 -0.74088832
14 0.76987560 0.01092874
15 0.81000834 0.76987560
16 -0.08924423 0.81000834
17 -0.68312734 -0.08924423
18 -1.53998241 -0.68312734
19 -2.16254489 -1.53998241
20 -1.76882351 -2.16254489
21 -1.44223593 -1.76882351
22 -0.09385178 -1.44223593
23 0.76079325 -0.09385178
24 0.32107488 0.76079325
25 -0.17862665 0.32107488
26 -0.59432482 -0.17862665
27 -1.32283522 -0.59432482
28 -1.13624763 -1.32283522
29 -0.90400336 -1.13624763
30 -0.30341042 -0.90400336
31 0.50538396 -0.30341042
32 0.83346314 0.50538396
33 0.76601638 0.83346314
34 -0.03188858 0.76601638
35 -0.47724356 -0.03188858
36 -1.20503061 -0.47724356
37 -1.64209089 -1.20503061
38 -1.23466262 -1.64209089
39 -0.74601223 -1.23466262
40 -0.27662166 -0.74601223
41 -0.08989409 -0.27662166
42 -0.34304827 -0.08989409
43 -1.17676965 -0.34304827
44 -0.79127868 -1.17676965
45 -0.16549974 -0.79127868
46 1.02685629 -0.16549974
47 1.64940827 1.02685629
48 1.15894373 1.64940827
49 0.89137147 1.15894373
50 -0.54141502 0.89137147
51 -0.28185673 -0.54141502
52 0.79799279 -0.28185673
53 1.51530481 0.79799279
54 1.63832424 1.51530481
55 1.32772930 1.63832424
56 0.78716534 1.32772930
57 0.46449910 0.78716534
58 -0.31698126 0.46449910
59 -0.89150079 -0.31698126
> 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/7fw2k1264493838.ps",horizontal=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/85zlz1264493838.ps",horizontal=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/96wch1264493838.ps",horizontal=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/10j2q61264493838.ps",horizontal=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/1134mt1264493838.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/12fruk1264493838.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/137l691264493838.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/14cund1264493838.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/15u7qg1264493838.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/16oxxd1264493838.tab")
+ }
>
> try(system("convert tmp/1zs7x1264493838.ps tmp/1zs7x1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/2z8vy1264493838.ps tmp/2z8vy1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/3yisj1264493838.ps tmp/3yisj1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/4rhyv1264493838.ps tmp/4rhyv1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/5hvjz1264493838.ps tmp/5hvjz1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/6r0cz1264493838.ps tmp/6r0cz1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/7fw2k1264493838.ps tmp/7fw2k1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/85zlz1264493838.ps tmp/85zlz1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/96wch1264493838.ps tmp/96wch1264493838.png",intern=TRUE))
character(0)
> try(system("convert tmp/10j2q61264493838.ps tmp/10j2q61264493838.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.421 1.568 14.234