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(29,27,24,26,28,29,26,25,26,21,19,26,23,19,21,22,19,23,21,20,22,16,16,21,19,22,16,16,21,19,25,25,16,27,29,25,23,28,27,22,25,23,23,26,22,20,24,23,24,28,20,23,28,24,20,28,23,21,28,20,22,32,21,17,31,22,21,22,17,19,29,21,23,31,19,22,29,23,15,32,22,23,32,15,21,31,23,18,29,21,18,28,18,18,28,18,18,29,18,10,22,18,13,26,10,10,24,13,9,27,10,9,27,9,6,23,9,11,21,6,9,19,11,10,17,9,9,19,10,16,21,9,10,13,16,7,8,10,7,5,7,14,10,7,11,6,14,10,6,11,6,8,10,8,11,6,13,12,8,12,13,13,15,19,12,16,19,15,16,18,16),dim=c(3,57),dimnames=list(c('s','consv','y(t-1)'),1:57))
> y <- array(NA,dim=c(3,57),dimnames=list(c('s','consv','y(t-1)'),1:57))
> 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))
+ colnames(x)[k+1] <- 't'
+ }
> x
s consv y(t-1) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 29 27 24 1 0 0 0 0 0 0 0 0 0 0 1
2 26 28 29 0 1 0 0 0 0 0 0 0 0 0 2
3 26 25 26 0 0 1 0 0 0 0 0 0 0 0 3
4 21 19 26 0 0 0 1 0 0 0 0 0 0 0 4
5 23 19 21 0 0 0 0 1 0 0 0 0 0 0 5
6 22 19 23 0 0 0 0 0 1 0 0 0 0 0 6
7 21 20 22 0 0 0 0 0 0 1 0 0 0 0 7
8 16 16 21 0 0 0 0 0 0 0 1 0 0 0 8
9 19 22 16 0 0 0 0 0 0 0 0 1 0 0 9
10 16 21 19 0 0 0 0 0 0 0 0 0 1 0 10
11 25 25 16 0 0 0 0 0 0 0 0 0 0 1 11
12 27 29 25 0 0 0 0 0 0 0 0 0 0 0 12
13 23 28 27 1 0 0 0 0 0 0 0 0 0 0 13
14 22 25 23 0 1 0 0 0 0 0 0 0 0 0 14
15 23 26 22 0 0 1 0 0 0 0 0 0 0 0 15
16 20 24 23 0 0 0 1 0 0 0 0 0 0 0 16
17 24 28 20 0 0 0 0 1 0 0 0 0 0 0 17
18 23 28 24 0 0 0 0 0 1 0 0 0 0 0 18
19 20 28 23 0 0 0 0 0 0 1 0 0 0 0 19
20 21 28 20 0 0 0 0 0 0 0 1 0 0 0 20
21 22 32 21 0 0 0 0 0 0 0 0 1 0 0 21
22 17 31 22 0 0 0 0 0 0 0 0 0 1 0 22
23 21 22 17 0 0 0 0 0 0 0 0 0 0 1 23
24 19 29 21 0 0 0 0 0 0 0 0 0 0 0 24
25 23 31 19 1 0 0 0 0 0 0 0 0 0 0 25
26 22 29 23 0 1 0 0 0 0 0 0 0 0 0 26
27 15 32 22 0 0 1 0 0 0 0 0 0 0 0 27
28 23 32 15 0 0 0 1 0 0 0 0 0 0 0 28
29 21 31 23 0 0 0 0 1 0 0 0 0 0 0 29
30 18 29 21 0 0 0 0 0 1 0 0 0 0 0 30
31 18 28 18 0 0 0 0 0 0 1 0 0 0 0 31
32 18 28 18 0 0 0 0 0 0 0 1 0 0 0 32
33 18 29 18 0 0 0 0 0 0 0 0 1 0 0 33
34 10 22 18 0 0 0 0 0 0 0 0 0 1 0 34
35 13 26 10 0 0 0 0 0 0 0 0 0 0 1 35
36 10 24 13 0 0 0 0 0 0 0 0 0 0 0 36
37 9 27 10 1 0 0 0 0 0 0 0 0 0 0 37
38 9 27 9 0 1 0 0 0 0 0 0 0 0 0 38
39 6 23 9 0 0 1 0 0 0 0 0 0 0 0 39
40 11 21 6 0 0 0 1 0 0 0 0 0 0 0 40
41 9 19 11 0 0 0 0 1 0 0 0 0 0 0 41
42 10 17 9 0 0 0 0 0 1 0 0 0 0 0 42
43 9 19 10 0 0 0 0 0 0 1 0 0 0 0 43
44 16 21 9 0 0 0 0 0 0 0 1 0 0 0 44
45 10 13 16 0 0 0 0 0 0 0 0 1 0 0 45
46 7 8 10 0 0 0 0 0 0 0 0 0 1 0 46
47 7 5 7 0 0 0 0 0 0 0 0 0 0 1 47
48 14 10 7 0 0 0 0 0 0 0 0 0 0 0 48
49 11 6 14 1 0 0 0 0 0 0 0 0 0 0 49
50 10 6 11 0 1 0 0 0 0 0 0 0 0 0 50
51 6 8 10 0 0 1 0 0 0 0 0 0 0 0 51
52 8 11 6 0 0 0 1 0 0 0 0 0 0 0 52
53 13 12 8 0 0 0 0 1 0 0 0 0 0 0 53
54 12 13 13 0 0 0 0 0 1 0 0 0 0 0 54
55 15 19 12 0 0 0 0 0 0 1 0 0 0 0 55
56 16 19 15 0 0 0 0 0 0 0 1 0 0 0 56
57 16 18 16 0 0 0 0 0 0 0 0 1 0 0 57
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) consv `y(t-1)` M1 M2 M3
8.6945 0.1281 0.5383 -0.3444 -1.4488 -3.2765
M4 M5 M6 M7 M8 M9
-0.1968 0.4991 -1.0768 -1.0428 0.1246 -0.6565
M10 M11 t
-5.2850 1.5008 -0.1008
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.3671 -2.1614 0.1033 1.8181 5.1496
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.69448 3.84662 2.260 0.029048 *
consv 0.12812 0.07060 1.815 0.076705 .
`y(t-1)` 0.53830 0.12977 4.148 0.000160 ***
M1 -0.34445 2.09681 -0.164 0.870305
M2 -1.44884 2.10162 -0.689 0.494368
M3 -3.27648 2.09338 -1.565 0.125049
M4 -0.19676 2.10563 -0.093 0.925993
M5 0.49914 2.09239 0.239 0.812614
M6 -1.07684 2.10600 -0.511 0.611806
M7 -1.04275 2.09264 -0.498 0.620876
M8 0.12459 2.09267 0.060 0.952809
M9 -0.65653 2.10370 -0.312 0.756521
M10 -5.28497 2.21420 -2.387 0.021573 *
M11 1.50084 2.27060 0.661 0.512228
t -0.10077 0.04616 -2.183 0.034681 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.115 on 42 degrees of freedom
Multiple R-squared: 0.8075, Adjusted R-squared: 0.7434
F-statistic: 12.59 on 14 and 42 DF, p-value: 8.201e-11
> 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.003976257 0.007952514 0.9960237
[2,] 0.000772986 0.001545972 0.9992270
[3,] 0.001022337 0.002044675 0.9989777
[4,] 0.004873947 0.009747893 0.9951261
[5,] 0.001420374 0.002840747 0.9985796
[6,] 0.002311557 0.004623113 0.9976884
[7,] 0.009461559 0.018923117 0.9905384
[8,] 0.009034407 0.018068813 0.9909656
[9,] 0.009698684 0.019397369 0.9903013
[10,] 0.119079009 0.238158019 0.8809210
[11,] 0.187577116 0.375154233 0.8124229
[12,] 0.139969507 0.279939015 0.8600305
[13,] 0.105505787 0.211011574 0.8944942
[14,] 0.114597541 0.229195082 0.8854025
[15,] 0.096871442 0.193742883 0.9031286
[16,] 0.233473607 0.466947215 0.7665264
[17,] 0.221135459 0.442270918 0.7788645
[18,] 0.622980004 0.754039992 0.3770200
[19,] 0.552071765 0.895856469 0.4479282
[20,] 0.618165784 0.763668432 0.3818342
[21,] 0.684790093 0.630419814 0.3152099
[22,] 0.645862928 0.708274144 0.3541371
> postscript(file="/var/www/html/rcomp/tmp/1esaa1258653886.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/2tbyz1258653886.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/3ecz31258653886.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/4d21j1258653886.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/5y6rk1258653886.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 = 57
Frequency = 1
1 2 3 4 5 6
4.372322329 -0.242132570 3.685540406 -3.524693850 0.571675141 0.171823739
7 8 9 10 11 12
-0.351304998 -5.367097284 0.437578942 0.680012910 4.097393650 2.341833106
13 14 15 16 17 18
-2.161428936 0.581293332 3.919890761 -2.341118810 2.166174633 0.689722768
19 20 21 22 23 24
-1.705287198 -0.156954105 0.674158274 -0.006807295 1.152717931 -2.295697768
25 26 27 28 29 30
2.969884802 1.278086448 -3.639553666 5.149601074 -1.623814175 -1.614227108
31 32 33 34 35 36
0.195482159 -0.871085442 -0.117316519 -2.491269230 -2.382387333 -5.139433861
37 38 39 40 41 42
-4.463669830 -2.720204569 -3.279313517 0.612877838 -4.417517945 -0.407930878
43 44 45 46 47 48
-2.135778850 4.079716239 -3.781547520 1.818063616 -2.867724248 5.093298522
49 50 51 52 53 54
-0.717108365 1.102957359 -0.686563984 0.103333748 3.303482346 1.160611479
55 56 57
3.996888887 2.315420591 2.787126824
> postscript(file="/var/www/html/rcomp/tmp/6ymif1258653886.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 = 57
Frequency = 1
lag(myerror, k = 1) myerror
0 4.372322329 NA
1 -0.242132570 4.372322329
2 3.685540406 -0.242132570
3 -3.524693850 3.685540406
4 0.571675141 -3.524693850
5 0.171823739 0.571675141
6 -0.351304998 0.171823739
7 -5.367097284 -0.351304998
8 0.437578942 -5.367097284
9 0.680012910 0.437578942
10 4.097393650 0.680012910
11 2.341833106 4.097393650
12 -2.161428936 2.341833106
13 0.581293332 -2.161428936
14 3.919890761 0.581293332
15 -2.341118810 3.919890761
16 2.166174633 -2.341118810
17 0.689722768 2.166174633
18 -1.705287198 0.689722768
19 -0.156954105 -1.705287198
20 0.674158274 -0.156954105
21 -0.006807295 0.674158274
22 1.152717931 -0.006807295
23 -2.295697768 1.152717931
24 2.969884802 -2.295697768
25 1.278086448 2.969884802
26 -3.639553666 1.278086448
27 5.149601074 -3.639553666
28 -1.623814175 5.149601074
29 -1.614227108 -1.623814175
30 0.195482159 -1.614227108
31 -0.871085442 0.195482159
32 -0.117316519 -0.871085442
33 -2.491269230 -0.117316519
34 -2.382387333 -2.491269230
35 -5.139433861 -2.382387333
36 -4.463669830 -5.139433861
37 -2.720204569 -4.463669830
38 -3.279313517 -2.720204569
39 0.612877838 -3.279313517
40 -4.417517945 0.612877838
41 -0.407930878 -4.417517945
42 -2.135778850 -0.407930878
43 4.079716239 -2.135778850
44 -3.781547520 4.079716239
45 1.818063616 -3.781547520
46 -2.867724248 1.818063616
47 5.093298522 -2.867724248
48 -0.717108365 5.093298522
49 1.102957359 -0.717108365
50 -0.686563984 1.102957359
51 0.103333748 -0.686563984
52 3.303482346 0.103333748
53 1.160611479 3.303482346
54 3.996888887 1.160611479
55 2.315420591 3.996888887
56 2.787126824 2.315420591
57 NA 2.787126824
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.242132570 4.372322329
[2,] 3.685540406 -0.242132570
[3,] -3.524693850 3.685540406
[4,] 0.571675141 -3.524693850
[5,] 0.171823739 0.571675141
[6,] -0.351304998 0.171823739
[7,] -5.367097284 -0.351304998
[8,] 0.437578942 -5.367097284
[9,] 0.680012910 0.437578942
[10,] 4.097393650 0.680012910
[11,] 2.341833106 4.097393650
[12,] -2.161428936 2.341833106
[13,] 0.581293332 -2.161428936
[14,] 3.919890761 0.581293332
[15,] -2.341118810 3.919890761
[16,] 2.166174633 -2.341118810
[17,] 0.689722768 2.166174633
[18,] -1.705287198 0.689722768
[19,] -0.156954105 -1.705287198
[20,] 0.674158274 -0.156954105
[21,] -0.006807295 0.674158274
[22,] 1.152717931 -0.006807295
[23,] -2.295697768 1.152717931
[24,] 2.969884802 -2.295697768
[25,] 1.278086448 2.969884802
[26,] -3.639553666 1.278086448
[27,] 5.149601074 -3.639553666
[28,] -1.623814175 5.149601074
[29,] -1.614227108 -1.623814175
[30,] 0.195482159 -1.614227108
[31,] -0.871085442 0.195482159
[32,] -0.117316519 -0.871085442
[33,] -2.491269230 -0.117316519
[34,] -2.382387333 -2.491269230
[35,] -5.139433861 -2.382387333
[36,] -4.463669830 -5.139433861
[37,] -2.720204569 -4.463669830
[38,] -3.279313517 -2.720204569
[39,] 0.612877838 -3.279313517
[40,] -4.417517945 0.612877838
[41,] -0.407930878 -4.417517945
[42,] -2.135778850 -0.407930878
[43,] 4.079716239 -2.135778850
[44,] -3.781547520 4.079716239
[45,] 1.818063616 -3.781547520
[46,] -2.867724248 1.818063616
[47,] 5.093298522 -2.867724248
[48,] -0.717108365 5.093298522
[49,] 1.102957359 -0.717108365
[50,] -0.686563984 1.102957359
[51,] 0.103333748 -0.686563984
[52,] 3.303482346 0.103333748
[53,] 1.160611479 3.303482346
[54,] 3.996888887 1.160611479
[55,] 2.315420591 3.996888887
[56,] 2.787126824 2.315420591
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.242132570 4.372322329
2 3.685540406 -0.242132570
3 -3.524693850 3.685540406
4 0.571675141 -3.524693850
5 0.171823739 0.571675141
6 -0.351304998 0.171823739
7 -5.367097284 -0.351304998
8 0.437578942 -5.367097284
9 0.680012910 0.437578942
10 4.097393650 0.680012910
11 2.341833106 4.097393650
12 -2.161428936 2.341833106
13 0.581293332 -2.161428936
14 3.919890761 0.581293332
15 -2.341118810 3.919890761
16 2.166174633 -2.341118810
17 0.689722768 2.166174633
18 -1.705287198 0.689722768
19 -0.156954105 -1.705287198
20 0.674158274 -0.156954105
21 -0.006807295 0.674158274
22 1.152717931 -0.006807295
23 -2.295697768 1.152717931
24 2.969884802 -2.295697768
25 1.278086448 2.969884802
26 -3.639553666 1.278086448
27 5.149601074 -3.639553666
28 -1.623814175 5.149601074
29 -1.614227108 -1.623814175
30 0.195482159 -1.614227108
31 -0.871085442 0.195482159
32 -0.117316519 -0.871085442
33 -2.491269230 -0.117316519
34 -2.382387333 -2.491269230
35 -5.139433861 -2.382387333
36 -4.463669830 -5.139433861
37 -2.720204569 -4.463669830
38 -3.279313517 -2.720204569
39 0.612877838 -3.279313517
40 -4.417517945 0.612877838
41 -0.407930878 -4.417517945
42 -2.135778850 -0.407930878
43 4.079716239 -2.135778850
44 -3.781547520 4.079716239
45 1.818063616 -3.781547520
46 -2.867724248 1.818063616
47 5.093298522 -2.867724248
48 -0.717108365 5.093298522
49 1.102957359 -0.717108365
50 -0.686563984 1.102957359
51 0.103333748 -0.686563984
52 3.303482346 0.103333748
53 1.160611479 3.303482346
54 3.996888887 1.160611479
55 2.315420591 3.996888887
56 2.787126824 2.315420591
> 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/76zr71258653886.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/8mzzu1258653886.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/9clj31258653886.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/105sns1258653886.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/11vvch1258653886.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/12qhsy1258653886.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/139bpt1258653886.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/14qs671258653886.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/15nohr1258653886.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/16ywv81258653886.tab")
+ }
>
> system("convert tmp/1esaa1258653886.ps tmp/1esaa1258653886.png")
> system("convert tmp/2tbyz1258653886.ps tmp/2tbyz1258653886.png")
> system("convert tmp/3ecz31258653886.ps tmp/3ecz31258653886.png")
> system("convert tmp/4d21j1258653886.ps tmp/4d21j1258653886.png")
> system("convert tmp/5y6rk1258653886.ps tmp/5y6rk1258653886.png")
> system("convert tmp/6ymif1258653886.ps tmp/6ymif1258653886.png")
> system("convert tmp/76zr71258653886.ps tmp/76zr71258653886.png")
> system("convert tmp/8mzzu1258653886.ps tmp/8mzzu1258653886.png")
> system("convert tmp/9clj31258653886.ps tmp/9clj31258653886.png")
> system("convert tmp/105sns1258653886.ps tmp/105sns1258653886.png")
>
>
> proc.time()
user system elapsed
2.256 1.619 2.749