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 = 'No 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: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 0 0 0
56 20.6 6.5 0.7 0 0 0 0 0 0 0 1 0 0 0
57 19.1 6.2 -0.2 0 0 0 0 0 0 0 0 1 0 0
58 19.6 6.2 -1.0 0 0 0 0 0 0 0 0 0 1 0
59 23.5 6.5 -1.7 0 0 0 0 0 0 0 0 0 0 1
60 24.0 6.7 -0.7 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `W>25j` Inflatie M1 M2 M3
6.0283 2.6954 -0.2712 -0.2383 -1.4749 -2.9481
M4 M5 M6 M7 M8 M9
-3.8265 -4.4083 -4.7154 -4.8585 -4.5241 -4.7674
M10 M11
-4.1840 -0.5471
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.81426 -0.72363 -0.06881 0.77218 2.16441
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.0283 2.0984 2.873 0.006136 **
`W>25j` 2.6954 0.2996 8.998 1.05e-11 ***
Inflatie -0.2712 0.1078 -2.515 0.015448 *
M1 -0.2383 0.7406 -0.322 0.749073
M2 -1.4749 0.7404 -1.992 0.052339 .
M3 -2.9481 0.7405 -3.981 0.000242 ***
M4 -3.8265 0.7394 -5.175 4.88e-06 ***
M5 -4.4083 0.7457 -5.911 3.93e-07 ***
M6 -4.7154 0.7520 -6.270 1.14e-07 ***
M7 -4.8585 0.7462 -6.511 4.94e-08 ***
M8 -4.5241 0.7403 -6.111 1.97e-07 ***
M9 -4.7674 0.7387 -6.454 6.02e-08 ***
M10 -4.1840 0.7404 -5.651 9.62e-07 ***
M11 -0.5471 0.7385 -0.741 0.462575
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.168 on 46 degrees of freedom
Multiple R-squared: 0.8348, Adjusted R-squared: 0.7881
F-statistic: 17.88 on 13 and 46 DF, p-value: 8.789e-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,] 0.027339719 0.05467944 0.9726603
[2,] 0.007443372 0.01488674 0.9925566
[3,] 0.058242086 0.11648417 0.9417579
[4,] 0.077135358 0.15427072 0.9228646
[5,] 0.051241669 0.10248334 0.9487583
[6,] 0.043268646 0.08653729 0.9567314
[7,] 0.033097563 0.06619513 0.9669024
[8,] 0.018884770 0.03776954 0.9811152
[9,] 0.027294986 0.05458997 0.9727050
[10,] 0.038506049 0.07701210 0.9614940
[11,] 0.057192776 0.11438555 0.9428072
[12,] 0.140330079 0.28066016 0.8596699
[13,] 0.193195428 0.38639086 0.8068046
[14,] 0.259133343 0.51826669 0.7408667
[15,] 0.297742087 0.59548417 0.7022579
[16,] 0.318040343 0.63608069 0.6819597
[17,] 0.324588245 0.64917649 0.6754118
[18,] 0.245453242 0.49090648 0.7545468
[19,] 0.175622904 0.35124581 0.8243771
[20,] 0.159436044 0.31887209 0.8405640
[21,] 0.175399430 0.35079886 0.8246006
[22,] 0.454407409 0.90881482 0.5455926
[23,] 0.684639584 0.63072083 0.3153604
[24,] 0.805102450 0.38979510 0.1948976
[25,] 0.793797306 0.41240539 0.2062027
[26,] 0.679369741 0.64126052 0.3206303
[27,] 0.549026737 0.90194653 0.4509733
> postscript(file="/var/www/html/rcomp/tmp/1sgx61261049328.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/21xdq1261049328.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/3pw2u1261049328.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/4x84g1261049328.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/59gpl1261049328.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.35248573 0.74173177 1.21504643 1.01543293 0.21576606 -0.23477429
7 8 9 10 11 12
0.21337068 0.94871712 0.56489005 0.05946350 -0.78601138 -1.14842713
13 14 15 16 17 18
-0.61346466 0.07566690 0.84551052 0.92044252 -0.03680860 -0.56870942
19 20 21 22 23 24
-1.38842208 -1.81425803 -1.37765281 -1.23384864 -0.28922820 0.37560331
25 26 27 28 29 30
0.20542908 -0.21225433 -0.42724221 -1.16079084 -1.15698667 -1.02269552
31 32 33 34 35 36
-0.41015133 0.55553209 0.77183213 0.46653268 -0.47033446 -1.10550295
37 38 39 40 41 42
-1.67388441 -1.75943808 -1.19640943 -0.70283790 -0.25160839 -0.24778132
43 44 45 46 47 48
-0.57920406 -1.45580929 -1.03270690 -0.06538072 1.50765683 2.15539998
49 50 51 52 53 54
1.72943427 1.15429373 -0.43690531 -0.07224671 1.22963760 2.07396055
55 56 57 58 59 60
2.16440679 1.76581810 1.07363752 0.77323317 0.03791720 -0.27707321
> postscript(file="/var/www/html/rcomp/tmp/65gze1261049328.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.35248573 NA
1 0.74173177 0.35248573
2 1.21504643 0.74173177
3 1.01543293 1.21504643
4 0.21576606 1.01543293
5 -0.23477429 0.21576606
6 0.21337068 -0.23477429
7 0.94871712 0.21337068
8 0.56489005 0.94871712
9 0.05946350 0.56489005
10 -0.78601138 0.05946350
11 -1.14842713 -0.78601138
12 -0.61346466 -1.14842713
13 0.07566690 -0.61346466
14 0.84551052 0.07566690
15 0.92044252 0.84551052
16 -0.03680860 0.92044252
17 -0.56870942 -0.03680860
18 -1.38842208 -0.56870942
19 -1.81425803 -1.38842208
20 -1.37765281 -1.81425803
21 -1.23384864 -1.37765281
22 -0.28922820 -1.23384864
23 0.37560331 -0.28922820
24 0.20542908 0.37560331
25 -0.21225433 0.20542908
26 -0.42724221 -0.21225433
27 -1.16079084 -0.42724221
28 -1.15698667 -1.16079084
29 -1.02269552 -1.15698667
30 -0.41015133 -1.02269552
31 0.55553209 -0.41015133
32 0.77183213 0.55553209
33 0.46653268 0.77183213
34 -0.47033446 0.46653268
35 -1.10550295 -0.47033446
36 -1.67388441 -1.10550295
37 -1.75943808 -1.67388441
38 -1.19640943 -1.75943808
39 -0.70283790 -1.19640943
40 -0.25160839 -0.70283790
41 -0.24778132 -0.25160839
42 -0.57920406 -0.24778132
43 -1.45580929 -0.57920406
44 -1.03270690 -1.45580929
45 -0.06538072 -1.03270690
46 1.50765683 -0.06538072
47 2.15539998 1.50765683
48 1.72943427 2.15539998
49 1.15429373 1.72943427
50 -0.43690531 1.15429373
51 -0.07224671 -0.43690531
52 1.22963760 -0.07224671
53 2.07396055 1.22963760
54 2.16440679 2.07396055
55 1.76581810 2.16440679
56 1.07363752 1.76581810
57 0.77323317 1.07363752
58 0.03791720 0.77323317
59 -0.27707321 0.03791720
60 NA -0.27707321
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.74173177 0.35248573
[2,] 1.21504643 0.74173177
[3,] 1.01543293 1.21504643
[4,] 0.21576606 1.01543293
[5,] -0.23477429 0.21576606
[6,] 0.21337068 -0.23477429
[7,] 0.94871712 0.21337068
[8,] 0.56489005 0.94871712
[9,] 0.05946350 0.56489005
[10,] -0.78601138 0.05946350
[11,] -1.14842713 -0.78601138
[12,] -0.61346466 -1.14842713
[13,] 0.07566690 -0.61346466
[14,] 0.84551052 0.07566690
[15,] 0.92044252 0.84551052
[16,] -0.03680860 0.92044252
[17,] -0.56870942 -0.03680860
[18,] -1.38842208 -0.56870942
[19,] -1.81425803 -1.38842208
[20,] -1.37765281 -1.81425803
[21,] -1.23384864 -1.37765281
[22,] -0.28922820 -1.23384864
[23,] 0.37560331 -0.28922820
[24,] 0.20542908 0.37560331
[25,] -0.21225433 0.20542908
[26,] -0.42724221 -0.21225433
[27,] -1.16079084 -0.42724221
[28,] -1.15698667 -1.16079084
[29,] -1.02269552 -1.15698667
[30,] -0.41015133 -1.02269552
[31,] 0.55553209 -0.41015133
[32,] 0.77183213 0.55553209
[33,] 0.46653268 0.77183213
[34,] -0.47033446 0.46653268
[35,] -1.10550295 -0.47033446
[36,] -1.67388441 -1.10550295
[37,] -1.75943808 -1.67388441
[38,] -1.19640943 -1.75943808
[39,] -0.70283790 -1.19640943
[40,] -0.25160839 -0.70283790
[41,] -0.24778132 -0.25160839
[42,] -0.57920406 -0.24778132
[43,] -1.45580929 -0.57920406
[44,] -1.03270690 -1.45580929
[45,] -0.06538072 -1.03270690
[46,] 1.50765683 -0.06538072
[47,] 2.15539998 1.50765683
[48,] 1.72943427 2.15539998
[49,] 1.15429373 1.72943427
[50,] -0.43690531 1.15429373
[51,] -0.07224671 -0.43690531
[52,] 1.22963760 -0.07224671
[53,] 2.07396055 1.22963760
[54,] 2.16440679 2.07396055
[55,] 1.76581810 2.16440679
[56,] 1.07363752 1.76581810
[57,] 0.77323317 1.07363752
[58,] 0.03791720 0.77323317
[59,] -0.27707321 0.03791720
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.74173177 0.35248573
2 1.21504643 0.74173177
3 1.01543293 1.21504643
4 0.21576606 1.01543293
5 -0.23477429 0.21576606
6 0.21337068 -0.23477429
7 0.94871712 0.21337068
8 0.56489005 0.94871712
9 0.05946350 0.56489005
10 -0.78601138 0.05946350
11 -1.14842713 -0.78601138
12 -0.61346466 -1.14842713
13 0.07566690 -0.61346466
14 0.84551052 0.07566690
15 0.92044252 0.84551052
16 -0.03680860 0.92044252
17 -0.56870942 -0.03680860
18 -1.38842208 -0.56870942
19 -1.81425803 -1.38842208
20 -1.37765281 -1.81425803
21 -1.23384864 -1.37765281
22 -0.28922820 -1.23384864
23 0.37560331 -0.28922820
24 0.20542908 0.37560331
25 -0.21225433 0.20542908
26 -0.42724221 -0.21225433
27 -1.16079084 -0.42724221
28 -1.15698667 -1.16079084
29 -1.02269552 -1.15698667
30 -0.41015133 -1.02269552
31 0.55553209 -0.41015133
32 0.77183213 0.55553209
33 0.46653268 0.77183213
34 -0.47033446 0.46653268
35 -1.10550295 -0.47033446
36 -1.67388441 -1.10550295
37 -1.75943808 -1.67388441
38 -1.19640943 -1.75943808
39 -0.70283790 -1.19640943
40 -0.25160839 -0.70283790
41 -0.24778132 -0.25160839
42 -0.57920406 -0.24778132
43 -1.45580929 -0.57920406
44 -1.03270690 -1.45580929
45 -0.06538072 -1.03270690
46 1.50765683 -0.06538072
47 2.15539998 1.50765683
48 1.72943427 2.15539998
49 1.15429373 1.72943427
50 -0.43690531 1.15429373
51 -0.07224671 -0.43690531
52 1.22963760 -0.07224671
53 2.07396055 1.22963760
54 2.16440679 2.07396055
55 1.76581810 2.16440679
56 1.07363752 1.76581810
57 0.77323317 1.07363752
58 0.03791720 0.77323317
59 -0.27707321 0.03791720
> 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/77zny1261049328.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/8x7681261049328.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/9hj9v1261049328.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/10zz3i1261049328.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/11hbtr1261049328.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/12gkyn1261049328.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/137q5v1261049328.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/1403uz1261049328.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/15ek4w1261049328.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/16g5dx1261049328.tab")
+ }
>
> try(system("convert tmp/1sgx61261049328.ps tmp/1sgx61261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/21xdq1261049328.ps tmp/21xdq1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/3pw2u1261049328.ps tmp/3pw2u1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/4x84g1261049328.ps tmp/4x84g1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/59gpl1261049328.ps tmp/59gpl1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/65gze1261049328.ps tmp/65gze1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/77zny1261049328.ps tmp/77zny1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/8x7681261049328.ps tmp/8x7681261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/9hj9v1261049328.ps tmp/9hj9v1261049328.png",intern=TRUE))
character(0)
> try(system("convert tmp/10zz3i1261049328.ps tmp/10zz3i1261049328.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.376 1.530 3.630