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(1.1,2.1,1.2,1.3,1.4,2.5,1.1,1.2,1.2,2.2,1.4,1.1,1.5,2.3,1.2,1.4,1.1,2.3,1.5,1.2,1.3,2.2,1.1,1.5,1.5,2.2,1.3,1.1,1.1,1.6,1.5,1.3,1.4,1.8,1.1,1.5,1.3,1.7,1.4,1.1,1.5,1.9,1.3,1.4,1.6,1.8,1.5,1.3,1.7,1.9,1.6,1.5,1.1,1.5,1.7,1.6,1.6,1,1.1,1.7,1.3,0.8,1.6,1.1,1.7,1.1,1.3,1.6,1.6,1.5,1.7,1.3,1.7,1.7,1.6,1.7,1.9,2.3,1.7,1.6,1.8,2.4,1.9,1.7,1.9,3,1.8,1.9,1.6,3,1.9,1.8,1.5,3.2,1.6,1.9,1.6,3.2,1.5,1.6,1.6,3.2,1.6,1.5,1.7,3.5,1.6,1.6,2,4,1.7,1.6,2,4.3,2,1.7,1.9,4.1,2,2,1.7,4,1.9,2,1.8,4.1,1.7,1.9,1.9,4.2,1.8,1.7,1.7,4.5,1.9,1.8,2,5.6,1.7,1.9,2.1,6.5,2,1.7,2.4,7.6,2.1,2,2.5,8.5,2.4,2.1,2.5,8.7,2.5,2.4,2.6,8.3,2.5,2.5,2.2,8.3,2.6,2.5,2.5,8.5,2.2,2.6,2.8,8.7,2.5,2.2,2.8,8.7,2.8,2.5,2.9,8.5,2.8,2.8,3,7.9,2.9,2.8,3.1,7,3,2.9,2.9,5.8,3.1,3,2.7,4.5,2.9,3.1,2.2,3.7,2.7,2.9,2.5,3.1,2.2,2.7,2.3,2.7,2.5,2.2,2.6,2.3,2.3,2.5,2.3,1.8,2.6,2.3,2.2,1.5,2.3,2.6,1.8,1.2,2.2,2.3,1.8,1,1.8,2.2),dim=c(4,57),dimnames=list(c('inflatie','inflatie_levensmiddelen','Y(t+1)','Y(t+2)'),1:57))
> y <- array(NA,dim=c(4,57),dimnames=list(c('inflatie','inflatie_levensmiddelen','Y(t+1)','Y(t+2)'),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 = 'Do not include Seasonal 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
inflatie inflatie_levensmiddelen Y(t+1) Y(t+2) t
1 1.1 2.1 1.2 1.3 1
2 1.4 2.5 1.1 1.2 2
3 1.2 2.2 1.4 1.1 3
4 1.5 2.3 1.2 1.4 4
5 1.1 2.3 1.5 1.2 5
6 1.3 2.2 1.1 1.5 6
7 1.5 2.2 1.3 1.1 7
8 1.1 1.6 1.5 1.3 8
9 1.4 1.8 1.1 1.5 9
10 1.3 1.7 1.4 1.1 10
11 1.5 1.9 1.3 1.4 11
12 1.6 1.8 1.5 1.3 12
13 1.7 1.9 1.6 1.5 13
14 1.1 1.5 1.7 1.6 14
15 1.6 1.0 1.1 1.7 15
16 1.3 0.8 1.6 1.1 16
17 1.7 1.1 1.3 1.6 17
18 1.6 1.5 1.7 1.3 18
19 1.7 1.7 1.6 1.7 19
20 1.9 2.3 1.7 1.6 20
21 1.8 2.4 1.9 1.7 21
22 1.9 3.0 1.8 1.9 22
23 1.6 3.0 1.9 1.8 23
24 1.5 3.2 1.6 1.9 24
25 1.6 3.2 1.5 1.6 25
26 1.6 3.2 1.6 1.5 26
27 1.7 3.5 1.6 1.6 27
28 2.0 4.0 1.7 1.6 28
29 2.0 4.3 2.0 1.7 29
30 1.9 4.1 2.0 2.0 30
31 1.7 4.0 1.9 2.0 31
32 1.8 4.1 1.7 1.9 32
33 1.9 4.2 1.8 1.7 33
34 1.7 4.5 1.9 1.8 34
35 2.0 5.6 1.7 1.9 35
36 2.1 6.5 2.0 1.7 36
37 2.4 7.6 2.1 2.0 37
38 2.5 8.5 2.4 2.1 38
39 2.5 8.7 2.5 2.4 39
40 2.6 8.3 2.5 2.5 40
41 2.2 8.3 2.6 2.5 41
42 2.5 8.5 2.2 2.6 42
43 2.8 8.7 2.5 2.2 43
44 2.8 8.7 2.8 2.5 44
45 2.9 8.5 2.8 2.8 45
46 3.0 7.9 2.9 2.8 46
47 3.1 7.0 3.0 2.9 47
48 2.9 5.8 3.1 3.0 48
49 2.7 4.5 2.9 3.1 49
50 2.2 3.7 2.7 2.9 50
51 2.5 3.1 2.2 2.7 51
52 2.3 2.7 2.5 2.2 52
53 2.6 2.3 2.3 2.5 53
54 2.3 1.8 2.6 2.3 54
55 2.2 1.5 2.3 2.6 55
56 1.8 1.2 2.2 2.3 56
57 1.8 1.0 1.8 2.2 57
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) inflatie_levensmiddelen `Y(t+1)`
0.427931 0.065550 0.274321
`Y(t+2)` t
0.300108 0.005238
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.45026 -0.10202 0.01995 0.12297 0.36249
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.427931 0.134995 3.170 0.00256 **
inflatie_levensmiddelen 0.065550 0.014409 4.549 3.26e-05 ***
`Y(t+1)` 0.274321 0.126509 2.168 0.03473 *
`Y(t+2)` 0.300108 0.124582 2.409 0.01958 *
t 0.005238 0.003553 1.474 0.14640
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1945 on 52 degrees of freedom
Multiple R-squared: 0.8792, Adjusted R-squared: 0.8699
F-statistic: 94.59 on 4 and 52 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.35592795 0.71185591 0.6440720
[2,] 0.20447392 0.40894784 0.7955261
[3,] 0.11259698 0.22519397 0.8874030
[4,] 0.06418419 0.12836837 0.9358158
[5,] 0.09595601 0.19191201 0.9040440
[6,] 0.08850506 0.17701013 0.9114949
[7,] 0.18734865 0.37469731 0.8126513
[8,] 0.20014880 0.40029760 0.7998512
[9,] 0.13992758 0.27985516 0.8600724
[10,] 0.13423851 0.26847702 0.8657615
[11,] 0.08945328 0.17890657 0.9105467
[12,] 0.06387742 0.12775483 0.9361226
[13,] 0.06046188 0.12092377 0.9395381
[14,] 0.04221637 0.08443273 0.9577836
[15,] 0.05611324 0.11222648 0.9438868
[16,] 0.17661038 0.35322076 0.8233896
[17,] 0.53242912 0.93514176 0.4675709
[18,] 0.54663185 0.90673629 0.4533681
[19,] 0.48786434 0.97572868 0.5121357
[20,] 0.41021944 0.82043888 0.5897806
[21,] 0.47760820 0.95521639 0.5223918
[22,] 0.45314259 0.90628518 0.5468574
[23,] 0.37616557 0.75233115 0.6238344
[24,] 0.36796382 0.73592764 0.6320362
[25,] 0.30869101 0.61738202 0.6913090
[26,] 0.26131478 0.52262956 0.7386852
[27,] 0.25180546 0.50361093 0.7481945
[28,] 0.19851435 0.39702870 0.8014856
[29,] 0.15575845 0.31151690 0.8442415
[30,] 0.18759336 0.37518671 0.8124066
[31,] 0.17314266 0.34628531 0.8268573
[32,] 0.12325051 0.24650102 0.8767495
[33,] 0.10113734 0.20227469 0.8988627
[34,] 0.24725933 0.49451865 0.7527407
[35,] 0.23094868 0.46189736 0.7690513
[36,] 0.20789569 0.41579139 0.7921043
[37,] 0.20628848 0.41257696 0.7937115
[38,] 0.20135118 0.40270235 0.7986488
[39,] 0.17443829 0.34887657 0.8255617
[40,] 0.13301953 0.26603905 0.8669805
[41,] 0.11463824 0.22927648 0.8853618
[42,] 0.42352275 0.84704551 0.5764772
> postscript(file="/var/www/html/rcomp/tmp/1uane1258729415.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/24chn1258729415.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/3169s1258729415.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/4ybah1258729415.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/5837n1258729415.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
-0.190150120 0.135834909 -0.102023504 0.151015295 -0.276497293 -0.055484241
7 8 9 10 11 12
0.204456976 -0.276336825 0.055022051 -0.005913846 0.113137826 0.189601522
13 14 15 16 17 18
0.190354801 -0.446106049 0.216012952 -0.033210497 0.274128727 0.122974837
19 20 21 22 23 24
0.112015666 0.270026442 0.073358443 0.096200933 -0.206458255 -0.272520658
25 26 27 28 29 30
-0.060293921 -0.062953109 -0.017866880 0.216688060 0.079477928 -0.102682497
31 32 33 34 35 36
-0.273933281 -0.100851114 0.019945534 -0.262400357 -0.014889933 -0.001397574
37 38 39 40 41 42
0.103794804 0.027254637 -0.108557933 -0.017586662 -0.450256693 -0.088886974
43 44 45 46 47 48
0.230512111 0.052945312 0.070784887 0.177444891 0.273759071 0.089738268
49 50 51 52 53 54
-0.005431167 -0.343343104 0.187931309 0.076671271 0.362485099 0.067747540
55 56 57
-0.025561517 -0.293669762 -0.146058336
> postscript(file="/var/www/html/rcomp/tmp/63w381258729415.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 -0.190150120 NA
1 0.135834909 -0.190150120
2 -0.102023504 0.135834909
3 0.151015295 -0.102023504
4 -0.276497293 0.151015295
5 -0.055484241 -0.276497293
6 0.204456976 -0.055484241
7 -0.276336825 0.204456976
8 0.055022051 -0.276336825
9 -0.005913846 0.055022051
10 0.113137826 -0.005913846
11 0.189601522 0.113137826
12 0.190354801 0.189601522
13 -0.446106049 0.190354801
14 0.216012952 -0.446106049
15 -0.033210497 0.216012952
16 0.274128727 -0.033210497
17 0.122974837 0.274128727
18 0.112015666 0.122974837
19 0.270026442 0.112015666
20 0.073358443 0.270026442
21 0.096200933 0.073358443
22 -0.206458255 0.096200933
23 -0.272520658 -0.206458255
24 -0.060293921 -0.272520658
25 -0.062953109 -0.060293921
26 -0.017866880 -0.062953109
27 0.216688060 -0.017866880
28 0.079477928 0.216688060
29 -0.102682497 0.079477928
30 -0.273933281 -0.102682497
31 -0.100851114 -0.273933281
32 0.019945534 -0.100851114
33 -0.262400357 0.019945534
34 -0.014889933 -0.262400357
35 -0.001397574 -0.014889933
36 0.103794804 -0.001397574
37 0.027254637 0.103794804
38 -0.108557933 0.027254637
39 -0.017586662 -0.108557933
40 -0.450256693 -0.017586662
41 -0.088886974 -0.450256693
42 0.230512111 -0.088886974
43 0.052945312 0.230512111
44 0.070784887 0.052945312
45 0.177444891 0.070784887
46 0.273759071 0.177444891
47 0.089738268 0.273759071
48 -0.005431167 0.089738268
49 -0.343343104 -0.005431167
50 0.187931309 -0.343343104
51 0.076671271 0.187931309
52 0.362485099 0.076671271
53 0.067747540 0.362485099
54 -0.025561517 0.067747540
55 -0.293669762 -0.025561517
56 -0.146058336 -0.293669762
57 NA -0.146058336
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.135834909 -0.190150120
[2,] -0.102023504 0.135834909
[3,] 0.151015295 -0.102023504
[4,] -0.276497293 0.151015295
[5,] -0.055484241 -0.276497293
[6,] 0.204456976 -0.055484241
[7,] -0.276336825 0.204456976
[8,] 0.055022051 -0.276336825
[9,] -0.005913846 0.055022051
[10,] 0.113137826 -0.005913846
[11,] 0.189601522 0.113137826
[12,] 0.190354801 0.189601522
[13,] -0.446106049 0.190354801
[14,] 0.216012952 -0.446106049
[15,] -0.033210497 0.216012952
[16,] 0.274128727 -0.033210497
[17,] 0.122974837 0.274128727
[18,] 0.112015666 0.122974837
[19,] 0.270026442 0.112015666
[20,] 0.073358443 0.270026442
[21,] 0.096200933 0.073358443
[22,] -0.206458255 0.096200933
[23,] -0.272520658 -0.206458255
[24,] -0.060293921 -0.272520658
[25,] -0.062953109 -0.060293921
[26,] -0.017866880 -0.062953109
[27,] 0.216688060 -0.017866880
[28,] 0.079477928 0.216688060
[29,] -0.102682497 0.079477928
[30,] -0.273933281 -0.102682497
[31,] -0.100851114 -0.273933281
[32,] 0.019945534 -0.100851114
[33,] -0.262400357 0.019945534
[34,] -0.014889933 -0.262400357
[35,] -0.001397574 -0.014889933
[36,] 0.103794804 -0.001397574
[37,] 0.027254637 0.103794804
[38,] -0.108557933 0.027254637
[39,] -0.017586662 -0.108557933
[40,] -0.450256693 -0.017586662
[41,] -0.088886974 -0.450256693
[42,] 0.230512111 -0.088886974
[43,] 0.052945312 0.230512111
[44,] 0.070784887 0.052945312
[45,] 0.177444891 0.070784887
[46,] 0.273759071 0.177444891
[47,] 0.089738268 0.273759071
[48,] -0.005431167 0.089738268
[49,] -0.343343104 -0.005431167
[50,] 0.187931309 -0.343343104
[51,] 0.076671271 0.187931309
[52,] 0.362485099 0.076671271
[53,] 0.067747540 0.362485099
[54,] -0.025561517 0.067747540
[55,] -0.293669762 -0.025561517
[56,] -0.146058336 -0.293669762
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.135834909 -0.190150120
2 -0.102023504 0.135834909
3 0.151015295 -0.102023504
4 -0.276497293 0.151015295
5 -0.055484241 -0.276497293
6 0.204456976 -0.055484241
7 -0.276336825 0.204456976
8 0.055022051 -0.276336825
9 -0.005913846 0.055022051
10 0.113137826 -0.005913846
11 0.189601522 0.113137826
12 0.190354801 0.189601522
13 -0.446106049 0.190354801
14 0.216012952 -0.446106049
15 -0.033210497 0.216012952
16 0.274128727 -0.033210497
17 0.122974837 0.274128727
18 0.112015666 0.122974837
19 0.270026442 0.112015666
20 0.073358443 0.270026442
21 0.096200933 0.073358443
22 -0.206458255 0.096200933
23 -0.272520658 -0.206458255
24 -0.060293921 -0.272520658
25 -0.062953109 -0.060293921
26 -0.017866880 -0.062953109
27 0.216688060 -0.017866880
28 0.079477928 0.216688060
29 -0.102682497 0.079477928
30 -0.273933281 -0.102682497
31 -0.100851114 -0.273933281
32 0.019945534 -0.100851114
33 -0.262400357 0.019945534
34 -0.014889933 -0.262400357
35 -0.001397574 -0.014889933
36 0.103794804 -0.001397574
37 0.027254637 0.103794804
38 -0.108557933 0.027254637
39 -0.017586662 -0.108557933
40 -0.450256693 -0.017586662
41 -0.088886974 -0.450256693
42 0.230512111 -0.088886974
43 0.052945312 0.230512111
44 0.070784887 0.052945312
45 0.177444891 0.070784887
46 0.273759071 0.177444891
47 0.089738268 0.273759071
48 -0.005431167 0.089738268
49 -0.343343104 -0.005431167
50 0.187931309 -0.343343104
51 0.076671271 0.187931309
52 0.362485099 0.076671271
53 0.067747540 0.362485099
54 -0.025561517 0.067747540
55 -0.293669762 -0.025561517
56 -0.146058336 -0.293669762
> 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/7sbje1258729415.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/8ua9c1258729415.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/9udbw1258729415.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/10ovkr1258729415.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/11gy2m1258729415.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/12mooz1258729415.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/13zmcr1258729415.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/14f79i1258729415.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/15424l1258729415.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/16qcwo1258729415.tab")
+ }
>
> system("convert tmp/1uane1258729415.ps tmp/1uane1258729415.png")
> system("convert tmp/24chn1258729415.ps tmp/24chn1258729415.png")
> system("convert tmp/3169s1258729415.ps tmp/3169s1258729415.png")
> system("convert tmp/4ybah1258729415.ps tmp/4ybah1258729415.png")
> system("convert tmp/5837n1258729415.ps tmp/5837n1258729415.png")
> system("convert tmp/63w381258729415.ps tmp/63w381258729415.png")
> system("convert tmp/7sbje1258729415.ps tmp/7sbje1258729415.png")
> system("convert tmp/8ua9c1258729415.ps tmp/8ua9c1258729415.png")
> system("convert tmp/9udbw1258729415.ps tmp/9udbw1258729415.png")
> system("convert tmp/10ovkr1258729415.ps tmp/10ovkr1258729415.png")
>
>
> proc.time()
user system elapsed
2.500 1.585 3.480